summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authornitsuja <nitsuja-@hotmail.com>2011-12-17 16:49:24 -0800
committernitsuja <nitsuja-@hotmail.com>2011-12-18 00:22:06 -0800
commitc68c8c388cc29cfd4e97be8fc7f5ea7534508672 (patch)
treed31452a762f61df621ad38f35d784865c7ae51fb /Source/Core/Common
parent98d22d0e03ba22092ebd550ee0e6be9afd95f687 (diff)
made savestate loads less fragile by adding some markers and rolling back on a mismatch.
This should make it so if you try to load an incompatible save, it simply doesn't load, instead of crashing dolphin. (I can't guarantee no crash but it's much less likely now)
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/ChunkFile.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/ChunkFile.h b/Source/Core/Common/Src/ChunkFile.h
index 03216deaf1..b0662d2517 100644
--- a/Source/Core/Common/Src/ChunkFile.h
+++ b/Source/Core/Common/Src/ChunkFile.h
@@ -170,6 +170,17 @@ public:
// TODO
PanicAlert("Do(linked list<>) does not yet work.");
}
+
+ void DoMarker(const char* prevName, u32 arbitraryNumber=0x42)
+ {
+ u32 cookie = arbitraryNumber;
+ Do(cookie);
+ if(mode == PointerWrap::MODE_READ && cookie != arbitraryNumber)
+ {
+ PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
+ mode = PointerWrap::MODE_MEASURE;
+ }
+ }
};