windows: add "background input" option to the menu.

This commit is contained in:
gocha 2010-09-18 03:26:00 +00:00
parent af035533a0
commit f969eedf7d
4 changed files with 11 additions and 2 deletions

View File

@ -260,6 +260,7 @@ SPiano Piano;
SPiano DefaultPiano = { false, 'Z', 'S', 'X', 'D', 'C', 'V', 'G', 'B', 'H', 'N', 'J', 'M', VK_OEM_COMMA };
bool allowUpAndDown = false;
bool allowBackgroundInput = false;
extern volatile bool paused;
@ -450,6 +451,7 @@ static void LoadInputConfig()
#undef DO
allowUpAndDown = GetPrivateProfileInt("Controls","AllowUpAndDown",0,IniName) != 0;
allowBackgroundInput = GetPrivateProfileInt("Controls","AllowBackgroundInput",0,IniName) != 0;
}
static void WriteControl(char* name, WORD val)
@ -2193,8 +2195,7 @@ bool S9xGetState (WORD KeyIdent)
if(KeyIdent == 0 || KeyIdent == 0xFF || KeyIdent == VK_ESCAPE) // if it's the 'disabled' key, it's never pressed
return true;
//TODO - option for background game keys
if(MainWindow->getHWnd() != GetForegroundWindow())
if(!allowBackgroundInput && MainWindow->getHWnd() != GetForegroundWindow())
return true;
if (KeyIdent & 0x8000) // if it's a joystick 'key':

View File

@ -406,6 +406,7 @@ extern HWND RamSearchHWnd;
static bool lostFocusPause = true;
static bool lastPauseFromLostFocus = false;
static bool FrameLimit = true;
extern bool allowBackgroundInput;
std::vector<HWND> LuaScriptHWnds;
LRESULT CALLBACK LuaScriptProc(HWND, UINT, WPARAM, LPARAM);
@ -3979,6 +3980,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
MainWindow->checkMenu(ID_DISPLAYMETHOD_DIRECTDRAWSW, (GetStyle()&DWS_DDRAW_SW)!=0);
MainWindow->checkMenu(IDC_BACKGROUNDPAUSE, lostFocusPause);
MainWindow->checkMenu(IDC_BACKGROUNDINPUT, allowBackgroundInput);
MainWindow->checkMenu(IDM_CHEATS_DISABLE, CommonSettings.cheatsDisable == true);
@ -5133,6 +5135,11 @@ DOKEYDOWN:
WritePrivateProfileInt("Focus", "BackgroundPause", (int)lostFocusPause, IniName);
return 0;
case IDC_BACKGROUNDINPUT:
allowBackgroundInput = !allowBackgroundInput;
WritePrivateProfileInt("Controls", "AllowBackgroundInput", (int)allowBackgroundInput, IniName);
return 0;
case ID_DISPLAYMETHOD_VSYNC:
SetStyle(GetStyle()^DWS_VSYNC);
WritePrivateProfileInt("Video","VSync", (GetStyle()&DWS_VSYNC)?1:0, IniName);

View File

@ -107,6 +107,7 @@
#define IDC_16_BIT 303
#define IDC_32_BIT 304
#define IDC_BACKGROUNDPAUSE 305
#define IDC_BACKGROUNDINPUT 306
#define IDC_LUACONSOLE 309
#define IDC_EDIT_LUAPATH 310
#define IDC_BUTTON_LUARUN 311

Binary file not shown.