mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-29 15:32:01 +00:00
(Menu) Build up Input Settings dynamically
This commit is contained in:
parent
9e00fcd419
commit
135edc289b
@ -74,6 +74,11 @@ static int deferred_push_accounts_list(menu_displaylist_info_t *info)
|
||||
return deferred_push_dlist(info, DISPLAYLIST_ACCOUNTS_LIST);
|
||||
}
|
||||
|
||||
static int deferred_push_input_settings_list(menu_displaylist_info_t *info)
|
||||
{
|
||||
return deferred_push_dlist(info, DISPLAYLIST_INPUT_SETTINGS_LIST);
|
||||
}
|
||||
|
||||
static int deferred_push_accounts_cheevos_list(menu_displaylist_info_t *info)
|
||||
{
|
||||
return deferred_push_dlist(info, DISPLAYLIST_ACCOUNTS_CHEEVOS_LIST);
|
||||
@ -566,6 +571,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(menu_file_list_cbs_t *
|
||||
case MENU_LABEL_DEFERRED_ACCOUNTS_LIST:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_accounts_list);
|
||||
break;
|
||||
case MENU_LABEL_DEFERRED_INPUT_SETTINGS_LIST:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_input_settings_list);
|
||||
break;
|
||||
case MENU_LABEL_DEFERRED_ACCOUNTS_CHEEVOS_LIST:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_accounts_cheevos_list);
|
||||
break;
|
||||
|
@ -293,6 +293,12 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
info_path = path;
|
||||
info_label = menu_hash_to_str(MENU_LABEL_DEFERRED_ACCOUNTS_LIST);
|
||||
break;
|
||||
case ACTION_OK_DL_INPUT_SETTINGS_LIST:
|
||||
info.directory_ptr = idx;
|
||||
info.type = type;
|
||||
info_path = path;
|
||||
info_label = menu_hash_to_str(MENU_LABEL_DEFERRED_INPUT_SETTINGS_LIST);
|
||||
break;
|
||||
case ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST:
|
||||
info.directory_ptr = idx;
|
||||
info.type = type;
|
||||
@ -1554,6 +1560,13 @@ static int action_ok_push_accounts_list(const char *path,
|
||||
ACTION_OK_DL_ACCOUNTS_LIST);
|
||||
}
|
||||
|
||||
static int action_ok_push_input_settings_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_INPUT_SETTINGS_LIST);
|
||||
}
|
||||
|
||||
static int action_ok_push_user_binds_list(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -1873,6 +1886,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_LABEL_ACCOUNTS_LIST:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_accounts_list);
|
||||
break;
|
||||
case MENU_LABEL_INPUT_SETTINGS:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_input_settings_list);
|
||||
break;
|
||||
case MENU_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_accounts_cheevos_list);
|
||||
break;
|
||||
|
@ -42,8 +42,14 @@ static const char *menu_hash_to_str_us_label(uint32_t hash)
|
||||
return "deferred_user_binds_list";
|
||||
case MENU_LABEL_DEFERRED_ACCOUNTS_LIST:
|
||||
return "deferred_accounts_list";
|
||||
case MENU_LABEL_DEFERRED_INPUT_SETTINGS_LIST:
|
||||
return "deferred_input_settings_list";
|
||||
case MENU_LABEL_ACCOUNTS_LIST:
|
||||
return "accounts_list";
|
||||
case MENU_LABEL_INPUT_SETTINGS_BEGIN:
|
||||
return "input_settings_begin";
|
||||
case MENU_LABEL_INPUT_SETTINGS:
|
||||
return "input_settings";
|
||||
case MENU_LABEL_DEBUG_PANEL_ENABLE:
|
||||
return "debug_panel_enable";
|
||||
case MENU_LABEL_HELP_SCANNING_CONTENT:
|
||||
|
@ -41,6 +41,7 @@ enum
|
||||
ACTION_OK_DL_GENERIC,
|
||||
ACTION_OK_DL_PUSH_DEFAULT,
|
||||
ACTION_OK_DL_DOWNLOADS_DIR,
|
||||
ACTION_OK_DL_INPUT_SETTINGS_LIST,
|
||||
ACTION_OK_DL_ACCOUNTS_LIST,
|
||||
ACTION_OK_DL_ACCOUNTS_CHEEVOS_LIST,
|
||||
ACTION_OK_DL_USER_BINDS_LIST,
|
||||
|
@ -1478,6 +1478,12 @@ int menu_displaylist_parse_settings(void *data, menu_displaylist_info_t *info,
|
||||
case PARSE_ONLY_UINT:
|
||||
precond = ST_UINT;
|
||||
break;
|
||||
case PARSE_ONLY_BOOL:
|
||||
precond = ST_BOOL;
|
||||
break;
|
||||
case PARSE_ONLY_FLOAT:
|
||||
precond = ST_FLOAT;
|
||||
break;
|
||||
case PARSE_ONLY_GROUP:
|
||||
default:
|
||||
precond = ST_END_GROUP;
|
||||
@ -1519,6 +1525,14 @@ int menu_displaylist_parse_settings(void *data, menu_displaylist_info_t *info,
|
||||
if (type == ST_UINT)
|
||||
break;
|
||||
goto loop;
|
||||
case PARSE_ONLY_BOOL:
|
||||
if (type == ST_BOOL)
|
||||
break;
|
||||
goto loop;
|
||||
case PARSE_ONLY_FLOAT:
|
||||
if (type == ST_FLOAT)
|
||||
break;
|
||||
goto loop;
|
||||
}
|
||||
|
||||
if (flags & SD_FLAG_ADVANCED &&
|
||||
@ -1540,6 +1554,8 @@ loop:
|
||||
if (menu_setting_get_type(setting) == precond)
|
||||
time_to_exit = true;
|
||||
break;
|
||||
case PARSE_ONLY_FLOAT:
|
||||
case PARSE_ONLY_BOOL:
|
||||
case PARSE_ONLY_UINT:
|
||||
case PARSE_ACTION:
|
||||
time_to_exit = true;
|
||||
@ -2285,6 +2301,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
case DISPLAYLIST_DATABASE_PLAYLISTS:
|
||||
case DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL:
|
||||
case DISPLAYLIST_VIDEO_FILTERS:
|
||||
case DISPLAYLIST_INPUT_SETTINGS_LIST:
|
||||
case DISPLAYLIST_AUDIO_FILTERS:
|
||||
case DISPLAYLIST_IMAGES:
|
||||
case DISPLAYLIST_OVERLAYS:
|
||||
@ -2429,6 +2446,48 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
#endif
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_INPUT_SETTINGS_LIST:
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_MAX_USERS), PARSE_ONLY_UINT);
|
||||
#ifdef ANDROID
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABELINPUT_BACK_AS_MENU_TOGGLE_ENABLE), PARSE_ONLY_BOOL);
|
||||
#endif
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_MENU_TOGGLE_GAMEPAD_COMBO), PARSE_ONLY_UINT);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_REMAP_BINDS_ENABLE), PARSE_ONLY_BOOL);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_AUTODETECT_ENABLE), PARSE_ONLY_BOOL);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_AUTOCONFIG_DESCRIPTOR_LABEL_SHOW), PARSE_ONLY_BOOL);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_DESCRIPTOR_LABEL_SHOW), PARSE_ONLY_BOOL);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_DESCRIPTOR_HIDE_UNBOUND), PARSE_ONLY_BOOL);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_AXIS_THRESHOLD), PARSE_ONLY_FLOAT);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_TURBO_PERIOD), PARSE_ONLY_UINT);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_TURBO_PERIOD), PARSE_ONLY_UINT);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_DUTY_CYCLE), PARSE_ONLY_UINT);
|
||||
|
||||
{
|
||||
unsigned user;
|
||||
for (user = 0; user < settings->input.max_users; user++)
|
||||
{
|
||||
char binds_list[PATH_MAX_LENGTH];
|
||||
snprintf(binds_list, sizeof(binds_list), "%d_input_binds_list", user + 1);
|
||||
menu_displaylist_parse_settings(menu, info,
|
||||
binds_list, PARSE_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_SETTINGS_ALL:
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_DRIVER_SETTINGS), PARSE_ONLY_GROUP);
|
||||
@ -2437,7 +2496,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_AUDIO_SETTINGS), PARSE_ONLY_GROUP);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_SETTINGS), PARSE_ONLY_GROUP);
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_SETTINGS), PARSE_ACTION);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_HOTKEY_BINDS), PARSE_ONLY_GROUP);
|
||||
ret = menu_displaylist_parse_settings(menu, info,
|
||||
|
@ -38,9 +38,11 @@ enum
|
||||
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)
|
||||
PARSE_ONLY_BOOL = (1 << 4),
|
||||
PARSE_ONLY_FLOAT = (1 << 5),
|
||||
PARSE_ONLY_GROUP = (1 << 6),
|
||||
PARSE_ONLY_SUB_GROUP = (1 << 7),
|
||||
PARSE_SUB_GROUP = (1 << 8)
|
||||
};
|
||||
|
||||
enum
|
||||
@ -91,6 +93,7 @@ enum
|
||||
DISPLAYLIST_DEBUG_INFO,
|
||||
DISPLAYLIST_USER_BINDS_LIST,
|
||||
DISPLAYLIST_ACCOUNTS_LIST,
|
||||
DISPLAYLIST_INPUT_SETTINGS_LIST,
|
||||
DISPLAYLIST_ACCOUNTS_CHEEVOS_LIST,
|
||||
DISPLAYLIST_LOAD_CONTENT_LIST,
|
||||
DISPLAYLIST_INFORMATION_LIST,
|
||||
|
@ -22,6 +22,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MENU_LABEL_INPUT_SETTINGS 0x78b4a7c5U
|
||||
|
||||
#define MENU_LABEL_INPUT_SETTINGS_BEGIN 0xddee308bU
|
||||
|
||||
#define MENU_LABEL_DEFERRED_INPUT_SETTINGS_LIST 0x050bec60U
|
||||
|
||||
#define MENU_LABEL_DEFERRED_USER_BINDS_LIST 0x28c5750eU
|
||||
|
||||
#define MENU_LABEL_CHEEVOS_USERNAME 0x6ce57e31U
|
||||
|
@ -3172,6 +3172,13 @@ static bool setting_append_list_main_menu_options(
|
||||
menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_SHUTDOWN);
|
||||
#endif
|
||||
|
||||
CONFIG_ACTION(
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_SETTINGS),
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_SETTINGS),
|
||||
group_info.name,
|
||||
subgroup_info.name,
|
||||
parent_group);
|
||||
|
||||
for (user = 0; user < MAX_USERS; user++)
|
||||
setting_append_list_input_player_options(list, list_info, parent_group, user);
|
||||
|
||||
@ -4880,7 +4887,7 @@ static bool setting_append_list_input_options(
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
START_GROUP(group_info,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_SETTINGS),
|
||||
menu_hash_to_str(MENU_LABEL_INPUT_SETTINGS_BEGIN),
|
||||
parent_group);
|
||||
|
||||
parent_group = menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS);
|
||||
@ -5029,6 +5036,7 @@ static bool setting_append_list_input_options(
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 1, 0, 1, true, false);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
|
||||
|
||||
CONFIG_UINT(
|
||||
settings->input.turbo_duty_cycle,
|
||||
@ -5041,6 +5049,7 @@ static bool setting_append_list_input_options(
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
menu_settings_list_current_add_range(list, list_info, 1, 0, 1, true, false);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
|
||||
|
||||
END_SUB_GROUP(list, list_info, parent_group);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user