From fdd7af89979f438305fcc94e269ff29bb344df7c Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 18 Nov 2009 02:06:06 +0000 Subject: [PATCH] Win32 - if Cheats dialog pauses the emulator, the emulator will unpaused if it regains focus. --- src/drivers/win/cheat.cpp | 5 +++++ src/drivers/win/window.cpp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index bd9e900a..1eb605bd 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -32,6 +32,7 @@ HWND hCheat; //mbg merge 7/19/06 had to add void InitializeCheatsAdded(HWND hwndDlg); bool pauseWhileActive = false; //For checkbox "Pause while active" +extern bool wasPausedByCheats; int CheatWindow; int CheatStyle=1; @@ -212,7 +213,11 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (pauseWhileActive) { if (EmulationPaused == 0) + { EmulationPaused = 1; + wasPausedByCheats = true; + FCEU_printf("Emulation paused: %d\n", EmulationPaused); + } } if ((CheatStyle) && (scrollnum)) { diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 041ab96a..f0c747b8 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -126,6 +126,7 @@ int MainWindow_wndx, MainWindow_wndy; static uint32 mousex,mousey,mouseb; static int vchanged = 0; int menuYoffset = 0; +bool wasPausedByCheats = false; //For unpausing the emulator if paused by the cheats dialog bool rightClickEnabled = true; //If set to false, the right click context menu will be disabled. @@ -1145,8 +1146,6 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) mouseb=wParam; goto proco; - case WM_SETFOCUS: - break; case WM_RBUTTONUP: { if (rightClickEnabled) @@ -2045,7 +2044,15 @@ adelikat: Outsourced this to a remappable hotkey case WM_QUIT: DoFCEUExit(); break; - case WM_ACTIVATEAPP: + case WM_SETFOCUS: + FCEUI_printf("wasPausedbyCheats = %d\n",wasPausedByCheats); + if (wasPausedByCheats) + { + EmulationPaused = 0; + wasPausedByCheats = false; + } + break; + case WM_ACTIVATEAPP: if((BOOL)wParam) { nofocus=0;