diff options
author | Arisotura <thetotalworm@gmail.com> | 2024-04-12 20:02:16 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2024-04-12 20:02:16 +0200 |
commit | 8feeee61037b23fd0cb22d2f035f6ebfa0c76e32 (patch) | |
tree | f4fd99fdf2c4412440928e2c97f722c0434bc27a | |
parent | d99c571f947ac69890fc60c4525122d1394c7338 (diff) |
Input: only check joystick input if a joystick actually exists
-rw-r--r-- | src/frontend/qt_sdl/Input.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/frontend/qt_sdl/Input.cpp b/src/frontend/qt_sdl/Input.cpp index 27c42e9..7ebd7e2 100644 --- a/src/frontend/qt_sdl/Input.cpp +++ b/src/frontend/qt_sdl/Input.cpp @@ -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; |