aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2024-04-12 20:02:16 +0200
committerArisotura <thetotalworm@gmail.com>2024-04-12 20:02:16 +0200
commit8feeee61037b23fd0cb22d2f035f6ebfa0c76e32 (patch)
treef4fd99fdf2c4412440928e2c97f722c0434bc27a /src
parentd99c571f947ac69890fc60c4525122d1394c7338 (diff)
Input: only check joystick input if a joystick actually exists
Diffstat (limited to 'src')
-rw-r--r--src/frontend/qt_sdl/Input.cpp18
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;