From 20f2b71e214737e7065e4095050ed85c94a5dd7d Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Wed, 18 Nov 2020 09:44:25 +0000 Subject: [PATCH] Update joy button and stick names, enums and documentation --- core/core_constants.cpp | 41 +--------- core/input/input.cpp | 106 +++----------------------- core/input/input.h | 5 -- core/input/input_event.h | 57 ++------------ doc/classes/@GlobalScope.xml | 141 ++++++----------------------------- editor/input_map_editor.cpp | 54 +++++++------- 6 files changed, 68 insertions(+), 336 deletions(-) diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 4229436e843..64bfff1c589 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -409,7 +409,7 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2); // Joypad buttons - BIND_CORE_ENUM_CONSTANT(JOY_INVALID_BUTTON); + BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_INVALID); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_A); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_B); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_X); @@ -425,51 +425,18 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_DOWN); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_LEFT); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_RIGHT); - BIND_CORE_ENUM_CONSTANT(JOY_SDL_BUTTONS); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_X); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_CROSS); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_CIRCLE); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_SQUARE); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_TRIANGLE); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_SELECT); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_START); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_PS); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_L1); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_R1); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_L3); - BIND_CORE_ENUM_CONSTANT(JOY_SONY_R3); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_A); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_B); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_X); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_Y); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_BACK); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_START); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_HOME); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_LS); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_RS); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_LB); - BIND_CORE_ENUM_CONSTANT(JOY_XBOX_RB); + BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_SDL_MAX); BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_MAX); // Joypad axes - BIND_CORE_ENUM_CONSTANT(JOY_INVALID_AXIS); + BIND_CORE_ENUM_CONSTANT(JOY_AXIS_INVALID); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_LEFT_X); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_LEFT_Y); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_RIGHT_X); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_RIGHT_Y); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_TRIGGER_LEFT); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_TRIGGER_RIGHT); - BIND_CORE_ENUM_CONSTANT(JOY_SDL_AXES); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_0_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_0_Y); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_1_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_1_Y); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_2_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_2_Y); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_3_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_3_Y); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_4_X); - BIND_CORE_ENUM_CONSTANT(JOY_AXIS_4_Y); + BIND_CORE_ENUM_CONSTANT(JOY_AXIS_SDL_MAX); BIND_CORE_ENUM_CONSTANT(JOY_AXIS_MAX); // midi diff --git a/core/input/input.cpp b/core/input/input.cpp index aa64ac09a73..00a7e63a731 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -39,7 +39,7 @@ #include "editor/editor_settings.h" #endif -static const char *_joy_buttons[JOY_SDL_BUTTONS + 1] = { +static const char *_joy_buttons[JOY_BUTTON_SDL_MAX] = { "a", "b", "x", @@ -55,69 +55,15 @@ static const char *_joy_buttons[JOY_SDL_BUTTONS + 1] = { "dpdown", "dpleft", "dpright", - nullptr }; -static const char *_joy_button_names[JOY_BUTTON_MAX] = { - "Face Bottom", - "Face Right", - "Face Left", - "Face Top", - "Select", - "Guide", - "Start", - "Left Stick", - "Right Stick", - "Left Shoulder", - "Right Shoulder", - "D-Pad Up", - "D-Pad Down", - "D-Pad Left", - "D-Pad Right", - "Button 15", - "Button 16", - "Button 17", - "Button 18", - "Button 19", - "Button 20", - "Button 21", - "Button 22", - "Button 23", - "Button 24", - "Button 25", - "Button 26", - "Button 27", - "Button 28", - "Button 29", - "Button 30", - "Button 31", - "Button 32", - "Button 33", - "Button 34", - "Button 35" -}; - -static const char *_joy_axes[JOY_SDL_AXES + 1] = { +static const char *_joy_axes[JOY_AXIS_SDL_MAX] = { "leftx", "lefty", "rightx", "righty", "lefttrigger", "righttrigger", - nullptr -}; - -static const char *_joy_axis_names[JOY_AXIS_MAX] = { - "Left Stick X", - "Left Stick Y", - "Right Stick X", - "Right Stick Y", - "Left Trigger", - "Right Trigger", - "Joystick 3 Stick X", - "Joystick 3 Stick Y", - "Joystick 4 Stick X", - "Joystick 4 Stick Y" }; Input *Input::singleton = nullptr; @@ -162,10 +108,6 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("get_connected_joypads"), &Input::get_connected_joypads); ClassDB::bind_method(D_METHOD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); ClassDB::bind_method(D_METHOD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); - ClassDB::bind_method(D_METHOD("get_joy_button_string", "button_index"), &Input::get_joy_button_string); - ClassDB::bind_method(D_METHOD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string); - ClassDB::bind_method(D_METHOD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string); - ClassDB::bind_method(D_METHOD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string); ClassDB::bind_method(D_METHOD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); ClassDB::bind_method(D_METHOD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); ClassDB::bind_method(D_METHOD("vibrate_handheld", "duration_ms"), &Input::vibrate_handheld, DEFVAL(500)); @@ -1226,21 +1168,21 @@ void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, int p_hat, J } JoyButtonList Input::_get_output_button(String output) { - for (int i = 0; _joy_buttons[i]; i++) { + for (int i = 0; i < JOY_BUTTON_SDL_MAX; i++) { if (output == _joy_buttons[i]) { return JoyButtonList(i); } } - return JoyButtonList::JOY_INVALID_BUTTON; + return JoyButtonList::JOY_BUTTON_INVALID; } JoyAxisList Input::_get_output_axis(String output) { - for (int i = 0; _joy_axes[i]; i++) { + for (int i = 0; i < JOY_AXIS_SDL_MAX; i++) { if (output == _joy_axes[i]) { return JoyAxisList(i); } } - return JoyAxisList::JOY_INVALID_AXIS; + return JoyAxisList::JOY_AXIS_INVALID; } void Input::parse_mapping(String p_mapping) { @@ -1300,16 +1242,16 @@ void Input::parse_mapping(String p_mapping) { JoyButtonList output_button = _get_output_button(output); JoyAxisList output_axis = _get_output_axis(output); - ERR_CONTINUE_MSG(output_button == JOY_INVALID_BUTTON && output_axis == JOY_INVALID_AXIS, + ERR_CONTINUE_MSG(output_button == JOY_BUTTON_INVALID && output_axis == JOY_AXIS_INVALID, String(entry[idx] + "\nUnrecognised output string: " + output)); - ERR_CONTINUE_MSG(output_button != JOY_INVALID_BUTTON && output_axis != JOY_INVALID_AXIS, + ERR_CONTINUE_MSG(output_button != JOY_BUTTON_INVALID && output_axis != JOY_AXIS_INVALID, String("BUG: Output string matched both button and axis: " + output)); JoyBinding binding; - if (output_button != JOY_INVALID_BUTTON) { + if (output_button != JOY_BUTTON_INVALID) { binding.outputType = TYPE_BUTTON; binding.output.button = output_button; - } else if (output_axis != JOY_INVALID_AXIS) { + } else if (output_axis != JOY_AXIS_INVALID) { binding.outputType = TYPE_AXIS; binding.output.axis.axis = output_axis; binding.output.axis.range = output_range; @@ -1401,20 +1343,6 @@ Array Input::get_connected_joypads() { return ret; } -String Input::get_joy_button_string(int p_button) { - ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, "Invalid button"); - return _joy_button_names[p_button]; -} - -int Input::get_joy_button_index_from_string(String p_button) { - for (int i = 0; i < JOY_BUTTON_MAX; i++) { - if (p_button == _joy_button_names[i]) { - return i; - } - } - ERR_FAIL_V(JOY_INVALID_BUTTON); -} - int Input::get_unused_joy_id() { for (int i = 0; i < JOYPADS_MAX; i++) { if (!joy_names.has(i) || !joy_names[i].connected) { @@ -1424,20 +1352,6 @@ int Input::get_unused_joy_id() { return -1; } -String Input::get_joy_axis_string(int p_axis) { - ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, "Invalid axis"); - return _joy_axis_names[p_axis]; -} - -int Input::get_joy_axis_index_from_string(String p_axis) { - for (int i = 0; i < JOY_AXIS_MAX; i++) { - if (p_axis == _joy_axis_names[i]) { - return i; - } - } - ERR_FAIL_V(JOY_INVALID_AXIS); -} - Input::Input() { singleton = this; diff --git a/core/input/input.h b/core/input/input.h index 46e9d24bf21..1b2df49ac0e 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -330,11 +330,6 @@ public: void add_joy_mapping(String p_mapping, bool p_update_existing = false); void remove_joy_mapping(String p_guid); - String get_joy_button_string(int p_button); - String get_joy_axis_string(int p_axis); - int get_joy_axis_index_from_string(String p_axis); - int get_joy_button_index_from_string(String p_button); - int get_unused_joy_id(); bool is_joy_known(int p_device); diff --git a/core/input/input_event.h b/core/input/input_event.h index dc86bddf8ee..b0e3b3cd95f 100644 --- a/core/input/input_event.h +++ b/core/input/input_event.h @@ -60,9 +60,7 @@ enum ButtonList { }; enum JoyButtonList { - JOY_INVALID_BUTTON = -1, - - // SDL Buttons + JOY_BUTTON_INVALID = -1, JOY_BUTTON_A = 0, JOY_BUTTON_B = 1, JOY_BUTTON_X = 2, @@ -78,63 +76,20 @@ enum JoyButtonList { JOY_BUTTON_DPAD_DOWN = 12, JOY_BUTTON_DPAD_LEFT = 13, JOY_BUTTON_DPAD_RIGHT = 14, - JOY_SDL_BUTTONS = 15, - - // Sony Buttons - JOY_SONY_X = JOY_BUTTON_A, - JOY_SONY_CROSS = JOY_BUTTON_A, - JOY_SONY_CIRCLE = JOY_BUTTON_B, - JOY_SONY_SQUARE = JOY_BUTTON_X, - JOY_SONY_TRIANGLE = JOY_BUTTON_Y, - JOY_SONY_SELECT = JOY_BUTTON_BACK, - JOY_SONY_START = JOY_BUTTON_START, - JOY_SONY_PS = JOY_BUTTON_GUIDE, - JOY_SONY_L1 = JOY_BUTTON_LEFT_SHOULDER, - JOY_SONY_R1 = JOY_BUTTON_RIGHT_SHOULDER, - JOY_SONY_L3 = JOY_BUTTON_LEFT_STICK, - JOY_SONY_R3 = JOY_BUTTON_RIGHT_STICK, - - // Xbox Buttons - JOY_XBOX_A = JOY_BUTTON_A, - JOY_XBOX_B = JOY_BUTTON_B, - JOY_XBOX_X = JOY_BUTTON_X, - JOY_XBOX_Y = JOY_BUTTON_Y, - JOY_XBOX_BACK = JOY_BUTTON_BACK, - JOY_XBOX_START = JOY_BUTTON_START, - JOY_XBOX_HOME = JOY_BUTTON_GUIDE, - JOY_XBOX_LS = JOY_BUTTON_LEFT_STICK, - JOY_XBOX_RS = JOY_BUTTON_RIGHT_STICK, - JOY_XBOX_LB = JOY_BUTTON_LEFT_SHOULDER, - JOY_XBOX_RB = JOY_BUTTON_RIGHT_SHOULDER, - - JOY_BUTTON_MAX = 36 // Apparently Android supports up to 36 buttons. + JOY_BUTTON_SDL_MAX = 15, + JOY_BUTTON_MAX = 36, // Android supports up to 36 buttons. }; enum JoyAxisList { - JOY_INVALID_AXIS = -1, - - // SDL Axes + JOY_AXIS_INVALID = -1, JOY_AXIS_LEFT_X = 0, JOY_AXIS_LEFT_Y = 1, JOY_AXIS_RIGHT_X = 2, JOY_AXIS_RIGHT_Y = 3, JOY_AXIS_TRIGGER_LEFT = 4, JOY_AXIS_TRIGGER_RIGHT = 5, - JOY_SDL_AXES = 6, - - // Joystick axes. - JOY_AXIS_0_X = 0, - JOY_AXIS_0_Y = 1, - JOY_AXIS_1_X = 2, - JOY_AXIS_1_Y = 3, - JOY_AXIS_2_X = 4, - JOY_AXIS_2_Y = 5, - JOY_AXIS_3_X = 6, - JOY_AXIS_3_Y = 7, - JOY_AXIS_4_X = 8, - JOY_AXIS_4_Y = 9, - - JOY_AXIS_MAX = 10 // OpenVR supports up to 5 Joysticks making a total of 10 axes. + JOY_AXIS_SDL_MAX = 6, + JOY_AXIS_MAX = 10, // OpenVR supports up to 5 Joysticks making a total of 10 axes. }; enum MidiMessageList { diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index f6b1bb4d7c7..f6b8e0da194 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2093,130 +2093,61 @@ Extra mouse button 2 mask. - + An invalid game controller button. - Game controller SDL button A. + Game controller SDL button A. Corresponds to the bottom action button: Sony Cross, Xbox A, Nintendo B. - Game controller SDL button B. + Game controller SDL button B. Corresponds to the right action button: Sony Circle, Xbox B, Nintendo A. - Game controller SDL button X. + Game controller SDL button X. Corresponds to the left action button: Sony Square, Xbox X, Nintendo Y. - Game controller SDL button Y. + Game controller SDL button Y. Corresponds to the top action button: Sony Triangle, Xbox Y, Nintendo X. - Game controller SDL back button. + Game controller SDL back button. Corresponds to the Sony Select, Xbox Back, Nintendo - button. - Game controller SDL guide button. + Game controller SDL guide button. Corresponds to the Sony PS, Xbox Home button. - Game controller SDL start button. + Game controller SDL start button. Corresponds to the Nintendo + button. - Game controller SDL left stick button. + Game controller SDL left stick button. Corresponds to the Sony L3, Xbox L/LS button. - Game controller SDL right stick button. + Game controller SDL right stick button. Corresponds to the Sony R3, Xbox R/RS button. - Game controller SDL left shoulder button. + Game controller SDL left shoulder button. Corresponds to the Sony L1, Xbox LB button. - Game controller SDL right shoulder button. + Game controller SDL right shoulder button. Corresponds to the Sony R1, Xbox RB button. - Game controller SDL D-pad up button. + Game controller D-pad up button. - Game controller SDL D-pad down button. + Game controller D-pad down button. - Game controller SDL D-pad left button. + Game controller D-pad left button. - Game controller SDL D-pad right button. + Game controller D-pad right button. - + The number of SDL game controller buttons. - - Sony DualShock controller X button maps to SDL button A. - - - Sony DualShock controller cross button maps to SDL button A. - - - Sony DualShock controller circle button maps to SDL button B. - - - Sony DualShock controller square button maps to SDL button X. - - - Sony DualShock controller triangle button maps to SDL button Y. - - - Sony DualShock controller select button maps to SDL back button. - - - Sony DualShock controller start button maps to SDL start button. - - - Sony DualShock controller PS button maps to SDL guide button. - - - Sony DualShock controller L1 button maps to SDL left shoulder button. - - - Sony DualShock controller R1 button maps to SDL right shoulder button. - - - Sony DualShock controller L3 button maps to SDL left stick button. - - - Sony DualShock controller R3 button maps to SDL right stick button. - - - Xbox game controller A button maps to SDL button A. - - - Xbox game controller B button maps to SDL button B. - - - Xbox game controller X button maps to SDL button X. - - - Xbox game controller Y button maps to SDL button Y. - - - Xbox game controller back button maps to SDL back button. - - - Xbox game controller start button maps to SDL start button. - - - Xbox game controller home button maps to SDL guide button. - - - Xbox game controller left stick button maps to SDL left stick button. - - - Xbox game controller right stick button maps to SDL right stick button. - - - Xbox game controller left bumper button maps to SDL left shoulder button. - - - Xbox game controller right bumper button maps to SDL right shoulder button. - - The maximum number of game controller buttons. + The maximum number of game controller buttons: Android supports up to 36 buttons. - + An invalid game controller axis. @@ -2237,41 +2168,11 @@ Game controller right trigger axis. - + The number of SDL game controller axes. - - Game controller joystick 0 x-axis. - - - Game controller joystick 0 y-axis. - - - Game controller joystick 1 x-axis. - - - Game controller joystick 1 y-axis. - - - Game controller joystick 2 x-axis. - - - Game controller joystick 2 y-axis. - - - Game controller joystick 3 x-axis. - - - Game controller joystick 3 y-axis. - - - Game controller joystick 4 x-axis. - - - Game controller joystick 4 y-axis. - - The maximum number of game controller axes. + The maximum number of game controller axes: OpenVR supports up to 5 Joysticks making a total of 10 axes. MIDI note OFF message. diff --git a/editor/input_map_editor.cpp b/editor/input_map_editor.cpp index c67e16d3719..5b6d8500964 100644 --- a/editor/input_map_editor.cpp +++ b/editor/input_map_editor.cpp @@ -35,37 +35,37 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" -static const char *_button_descriptions[JOY_SDL_BUTTONS] = { - TTRC("Face Bottom, DualShock Cross, Xbox A, Nintendo B"), - TTRC("Face Right, DualShock Circle, Xbox B, Nintendo A"), - TTRC("Face Left, DualShock Square, Xbox X, Nintendo Y"), - TTRC("Face Top, DualShock Triangle, Xbox Y, Nintendo X"), - TTRC("DualShock Select, Xbox Back, Nintendo -"), - TTRC("Home, DualShock PS, Guide"), +static const char *_button_descriptions[JOY_BUTTON_SDL_MAX] = { + TTRC("Bottom Action, Sony Cross, Xbox A, Nintendo B"), + TTRC("Right Action, Sony Circle, Xbox B, Nintendo A"), + TTRC("Left Action, Sony Square, Xbox X, Nintendo Y"), + TTRC("Top Action, Sony Triangle, Xbox Y, Nintendo X"), + TTRC("Back, Sony Select, Xbox Back, Nintendo -"), + TTRC("Guide, Sony PS, Xbox Home"), TTRC("Start, Nintendo +"), - TTRC("Left Stick, DualShock L3, Xbox L/LS"), - TTRC("Right Stick, DualShock R3, Xbox R/RS"), - TTRC("Left Shoulder, DualShock L1, Xbox LB"), - TTRC("Right Shoulder, DualShock R1, Xbox RB"), - TTRC("D-Pad Up"), - TTRC("D-Pad Down"), - TTRC("D-Pad Left"), - TTRC("D-Pad Right") + TTRC("Left Stick, Sony L3, Xbox L/LS"), + TTRC("Right Stick, Sony R3, Xbox R/RS"), + TTRC("Left Shoulder, Sony L1, Xbox LB"), + TTRC("Right Shoulder, Sony R1, Xbox RB"), + TTRC("D-pad Up"), + TTRC("D-pad Down"), + TTRC("D-pad Left"), + TTRC("D-pad Right"), }; static const char *_axis_descriptions[JOY_AXIS_MAX * 2] = { - TTRC("Left Stick Left"), - TTRC("Left Stick Right"), - TTRC("Left Stick Up"), - TTRC("Left Stick Down"), - TTRC("Right Stick Left"), - TTRC("Right Stick Right"), - TTRC("Right Stick Up"), - TTRC("Right Stick Down"), + TTRC("Left Stick Left, Joystick 0 Left"), + TTRC("Left Stick Right, Joystick 0 Right"), + TTRC("Left Stick Up, Joystick 0 Up"), + TTRC("Left Stick Down, Joystick 0 Down"), + TTRC("Right Stick Left, Joystick 1 Left"), + TTRC("Right Stick Right, Joystick 1 Right"), + TTRC("Right Stick Up, Joystick 1 Up"), + TTRC("Right Stick Down, Joystick 1 Down"), TTRC("Joystick 2 Left"), - TTRC("Joystick 2 Right, Left Trigger, L2, LT"), + TTRC("Left Trigger, L2, LT, Joystick 2 Right"), TTRC("Joystick 2 Up"), - TTRC("Joystick 2 Down, Right Trigger, R2, RT"), + TTRC("Right Trigger, R2, RT, Joystick 2 Down"), TTRC("Joystick 3 Left"), TTRC("Joystick 3 Right"), TTRC("Joystick 3 Up"), @@ -503,7 +503,7 @@ void InputMapEditor::_add_item(int p_item, Ref p_exiting_event) { device_index->clear(); for (int i = 0; i < JOY_BUTTON_MAX; i++) { String desc = TTR("Button") + " " + itos(i); - if (i < JOY_SDL_BUTTONS) { + if (i < JOY_BUTTON_SDL_MAX) { desc += " (" + TTR(_button_descriptions[i]) + ")"; } device_index->add_item(desc); @@ -717,7 +717,7 @@ void InputMapEditor::_update_actions() { const int idx = jb->get_button_index(); String str = _get_device_string(jb->get_device()) + ", " + TTR("Button") + " " + itos(idx); - if (idx >= 0 && idx < JOY_SDL_BUTTONS) { + if (idx >= 0 && idx < JOY_BUTTON_SDL_MAX) { str += String() + " (" + TTR(_button_descriptions[jb->get_button_index()]) + ")"; }