Input: Add missing MISC2-MISC6 gamepad button constants

The MISC2-MISC6 button strings are recognized by SDL3 but were not
mapped in Godot's JoyButton enum, causing 'Unrecognized output string'
warnings for controllers that use these buttons.

This adds:
- JoyButton::MISC2-MISC6 enum values (21-25)
- 'misc2'-'misc6' string mappings in _joy_buttons array
- GDScript bindings for JOY_BUTTON_MISC2 through JOY_BUTTON_MISC6
- Documentation entries in @GlobalScope.xml
- Updates JoyButton::SDL_MAX from 21 to 26
This commit is contained in:
CHIKI Badreddine 2026-02-17 21:12:23 +00:00
parent bf95b62586
commit bea703ae12
4 changed files with 32 additions and 2 deletions

View file

@ -549,6 +549,11 @@ void register_global_constants() {
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE3);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE4);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, TOUCHPAD);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC2);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC3);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC4);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC5);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC6);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, SDL_MAX);
BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MAX);

View file

@ -66,6 +66,11 @@ static const char *_joy_buttons[(size_t)JoyButton::SDL_MAX] = {
"paddle3",
"paddle4",
"touchpad",
"misc2",
"misc3",
"misc4",
"misc5",
"misc6",
};
static const char *_joy_axes[(size_t)JoyAxis::SDL_MAX] = {

View file

@ -100,7 +100,12 @@ enum class JoyButton {
PADDLE3 = 18,
PADDLE4 = 19,
TOUCHPAD = 20,
SDL_MAX = 21,
MISC2 = 21,
MISC3 = 22,
MISC4 = 23,
MISC5 = 24,
MISC6 = 25,
SDL_MAX = 26,
MAX = 128, // Android supports up to 36 buttons. DirectInput supports up to 128 buttons.
};

View file

@ -2514,7 +2514,22 @@
<constant name="JOY_BUTTON_TOUCHPAD" value="20" enum="JoyButton">
Game controller SDL touchpad button.
</constant>
<constant name="JOY_BUTTON_SDL_MAX" value="21" enum="JoyButton">
<constant name="JOY_BUTTON_MISC2" value="21" enum="JoyButton">
Game controller SDL miscellaneous button. Used by Nintendo Switch 2 Pro Controller and Horipad Steam controllers.
</constant>
<constant name="JOY_BUTTON_MISC3" value="22" enum="JoyButton">
Game controller SDL miscellaneous button.
</constant>
<constant name="JOY_BUTTON_MISC4" value="23" enum="JoyButton">
Game controller SDL miscellaneous button.
</constant>
<constant name="JOY_BUTTON_MISC5" value="24" enum="JoyButton">
Game controller SDL miscellaneous button.
</constant>
<constant name="JOY_BUTTON_MISC6" value="25" enum="JoyButton">
Game controller SDL miscellaneous button.
</constant>
<constant name="JOY_BUTTON_SDL_MAX" value="26" enum="JoyButton">
The number of SDL game controller buttons.
</constant>
<constant name="JOY_BUTTON_MAX" value="128" enum="JoyButton">