GBA: Reset active region as needed when loading a ROM

This commit is contained in:
Vicki Pfau 2017-07-21 17:15:24 -07:00
parent b75812a99d
commit 91abd41eab
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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;
}