GBA: Check for cycle count being too high

This commit is contained in:
Jeffrey Pfau 2015-10-05 19:24:06 -07:00
parent a90eeea924
commit 32ca05312b
2 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,7 @@ Misc:
- GBA: Additional savestate sanity checks
- All: Reset next event to cycles instead of zero to interrupt
- GBA Video: Remove lastHblank, as it is implied
- GBA: Check for cycle count being too high
0.3.0: (2015-08-16)
Features:

View File

@ -87,6 +87,10 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: CPU cycles are negative");
error = true;
}
if (state->cpu.cycles >= (int32_t) GBA_ARM7TDMI_FREQUENCY) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: CPU cycles are too high");
error = true;
}
if (state->cpu.nextEvent < 0) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: Next event is negative");
error = true;