all repos — mgba @ 4cbcc41e35665f7b5fcd5fd0f911c80a0efbe81c

mGBA Game Boy Advance Emulator

GBA Memory: Fix misaligned BIOS reads
Jeffrey Pfau jeffrey@endrift.com
Tue, 11 Oct 2016 21:59:57 -0700
commit

4cbcc41e35665f7b5fcd5fd0f911c80a0efbe81c

parent

82df0e1cabb0b2aeb10aff7f1ea24dd3c33d7b40

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

jump to
M CHANGESCHANGES

@@ -4,6 +4,7 @@ - GBA: Support printing debug strings from inside a game

Bugfixes: - LR35902: Fix core never exiting with certain event patterns - GB Timer: Improve DIV reset behavior + - GBA Memory: Fix misaligned BIOS reads Misc: - SDL: Remove scancode key input - GBA Video: Clean up unused timers
M src/gba/memory.csrc/gba/memory.c

@@ -352,7 +352,7 @@

#define LOAD_BIOS \ if (address < SIZE_BIOS) { \ if (memory->activeRegion == REGION_BIOS) { \ - LOAD_32(value, address, memory->bios); \ + LOAD_32(value, address & -4, memory->bios); \ } else { \ mLOG(GBA_MEM, GAME_ERROR, "Bad BIOS Load32: 0x%08X", address); \ value = memory->biosPrefetch; \

@@ -479,7 +479,7 @@ switch (address >> BASE_OFFSET) {

case REGION_BIOS: if (address < SIZE_BIOS) { if (memory->activeRegion == REGION_BIOS) { - LOAD_16(value, address, memory->bios); + LOAD_16(value, address & -2, memory->bios); } else { mLOG(GBA_MEM, GAME_ERROR, "Bad BIOS Load16: 0x%08X", address); value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF;