From 18bc19a09cd3dcce07c3048fad720b275ecfb491 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Fri, 14 May 2021 11:54:58 +0200 Subject: [PATCH] savestate: remove a bunch of dead code --- pcsx2/GS/GS.cpp | 7 ++++--- pcsx2/SaveState.cpp | 18 ------------------ pcsx2/SaveState.h | 6 ------ pcsx2/System/SysCoreThread.cpp | 10 ---------- pcsx2/System/SysThreads.h | 1 - pcsx2/gui/AppCoreThread.cpp | 7 ------- pcsx2/gui/AppCoreThread.h | 1 - pcsx2/gui/GlobalCommands.cpp | 2 +- pcsx2/gui/SysState.cpp | 2 +- 9 files changed, 6 insertions(+), 48 deletions(-) diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index 0ad0f5ce0f..d61b51708d 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -24,6 +24,7 @@ #include "GSLzma.h" #include "AppCoreThread.h" +#include "Utilities/pxStreams.h" #ifdef _WIN32 @@ -2309,7 +2310,7 @@ GSRendererType GSApp::GetCurrentRendererType() const void GSDoFreezeOut(void* dest) { - freezeData fP = {0, (s8*)dest}; + GSFreezeData fP = {0, (u8*)dest}; if (GSfreeze(FREEZE_SIZE, &fP) != 0) return; if (!fP.size) @@ -2324,7 +2325,7 @@ void GSDoFreezeOut(void* dest) void GSDoFreezeIn(pxInputStream& infp) { - freezeData fP = {0, nullptr}; + GSFreezeData fP = {0, nullptr}; if (GSfreeze(FREEZE_SIZE, &fP) != 0) fP.size = 0; @@ -2346,7 +2347,7 @@ void GSDoFreezeIn(pxInputStream& infp) } ScopedAlloc data(fP.size); - fP.data = data.GetPtr(); + fP.data = (u8*)data.GetPtr(); infp.Read(fP.data, fP.size); if (GSfreeze(FREEZE_LOAD, &fP) != 0) diff --git a/pcsx2/SaveState.cpp b/pcsx2/SaveState.cpp index c5e96c71af..6bbe2654fb 100644 --- a/pcsx2/SaveState.cpp +++ b/pcsx2/SaveState.cpp @@ -241,16 +241,6 @@ SaveStateBase& SaveStateBase::FreezeInternals() return *this; } -SaveStateBase& SaveStateBase::FreezeAll() -{ - FreezeMainMemory(); - FreezeBios(); - FreezeInternals(); - //TODO: ADD BACK FREEZE PLUGINS HERE - - return *this; -} - // -------------------------------------------------------------------------------------- // memSavingState (implementations) @@ -285,14 +275,6 @@ void memSavingState::MakeRoomForData() m_memory->MakeRoomFor( m_idx + MemoryBaseAllocSize ); } -// Saving of state data to a memory buffer -memSavingState& memSavingState::FreezeAll() -{ - MakeRoomForData(); - _parent::FreezeAll(); - return *this; -} - // -------------------------------------------------------------------------------------- // memLoadingState (implementations) // -------------------------------------------------------------------------------------- diff --git a/pcsx2/SaveState.h b/pcsx2/SaveState.h index 55d249a7be..77123cc17a 100644 --- a/pcsx2/SaveState.h +++ b/pcsx2/SaveState.h @@ -76,11 +76,6 @@ public: return (m_version & 0xffff); } - // Loads or saves the entire emulation state. - // Note: The Cpu state must be reset, and plugins *open*, prior to Defrosting - // (loading) a state! - virtual SaveStateBase& FreezeAll(); - virtual SaveStateBase& FreezeMainMemory(); virtual SaveStateBase& FreezeBios(); virtual SaveStateBase& FreezeInternals(); @@ -197,7 +192,6 @@ public: void MakeRoomForData(); void FreezeMem( void* data, int size ); - memSavingState& FreezeAll(); bool IsSaving() const { return true; } }; diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index 5a912a2a67..89f5ddeee1 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -181,16 +181,6 @@ void SysCoreThread::ApplySettings(const Pcsx2Config& src) const_cast(EmuConfig) = src; } -void SysCoreThread::UploadStateCopy(const VmStateBuffer& copy) -{ - if (!pxAssertDev(IsPaused(), "CoreThread is not paused; new VM state cannot be uploaded.")) - return; - - memLoadingState loadme(copy); - loadme.FreezeAll(); - m_resetVirtualMachine = false; -} - // -------------------------------------------------------------------------------------- // SysCoreThread *Worker* Implementations // (Called from the context of this thread only) diff --git a/pcsx2/System/SysThreads.h b/pcsx2/System/SysThreads.h index 1c77870ea5..61f37bce0e 100644 --- a/pcsx2/System/SysThreads.h +++ b/pcsx2/System/SysThreads.h @@ -209,7 +209,6 @@ public: virtual void GameStartingInThread(); virtual void ApplySettings(const Pcsx2Config& src); - virtual void UploadStateCopy(const VmStateBuffer& copy); virtual bool HasActiveMachine() const { return m_hasActiveMachine; } diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index 96283cc38d..b150df0891 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -642,13 +642,6 @@ bool AppCoreThread::StateCheckInThread() return _parent::StateCheckInThread(); } -void AppCoreThread::UploadStateCopy(const VmStateBuffer& copy) -{ - ScopedCoreThreadPause paused_core; - _parent::UploadStateCopy(copy); - paused_core.AllowResume(); -} - static uint m_except_threshold = 0; void AppCoreThread::ExecuteTaskInThread() diff --git a/pcsx2/gui/AppCoreThread.h b/pcsx2/gui/AppCoreThread.h index a0954532bb..19939ecf19 100644 --- a/pcsx2/gui/AppCoreThread.h +++ b/pcsx2/gui/AppCoreThread.h @@ -151,7 +151,6 @@ public: virtual void ChangeCdvdSource(); virtual void ApplySettings(const Pcsx2Config& src); - virtual void UploadStateCopy(const VmStateBuffer& copy); protected: virtual void DoCpuExecute(); diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index 31b92644de..843104efae 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -400,7 +400,7 @@ namespace Implementations return; if (renderswitch_delay == 0) { - ScopedCoreThreadPause paused_core(); + ScopedCoreThreadPause paused_core; // TODO: add back saving/freezing of gs here -- govanify renderswitch = !renderswitch; paused_core.AllowResume(); diff --git a/pcsx2/gui/SysState.cpp b/pcsx2/gui/SysState.cpp index 54dbd1b444..353dd5955e 100644 --- a/pcsx2/gui/SysState.cpp +++ b/pcsx2/gui/SysState.cpp @@ -279,7 +279,7 @@ public: void FreezeIn(pxInputStream& reader) const { return GSDoFreezeIn(reader); } void FreezeOut(SaveStateBase& writer) const { - freezeData fP = {0, NULL}; + GSFreezeData fP = {0, NULL}; if (GSfreeze(FREEZE_SIZE, &fP) == 0) { const int size = fP.size;