diff --git a/core/global_constants.cpp b/core/global_constants.cpp index b1b804eacf9..73410b4ea39 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -413,6 +413,7 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_19); BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_20); BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_21); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_22); BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_MAX); BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CIRCLE); @@ -446,6 +447,7 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_DOWN); BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_LEFT); BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_RIGHT); + BIND_GLOBAL_ENUM_CONSTANT(JOY_GUIDE); BIND_GLOBAL_ENUM_CONSTANT(JOY_MISC1); BIND_GLOBAL_ENUM_CONSTANT(JOY_PADDLE1); BIND_GLOBAL_ENUM_CONSTANT(JOY_PADDLE2); diff --git a/core/os/input_event.h b/core/os/input_event.h index 9880a0a9fd5..4ae4933d616 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -84,7 +84,8 @@ enum JoystickList { JOY_BUTTON_19 = 19, JOY_BUTTON_20 = 20, JOY_BUTTON_21 = 21, - JOY_BUTTON_MAX = 22, + JOY_BUTTON_22 = 22, + JOY_BUTTON_MAX = 23, JOY_L = JOY_BUTTON_4, JOY_R = JOY_BUTTON_5, @@ -98,12 +99,13 @@ enum JoystickList { JOY_DPAD_DOWN = JOY_BUTTON_13, JOY_DPAD_LEFT = JOY_BUTTON_14, JOY_DPAD_RIGHT = JOY_BUTTON_15, - JOY_MISC1 = JOY_BUTTON_16, - JOY_PADDLE1 = JOY_BUTTON_17, - JOY_PADDLE2 = JOY_BUTTON_18, - JOY_PADDLE3 = JOY_BUTTON_19, - JOY_PADDLE4 = JOY_BUTTON_20, - JOY_TOUCHPAD = JOY_BUTTON_21, + JOY_GUIDE = JOY_BUTTON_16, + JOY_MISC1 = JOY_BUTTON_17, + JOY_PADDLE1 = JOY_BUTTON_18, + JOY_PADDLE2 = JOY_BUTTON_19, + JOY_PADDLE3 = JOY_BUTTON_20, + JOY_PADDLE4 = JOY_BUTTON_21, + JOY_TOUCHPAD = JOY_BUTTON_22, JOY_SONY_CIRCLE = JOY_BUTTON_1, JOY_SONY_X = JOY_BUTTON_0, diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index f73d6afc58b..58256a3a723 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1003,7 +1003,10 @@ Gamepad button 21. - + + Gamepad button 22. + + Represents the maximum number of joystick buttons supported. @@ -1081,22 +1084,25 @@ Gamepad DPad right. - + + Gamepad SDL guide button. + + Gamepad SDL miscellaneous button. - + Gamepad SDL paddle 1 button. - + Gamepad SDL paddle 2 button. - + Gamepad SDL paddle 3 button. - + Gamepad SDL paddle 4 button. - + Gamepad SDL touchpad button. diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 63d3eaf748c..4d03a2a0035 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -60,6 +60,7 @@ static const char *_button_names[JOY_BUTTON_MAX] = { "D-Pad Down", "D-Pad Left", "D-Pad Right", + "Home, DualShock PS, Guide", "Xbox Share, PS5 Microphone, Nintendo Capture", "Xbox Paddle 1", "Xbox Paddle 2", diff --git a/main/input_default.cpp b/main/input_default.cpp index 79056221808..ba5c02bce0e 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -1254,6 +1254,7 @@ static const char *_buttons[JOY_BUTTON_MAX] = { "DPAD Down", "DPAD Left", "DPAD Right", + "Guide", "Misc 1", "Paddle 1", "Paddle 2", diff --git a/main/input_default.h b/main/input_default.h index ace0a164c79..281e30efeff 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -81,7 +81,7 @@ class InputDefault : public Input { StringName name; StringName uid; bool connected; - bool last_buttons[JOY_BUTTON_MAX + 13]; //apparently SDL specifies 35 possible buttons on android + bool last_buttons[JOY_BUTTON_MAX + 12]; //apparently SDL specifies 35 possible buttons on android float last_axis[JOY_AXIS_MAX]; int last_hat; int mapping; @@ -91,7 +91,7 @@ class InputDefault : public Input { for (int i = 0; i < JOY_AXIS_MAX; i++) { last_axis[i] = 0.0f; } - for (int i = 0; i < JOY_BUTTON_MAX + 13; i++) { + for (int i = 0; i < JOY_BUTTON_MAX + 12; i++) { last_buttons[i] = false; } connected = false;