1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-03 11:50:27 +00:00

Merge pull request #111192 from Nintorch/fix-joy-weird-presses

Fix invalid reported joypad presses
This commit is contained in:
Rémi Verschelde
2025-10-07 14:34:05 +02:00

View File

@@ -232,6 +232,12 @@ void JoypadSDL::process_events() {
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
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(
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