@@ -9021,7 +9021,7 @@ static bool setting_append_list_input_player_options(
90219021 */
90229022 static char buffer[MAX_USERS][13+2+1];
90239023 static char group_label[MAX_USERS][255];
9024- unsigned bindIndex, j ;
9024+ unsigned logicalIndex, bindIndex ;
90259025 rarch_setting_group_info_t group_info;
90269026 rarch_setting_group_info_t subgroup_info;
90279027 settings_t *settings = config_get_ptr();
@@ -9254,18 +9254,18 @@ static bool setting_append_list_input_player_options(
92549254 {
92559255 const char *value_na =
92569256 msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE);
9257- for (j = 0; j < RARCH_BIND_LIST_END; j ++)
9257+ for (bindIndex = 0; bindIndex < RARCH_BIND_LIST_END; bindIndex ++)
92589258 {
92599259 char label[NAME_MAX_LENGTH];
92609260 char name[NAME_MAX_LENGTH];
9261- bool isExtraKey = (j >= RARCH_BIND_ID_EXTRA_BUTTON_START && j < RARCH_BIND_ID_EXTRA_BUTTON_END);
9261+ bool isExtraKey = (bindIndex >= RARCH_BIND_ID_EXTRA_BUTTON_START && bindIndex <= RARCH_BIND_ID_EXTRA_BUTTON_END);
92629262 size_t _len = 0;
92639263
9264- bindIndex = (j < RARCH_ANALOG_BIND_LIST_END)
9265- ? input_config_bind_order[j ]
9266- : j ;
9264+ logicalIndex = (bindIndex < RARCH_ANALOG_BIND_LIST_END)
9265+ ? input_config_bind_order[bindIndex ]
9266+ : bindIndex ;
92679267
9268- if (!isExtraKey && input_config_bind_map_get_meta(bindIndex ))
9268+ if (!isExtraKey && input_config_bind_map_get_meta(logicalIndex ))
92699269 continue;
92709270
92719271 name[0] = '\0';
@@ -9281,44 +9281,64 @@ static bool setting_append_list_input_player_options(
92819281
92829282 if (
92839283 settings->bools.input_descriptor_label_show
9284- && (bindIndex < RARCH_FIRST_META_KEY)
9284+ && (isExtraKey || logicalIndex < RARCH_FIRST_META_KEY)
92859285 && core_has_set_input_descriptor()
9286- && (bindIndex != RARCH_TURBO_ENABLE)
9286+ && (logicalIndex != RARCH_TURBO_ENABLE)
92879287 )
92889288 {
9289- if (sys_info->input_desc_btn[user][bindIndex])
9289+ /* Remap the binding key to extra key accordingly. */
9290+ if (isExtraKey)
9291+ {
9292+ logicalIndex = RETRO_DEVICE_ID_JOYPAD_MAX_BUTTONS + (bindIndex - RARCH_BIND_ID_EXTRA_BUTTON_START);
9293+
9294+ /* Debug. */
9295+ RARCH_LOG("Reassigned bindIndex %d to logicalIndex %d\n",
9296+ bindIndex, logicalIndex);
9297+ }
9298+
9299+ /* Debug. */
9300+ if (sys_info->input_desc_btn[user][logicalIndex])
9301+ RARCH_LOG("Desc of bind %d/logical %d is %s\n",
9302+ bindIndex, logicalIndex,
9303+ sys_info->input_desc_btn[user][logicalIndex]);
9304+
9305+ if (sys_info->input_desc_btn[user][logicalIndex])
92909306 strlcpy(label + _len,
9291- sys_info->input_desc_btn[user][bindIndex ],
9307+ sys_info->input_desc_btn[user][logicalIndex ],
92929308 sizeof(label) - _len);
92939309 else
92949310 {
92959311 snprintf(label, sizeof(label), "%s (%s)",
9296- input_config_bind_map_get_desc(bindIndex ),
9312+ input_config_bind_map_get_desc(logicalIndex ),
92979313 value_na);
92989314
92999315 if (settings->bools.input_descriptor_hide_unbound)
93009316 continue;
93019317 }
93029318 }
9303- else
9319+ else if (!isExtraKey)
93049320 strlcpy(label + _len,
9305- input_config_bind_map_get_desc(bindIndex ),
9321+ input_config_bind_map_get_desc(logicalIndex ),
93069322 sizeof(label) - _len);
93079323
9308- snprintf(name, sizeof(name), "p%u_%s", user + 1, input_config_bind_map_get_base(bindIndex));
9324+ /* Not a valid controller key. */
9325+ else
9326+ continue;
9327+
9328+ snprintf(name, sizeof(name), "p%u_%s", user + 1, input_config_bind_map_get_base(logicalIndex));
93099329
93109330 CONFIG_BIND_ALT(
93119331 list, list_info,
9312- &input_config_binds[user][bindIndex ],
9332+ &input_config_binds[user][logicalIndex ],
93139333 user + 1,
93149334 user,
93159335 strdup(name),
93169336 strdup(label),
9317- &defaults[bindIndex ],
9337+ &defaults[logicalIndex ],
93189338 &group_info,
93199339 &subgroup_info,
93209340 parent_group);
9321- (*list)[list_info->index - 1].bind_type = bindIndex + MENU_SETTINGS_BIND_BEGIN;
9341+ (*list)[list_info->index - 1].bind_type = logicalIndex + MENU_SETTINGS_BIND_BEGIN;
93229342 }
93239343 }
93249344
0 commit comments