mirror of https://github.com/snes9xgit/snes9x.git
win32: add option to ignore hotkeys from keyboard with backgroundinput
This commit is contained in:
parent
14d5dcb0c6
commit
5593fb762a
|
@ -485,6 +485,7 @@
|
|||
#define ID_DEBUG_APU_TRACE 40173
|
||||
#define ID_EMULATION_BACKGROUNDINPUT 40174
|
||||
#define ID_SAVEMEMPACK 40175
|
||||
#define ID_INPUT_BACKGROUNDKEYBOARDHOTKEYS 40176
|
||||
#define ID_FILE_SAVE0 44000
|
||||
#define ID_FILE_SAVE1 44001
|
||||
#define ID_FILE_SAVE2 44002
|
||||
|
@ -513,8 +514,8 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 154
|
||||
#define _APS_NEXT_COMMAND_VALUE 40176
|
||||
#define _APS_NEXT_RESOURCE_VALUE 155
|
||||
#define _APS_NEXT_COMMAND_VALUE 40178
|
||||
#define _APS_NEXT_CONTROL_VALUE 3022
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
|
@ -880,6 +880,7 @@ BEGIN
|
|||
MENUITEM "&Customize Hotkeys...\tAlt+F9", ID_OPTIONS_KEYCUSTOM
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Enable Background Input", ID_EMULATION_BACKGROUNDINPUT
|
||||
MENUITEM "Background Keyboard Hotkeys", ID_INPUT_BACKGROUNDKEYBOARDHOTKEYS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Use SNES Joypad(s)", IDM_SNES_JOYPAD
|
||||
MENUITEM "Use SNES Mouse", IDM_MOUSE_TOGGLE
|
||||
|
|
|
@ -1042,6 +1042,7 @@ void WinRegisterConfigItems()
|
|||
#undef ADDTN
|
||||
#undef ADD2T2
|
||||
AddBool2C("Input:Background", GUI.BackgroundInput, false, "on to detect game keypresses and hotkeys while window is inactive, if PauseWhenInactive = FALSE.");
|
||||
AddBool2C("Input:BackgroundKeyHotkeys", GUI.BackgroundKeyHotkeys, true, "on to also detect keyboard hotkeys when backgroundinput is active");
|
||||
#undef CATEGORY
|
||||
#define CATEGORY "Controls\\Win\\Hotkeys"
|
||||
AddBool2C("Handler:Joystick", GUI.JoystickHotkeys, true, "on to detect game controller buttons assigned to hotkeys. May impact performance.");
|
||||
|
|
|
@ -971,6 +971,12 @@ int HandleKeyMessage(WPARAM wParam, LPARAM lParam)
|
|||
|
||||
bool hitHotKey = false;
|
||||
|
||||
// if this is not a gamepad press and background hotkeys are disabled, skip it if we do not have focus
|
||||
if (!GUI.BackgroundKeyHotkeys && !(wParam & 0x8000) && GUI.hWnd != GetForegroundWindow())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!(wParam == 0 || wParam == VK_ESCAPE)) // if it's the 'disabled' key, it's never pressed as a hotkey
|
||||
{
|
||||
int modifiers = 0;
|
||||
|
@ -1934,6 +1940,10 @@ LRESULT CALLBACK WinProc(
|
|||
GUI.hHotkeyTimer = timeSetEvent (32, 0, (LPTIMECALLBACK)HotkeyTimer, 0, TIME_PERIODIC);
|
||||
break;
|
||||
|
||||
case ID_INPUT_BACKGROUNDKEYBOARDHOTKEYS:
|
||||
GUI.BackgroundKeyHotkeys = !GUI.BackgroundKeyHotkeys;
|
||||
break;
|
||||
|
||||
case ID_FILE_LOADMULTICART:
|
||||
{
|
||||
RestoreGUIDisplay ();
|
||||
|
@ -4018,6 +4028,11 @@ static void CheckMenuStates ()
|
|||
mii.fState = GUI.BackgroundInput ? MFS_CHECKED : MFS_UNCHECKED;
|
||||
SetMenuItemInfo (GUI.hMenu, ID_EMULATION_BACKGROUNDINPUT, FALSE, &mii);
|
||||
|
||||
mii.fState = GUI.BackgroundKeyHotkeys ? MFS_CHECKED : MFS_UNCHECKED;
|
||||
if (!GUI.BackgroundInput)
|
||||
mii.fState |= MFS_DISABLED;
|
||||
SetMenuItemInfo(GUI.hMenu, ID_INPUT_BACKGROUNDKEYBOARDHOTKEYS, FALSE, &mii);
|
||||
|
||||
UINT validFlag;
|
||||
ControllerOptionsFromControllers();
|
||||
|
||||
|
|
|
@ -374,6 +374,7 @@ struct sGUI {
|
|||
int ValidControllerOptions;
|
||||
int SoundChannelEnable;
|
||||
bool BackgroundInput;
|
||||
bool BackgroundKeyHotkeys;
|
||||
bool JoystickHotkeys;
|
||||
bool MovieClearSRAM;
|
||||
bool MovieStartFromReset;
|
||||
|
|
Loading…
Reference in New Issue