Win32: merge BackgroundKeyGamekeys and BackgroundKeyHotkeys, add menu item

This commit is contained in:
OV2 2011-05-08 01:41:33 +02:00
parent 2c3b9f1f63
commit a4f56c08e7
6 changed files with 20 additions and 9 deletions

View File

@ -485,13 +485,14 @@
#define ID_WINDOW_SIZE_3X 40171
#define ID_WINDOW_SIZE_4X 40172
#define ID_DEBUG_APU_TRACE 40173
#define ID_EMULATION_BACKGROUNDINPUT 40174
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 151
#define _APS_NEXT_COMMAND_VALUE 40174
#define _APS_NEXT_COMMAND_VALUE 40175
#define _APS_NEXT_CONTROL_VALUE 3018
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -842,6 +842,8 @@ BEGIN
MENUITEM "&Input Configuration...\tAlt+F7", 40022
MENUITEM "&Customize Hotkeys...\tAlt+F9", ID_OPTIONS_KEYCUSTOM
MENUITEM SEPARATOR
MENUITEM "Enable Background Input", ID_EMULATION_BACKGROUNDINPUT
MENUITEM SEPARATOR
MENUITEM "Use SNES Joypad(s)", IDM_SNES_JOYPAD
MENUITEM "Use SNES Mouse", IDM_MOUSE_TOGGLE
MENUITEM "Use Super Scope", IDM_SCOPE_TOGGLE

View File

@ -997,11 +997,10 @@ void WinRegisterConfigItems()
#undef ADDT3
#undef ADDTN
#undef ADD2T2
AddBool2C("Joypads:Background", GUI.BackgroundKeyGamekeys, true, "on to detect game keypresses while window is inactive, if PauseWhenInactive = FALSE.");
AddBool2C("Input:Background", GUI.BackgroundInput, false, "on to detect game keypresses and hotkeys while window is inactive, if PauseWhenInactive = FALSE.");
#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.");
AddBool2C("Handler:Background", GUI.BackgroundKeyHotkeys, false, "on to detect keyboard hotkeys when in the background. May impact performance and decrease responsiveness.");
#define ADD(x) AddVKey("Key:" #x , CustomKeys.x.key, CustomKeys.x.key); AddVKMod("Mods:" #x, CustomKeys.x.modifiers, CustomKeys.x.modifiers)
#define ADDN(x,n2) AddVKey("Key:" #n2, CustomKeys.x.key, CustomKeys.x.key); AddVKMod("Mods:" #n2, CustomKeys.x.modifiers, CustomKeys.x.modifiers)
ADD(SpeedUp); ADD(SpeedDown); ADD(Pause); ADD(FrameAdvance);

View File

@ -641,7 +641,7 @@ bool S9xGetState (WORD KeyIdent)
if(KeyIdent == 0 || KeyIdent == VK_ESCAPE) // if it's the 'disabled' key, it's never pressed
return true;
if(!GUI.BackgroundKeyGamekeys && GUI.hWnd != GetActiveWindow())
if(!GUI.BackgroundInput && GUI.hWnd != GetForegroundWindow())
return true;
if (KeyIdent & 0x8000) // if it's a joystick 'key':

View File

@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgCreateMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
INT_PTR CALLBACK DlgOpenMovie(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
HRESULT CALLBACK EnumModesCallback( LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext);
INT_PTR CALLBACK test(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
VOID CALLBACK HotkeyTimer( UINT idEvent, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
#define NOTKNOWN "Unknown Company "
#define HEADER_SIZE 512
@ -1440,7 +1440,7 @@ LRESULT CALLBACK WinProc(
DragAcceptFiles(hWnd, TRUE);
return 0;
case WM_KEYDOWN:
if(GUI.BackgroundKeyHotkeys)
if(GUI.BackgroundInput && !GUI.InactivePause)
break;
case WM_CUSTKEYDOWN:
case WM_SYSKEYDOWN:
@ -1754,6 +1754,12 @@ LRESULT CALLBACK WinProc(
RestoreSNESDisplay ();
break;
case ID_EMULATION_BACKGROUNDINPUT:
GUI.BackgroundInput = !GUI.BackgroundInput;
if(!GUI.hHotkeyTimer)
GUI.hHotkeyTimer = timeSetEvent (32, 0, (LPTIMECALLBACK)HotkeyTimer, 0, TIME_PERIODIC);
break;
case ID_FILE_LOADMULTICART:
{
#ifdef NETPLAY_SUPPORT
@ -2669,7 +2675,7 @@ VOID CALLBACK HotkeyTimer( UINT idEvent, UINT uMsg, DWORD dwUser, DWORD dw1, DWO
}
counter++;
}
if(GUI.BackgroundKeyHotkeys)
if(GUI.BackgroundInput && !GUI.InactivePause)
{
static int counter = 0;
static uint32 joyState [256];
@ -3270,7 +3276,7 @@ int WINAPI WinMain(
Settings.StopEmulation = TRUE;
GUI.hFrameTimer = timeSetEvent (20, 0, (LPTIMECALLBACK)FrameTimer, 0, TIME_PERIODIC);
if(GUI.JoystickHotkeys || GUI.BackgroundKeyHotkeys)
if(GUI.JoystickHotkeys || GUI.BackgroundInput)
GUI.hHotkeyTimer = timeSetEvent (32, 0, (LPTIMECALLBACK)HotkeyTimer, 0, TIME_PERIODIC);
else
GUI.hHotkeyTimer = 0;
@ -3792,6 +3798,9 @@ static void CheckMenuStates ()
mii.fState = (GUI.SoundChannelEnable & (1 << 7)) ? MFS_CHECKED : MFS_UNCHECKED;
SetMenuItemInfo (GUI.hMenu, ID_CHANNELS_CHANNEL8, FALSE, &mii);
mii.fState = GUI.BackgroundInput ? MFS_CHECKED : MFS_UNCHECKED;
SetMenuItemInfo (GUI.hMenu, ID_EMULATION_BACKGROUNDINPUT, FALSE, &mii);
UINT validFlag;
enum controllers controller[2];
int8 ids[4];

View File

@ -353,7 +353,7 @@ struct sGUI {
int ControllerOption;
int ValidControllerOptions;
int SoundChannelEnable;
bool BackgroundKeyHotkeys, BackgroundKeyGamekeys;
bool BackgroundInput;
bool JoystickHotkeys;
bool MovieClearSRAM;
bool MovieStartFromReset;