mirror of https://github.com/mgba-emu/mgba.git
GBA: Check for savestates made from differently sized ROMs
This commit is contained in:
parent
a51066820a
commit
cd43d07561
1
CHANGES
1
CHANGES
|
@ -36,6 +36,7 @@ Bugfixes:
|
|||
- GBA: Cap audio FIFO read size during deserialization
|
||||
- GBA: Check for corrupted savestates when loading
|
||||
- GBA: Check for improperly sized savestates when loading
|
||||
- GBA: Check for savestates made from differently sized ROMs
|
||||
Misc:
|
||||
- Qt: Handle saving input settings better
|
||||
- Debugger: Free watchpoints in addition to breakpoints
|
||||
|
|
|
@ -90,6 +90,10 @@ void GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
|
|||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: overflowInterval is negative");
|
||||
return;
|
||||
}
|
||||
if (state->cpu.gprs[ARM_PC] == BASE_CART0 || (state->cpu.gprs[ARM_PC] & SIZE_CART0) >= gba->memory.romSize) {
|
||||
GBALog(gba, GBA_LOG_WARN, "Savestate created using a differently sized version of the ROM");
|
||||
return;
|
||||
}
|
||||
memcpy(gba->cpu->gprs, state->cpu.gprs, sizeof(gba->cpu->gprs));
|
||||
gba->cpu->cpsr = state->cpu.cpsr;
|
||||
gba->cpu->spsr = state->cpu.spsr;
|
||||
|
|
Loading…
Reference in New Issue