From 2a9c1d8dd059d7d37e3b9b1dc3f6cb0278330bfe Mon Sep 17 00:00:00 2001 From: Souryo Date: Sat, 12 Nov 2016 09:47:52 -0500 Subject: [PATCH] MMC3: Fixed potential issues with save states --- Core/MMC3.h | 5 +++++ Core/Snapshotable.cpp | 2 ++ Core/Snapshotable.h | 1 + 3 files changed, 8 insertions(+) diff --git a/Core/MMC3.h b/Core/MMC3.h index 0ae21e25..b01384ba 100644 --- a/Core/MMC3.h +++ b/Core/MMC3.h @@ -185,6 +185,11 @@ class MMC3 : public BaseMapper _wramEnabled, _wramWriteProtected, registers, _needIrq); } + void AfterLoadState() override + { + UpdateState(); + } + virtual uint16_t GetPRGPageSize() { return 0x2000; } virtual uint16_t GetCHRPageSize() { return 0x0400; } virtual uint32_t GetSaveRamPageSize() { return _subMapperID == 1 ? 0x200 : 0x2000; } diff --git a/Core/Snapshotable.cpp b/Core/Snapshotable.cpp index 596f792d..104d203d 100644 --- a/Core/Snapshotable.cpp +++ b/Core/Snapshotable.cpp @@ -93,6 +93,8 @@ void Snapshotable::LoadSnapshot(istream* file) file->read((char*)_stream, _streamSize); StreamState(_saving); + AfterLoadState(); + delete[] _stream; if(_blockBuffer) { diff --git a/Core/Snapshotable.h b/Core/Snapshotable.h index f32f751d..11a5bf99 100644 --- a/Core/Snapshotable.h +++ b/Core/Snapshotable.h @@ -144,6 +144,7 @@ private: protected: virtual void StreamState(bool saving) = 0; + virtual void AfterLoadState() { } void Stream(Snapshotable* snapshotable);