mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-30 19:24:23 +01:00
Savestate: Don't break event callbacks when a save fails
CoreTiming::DoState replaced every event's callback with the anti-crash one in every mode, relying on each module's restore to put it back. A save that failed partway never got to those, and left the running game with events that break into the debugger. The missing-section fallbacks then also ran on the save: cheats and the mic re-registered events into the wrong slots, and achievements reset the runtime. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9140bc9548
commit
2e5edcd298
4 files changed
+27
-15
No files matched your search
+10
-6
@@ -544,13 +544,17 @@ void DoState(PointerWrap &p) {
|
||||
return;
|
||||
}
|
||||
|
||||
// These (should) be filled in later by the modules.
|
||||
for (int i = 0; i < current; ++i) {
|
||||
event_types[i].callback = AntiCrashCallback;
|
||||
event_types[i].name = "INVALID EVENT";
|
||||
// These (should) be filled in later by the modules. Only when loading: a save that fails partway
|
||||
// wouldn't get to all the restores, and would leave the running game with broken events.
|
||||
if (p.mode == PointerWrap::MODE_READ) {
|
||||
for (int i = 0; i < current; ++i) {
|
||||
event_types[i].callback = AntiCrashCallback;
|
||||
event_types[i].name = "INVALID EVENT";
|
||||
}
|
||||
nextEventTypeRestoreId = n - 1;
|
||||
usedEventTypes.clear();
|
||||
}
|
||||
nextEventTypeRestoreId = n - 1;
|
||||
usedEventTypes.clear();
|
||||
// Needed in every pass, or each restore would look like a duplicate and get a new id.
|
||||
restoredEventTypes.clear();
|
||||
|
||||
if (s >= 3) {
|
||||
|
||||
Reference in new issue
Block a user