From 7bd449c171b7b12554541069ca41af6d1a99c241 Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Sun, 10 Jun 2018 10:24:15 -0500 Subject: [PATCH] Prevent two titles emulating at same time. This will help producing false postive report and inform user to stop current title emulating before start new emulation. --- src/Cxbx/WndMain.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Cxbx/WndMain.cpp b/src/Cxbx/WndMain.cpp index ec0c078cf..a0f5c6e3d 100644 --- a/src/Cxbx/WndMain.cpp +++ b/src/Cxbx/WndMain.cpp @@ -2188,6 +2188,17 @@ void WndMain::SaveXbeAs() void WndMain::StartEmulation(HWND hwndParent, DebuggerState LocalDebuggerState /*= debuggerOff*/) { char szBuffer[MAX_PATH]; + bool isEmulating = false; + + g_EmuShared->GetIsEmulating(&isEmulating); + + if (isEmulating) { + MessageBox(m_hwnd, "A title is currently emulating, please stop emulation before attempt start again.", + "Cxbx-Reloaded", MB_ICONERROR | MB_OK); + return; + } + + g_EmuShared->SetIsEmulating(true); // register xbe path with emulator process g_EmuShared->SetXbePath(m_Xbe->m_szPath); @@ -2288,6 +2299,7 @@ void WndMain::StopEmulation() RefreshMenus(); // Set the window size back to it's GUI dimensions ResizeWindow(m_hwnd, /*bForGUI=*/true); + g_EmuShared->SetIsEmulating(false); } // wrapper function to call CrashMonitor