mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
mtgs: fix threading woes
This commit is contained in:
committed by
Kojin
parent
c73769607e
commit
db80ff5477
@@ -595,14 +595,13 @@ void SysMtgsThread::CloseGS()
|
||||
if (!m_Opened || GSDump::isRunning)
|
||||
return;
|
||||
m_Opened = false;
|
||||
Suspend();
|
||||
GSclose();
|
||||
sApp.CloseGsPanel();
|
||||
}
|
||||
|
||||
void SysMtgsThread::OnSuspendInThread()
|
||||
{
|
||||
GSclose();
|
||||
GetSysExecutorThread().PostEvent(new SysExecEvent_InvokeMtgsThreadMethod(&SysMtgsThread::CloseGS));
|
||||
CloseGS();
|
||||
_parent::OnSuspendInThread();
|
||||
}
|
||||
|
||||
@@ -616,7 +615,7 @@ void SysMtgsThread::OnResumeInThread(bool isSuspended)
|
||||
|
||||
void SysMtgsThread::OnCleanupInThread()
|
||||
{
|
||||
GetSysExecutorThread().PostEvent(new SysExecEvent_InvokeMtgsThreadMethod(&SysMtgsThread::CloseGS));
|
||||
CloseGS();
|
||||
_parent::OnCleanupInThread();
|
||||
}
|
||||
|
||||
@@ -925,8 +924,9 @@ void SysMtgsThread::WaitForOpen()
|
||||
|
||||
void SysMtgsThread::Freeze(int mode, MTGS_FreezeData& data)
|
||||
{
|
||||
Resume();
|
||||
pxAssertDev(!IsSelf(), "This method is only allowed from threads *not* named MTGS.");
|
||||
SendPointerPacket(GS_RINGTYPE_FREEZE, mode, &data);
|
||||
// make sure MTGS is processing the packet we send it
|
||||
Resume();
|
||||
// we are forced to wait for the semaphore to be released, otherwise
|
||||
// we'll end up in a state where the main thread is stuck on WaitGS
|
||||
|
||||
@@ -400,6 +400,7 @@ namespace Implementations
|
||||
return;
|
||||
if (renderswitch_delay == 0)
|
||||
{
|
||||
ScopedCoreThreadPause paused_core;
|
||||
freezeData fP = {0, nullptr};
|
||||
MTGS_FreezeData sstate = {&fP, 0};
|
||||
GetMTGS().Freeze(FREEZE_SIZE, sstate);
|
||||
@@ -410,6 +411,7 @@ namespace Implementations
|
||||
GetMTGS().Freeze(FREEZE_LOAD, sstate);
|
||||
delete[] fP.data;
|
||||
renderswitch_delay = -1;
|
||||
paused_core.AllowResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,10 @@ struct SysState_Component
|
||||
|
||||
int SysState_MTGSFreeze(int mode, freezeData* fP)
|
||||
{
|
||||
ScopedCoreThreadPause paused_core;
|
||||
MTGS_FreezeData sstate = {fP, 0};
|
||||
GetMTGS().Freeze(mode, sstate);
|
||||
paused_core.AllowResume();
|
||||
return sstate.retval;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user