Skip to content

Commit

Permalink
Input: only check joystick input if a joystick actually exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed Apr 12, 2024
1 parent d99c571 commit 8feeee6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/frontend/qt_sdl/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,22 @@ void Process()
}

JoyInputMask = 0xFFF;
for (int i = 0; i < 12; i++)
if (JoystickButtonDown(Config::JoyMapping[i]))
JoyInputMask &= ~(1<<i);
if (Joystick)
{
for (int i = 0; i < 12; i++)
if (JoystickButtonDown(Config::JoyMapping[i]))
JoyInputMask &= ~(1 << i);
}

InputMask = KeyInputMask & JoyInputMask;

JoyHotkeyMask = 0;
for (int i = 0; i < HK_MAX; i++)
if (JoystickButtonDown(Config::HKJoyMapping[i]))
JoyHotkeyMask |= (1<<i);
if (Joystick)
{
for (int i = 0; i < HK_MAX; i++)
if (JoystickButtonDown(Config::HKJoyMapping[i]))
JoyHotkeyMask |= (1 << i);
}

HotkeyMask = KeyHotkeyMask | JoyHotkeyMask;
HotkeyPress = HotkeyMask & ~LastHotkeyMask;
Expand Down

0 comments on commit 8feeee6

Please sign in to comment.