diff --git a/CHANGES b/CHANGES index a161617a5..3d9a5d963 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ 0.6.1: (Future) Bugfixes: - Python: Fix importing .gb or .gba before .core + - GBA: Reset active region as needed when loading a ROM Misc: - Qt: Don't rebuild library view if style hasn't changed diff --git a/src/gba/gba.c b/src/gba/gba.c index a6d9467ae..3089b244c 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -308,6 +308,9 @@ bool GBALoadMB(struct GBA* gba, struct VFile* vf) { gba->memory.romSize = 0; gba->memory.romMask = 0; gba->romCrc32 = doCrc32(gba->memory.wram, gba->pristineRomSize); + if (gba->cpu && gba->memory.activeRegion == REGION_WORKING_RAM) { + gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]); + } return true; } @@ -342,6 +345,9 @@ bool GBALoadROM(struct GBA* gba, struct VFile* vf) { gba->romCrc32 = doCrc32(gba->memory.rom, gba->memory.romSize); GBAHardwareInit(&gba->memory.hw, &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1]); GBAVFameDetect(&gba->memory.vfame, gba->memory.rom, gba->memory.romSize); + if (gba->cpu && gba->memory.activeRegion >= REGION_CART0) { + gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]); + } // TODO: error check return true; }