GB Serialize: Prevent loading savestates that aren't about to load an instruction

This commit is contained in:
Jeffrey Pfau 2016-09-12 12:38:16 -07:00
parent 13a68a0dac
commit 7b86d5cec7
1 changed files with 4 additions and 0 deletions

View File

@ -112,6 +112,10 @@ bool GBDeserialize(struct GB* gb, const struct GBSerializedState* state) {
mLOG(GB_STATE, WARN, "Savestate is corrupted: CPU cycles are negative");
error = true;
}
if (state->cpu.executionState != LR35902_CORE_FETCH) {
mLOG(GB_STATE, WARN, "Savestate is corrupted: Execution state is not FETCH");
error = true;
}
if (check >= (int32_t) DMG_LR35902_FREQUENCY) {
mLOG(GB_STATE, WARN, "Savestate is corrupted: CPU cycles are too high");
error = true;