Also allow restartless cheats after loading state.

At least, an older state.
This commit is contained in:
Unknown W. Brackets 2013-10-13 18:03:23 -07:00
parent bbaacab315
commit a466b5ba32

View File

@ -59,13 +59,20 @@ void __CheatShutdown() {
} }
void __CheatDoState(PointerWrap &p) { void __CheatDoState(PointerWrap &p) {
auto s = p.Section("CwCheat", 0, 1); auto s = p.Section("CwCheat", 0, 2);
if (!s) { if (!s) {
return; return;
} }
p.Do(CheatEvent); p.Do(CheatEvent);
CoreTiming::RestoreRegisterEvent(CheatEvent, "CheatEvent", &hleCheat); CoreTiming::RestoreRegisterEvent(CheatEvent, "CheatEvent", &hleCheat);
if (s < 2) {
// Before this we didn't have a checkpoint, so reset didn't work.
// Let's just force one in.
CoreTiming::RemoveEvent(CheatEvent);
CoreTiming::ScheduleEvent(msToCycles(cheatsEnabled ? 77 : 1000), CheatEvent, 0);
}
} }
void hleCheat(u64 userdata, int cyclesLate) { void hleCheat(u64 userdata, int cyclesLate) {