Input: only check joystick input if a joystick actually exists

This commit is contained in:
Arisotura 2024-04-12 20:02:16 +02:00
parent d99c571f94
commit 8feeee6103
1 changed files with 12 additions and 6 deletions

View File

@ -209,16 +209,22 @@ void Process()
} }
JoyInputMask = 0xFFF; JoyInputMask = 0xFFF;
for (int i = 0; i < 12; i++) if (Joystick)
if (JoystickButtonDown(Config::JoyMapping[i])) {
JoyInputMask &= ~(1<<i); for (int i = 0; i < 12; i++)
if (JoystickButtonDown(Config::JoyMapping[i]))
JoyInputMask &= ~(1 << i);
}
InputMask = KeyInputMask & JoyInputMask; InputMask = KeyInputMask & JoyInputMask;
JoyHotkeyMask = 0; JoyHotkeyMask = 0;
for (int i = 0; i < HK_MAX; i++) if (Joystick)
if (JoystickButtonDown(Config::HKJoyMapping[i])) {
JoyHotkeyMask |= (1<<i); for (int i = 0; i < HK_MAX; i++)
if (JoystickButtonDown(Config::HKJoyMapping[i]))
JoyHotkeyMask |= (1 << i);
}
HotkeyMask = KeyHotkeyMask | JoyHotkeyMask; HotkeyMask = KeyHotkeyMask | JoyHotkeyMask;
HotkeyPress = HotkeyMask & ~LastHotkeyMask; HotkeyPress = HotkeyMask & ~LastHotkeyMask;