all repos — mgba @ f8ff96e051dcd0bea196869d07d22e1f1eae2616

mGBA Game Boy Advance Emulator

GBA Memory: Fix unaligned out-of-bounds ROM loads
Jeffrey Pfau jeffrey@endrift.com
Tue, 10 Nov 2015 22:44:23 -0800
commit

f8ff96e051dcd0bea196869d07d22e1f1eae2616

parent

7286a5247ff223c810972a7d2a9a1c3c5bf24673

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

jump to
M CHANGESCHANGES

@@ -13,6 +13,7 @@ - GBA Memory: Fix DMA behavior for SRAM accesses

- GBA Memory: Fix Store8 to OBJ VRAM - GBA Memory: Fix alignment of LDM/STM on SRAM - GBA: Initialize uninitialized pristineRom and pristineRomSize members + - GBA Memory: Fix unaligned out-of-bounds ROM loads Misc: - GBA Audio: Implement missing flags on SOUNDCNT_X register
M src/gba/memory.csrc/gba/memory.c

@@ -359,8 +359,8 @@ if ((address & (SIZE_CART0 - 1)) < memory->romSize) { \

LOAD_32(value, address & (SIZE_CART0 - 4), memory->rom); \ } else { \ GBALog(gba, GBA_LOG_GAME_ERROR, "Out of bounds ROM Load32: 0x%08X", address); \ - value = (address >> 1) & 0xFFFF; \ - value |= ((address + 2) >> 1) << 16; \ + value = ((address & ~3) >> 1) & 0xFFFF; \ + value |= (((address & ~3) + 2) >> 1) << 16; \ } #define LOAD_SRAM \