From 6e40d456f942df2a05182aa34168c17600543b2d Mon Sep 17 00:00:00 2001 From: gocha Date: Sat, 18 Sep 2010 04:44:46 +0000 Subject: [PATCH] windows: improve "background input" a bit --- desmume/src/lua-engine.cpp | 4 ++-- desmume/src/windows/main.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/desmume/src/lua-engine.cpp b/desmume/src/lua-engine.cpp index fad46d83d..7cf0b753e 100644 --- a/desmume/src/lua-engine.cpp +++ b/desmume/src/lua-engine.cpp @@ -3664,10 +3664,10 @@ DEFINE_LUA_FUNCTION(input_getcurrentinputstatus, "") #if defined(_WIN32) && !defined(WXPORT) // keyboard and mouse button status { - int BackgroundInput = 0;//TODO + extern bool allowBackgroundInput; unsigned char keys [256]; - if(!BackgroundInput) + if(!allowBackgroundInput) { if(GetKeyboardState(keys)) { diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 60d1c591b..b23ccdca2 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -3863,6 +3863,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM DesEnableMenuItem(mainMenu, ID_RAM_WATCH, romloaded); DesEnableMenuItem(mainMenu, ID_RAM_SEARCH, romloaded); + DesEnableMenuItem(mainMenu, IDC_BACKGROUNDINPUT, !lostFocusPause); + //Update savestate slot items based on ROM loaded for (int x = 0; x < 10; x++) { @@ -5132,7 +5134,9 @@ DOKEYDOWN: case IDC_BACKGROUNDPAUSE: lostFocusPause = !lostFocusPause; + allowBackgroundInput &= !lostFocusPause; WritePrivateProfileInt("Focus", "BackgroundPause", (int)lostFocusPause, IniName); + WritePrivateProfileInt("Controls", "AllowBackgroundInput", (int)allowBackgroundInput, IniName); return 0; case IDC_BACKGROUNDINPUT: