From 55f50d58f069fb513fba46311e8f0ac129b7ca6b Mon Sep 17 00:00:00 2001 From: Arisotura Date: Sat, 11 Mar 2023 23:07:29 +0100 Subject: [PATCH] make cross-instance pause work without breaking local wifi connections --- src/frontend/qt_sdl/IPC.cpp | 10 ++++++---- src/frontend/qt_sdl/main.cpp | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/frontend/qt_sdl/IPC.cpp b/src/frontend/qt_sdl/IPC.cpp index 1372eae9..1b0abf06 100644 --- a/src/frontend/qt_sdl/IPC.cpp +++ b/src/frontend/qt_sdl/IPC.cpp @@ -474,8 +474,6 @@ template void FIFOWrite(void* buf, int len) void ProcessCommands() { - memset(CmdRecvFlags, 0, sizeof(CmdRecvFlags)); - Buffer->lock(); u8* data = (u8*)Buffer->data(); BufferHeader* header = (BufferHeader*)&data[0]; @@ -505,11 +503,15 @@ void ProcessCommands() if (CommandReadOffset >= kCommandEnd) CommandReadOffset += kCommandStart - kCommandEnd; - continue; + { + // skip this command + CommandReadOffset += cmdheader.Length; + if (CommandReadOffset >= kCommandEnd) + CommandReadOffset += kCommandStart - kCommandEnd; } - if (cmdheader.Command >= Cmd_MAX) continue; + } // handle this command diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 32911cb8..1e290ff0 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -691,6 +691,7 @@ void EmuThread::emuRun() emit windowEmuStart(); AudioInOut::Enable(); IPC::SetActive(true); + IPC::SetActive(true); } void EmuThread::initContext() @@ -716,6 +717,7 @@ void EmuThread::emuPause() AudioInOut::Disable(); IPC::SetActive(false); + IPC::SetActive(false); } void EmuThread::emuUnpause() @@ -729,6 +731,7 @@ void EmuThread::emuUnpause() AudioInOut::Enable(); IPC::SetActive(true); + IPC::SetActive(true); } void EmuThread::emuStop() @@ -738,6 +741,7 @@ void EmuThread::emuStop() AudioInOut::Disable(); IPC::SetActive(false); + IPC::SetActive(false); } void EmuThread::emuFrameStep()