0.9.6: backport "background input" from trunk
This commit is contained in:
parent
f48b76b0fd
commit
5919d664ee
|
@ -3655,10 +3655,10 @@ DEFINE_LUA_FUNCTION(input_getcurrentinputstatus, "")
|
||||||
#if defined(_WIN32) && !defined(WXPORT)
|
#if defined(_WIN32) && !defined(WXPORT)
|
||||||
// keyboard and mouse button status
|
// keyboard and mouse button status
|
||||||
{
|
{
|
||||||
int BackgroundInput = 0;//TODO
|
extern bool allowBackgroundInput;
|
||||||
|
|
||||||
unsigned char keys [256];
|
unsigned char keys [256];
|
||||||
if(!BackgroundInput)
|
if(!allowBackgroundInput)
|
||||||
{
|
{
|
||||||
if(GetKeyboardState(keys))
|
if(GetKeyboardState(keys))
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,6 +252,7 @@ SGuitar Guitar;
|
||||||
u8 guitarState = 0;
|
u8 guitarState = 0;
|
||||||
|
|
||||||
bool allowUpAndDown = false;
|
bool allowUpAndDown = false;
|
||||||
|
bool allowBackgroundInput = false;
|
||||||
|
|
||||||
extern volatile bool paused;
|
extern volatile bool paused;
|
||||||
|
|
||||||
|
@ -415,6 +416,7 @@ static void LoadInputConfig()
|
||||||
#undef DO
|
#undef DO
|
||||||
|
|
||||||
allowUpAndDown = GetPrivateProfileInt("Controls","AllowUpAndDown",0,IniName) != 0;
|
allowUpAndDown = GetPrivateProfileInt("Controls","AllowUpAndDown",0,IniName) != 0;
|
||||||
|
allowBackgroundInput = GetPrivateProfileInt("Controls","AllowBackgroundInput",0,IniName) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteControl(char* name, WORD val)
|
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
|
if(KeyIdent == 0 || KeyIdent == 0xFF || KeyIdent == VK_ESCAPE) // if it's the 'disabled' key, it's never pressed
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//TODO - option for background game keys
|
if(!allowBackgroundInput && MainWindow->getHWnd() != GetForegroundWindow())
|
||||||
if(MainWindow->getHWnd() != GetForegroundWindow())
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (KeyIdent & 0x8000) // if it's a joystick 'key':
|
if (KeyIdent & 0x8000) // if it's a joystick 'key':
|
||||||
|
|
|
@ -277,6 +277,7 @@ extern HWND RamSearchHWnd;
|
||||||
static bool lostFocusPause = true;
|
static bool lostFocusPause = true;
|
||||||
static bool lastPauseFromLostFocus = false;
|
static bool lastPauseFromLostFocus = false;
|
||||||
static bool FrameLimit = true;
|
static bool FrameLimit = true;
|
||||||
|
extern bool allowBackgroundInput;
|
||||||
|
|
||||||
std::vector<HWND> LuaScriptHWnds;
|
std::vector<HWND> LuaScriptHWnds;
|
||||||
LRESULT CALLBACK LuaScriptProc(HWND, UINT, WPARAM, LPARAM);
|
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_WATCH, romloaded);
|
||||||
DesEnableMenuItem(mainMenu, ID_RAM_SEARCH, romloaded);
|
DesEnableMenuItem(mainMenu, ID_RAM_SEARCH, romloaded);
|
||||||
|
|
||||||
|
DesEnableMenuItem(mainMenu, IDC_BACKGROUNDINPUT, !lostFocusPause);
|
||||||
|
|
||||||
//Update savestate slot items based on ROM loaded
|
//Update savestate slot items based on ROM loaded
|
||||||
for (int x = 0; x < 10; x++)
|
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(ID_DISPLAYMETHOD_DIRECTDRAWSW, (GetStyle()&DWS_DDRAW_SW)!=0);
|
||||||
|
|
||||||
MainWindow->checkMenu(IDC_BACKGROUNDPAUSE, lostFocusPause);
|
MainWindow->checkMenu(IDC_BACKGROUNDPAUSE, lostFocusPause);
|
||||||
|
MainWindow->checkMenu(IDC_BACKGROUNDINPUT, allowBackgroundInput);
|
||||||
|
|
||||||
MainWindow->checkMenu(IDM_CHEATS_DISABLE, CommonSettings.cheatsDisable == true);
|
MainWindow->checkMenu(IDM_CHEATS_DISABLE, CommonSettings.cheatsDisable == true);
|
||||||
|
|
||||||
|
@ -4921,7 +4925,14 @@ DOKEYDOWN:
|
||||||
|
|
||||||
case IDC_BACKGROUNDPAUSE:
|
case IDC_BACKGROUNDPAUSE:
|
||||||
lostFocusPause = !lostFocusPause;
|
lostFocusPause = !lostFocusPause;
|
||||||
|
allowBackgroundInput &= !lostFocusPause;
|
||||||
WritePrivateProfileInt("Focus", "BackgroundPause", (int)lostFocusPause, IniName);
|
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;
|
return 0;
|
||||||
|
|
||||||
case ID_DISPLAYMETHOD_DIRECTDRAWHW:
|
case ID_DISPLAYMETHOD_DIRECTDRAWHW:
|
||||||
|
|
|
@ -106,6 +106,7 @@
|
||||||
#define IDC_16_BIT 303
|
#define IDC_16_BIT 303
|
||||||
#define IDC_32_BIT 304
|
#define IDC_32_BIT 304
|
||||||
#define IDC_BACKGROUNDPAUSE 305
|
#define IDC_BACKGROUNDPAUSE 305
|
||||||
|
#define IDC_BACKGROUNDINPUT 306
|
||||||
#define IDC_LUACONSOLE 309
|
#define IDC_LUACONSOLE 309
|
||||||
#define IDC_EDIT_LUAPATH 310
|
#define IDC_EDIT_LUAPATH 310
|
||||||
#define IDC_BUTTON_LUARUN 311
|
#define IDC_BUTTON_LUARUN 311
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue