mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-21 00:05:30 +00:00
Collapse User Binds into bigger 'Input Options' category
This commit is contained in:
parent
ad4dfd787c
commit
c4a66acbb6
@ -64,6 +64,11 @@ static int deferred_push_rdb_collection(menu_displaylist_info_t *info)
|
||||
return deferred_push_dlist(info, DISPLAYLIST_PLAYLIST_COLLECTION);
|
||||
}
|
||||
|
||||
static int deferred_user_binds_list(menu_displaylist_info_t *info)
|
||||
{
|
||||
return deferred_push_dlist(info, DISPLAYLIST_USER_BINDS_LIST);
|
||||
}
|
||||
|
||||
static int deferred_push_accounts_list(menu_displaylist_info_t *info)
|
||||
{
|
||||
return deferred_push_dlist(info, DISPLAYLIST_ACCOUNTS_LIST);
|
||||
@ -555,6 +560,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t *
|
||||
{
|
||||
switch (label_hash)
|
||||
{
|
||||
case MENU_LABEL_DEFERRED_USER_BINDS_LIST:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_user_binds_list);
|
||||
break;
|
||||
case MENU_LABEL_DEFERRED_ACCOUNTS_LIST:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_accounts_list);
|
||||
break;
|
||||
|
@ -71,6 +71,12 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
|
||||
switch (action_type)
|
||||
{
|
||||
case ACTION_OK_DL_USER_BINDS_LIST:
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = label;
|
||||
info_label = menu_hash_to_str(MENU_LABEL_DEFERRED_USER_BINDS_LIST);
|
||||
break;
|
||||
case ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE:
|
||||
case ACTION_OK_DL_OPEN_ARCHIVE:
|
||||
if (menu)
|
||||
@ -1548,6 +1554,13 @@ static int action_ok_push_accounts_list(const char *path,
|
||||
ACTION_OK_DL_ACCOUNTS_LIST);
|
||||
}
|
||||
|
||||
static int action_ok_push_user_binds_list(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
return generic_action_ok_displaylist_push(path, label, 0, 0, entry_idx,
|
||||
ACTION_OK_DL_USER_BINDS_LIST);
|
||||
}
|
||||
|
||||
static int action_ok_push_accounts_cheevos_list(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -1750,6 +1763,12 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strstr(elem0, "_input_binds_list"))
|
||||
{
|
||||
BIND_ACTION_OK(cbs, action_ok_push_user_binds_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (menu_setting_get_browser_selection_type(cbs->setting) == ST_DIR)
|
||||
{
|
||||
BIND_ACTION_OK(cbs, action_ok_push_generic_list);
|
||||
|
@ -38,6 +38,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash)
|
||||
return "retro_achievements";
|
||||
case MENU_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST:
|
||||
return "deferred_accounts_cheevos_list";
|
||||
case MENU_LABEL_DEFERRED_USER_BINDS_LIST:
|
||||
return "deferred_user_binds_list";
|
||||
case MENU_LABEL_DEFERRED_ACCOUNTS_LIST:
|
||||
return "deferred_accounts_list";
|
||||
case MENU_LABEL_ACCOUNTS_LIST:
|
||||
|
@ -43,6 +43,7 @@ enum
|
||||
ACTION_OK_DL_DOWNLOADS_DIR,
|
||||
ACTION_OK_DL_ACCOUNTS_LIST,
|
||||
ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST,
|
||||
ACTION_OK_DL_USER_BINDS_LIST,
|
||||
ACTION_OK_DL_CONTENT_LIST,
|
||||
ACTION_OK_DL_REMAP_FILE,
|
||||
ACTION_OK_DL_RECORD_CONFIGFILE,
|
||||
|
@ -2251,6 +2251,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
case DISPLAYLIST_INFORMATION_LIST:
|
||||
case DISPLAYLIST_ADD_CONTENT_LIST:
|
||||
case DISPLAYLIST_LOAD_CONTENT_LIST:
|
||||
case DISPLAYLIST_USER_BINDS_LIST:
|
||||
case DISPLAYLIST_ACCOUNTS_LIST:
|
||||
case DISPLAYLIST_ACCOUNTS_CHEEVOS_LIST:
|
||||
case DISPLAYLIST_OPTIONS:
|
||||
@ -2316,6 +2317,17 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
menu_entries_set_refresh(false);
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_USER_BINDS_LIST:
|
||||
{
|
||||
char lbl[PATH_MAX_LENGTH];
|
||||
snprintf(lbl, sizeof(lbl),
|
||||
"Input User %.1s Binds", info->path);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
lbl, PARSE_NONE);
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_ACCOUNTS_LIST:
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_ACCOUNTS_LIST_END),
|
||||
@ -2428,18 +2440,6 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_SETTINGS), PARSE_ONLY_GROUP);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_HOTKEY_BINDS), PARSE_ONLY_GROUP);
|
||||
{
|
||||
unsigned user;
|
||||
char group_lbl[MAX_USERS][PATH_MAX_LENGTH];
|
||||
|
||||
for (user = 0; user < settings->input.max_users; user++)
|
||||
{
|
||||
snprintf(group_lbl[user], sizeof(group_lbl[user]),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_USER_BINDS), user + 1);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
group_lbl[user], PARSE_ONLY_GROUP);
|
||||
}
|
||||
}
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_CORE_SETTINGS), PARSE_ONLY_GROUP);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
|
@ -34,12 +34,13 @@ extern "C" {
|
||||
|
||||
enum
|
||||
{
|
||||
PARSE_NONE = (1 << 0),
|
||||
PARSE_GROUP = (1 << 1),
|
||||
PARSE_ACTION = (1 << 2),
|
||||
PARSE_ONLY_UINT = (1 << 3),
|
||||
PARSE_ONLY_GROUP = (1 << 4),
|
||||
PARSE_SUB_GROUP = (1 << 5)
|
||||
PARSE_NONE = (1 << 0),
|
||||
PARSE_GROUP = (1 << 1),
|
||||
PARSE_ACTION = (1 << 2),
|
||||
PARSE_ONLY_UINT = (1 << 3),
|
||||
PARSE_ONLY_GROUP = (1 << 4),
|
||||
PARSE_ONLY_SUB_GROUP = (1 << 5),
|
||||
PARSE_SUB_GROUP = (1 << 6)
|
||||
};
|
||||
|
||||
enum
|
||||
@ -88,6 +89,7 @@ enum
|
||||
DISPLAYLIST_SHADER_PARAMETERS_PRESET,
|
||||
DISPLAYLIST_SYSTEM_INFO,
|
||||
DISPLAYLIST_DEBUG_INFO,
|
||||
DISPLAYLIST_USER_BINDS_LIST,
|
||||
DISPLAYLIST_ACCOUNTS_LIST,
|
||||
DISPLAYLIST_ACCOUNTS_CHEEVOS_LIST,
|
||||
DISPLAYLIST_LOAD_CONTENT_LIST,
|
||||
|
@ -22,6 +22,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MENU_LABEL_DEFERRED_USER_BINDS_LIST 0x28c5750eU
|
||||
|
||||
#define MENU_LABEL_CHEEVOS_USERNAME 0x6ce57e31U
|
||||
#define MENU_LABEL_CHEEVOS_PASSWORD 0x86c38d24U
|
||||
|
||||
|
@ -2802,11 +2802,242 @@ static void overlay_enable_toggle_change_handler(void *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool setting_append_list_input_player_options(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
const char *parent_group,
|
||||
unsigned user)
|
||||
{
|
||||
/* This constants matches the string length.
|
||||
* Keep it up to date or you'll get some really obvious bugs.
|
||||
* 2 is the length of '99'; we don't need more users than that.
|
||||
*/
|
||||
static char buffer[MAX_USERS][13+2+1];
|
||||
static char group_lbl[MAX_USERS][PATH_MAX_LENGTH];
|
||||
unsigned i;
|
||||
rarch_setting_group_info_t group_info = {0};
|
||||
rarch_setting_group_info_t subgroup_info = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
const struct retro_keybind* const defaults =
|
||||
(user == 0) ? retro_keybinds_1 : retro_keybinds_rest;
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
snprintf(buffer[user], sizeof(buffer[user]),
|
||||
"%s %u", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(group_lbl[user], sizeof(group_lbl[user]),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_USER_BINDS), user + 1);
|
||||
|
||||
START_GROUP(group_info, group_lbl[user], parent_group);
|
||||
|
||||
parent_group = menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS);
|
||||
|
||||
START_SUB_GROUP(
|
||||
list,
|
||||
list_info,
|
||||
buffer[user],
|
||||
group_info.name,
|
||||
subgroup_info,
|
||||
parent_group);
|
||||
|
||||
{
|
||||
/* These constants match the string lengths.
|
||||
* Keep them up to date or you'll get some really obvious bugs.
|
||||
* 2 is the length of '99'; we don't need more users than that.
|
||||
*/
|
||||
/* FIXME/TODO - really need to clean up this mess in some way. */
|
||||
static char key[MAX_USERS][64];
|
||||
static char key_type[MAX_USERS][64];
|
||||
static char key_analog[MAX_USERS][64];
|
||||
static char key_bind_all[MAX_USERS][64];
|
||||
static char key_bind_all_save_autoconfig[MAX_USERS][64];
|
||||
static char key_bind_defaults[MAX_USERS][64];
|
||||
|
||||
static char label[MAX_USERS][64];
|
||||
static char label_type[MAX_USERS][64];
|
||||
static char label_analog[MAX_USERS][64];
|
||||
static char label_bind_all[MAX_USERS][64];
|
||||
static char label_bind_all_save_autoconfig[MAX_USERS][64];
|
||||
static char label_bind_defaults[MAX_USERS][64];
|
||||
|
||||
snprintf(key[user], sizeof(key[user]),
|
||||
"input_player%u_joypad_index", user + 1);
|
||||
snprintf(key_type[user], sizeof(key_type[user]),
|
||||
"input_libretro_device_p%u", user + 1);
|
||||
snprintf(key_analog[user], sizeof(key_analog[user]),
|
||||
"input_player%u_analog_dpad_mode", user + 1);
|
||||
snprintf(key_bind_all[user], sizeof(key_bind_all[user]),
|
||||
"input_player%u_bind_all", user + 1);
|
||||
snprintf(key_bind_all_save_autoconfig[user], sizeof(key_bind_all[user]),
|
||||
"input_player%u_bind_all_save_autoconfig", user + 1);
|
||||
snprintf(key_bind_defaults[user], sizeof(key_bind_defaults[user]),
|
||||
"input_player%u_bind_defaults", user + 1);
|
||||
|
||||
snprintf(label[user], sizeof(label[user]),
|
||||
"%s %u Device Index", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_type[user], sizeof(label_type[user]),
|
||||
"%s %u Device Type", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_analog[user], sizeof(label_analog[user]),
|
||||
"%s %u Analog To Digital Type", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_bind_all[user], sizeof(label_bind_all[user]),
|
||||
"%s %u Bind All", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_bind_defaults[user], sizeof(label_bind_defaults[user]),
|
||||
"%s %u Bind Default All", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_bind_all_save_autoconfig[user], sizeof(label_bind_all_save_autoconfig[user]),
|
||||
"%s %u Save Autoconfig", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
|
||||
CONFIG_UINT(
|
||||
settings->input.libretro_device[user],
|
||||
key_type[user],
|
||||
label_type[user],
|
||||
user,
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_left = &setting_action_left_libretro_device_type;
|
||||
(*list)[list_info->index - 1].action_right = &setting_action_right_libretro_device_type;
|
||||
(*list)[list_info->index - 1].action_select = &setting_action_right_libretro_device_type;
|
||||
(*list)[list_info->index - 1].action_start = &setting_action_start_libretro_device_type;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_libretro_device;
|
||||
|
||||
CONFIG_UINT(
|
||||
settings->input.analog_dpad_mode[user],
|
||||
key_analog[user],
|
||||
label_analog[user],
|
||||
user,
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_left = &setting_action_left_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].action_right = &setting_action_right_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].action_select = &setting_action_right_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].action_start = &setting_action_start_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_analog_dpad_mode;
|
||||
|
||||
CONFIG_ACTION(
|
||||
key[user],
|
||||
label[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_start = &setting_action_start_bind_device;
|
||||
(*list)[list_info->index - 1].action_left = &setting_action_left_bind_device;
|
||||
(*list)[list_info->index - 1].action_right = &setting_action_right_bind_device;
|
||||
(*list)[list_info->index - 1].action_select = &setting_action_right_bind_device;
|
||||
(*list)[list_info->index - 1].get_string_representation = &get_string_representation_bind_device;
|
||||
|
||||
CONFIG_ACTION(
|
||||
key_bind_all[user],
|
||||
label_bind_all[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_bind_all;
|
||||
(*list)[list_info->index - 1].action_cancel = NULL;
|
||||
|
||||
CONFIG_ACTION(
|
||||
key_bind_defaults[user],
|
||||
label_bind_defaults[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_bind_defaults;
|
||||
(*list)[list_info->index - 1].action_cancel = NULL;
|
||||
|
||||
CONFIG_ACTION(
|
||||
key_bind_all_save_autoconfig[user],
|
||||
label_bind_all_save_autoconfig[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_bind_all_save_autoconfig;
|
||||
(*list)[list_info->index - 1].action_cancel = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < RARCH_BIND_LIST_END; i ++)
|
||||
{
|
||||
char label[PATH_MAX_LENGTH];
|
||||
char name[PATH_MAX_LENGTH];
|
||||
bool do_add = true;
|
||||
const struct input_bind_map* keybind =
|
||||
(const struct input_bind_map*)&input_config_bind_map[i];
|
||||
|
||||
if (!keybind || keybind->meta)
|
||||
continue;
|
||||
|
||||
strlcpy(label, buffer[user], sizeof(label));
|
||||
strlcat(label, " ", sizeof(label));
|
||||
if (
|
||||
settings->input.input_descriptor_label_show
|
||||
&& (i < RARCH_FIRST_META_KEY)
|
||||
&& (global->has_set.input_descriptors)
|
||||
&& (i != RARCH_TURBO_ENABLE)
|
||||
)
|
||||
{
|
||||
if (system->input_desc_btn[user][i])
|
||||
strlcat(label,
|
||||
system->input_desc_btn[user][i],
|
||||
sizeof(label));
|
||||
else
|
||||
{
|
||||
strlcat(label, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE),
|
||||
sizeof(label));
|
||||
|
||||
if (settings->input.input_descriptor_hide_unbound)
|
||||
do_add = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
strlcat(label, keybind->desc, sizeof(label));
|
||||
|
||||
snprintf(name, sizeof(name), "p%u_%s", user + 1, keybind->base);
|
||||
|
||||
if (do_add)
|
||||
{
|
||||
CONFIG_BIND(
|
||||
settings->input.binds[user][i],
|
||||
user + 1,
|
||||
user,
|
||||
strdup(name), /* TODO: Find a way to fix these memleaks. */
|
||||
strdup(label),
|
||||
&defaults[i],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].bind_type = i + MENU_SETTINGS_BIND_BEGIN;
|
||||
}
|
||||
}
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool setting_append_list_main_menu_options(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
const char *parent_group)
|
||||
{
|
||||
unsigned user;
|
||||
rarch_setting_group_info_t group_info = {0};
|
||||
rarch_setting_group_info_t subgroup_info = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -2931,6 +3162,9 @@ static bool setting_append_list_main_menu_options(
|
||||
menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_QUIT_RETROARCH);
|
||||
#endif
|
||||
|
||||
for (user = 0; user < MAX_USERS; user++)
|
||||
setting_append_list_input_player_options(list, list_info, parent_group, user);
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
|
||||
@ -4752,146 +4986,6 @@ static bool setting_append_list_input_options(
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
|
||||
START_SUB_GROUP(
|
||||
list,
|
||||
list_info,
|
||||
"Input Device Mapping",
|
||||
group_info.name,
|
||||
subgroup_info,
|
||||
parent_group);
|
||||
|
||||
for (user = 0; user < settings->input.max_users; user ++)
|
||||
{
|
||||
/* These constants match the string lengths.
|
||||
* Keep them up to date or you'll get some really obvious bugs.
|
||||
* 2 is the length of '99'; we don't need more users than that.
|
||||
*/
|
||||
/* FIXME/TODO - really need to clean up this mess in some way. */
|
||||
static char key[MAX_USERS][64];
|
||||
static char key_type[MAX_USERS][64];
|
||||
static char key_analog[MAX_USERS][64];
|
||||
static char key_bind_all[MAX_USERS][64];
|
||||
static char key_bind_all_save_autoconfig[MAX_USERS][64];
|
||||
static char key_bind_defaults[MAX_USERS][64];
|
||||
|
||||
static char label[MAX_USERS][64];
|
||||
static char label_type[MAX_USERS][64];
|
||||
static char label_analog[MAX_USERS][64];
|
||||
static char label_bind_all[MAX_USERS][64];
|
||||
static char label_bind_all_save_autoconfig[MAX_USERS][64];
|
||||
static char label_bind_defaults[MAX_USERS][64];
|
||||
|
||||
snprintf(key[user], sizeof(key[user]),
|
||||
"input_player%u_joypad_index", user + 1);
|
||||
snprintf(key_type[user], sizeof(key_type[user]),
|
||||
"input_libretro_device_p%u", user + 1);
|
||||
snprintf(key_analog[user], sizeof(key_analog[user]),
|
||||
"input_player%u_analog_dpad_mode", user + 1);
|
||||
snprintf(key_bind_all[user], sizeof(key_bind_all[user]),
|
||||
"input_player%u_bind_all", user + 1);
|
||||
snprintf(key_bind_all_save_autoconfig[user], sizeof(key_bind_all[user]),
|
||||
"input_player%u_bind_all_save_autoconfig", user + 1);
|
||||
snprintf(key_bind_defaults[user], sizeof(key_bind_defaults[user]),
|
||||
"input_player%u_bind_defaults", user + 1);
|
||||
|
||||
snprintf(label[user], sizeof(label[user]),
|
||||
"%s %u Device Index", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_type[user], sizeof(label_type[user]),
|
||||
"%s %u Device Type", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_analog[user], sizeof(label_analog[user]),
|
||||
"%s %u Analog To Digital Type", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_bind_all[user], sizeof(label_bind_all[user]),
|
||||
"%s %u Bind All", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_bind_defaults[user], sizeof(label_bind_defaults[user]),
|
||||
"%s %u Bind Default All", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(label_bind_all_save_autoconfig[user], sizeof(label_bind_all_save_autoconfig[user]),
|
||||
"%s %u Save Autoconfig", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
|
||||
CONFIG_UINT(
|
||||
settings->input.libretro_device[user],
|
||||
key_type[user],
|
||||
label_type[user],
|
||||
user,
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_left = &setting_action_left_libretro_device_type;
|
||||
(*list)[list_info->index - 1].action_right = &setting_action_right_libretro_device_type;
|
||||
(*list)[list_info->index - 1].action_select = &setting_action_right_libretro_device_type;
|
||||
(*list)[list_info->index - 1].action_start = &setting_action_start_libretro_device_type;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_libretro_device;
|
||||
|
||||
CONFIG_UINT(
|
||||
settings->input.analog_dpad_mode[user],
|
||||
key_analog[user],
|
||||
label_analog[user],
|
||||
user,
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_left = &setting_action_left_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].action_right = &setting_action_right_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].action_select = &setting_action_right_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].action_start = &setting_action_start_analog_dpad_mode;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_analog_dpad_mode;
|
||||
|
||||
CONFIG_ACTION(
|
||||
key[user],
|
||||
label[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_start = &setting_action_start_bind_device;
|
||||
(*list)[list_info->index - 1].action_left = &setting_action_left_bind_device;
|
||||
(*list)[list_info->index - 1].action_right = &setting_action_right_bind_device;
|
||||
(*list)[list_info->index - 1].action_select = &setting_action_right_bind_device;
|
||||
(*list)[list_info->index - 1].get_string_representation = &get_string_representation_bind_device;
|
||||
|
||||
CONFIG_ACTION(
|
||||
key_bind_all[user],
|
||||
label_bind_all[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_bind_all;
|
||||
(*list)[list_info->index - 1].action_cancel = NULL;
|
||||
|
||||
CONFIG_ACTION(
|
||||
key_bind_defaults[user],
|
||||
label_bind_defaults[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_bind_defaults;
|
||||
(*list)[list_info->index - 1].action_cancel = NULL;
|
||||
|
||||
CONFIG_ACTION(
|
||||
key_bind_all_save_autoconfig[user],
|
||||
label_bind_all_save_autoconfig[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_bind_all_save_autoconfig;
|
||||
(*list)[list_info->index - 1].action_cancel = NULL;
|
||||
}
|
||||
|
||||
START_SUB_GROUP(
|
||||
list,
|
||||
@ -4939,6 +5033,29 @@ static bool setting_append_list_input_options(
|
||||
menu_settings_list_current_add_range(list, list_info, 1, 0, 1, true, false);
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
|
||||
START_SUB_GROUP(list, list_info, "Binds", group_info.name, subgroup_info, parent_group);
|
||||
|
||||
for (user = 0; user < MAX_USERS; user++)
|
||||
{
|
||||
static char binds_list[MAX_USERS][PATH_MAX_LENGTH];
|
||||
static char binds_label[MAX_USERS][PATH_MAX_LENGTH];
|
||||
|
||||
snprintf(binds_list[user], sizeof(binds_list[user]), "%d_input_binds_list", user + 1);
|
||||
snprintf(binds_label[user], sizeof(binds_label[user]), "Input User %d Binds", user + 1);
|
||||
|
||||
CONFIG_ACTION(
|
||||
binds_list[user],
|
||||
binds_label[user],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].index = user + 1;
|
||||
(*list)[list_info->index - 1].index_offset = user;
|
||||
}
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
|
||||
return true;
|
||||
@ -6539,103 +6656,6 @@ static bool setting_append_list_privacy_options(
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool setting_append_list_input_player_options(
|
||||
rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info,
|
||||
const char *parent_group,
|
||||
unsigned user)
|
||||
{
|
||||
/* This constants matches the string length.
|
||||
* Keep it up to date or you'll get some really obvious bugs.
|
||||
* 2 is the length of '99'; we don't need more users than that.
|
||||
*/
|
||||
static char buffer[MAX_USERS][13+2+1];
|
||||
static char group_lbl[MAX_USERS][PATH_MAX_LENGTH];
|
||||
unsigned i;
|
||||
rarch_setting_group_info_t group_info = {0};
|
||||
rarch_setting_group_info_t subgroup_info = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
const struct retro_keybind* const defaults =
|
||||
(user == 0) ? retro_keybinds_1 : retro_keybinds_rest;
|
||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||
|
||||
snprintf(buffer[user], sizeof(buffer[user]),
|
||||
"%s %u", menu_hash_to_str(MENU_VALUE_USER), user + 1);
|
||||
snprintf(group_lbl[user], sizeof(group_lbl[user]),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_USER_BINDS), user + 1);
|
||||
|
||||
START_GROUP(group_info, group_lbl[user], parent_group);
|
||||
|
||||
parent_group = menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS);
|
||||
|
||||
START_SUB_GROUP(
|
||||
list,
|
||||
list_info,
|
||||
buffer[user],
|
||||
group_info.name,
|
||||
subgroup_info,
|
||||
parent_group);
|
||||
|
||||
for (i = 0; i < RARCH_BIND_LIST_END; i ++)
|
||||
{
|
||||
char label[PATH_MAX_LENGTH];
|
||||
char name[PATH_MAX_LENGTH];
|
||||
bool do_add = true;
|
||||
const struct input_bind_map* keybind =
|
||||
(const struct input_bind_map*)&input_config_bind_map[i];
|
||||
|
||||
if (!keybind || keybind->meta)
|
||||
continue;
|
||||
|
||||
strlcpy(label, buffer[user], sizeof(label));
|
||||
strlcat(label, " ", sizeof(label));
|
||||
if (
|
||||
settings->input.input_descriptor_label_show
|
||||
&& (i < RARCH_FIRST_META_KEY)
|
||||
&& (global->has_set.input_descriptors)
|
||||
&& (i != RARCH_TURBO_ENABLE)
|
||||
)
|
||||
{
|
||||
if (system->input_desc_btn[user][i])
|
||||
strlcat(label,
|
||||
system->input_desc_btn[user][i],
|
||||
sizeof(label));
|
||||
else
|
||||
{
|
||||
strlcat(label, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE),
|
||||
sizeof(label));
|
||||
|
||||
if (settings->input.input_descriptor_hide_unbound)
|
||||
do_add = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
strlcat(label, keybind->desc, sizeof(label));
|
||||
|
||||
snprintf(name, sizeof(name), "p%u_%s", user + 1, keybind->base);
|
||||
|
||||
if (do_add)
|
||||
{
|
||||
CONFIG_BIND(
|
||||
settings->input.binds[user][i],
|
||||
user + 1,
|
||||
user,
|
||||
strdup(name), /* TODO: Find a way to fix these memleaks. */
|
||||
strdup(label),
|
||||
&defaults[i],
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
(*list)[list_info->index - 1].bind_type = i + MENU_SETTINGS_BIND_BEGIN;
|
||||
}
|
||||
}
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
END_GROUP(list, list_info, parent_group);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool menu_setting_action_right(rarch_setting_t *setting, bool wraparound)
|
||||
{
|
||||
@ -6738,8 +6758,6 @@ rarch_setting_t *menu_setting_new(void)
|
||||
if (!setting_append_list_input_options(&list, list_info, root))
|
||||
goto error;
|
||||
|
||||
for (user = 0; user < settings->input.max_users; user++)
|
||||
setting_append_list_input_player_options(&list, list_info, root, user);
|
||||
}
|
||||
|
||||
if (!setting_append_list_input_hotkey_options(&list, list_info, root))
|
||||
|
Loading…
x
Reference in New Issue
Block a user