1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Add joystick button index boundary check. Increase max. button number to 128 (max. buttons supported by DirectInput).

(cherry picked from commit 61ea8f8337)
This commit is contained in:
bruvzg
2022-01-10 13:43:44 +02:00
committed by Rémi Verschelde
parent e1f96d5ee8
commit 6eac65d4fe
3 changed files with 8 additions and 4 deletions

View File

@@ -775,7 +775,8 @@ InputDefault::InputDefault() {
void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {
_THREAD_SAFE_METHOD_;
Joypad &joy = joy_names[p_device];
//printf("got button %i, mapping is %i\n", p_button, joy.mapping);
ERR_FAIL_INDEX(p_button, JOY_BUTTON_MAX);
if (joy.last_buttons[p_button] == p_pressed) {
return;
}