0.9.6: backport "background input" from trunk

This commit is contained in:
gocha 2010-09-18 04:51:50 +00:00
parent f48b76b0fd
commit 5919d664ee
5 changed files with 17 additions and 4 deletions

View File

@ -3655,10 +3655,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))
{

View File

@ -252,6 +252,7 @@ SGuitar Guitar;
u8 guitarState = 0;
bool allowUpAndDown = false;
bool allowBackgroundInput = false;
extern volatile bool paused;
@ -415,6 +416,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)
@ -2142,8 +2144,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

@ -277,6 +277,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);
@ -3663,6 +3664,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++)
{
@ -3779,6 +3782,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);
@ -4921,7 +4925,14 @@ 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:
allowBackgroundInput = !allowBackgroundInput;
WritePrivateProfileInt("Controls", "AllowBackgroundInput", (int)allowBackgroundInput, IniName);
return 0;
case ID_DISPLAYMETHOD_DIRECTDRAWHW:

View File

@ -106,6 +106,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.