gs: port renderswitch to mtgs

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-06-16 01:40:40 +02:00 committed by Kojin
parent 527e5a8610
commit ab65f2ab5e
1 changed files with 2 additions and 21 deletions

View File

@ -400,29 +400,10 @@ namespace Implementations
return;
if (renderswitch_delay == 0)
{
ScopedCoreThreadPause paused_core;
std::unique_ptr<VmStateBuffer> plugstore;
freezeData fP = {0, NULL};
GSfreeze(FREEZE_SIZE, &fP);
char* data = new char[fP.size];
fP.data = data;
if (CoreThread.HasActiveMachine())
{
plugstore = std::make_unique<VmStateBuffer>(L"StateCopy_RenderToggle");
memSavingState save(plugstore.get());
GSfreeze(FREEZE_SAVE, &fP);
}
GSclose();
if (plugstore)
{
memLoadingState load(plugstore.get());
GSfreeze(FREEZE_LOAD, &fP);
}
GetMTGS().Suspend();
renderswitch = !renderswitch;
GSopen2((void**)pDsp, (renderswitch ? 4 : 0));
GetMTGS().Resume();
renderswitch_delay = -1;
delete[] fP.data;
paused_core.AllowResume();
}
}