mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Add 'dropdown list' when pressing the OK/Confirm button on Video -> Aspect Ratio
This commit is contained in:
parent
a1d876b44e
commit
f00f73c5ed
@ -148,6 +148,8 @@ static const bool vsync = true;
|
||||
|
||||
static const unsigned max_swapchain_images = 3;
|
||||
|
||||
static const bool adaptive_vsync = true;
|
||||
|
||||
/* Attempts to hard-synchronize CPU and GPU.
|
||||
* Can reduce latency at cost of performance. */
|
||||
static const bool hard_sync = false;
|
||||
|
@ -1315,7 +1315,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("video_fullscreen", &settings->bools.video_fullscreen, true, fullscreen, false);
|
||||
SETTING_BOOL("bundle_assets_extract_enable", &settings->bools.bundle_assets_extract_enable, true, bundle_assets_extract_enable, false);
|
||||
SETTING_BOOL("video_vsync", &settings->bools.video_vsync, true, vsync, false);
|
||||
SETTING_BOOL("video_adaptive_vsync", &settings->bools.video_adaptive_vsync, true, false, false);
|
||||
SETTING_BOOL("video_adaptive_vsync", &settings->bools.video_adaptive_vsync, true, adaptive_vsync, false);
|
||||
SETTING_BOOL("video_hard_sync", &settings->bools.video_hard_sync, true, hard_sync, false);
|
||||
SETTING_BOOL("video_black_frame_insertion", &settings->bools.video_black_frame_insertion, true, black_frame_insertion, false);
|
||||
SETTING_BOOL("video_disable_composition", &settings->bools.video_disable_composition, true, disable_composition, false);
|
||||
|
@ -241,6 +241,8 @@ MSG_HASH(MENU_ENUM_LABEL_DATABASE_MANAGER,
|
||||
"database_manager")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DATABASE_MANAGER_LIST,
|
||||
"database_manager_list")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST,
|
||||
"deferred_dropdown_box_list")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST,
|
||||
"deferred_configurations_list")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST,
|
||||
|
@ -30,12 +30,17 @@
|
||||
#endif
|
||||
|
||||
/* Clicks the back button */
|
||||
static int action_cancel_pop_default(const char *path,
|
||||
int action_cancel_pop_default(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
size_t new_selection_ptr;
|
||||
const char *menu_label = NULL;
|
||||
enum msg_hash_enums enum_idx = 0 ;
|
||||
const char *menu_label = NULL;
|
||||
enum msg_hash_enums enum_idx = 0;
|
||||
|
||||
(void)path;
|
||||
(void)label;
|
||||
(void)type;
|
||||
(void)idx;
|
||||
|
||||
menu_entries_get_last_stack(NULL, &menu_label, NULL, &enum_idx, NULL);
|
||||
|
||||
|
@ -602,6 +602,7 @@ generic_deferred_push_clear_general(deferred_playlist_list, PUSH_DEFAULT, DISPLA
|
||||
generic_deferred_push_clear_general(deferred_music_history_list, PUSH_DEFAULT, DISPLAYLIST_MUSIC_HISTORY)
|
||||
generic_deferred_push_clear_general(deferred_image_history_list, PUSH_DEFAULT, DISPLAYLIST_IMAGES_HISTORY)
|
||||
generic_deferred_push_clear_general(deferred_video_history_list, PUSH_DEFAULT, DISPLAYLIST_VIDEO_HISTORY)
|
||||
generic_deferred_push_clear_general(deferred_push_dropdown_box_list, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST)
|
||||
|
||||
static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
menu_file_list_cbs_t *cbs,
|
||||
@ -612,6 +613,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_favorites_list);
|
||||
return 0;
|
||||
}
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST)))
|
||||
{
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_dropdown_box_list);
|
||||
return 0;
|
||||
}
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_LIST)))
|
||||
{
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_browse_url_list);
|
||||
|
@ -2383,6 +2383,8 @@ static int menu_cbs_init_bind_get_string_representation_compare_type(
|
||||
case 26: /* URL entries */
|
||||
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_entry_url);
|
||||
break;
|
||||
case MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM:
|
||||
case MENU_SETTING_DROPDOWN_ITEM:
|
||||
case MENU_SETTING_NO_ITEM:
|
||||
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_no_items);
|
||||
break;
|
||||
|
@ -735,7 +735,7 @@ static int disk_options_disk_idx_left(unsigned type, const char *label,
|
||||
static int bind_left_generic(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
return menu_setting_set(type, label, MENU_ACTION_LEFT, wraparound);
|
||||
return menu_setting_set(type, MENU_ACTION_LEFT, wraparound);
|
||||
}
|
||||
|
||||
static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
|
||||
|
@ -258,6 +258,8 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
|
||||
{
|
||||
switch (lbl)
|
||||
{
|
||||
case ACTION_OK_DL_DROPDOWN_BOX_LIST:
|
||||
return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST;
|
||||
case ACTION_OK_DL_MIXER_STREAM_SETTINGS_LIST:
|
||||
return MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST;
|
||||
case ACTION_OK_DL_ACCOUNTS_LIST:
|
||||
@ -409,6 +411,15 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST;
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_DROPDOWN_BOX_LIST:
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = path;
|
||||
info_label = msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST);
|
||||
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST;
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_USER_BINDS_LIST:
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
@ -1956,7 +1967,7 @@ static int action_ok_mixer_stream_action_stop(const char *path,
|
||||
static int action_ok_lookup_setting(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
return menu_setting_set(type, label, MENU_ACTION_OK, false);
|
||||
return menu_setting_set(type, MENU_ACTION_OK, false);
|
||||
}
|
||||
|
||||
static int action_ok_audio_add_to_mixer(const char *path,
|
||||
@ -4258,6 +4269,33 @@ 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_uint_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;
|
||||
|
||||
*setting->value.target.unsigned_integer = idx;
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
static int action_ok_push_dropdown_item(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#if 0
|
||||
RARCH_LOG("dropdown: \n");
|
||||
RARCH_LOG("path: %s \n", path);
|
||||
RARCH_LOG("label: %s \n", label);
|
||||
RARCH_LOG("type: %d \n", type);
|
||||
RARCH_LOG("idx: %d \n", idx);
|
||||
RARCH_LOG("entry_idx: %d \n", entry_idx);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_push_default(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -5306,6 +5344,12 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_setting_uint_item);
|
||||
break;
|
||||
case MENU_SETTING_DROPDOWN_ITEM:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_item);
|
||||
break;
|
||||
case MENU_SETTING_ACTION_CORE_DISK_OPTIONS:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_default);
|
||||
break;
|
||||
|
@ -513,7 +513,7 @@ static int disk_options_disk_idx_right(unsigned type, const char *label,
|
||||
int bind_right_generic(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
return menu_setting_set(type, label, MENU_ACTION_RIGHT, wraparound);
|
||||
return menu_setting_set(type, MENU_ACTION_RIGHT, wraparound);
|
||||
}
|
||||
|
||||
static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
|
||||
|
@ -283,7 +283,7 @@ static int action_start_video_resolution(unsigned type, const char *label)
|
||||
|
||||
static int action_start_lookup_setting(unsigned type, const char *label)
|
||||
{
|
||||
return menu_setting_set(type, label, MENU_ACTION_START, false);
|
||||
return menu_setting_set(type, MENU_ACTION_START, false);
|
||||
}
|
||||
|
||||
static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs)
|
||||
|
@ -78,6 +78,11 @@ static int action_get_title_action_generic(const char *path, const char *label,
|
||||
return 0; \
|
||||
}
|
||||
|
||||
static int action_get_title_dropdown_item(const char *path, const char *label, unsigned menu_type, char *s, size_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_get_title_mixer_stream_actions(const char *path, const char *label, unsigned menu_type, char *s, size_t len)
|
||||
{
|
||||
unsigned offset = (menu_type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_BEGIN);
|
||||
@ -1188,7 +1193,12 @@ int menu_cbs_init_bind_title(menu_file_list_cbs_t *cbs,
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_mixer_stream_actions);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (string_is_equal(label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST)))
|
||||
{
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_title_dropdown_item);
|
||||
return 0;
|
||||
}
|
||||
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS)))
|
||||
{
|
||||
BIND_ACTION_GET_TITLE(cbs, action_get_quick_menu_views_settings_list);
|
||||
|
@ -43,6 +43,7 @@ typedef struct key_desc
|
||||
enum
|
||||
{
|
||||
ACTION_OK_DL_DEFAULT = 0,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST,
|
||||
ACTION_OK_DL_OPEN_ARCHIVE,
|
||||
ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE,
|
||||
ACTION_OK_DL_MUSIC,
|
||||
@ -139,10 +140,16 @@ enum
|
||||
|
||||
/* Function callbacks */
|
||||
|
||||
int action_cancel_pop_default(const char *path,
|
||||
const char *label, unsigned type, size_t idx);
|
||||
|
||||
int action_refresh_default(file_list_t *list, file_list_t *menu_list);
|
||||
|
||||
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound);
|
||||
|
||||
int action_cancel_pop_with_new_pos(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t new_idx);
|
||||
|
||||
int generic_action_ok_displaylist_push(const char *path, const char *new_path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx,
|
||||
unsigned action_type);
|
||||
|
@ -7690,6 +7690,76 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
use_filebrowser = true;
|
||||
break;
|
||||
case DISPLAYLIST_DROPDOWN_LIST:
|
||||
{
|
||||
enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(info->path);
|
||||
rarch_setting_t *setting = menu_setting_find_enum(enum_idx);
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_UINT:
|
||||
if (setting->enforce_minrange && setting->enforce_maxrange)
|
||||
{
|
||||
float i;
|
||||
float step = setting->step;
|
||||
double min = setting->min;
|
||||
double max = setting->max;
|
||||
|
||||
if (setting->get_string_representation)
|
||||
{
|
||||
unsigned orig_value = *setting->value.target.unsigned_integer;
|
||||
for (i = 0.00; i < max; i += step)
|
||||
{
|
||||
char val_s[256], val_d[256];
|
||||
int val = (int)i;
|
||||
|
||||
/* TODO/FIXME -
|
||||
* get_string_representation for aspect ratio index
|
||||
* uses setting->value.target.unsigned_integer, so
|
||||
* create this hack */
|
||||
*setting->value.target.unsigned_integer = val;
|
||||
|
||||
setting->get_string_representation(setting,
|
||||
val_s, sizeof(val_s));
|
||||
snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx);
|
||||
menu_entries_append_enum(info->list,
|
||||
val_s,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM, val, 0);
|
||||
}
|
||||
|
||||
*setting->value.target.unsigned_integer = orig_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 1.00; i < max; i += step)
|
||||
{
|
||||
char val_s[16], val_d[16];
|
||||
int val = (int)i;
|
||||
|
||||
snprintf(val_s, sizeof(val_s), "%d", val);
|
||||
snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx);
|
||||
|
||||
menu_entries_append_enum(info->list,
|
||||
val_s,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM, val, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_NONE:
|
||||
break;
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ enum menu_displaylist_parse_type
|
||||
enum menu_displaylist_ctl_state
|
||||
{
|
||||
DISPLAYLIST_NONE = 0,
|
||||
DISPLAYLIST_DROPDOWN_LIST,
|
||||
DISPLAYLIST_INFO,
|
||||
DISPLAYLIST_HELP,
|
||||
DISPLAYLIST_HELP_SCREEN_LIST,
|
||||
|
@ -147,6 +147,8 @@ enum menu_settings_type
|
||||
MENU_NETPLAY_TAB,
|
||||
MENU_ADD_TAB,
|
||||
MENU_PLAYLISTS_TAB,
|
||||
MENU_SETTING_DROPDOWN_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM,
|
||||
MENU_SETTING_NO_ITEM,
|
||||
MENU_SETTING_DRIVER,
|
||||
MENU_SETTING_ACTION,
|
||||
|
@ -159,6 +159,22 @@ struct string_options_entry
|
||||
size_t len;
|
||||
};
|
||||
|
||||
static int setting_action_ok_uint(void *data, bool wraparound)
|
||||
{
|
||||
char enum_idx[16];
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
snprintf(enum_idx, sizeof(enum_idx), "%d", setting->enum_idx);
|
||||
|
||||
generic_action_ok_displaylist_push(
|
||||
enum_idx, /* we will pass the enumeration index of the string as a path */
|
||||
NULL, NULL, 0, 0, 0,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
static void setting_get_string_representation_cheevos_password(void *data,
|
||||
char *s, size_t len)
|
||||
@ -1054,8 +1070,7 @@ int menu_setting_set_flags(rarch_setting_t *setting)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int menu_setting_set(unsigned type, const char *label,
|
||||
unsigned action, bool wraparound)
|
||||
int menu_setting_set(unsigned type, unsigned action, bool wraparound)
|
||||
{
|
||||
int ret = 0;
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
@ -4065,6 +4080,7 @@ static bool setting_append_list(
|
||||
true,
|
||||
true);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_CMD_APPLY_AUTO);
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_aspect_ratio_index;
|
||||
|
||||
|
@ -76,8 +76,7 @@ int menu_setting_generic(rarch_setting_t *setting, bool wraparound);
|
||||
|
||||
int menu_setting_set_flags(rarch_setting_t *setting);
|
||||
|
||||
int menu_setting_set(unsigned type, const char *label,
|
||||
unsigned action, bool wraparound);
|
||||
int menu_setting_set(unsigned type, unsigned action, bool wraparound);
|
||||
|
||||
/**
|
||||
* menu_setting_find:
|
||||
|
@ -982,6 +982,7 @@ enum msg_hash_enums
|
||||
MENU_LABEL(BROWSE_URL),
|
||||
MENU_LABEL(BROWSE_START),
|
||||
/* Deferred */
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST,
|
||||
MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST,
|
||||
MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST,
|
||||
MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST,
|
||||
|
Loading…
x
Reference in New Issue
Block a user