mirror of https://github.com/mgba-emu/mgba.git
GBA Memory: Fix jumping to invalid memory when switching from Thumb to ARM
This commit is contained in:
parent
0511a2cfd5
commit
a499b09e48
1
CHANGES
1
CHANGES
|
@ -33,6 +33,7 @@ Bugfixes:
|
|||
- GBA BIOS: Initialize a variable that may be uninitialized in very rare cases
|
||||
- ARM7: Fix ARM multiply instructions when PC is a destination register
|
||||
- SDL: Fix potential build issues when Qt and SDL2 are in use
|
||||
- GBA Memory: Fix jumping to invalid memory when switching from Thumb to ARM
|
||||
Misc:
|
||||
- Qt: Show multiplayer numbers in window title
|
||||
- Qt: Solar sensor can have shortcuts set
|
||||
|
|
|
@ -225,13 +225,7 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
|
|||
}
|
||||
|
||||
gba->lastJump = address;
|
||||
if (newRegion >= REGION_CART0 && (address & (SIZE_CART0 - 1)) >= memory->romSize) {
|
||||
cpu->memory.activeRegion = _deadbeef;
|
||||
cpu->memory.activeMask = 0;
|
||||
GBALog(gba, GBA_LOG_FATAL, "Jumped past end of ROM");
|
||||
return;
|
||||
}
|
||||
if (newRegion == memory->activeRegion) {
|
||||
if (newRegion == memory->activeRegion && (newRegion < REGION_CART0 || (address & (SIZE_CART0 - 1)) < memory->romSize)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -264,8 +258,12 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
|
|||
case REGION_CART2_EX:
|
||||
cpu->memory.activeRegion = memory->rom;
|
||||
cpu->memory.activeMask = SIZE_CART0 - 1;
|
||||
break;
|
||||
if ((address & (SIZE_CART0 - 1)) < memory->romSize) {
|
||||
break;
|
||||
}
|
||||
// Fall through
|
||||
default:
|
||||
memory->activeRegion = 0;
|
||||
cpu->memory.activeRegion = _deadbeef;
|
||||
cpu->memory.activeMask = 0;
|
||||
GBALog(gba, GBA_LOG_FATAL, "Jumped to invalid address");
|
||||
|
|
Loading…
Reference in New Issue