From 65c988aaadb9e903d1a4719700ba1d77b4f97004 Mon Sep 17 00:00:00 2001 From: jsmolka Date: Sat, 21 Nov 2020 16:47:37 +0100 Subject: [PATCH] GBA Memory: Return correct byte in out of bounds ROM read --- CHANGES | 1 + src/gba/memory.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index bef7697a9..e774851a4 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ Emulation fixes: - ARM: Fix Addressing mode 1 shifter on rs == pc (fixes mgba.io/i/1926) - GBA I/O: Ignore high bits on IME - GBA Memory: Mark Famicom Mini games 22 through 28 as non-mirroring + - GBA Memory: Return correct byte for odd ROM open bus addresses Other fixes: - CMake: Fix build with downstream minizip that exports incompatible symbols - Core: Fix threading improperly setting paused state while interrupted diff --git a/src/gba/memory.c b/src/gba/memory.c index d2ba5a419..9d185c2fd 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -670,7 +670,7 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) { value = GBAVFameGetPatternValue(address, 8); } else { mLOG(GBA_MEM, GAME_ERROR, "Out of bounds ROM Load8: 0x%08X", address); - value = (address >> 1) & 0xFF; + value = ((address >> 1) >> ((address & 1) * 8)) & 0xFF; } break; case REGION_CART_SRAM: