From 5af00a8778b32730833fcc772ca510af607f603a Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Thu, 21 Apr 2016 23:44:57 -0700 Subject: [PATCH] GBA Memory: Fix executing code from OBJ region of VRAM --- CHANGES | 1 + src/gba/memory.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 1337f2b1c..b593254f4 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ Bugfixes: - GBA Serialize: Fix loading savegames from savestates - All: Fix several file handle leaks - Util: Use closesocket on Windows + - GBA Memory: Fix executing code from OBJ region of VRAM Misc: - GBA: Slightly optimize GBAProcessEvents - Qt: Add preset for DualShock 4 diff --git a/src/gba/memory.c b/src/gba/memory.c index 1d3d87ff4..6b6f7b508 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -268,8 +268,13 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) { cpu->memory.activeMask = SIZE_PALETTE_RAM - 1; break; case REGION_VRAM: - cpu->memory.activeRegion = (uint32_t*) gba->video.renderer->vram; - cpu->memory.activeMask = 0x0000FFFF; + if (address < 0x06010000) { + cpu->memory.activeRegion = (uint32_t*) gba->video.renderer->vram; + cpu->memory.activeMask = 0x0000FFFF; + } else { + cpu->memory.activeRegion = (uint32_t*) &gba->video.renderer->vram[0x8000]; + cpu->memory.activeMask = 0x00007FFF; + } break; case REGION_OAM: cpu->memory.activeRegion = (uint32_t*) gba->video.oam.raw;