From fa4f4bca73fee91293a9a8bfae6097c40ee23b4a Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Wed, 16 Jun 2021 03:18:30 +0200 Subject: [PATCH] mtgs: make renderswitch save current state --- pcsx2/MTGS.cpp | 1 + pcsx2/gui/GlobalCommands.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index 516cee4de5..766f76004e 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -925,6 +925,7 @@ void SysMtgsThread::WaitForOpen() void SysMtgsThread::Freeze(int mode, MTGS_FreezeData& data) { Resume(); + WaitForOpen(); SendPointerPacket(GS_RINGTYPE_FREEZE, mode, &data); Resume(); WaitGS(); diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index 116e139354..e23dbac952 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -400,9 +400,15 @@ namespace Implementations return; if (renderswitch_delay == 0) { - GetMTGS().Suspend(); + freezeData fP = {0, nullptr}; + MTGS_FreezeData sstate = {&fP, 0}; + GetMTGS().Freeze(FREEZE_SIZE, sstate); + fP.data = new char[fP.size]; + GetMTGS().Freeze(FREEZE_SAVE, sstate); + GetMTGS().Suspend(true); renderswitch = !renderswitch; - GetMTGS().Resume(); + GetMTGS().Freeze(FREEZE_LOAD, sstate); + delete[] fP.data; renderswitch_delay = -1; } }