all repos — mgba @ cab3a2272d6819387c096aa3591eeb230e114d9c

mGBA Game Boy Advance Emulator

GBA Memory: Various AGBPrint fixes
Vicki Pfau vi@endrift.com
Mon, 11 Feb 2019 21:59:15 -0800
commit

cab3a2272d6819387c096aa3591eeb230e114d9c

parent

22531a1315ff1f5e880dd352b244c88b403e2c5a

2 files changed, 8 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -7,6 +7,8 @@ - GBA: Reset now reloads multiboot ROMs

- GBA BIOS: Fix multiboot entry point (fixes Magic Floor) - 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 Savedata: EEPROM performance fixes - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
M src/gba/memory.csrc/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];