Permalink
Browse files

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

… instruction
  • Loading branch information...
1 parent 13a68a0 commit 7b86d5cec770712915edbcd7bf1b0ad96d1938dd @endrift endrift committed Sep 12, 2016
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/gb/serialize.c
View
@@ -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;

0 comments on commit 7b86d5c

Please sign in to comment.