mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Fix invalid reported joypad presses
(cherry picked from commit 4a3bf069a6
)
This commit is contained in:
parent
b891558050
commit
1d50fc26b4
1 changed files with 6 additions and 0 deletions
|
@ -234,6 +234,12 @@ void JoypadSDL::process_events() {
|
||||||
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
|
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
|
||||||
SKIP_EVENT_FOR_GAMEPAD;
|
SKIP_EVENT_FOR_GAMEPAD;
|
||||||
|
|
||||||
|
// Some devices report pressing buttons with indices like 232+, 241+, etc. that are not valid,
|
||||||
|
// so we ignore them here.
|
||||||
|
if (sdl_event.jbutton.button >= (int)JoyButton::MAX) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Input::get_singleton()->joy_button(
|
Input::get_singleton()->joy_button(
|
||||||
joy_id,
|
joy_id,
|
||||||
static_cast<JoyButton>(sdl_event.jbutton.button), // Godot button constants are intentionally the same as SDL's, so we can just straight up use them
|
static_cast<JoyButton>(sdl_event.jbutton.button), // Godot button constants are intentionally the same as SDL's, so we can just straight up use them
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue