GBA Memory: Various AGBPrint fixes
Vicki Pfau vi@endrift.com
Mon, 11 Feb 2019 21:59:15 -0800
2 files changed,
8 insertions(+),
2 deletions(-)
M
CHANGES
→
CHANGES
@@ -2,6 +2,8 @@ 0.7.1: (Future)
Bugfixes: - Switch: Fix final cleanup (fixes mgba.io/i/1283) - Qt: Fix tile and sprite views not always displaying at first + - GBA Memory: Fix a few AGBPrint crashes + - GBA Memory: Fix OOB ROM reads showing up as AGBPrint memory Misc: - GBA Video: Improve sprite cycle counting (fixes mgba.io/i/1274)
M
src/gba/memory.c
→
src/gba/memory.c
@@ -1647,6 +1647,10 @@ gba->isPristine = false;
} void GBAPrintFlush(struct GBA* gba) { + if (!gba->memory.agbPrintBuffer) { + return; + } + char oolBuf[0x101]; size_t i; for (i = 0; gba->memory.agbPrintCtx.get != gba->memory.agbPrintCtx.put && i < 0x100; ++i) {@@ -1688,8 +1692,8 @@ }
static int16_t _agbPrintLoad(struct GBA* gba, uint32_t address) { struct GBAMemory* memory = &gba->memory; - int16_t value = 0xFFFF; - if (address < AGB_PRINT_TOP) { + int16_t value = address >> 1; + if (address < AGB_PRINT_TOP && memory->agbPrintBuffer) { LOAD_16(value, address & (SIZE_AGB_PRINT - 1), memory->agbPrintBuffer); } else if ((address & 0x00FFFFF8) == (AGB_PRINT_STRUCT & 0x00FFFFF8)) { value = (&memory->agbPrintCtx.request)[(address & 7) >> 1];