mirror of https://github.com/PCSX2/pcsx2.git
gs: ensure the panel doesn't open at all when unneeded
This commit is contained in:
parent
b06468e268
commit
7597ac12b6
|
@ -52,6 +52,7 @@ using namespace Threading;
|
|||
|
||||
__aligned(32) MTGS_BufferedData RingBuffer;
|
||||
extern bool renderswitch;
|
||||
std::atomic_bool init_gspanel = true;
|
||||
|
||||
|
||||
#ifdef RINGBUF_DEBUG_STACK
|
||||
|
@ -242,7 +243,8 @@ void SysMtgsThread::OpenGS()
|
|||
if (m_Opened)
|
||||
return;
|
||||
|
||||
sApp.OpenGsPanel();
|
||||
if (init_gspanel)
|
||||
sApp.OpenGsPanel();
|
||||
|
||||
memcpy(RingBuffer.Regs, PS2MEM_GS, sizeof(PS2MEM_GS));
|
||||
GSsetBaseMem(RingBuffer.Regs);
|
||||
|
@ -596,7 +598,8 @@ void SysMtgsThread::CloseGS()
|
|||
return;
|
||||
m_Opened = false;
|
||||
GSclose();
|
||||
sApp.CloseGsPanel();
|
||||
if (init_gspanel)
|
||||
sApp.CloseGsPanel();
|
||||
}
|
||||
|
||||
void SysMtgsThread::OnSuspendInThread()
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
|
||||
using namespace Dialogs;
|
||||
|
||||
extern std::atomic_bool init_gspanel;
|
||||
|
||||
void MainEmuFrame::Menu_SysSettings_Click(wxCommandEvent& event)
|
||||
{
|
||||
AppOpenDialog<SysConfigDialog>(this);
|
||||
|
@ -91,20 +93,27 @@ void MainEmuFrame::Menu_PADSettings_Click(wxCommandEvent& event)
|
|||
void MainEmuFrame::Menu_GSSettings_Click(wxCommandEvent& event)
|
||||
{
|
||||
ScopedCoreThreadPause paused_core;
|
||||
bool is_frame_closed = (wxGetApp().GetGsFramePtr() == nullptr);
|
||||
if (!is_frame_closed)
|
||||
is_frame_closed = !wxGetApp().GetGsFramePtr()->IsShown();
|
||||
bool is_frame_init = !(wxGetApp().GetGsFramePtr() == nullptr);
|
||||
bool need_shutdown = GetMTGS().IsClosed();
|
||||
init_gspanel = false;
|
||||
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);
|
||||
if (is_frame_init)
|
||||
{
|
||||
GetMTGS().Freeze(FREEZE_SIZE, sstate);
|
||||
fP.data = new char[fP.size];
|
||||
GetMTGS().Freeze(FREEZE_SAVE, sstate);
|
||||
GetMTGS().Suspend(true);
|
||||
}
|
||||
GSconfigure();
|
||||
GetMTGS().Freeze(FREEZE_LOAD, sstate);
|
||||
delete[] fP.data;
|
||||
if (is_frame_closed)
|
||||
wxGetApp().GetGsFramePtr()->Hide();
|
||||
if (is_frame_init)
|
||||
{
|
||||
GetMTGS().Freeze(FREEZE_LOAD, sstate);
|
||||
delete[] fP.data;
|
||||
}
|
||||
if (need_shutdown)
|
||||
GetMTGS().Suspend(true);
|
||||
init_gspanel = true;
|
||||
paused_core.AllowResume();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue