mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Add dropdown lists for driver settings
This commit is contained in:
parent
c3e1dd0605
commit
1f864e379b
@ -4269,6 +4269,20 @@ int action_ok_push_filebrowser_list_file_select(const char *path,
|
||||
entry_idx, ACTION_OK_DL_FILE_BROWSER_SELECT_DIR);
|
||||
}
|
||||
|
||||
static int action_ok_push_dropdown_setting_string_options_item(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(label);
|
||||
rarch_setting_t *setting = menu_setting_find_enum(enum_idx);
|
||||
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
strlcpy(setting->value.target.string, path,
|
||||
sizeof(setting->value.target.string));
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
static int action_ok_push_dropdown_setting_int_item(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -5357,6 +5371,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_string_options_item);
|
||||
break;
|
||||
case MENU_SETTING_DROPDOWN_SETTING_INT_ITEM:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_int_item);
|
||||
break;
|
||||
|
@ -7700,6 +7700,28 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_STRING_OPTIONS:
|
||||
{
|
||||
struct string_list *tmp_str_list = string_split(setting->values, "|");
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned size = tmp_str_list->size;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
char val_d[256];
|
||||
snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx);
|
||||
menu_entries_append_enum(info->list,
|
||||
tmp_str_list->elems[i].data,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM, i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ST_INT:
|
||||
{
|
||||
int32_t orig_value = *setting->value.target.integer;
|
||||
|
@ -148,6 +148,7 @@ enum menu_settings_type
|
||||
MENU_ADD_TAB,
|
||||
MENU_PLAYLISTS_TAB,
|
||||
MENU_SETTING_DROPDOWN_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_INT_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM,
|
||||
MENU_SETTING_NO_ITEM,
|
||||
|
@ -3534,6 +3534,7 @@ static bool setting_append_list(
|
||||
general_read_handler,
|
||||
general_write_handler);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
||||
(*list)[list_info->index - 1].action_ok = setting_action_ok_uint;
|
||||
(*list)[list_info->index - 1].action_left = setting_string_action_left_driver;
|
||||
(*list)[list_info->index - 1].action_right = setting_string_action_right_driver;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user