mirror of https://github.com/mgba-emu/mgba.git
GBA: Reset active region as needed when loading a ROM
This commit is contained in:
parent
38e56597b5
commit
9d8f99295b
1
CHANGES
1
CHANGES
|
@ -4,6 +4,7 @@ Features:
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
- GB Audio: Make audio unsigned with bias (fixes mgba.io/i/749)
|
- GB Audio: Make audio unsigned with bias (fixes mgba.io/i/749)
|
||||||
- Python: Fix importing .gb or .gba before .core
|
- Python: Fix importing .gb or .gba before .core
|
||||||
|
- GBA: Reset active region as needed when loading a ROM
|
||||||
Misc:
|
Misc:
|
||||||
- GBA Timer: Use global cycles for timers
|
- GBA Timer: Use global cycles for timers
|
||||||
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
|
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
|
||||||
|
|
|
@ -312,6 +312,10 @@ bool GBALoadNull(struct GBA* gba) {
|
||||||
gba->memory.romMask = SIZE_CART0 - 1;
|
gba->memory.romMask = SIZE_CART0 - 1;
|
||||||
gba->memory.mirroring = false;
|
gba->memory.mirroring = false;
|
||||||
gba->romCrc32 = 0;
|
gba->romCrc32 = 0;
|
||||||
|
|
||||||
|
if (gba->cpu) {
|
||||||
|
gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,6 +339,9 @@ bool GBALoadMB(struct GBA* gba, struct VFile* vf) {
|
||||||
gba->memory.romSize = 0;
|
gba->memory.romSize = 0;
|
||||||
gba->memory.romMask = 0;
|
gba->memory.romMask = 0;
|
||||||
gba->romCrc32 = doCrc32(gba->memory.wram, gba->pristineRomSize);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,6 +386,9 @@ bool GBALoadROM(struct GBA* gba, struct VFile* vf) {
|
||||||
gba->memory.romSize = SIZE_CART0;
|
gba->memory.romSize = SIZE_CART0;
|
||||||
gba->isPristine = false;
|
gba->isPristine = false;
|
||||||
}
|
}
|
||||||
|
if (gba->cpu && gba->memory.activeRegion >= REGION_CART0) {
|
||||||
|
gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]);
|
||||||
|
}
|
||||||
// TODO: error check
|
// TODO: error check
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue