mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-26 15:50:00 -06:00
make cross-instance pause work without being a shitshow
This commit is contained in:
@ -198,6 +198,8 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent)
|
||||
connect(this, SIGNAL(swapScreensToggle()), mainWindow->actScreenSwap, SLOT(trigger()));
|
||||
connect(this, SIGNAL(screenEmphasisToggle()), mainWindow, SLOT(onScreenEmphasisToggled()));
|
||||
|
||||
connect(this, SIGNAL(windowIPCPause()), mainWindow, SLOT(onIPCPause()));
|
||||
|
||||
static_cast<ScreenPanelGL*>(mainWindow->panel)->transferLayout(this);
|
||||
}
|
||||
|
||||
@ -359,6 +361,8 @@ void EmuThread::run()
|
||||
{
|
||||
IPC::Process();
|
||||
|
||||
if (IPC::CommandReceived(IPC::Cmd_Pause)) emit windowIPCPause();
|
||||
|
||||
Input::Process();
|
||||
|
||||
if (Input::HotkeyPressed(HK_FastForwardToggle)) emit windowLimitFPSChange();
|
||||
@ -2707,10 +2711,32 @@ void MainWindow::onPause(bool checked)
|
||||
pausedManually = false;
|
||||
}
|
||||
|
||||
if (Platform::InstanceID()==0) // HAX
|
||||
IPC::SendCommand(0xFFFF, IPC::Cmd_Pause, 0, nullptr);
|
||||
}
|
||||
|
||||
void MainWindow::onIPCPause()
|
||||
{
|
||||
// for IPC, using the normal way to trigger a pause (actPause->trigger())
|
||||
// isn't viable, because it would lead to broadcasting more IPC 'pause' messages
|
||||
// so we have to replicate it this way
|
||||
|
||||
actPause->toggle(); // changes visual state, without triggering onPause()
|
||||
bool checked = actPause->isChecked();
|
||||
|
||||
if (checked)
|
||||
{
|
||||
emuThread->emuPause();
|
||||
OSD::AddMessage(0, "Paused");
|
||||
pausedManually = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
emuThread->emuUnpause();
|
||||
OSD::AddMessage(0, "Resumed");
|
||||
pausedManually = false;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onReset()
|
||||
{
|
||||
if (!RunningSomething) return;
|
||||
|
Reference in New Issue
Block a user