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: