From 83a28ddab180657c33ca35caf74bc337749206ed Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Fri, 14 May 2021 11:26:08 +0200 Subject: [PATCH] savestate: add back gs sstate --- pcsx2/gui/SysState.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pcsx2/gui/SysState.cpp b/pcsx2/gui/SysState.cpp index 3bea66cb83..54dbd1b444 100644 --- a/pcsx2/gui/SysState.cpp +++ b/pcsx2/gui/SysState.cpp @@ -270,6 +270,29 @@ public: bool IsRequired() const { return true; } }; +class SavestateEntry_GS : public BaseSavestateEntry +{ +public: + virtual ~SavestateEntry_GS() = default; + + wxString GetFilename() const { return L"GS.bin"; } + void FreezeIn(pxInputStream& reader) const { return GSDoFreezeIn(reader); } + void FreezeOut(SaveStateBase& writer) const + { + freezeData fP = {0, NULL}; + if (GSfreeze(FREEZE_SIZE, &fP) == 0) + { + const int size = fP.size; + writer.PrepBlock(size); + GSDoFreezeOut(writer.GetBlockPtr()); + writer.CommitBlock(size); + } + return; + } + bool IsRequired() const { return true; } +}; + + // [TODO] : Add other components as files to the savestate gzip? @@ -294,6 +317,7 @@ static const std::unique_ptr SavestateEntries[] = { std::unique_ptr(new SavestateEntry_SPU2), std::unique_ptr(new SavestateEntry_USB), std::unique_ptr(new SavestateEntry_PAD), + std::unique_ptr(new SavestateEntry_GS), }; // It's bad mojo to have savestates trying to read and write from the same file at the