mirror of https://github.com/snes9xgit/snes9x.git
Win32: fix joypad hotkeys on joypads > 0
This commit is contained in:
parent
56a4ce5ef8
commit
9ca3bcce39
|
@ -2784,28 +2784,32 @@ VOID CALLBACK HotkeyTimer( UINT idEvent, UINT uMsg, DWORD dwUser, DWORD dw1, DWO
|
|||
if(GUI.JoystickHotkeys)
|
||||
{
|
||||
static int counter = 0;
|
||||
static uint32 joyState [256];
|
||||
for(int i = 0 ; i < 255 ; i++)
|
||||
{
|
||||
if(counter%2 && !joyState[i])
|
||||
continue;
|
||||
static uint32 joyState[6][53];
|
||||
for(int j = 0 ; j < 6 ; j++)
|
||||
{
|
||||
for(int i = 0 ; i < 53 ; i++)
|
||||
{
|
||||
if(counter%2 && !joyState[j][i])
|
||||
continue;
|
||||
|
||||
bool active = !S9xGetState(0x8000|i);
|
||||
if(active)
|
||||
{
|
||||
if(joyState[i] < ULONG_MAX) // 0xffffffffUL
|
||||
joyState[i]++;
|
||||
if(joyState[i] == 1 || joyState[i] >= 12)
|
||||
PostMessage(GUI.hWnd, WM_CUSTKEYDOWN, (WPARAM)(0x8000|i),(LPARAM)(NULL));
|
||||
}
|
||||
else
|
||||
if(joyState[i])
|
||||
{
|
||||
joyState[i] = 0;
|
||||
PostMessage(GUI.hWnd, WM_CUSTKEYUP, (WPARAM)(0x8000|i),(LPARAM)(NULL));
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
WPARAM wp = (WPARAM)(0x8000 | (j << 8) | i);
|
||||
bool active = !S9xGetState(wp);
|
||||
if(active)
|
||||
{
|
||||
if(joyState[j][i] < ULONG_MAX) // 0xffffffffUL
|
||||
joyState[j][i]++;
|
||||
if(joyState[j][i] == 1 || joyState[j][i] >= 12)
|
||||
PostMessage(GUI.hWnd, WM_CUSTKEYDOWN, wp,(LPARAM)(NULL));
|
||||
}
|
||||
else
|
||||
if(joyState[j][i])
|
||||
{
|
||||
joyState[j][i] = 0;
|
||||
PostMessage(GUI.hWnd, WM_CUSTKEYUP, wp,(LPARAM)(NULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
if(GUI.BackgroundInput && !GUI.InactivePause)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue