mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Start implementing dropdown list for resolution - Win32 right now at first - now need to make OK button do something
This commit is contained in:
parent
ab8e02617d
commit
7730828560
@ -282,38 +282,43 @@ static bool win32_display_server_set_resolution(void *data,
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned win32_display_server_get_resolution_list(void *data,
|
||||
struct video_display_config **conf)
|
||||
void *win32_display_server_get_resolution_list(void *data,
|
||||
unsigned *len)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned len = 0;
|
||||
unsigned i, count = 0;
|
||||
struct video_display_config *conf = NULL;
|
||||
|
||||
for (i = 0;; i++)
|
||||
{
|
||||
void *optr = NULL;
|
||||
DEVMODE dm;
|
||||
|
||||
if (!win32_get_video_output(&dm, i, sizeof(dm)))
|
||||
continue;
|
||||
break;
|
||||
|
||||
len++;
|
||||
|
||||
if (*conf)
|
||||
optr = realloc(*conf, len);
|
||||
else
|
||||
optr = malloc(len);
|
||||
|
||||
if (optr)
|
||||
*conf = optr;
|
||||
|
||||
conf[i]->width = dm.dmPelsWidth;
|
||||
conf[i]->height = dm.dmPelsHeight;
|
||||
conf[i]->bpp = dm.dmBitsPerPel;
|
||||
conf[i]->refreshrate = dm.dmDisplayFrequency;
|
||||
conf[i]->idx = i;
|
||||
count++;
|
||||
}
|
||||
|
||||
return len;
|
||||
*len = count;
|
||||
conf = (struct video_display_config*)calloc(*len, sizeof(struct video_display_config));
|
||||
|
||||
if (!conf)
|
||||
return NULL;
|
||||
|
||||
for (i = 0;; i++)
|
||||
{
|
||||
DEVMODE dm;
|
||||
|
||||
if (!win32_get_video_output(&dm, i, sizeof(dm)))
|
||||
break;
|
||||
|
||||
conf[i].width = dm.dmPelsWidth;
|
||||
conf[i].height = dm.dmPelsHeight;
|
||||
conf[i].bpp = dm.dmBitsPerPel;
|
||||
conf[i].refreshrate = dm.dmDisplayFrequency;
|
||||
conf[i].idx = i;
|
||||
}
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
const video_display_server_t dispserv_win32 = {
|
||||
|
@ -98,11 +98,11 @@ bool video_display_server_switch_resolution(unsigned width, unsigned height,
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned video_display_server_get_resolution_list(struct video_display_config **list)
|
||||
void *video_display_server_get_resolution_list(unsigned *size)
|
||||
{
|
||||
if (current_display_server && current_display_server->get_resolution_list)
|
||||
return current_display_server->get_resolution_list(current_display_server_data, list);
|
||||
return 0;
|
||||
return current_display_server->get_resolution_list(current_display_server_data, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *video_display_server_get_output_options(void)
|
||||
|
@ -42,8 +42,8 @@ typedef struct video_display_server
|
||||
bool (*set_window_decorations)(void *data, bool on);
|
||||
bool (*switch_resolution)(void *data, unsigned width,
|
||||
unsigned height, int int_hz, float hz, int center);
|
||||
unsigned (*get_resolution_list)(void *data,
|
||||
struct video_display_config **conf);
|
||||
void *(*get_resolution_list)(void *data,
|
||||
unsigned *size);
|
||||
const char *(*get_output_options)(void *data);
|
||||
const char *ident;
|
||||
} video_display_server_t;
|
||||
@ -62,8 +62,7 @@ bool video_display_server_switch_resolution(
|
||||
unsigned width, unsigned height,
|
||||
int int_hz, float hz, int center);
|
||||
|
||||
unsigned video_display_server_get_resolution_list(
|
||||
struct video_display_config **list);
|
||||
void *video_display_server_get_resolution_list(unsigned *size);
|
||||
|
||||
const char *video_display_server_get_output_options(void);
|
||||
|
||||
|
@ -1491,15 +1491,6 @@ void video_driver_menu_settings(void **list_data, void *list_info_data,
|
||||
(void)subgroup_info;
|
||||
(void)global;
|
||||
|
||||
#if defined(GEKKO) || defined(__CELLOS_LV2__)
|
||||
CONFIG_ACTION(
|
||||
list, list_info,
|
||||
MENU_ENUM_LABEL_SCREEN_RESOLUTION,
|
||||
MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION,
|
||||
group_info,
|
||||
subgroup_info,
|
||||
parent_group);
|
||||
#endif
|
||||
#if defined(__CELLOS_LV2__)
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
|
@ -259,6 +259,8 @@ MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST,
|
||||
"deferred_dropdown_box_list")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL,
|
||||
"deferred_dropdown_box_list_special")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION,
|
||||
"deferred_dropdown_box_list_resolution")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST,
|
||||
"deferred_configurations_list")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST,
|
||||
|
@ -613,6 +613,7 @@ generic_deferred_push_clear_general(deferred_image_history_list, PUSH_DEFAULT, D
|
||||
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)
|
||||
generic_deferred_push_clear_general(deferred_push_dropdown_box_list_special, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_SPECIAL)
|
||||
generic_deferred_push_clear_general(deferred_push_dropdown_box_list_resolution, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_RESOLUTION)
|
||||
|
||||
static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
menu_file_list_cbs_t *cbs,
|
||||
@ -633,6 +634,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_dropdown_box_list_special);
|
||||
return 0;
|
||||
}
|
||||
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION)))
|
||||
{
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_dropdown_box_list_resolution);
|
||||
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);
|
||||
|
@ -150,6 +150,8 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
|
||||
return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST;
|
||||
case ACTION_OK_DL_DROPDOWN_BOX_LIST_SPECIAL:
|
||||
return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL;
|
||||
case ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION:
|
||||
return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION;
|
||||
case ACTION_OK_DL_MIXER_STREAM_SETTINGS_LIST:
|
||||
return MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST;
|
||||
case ACTION_OK_DL_ACCOUNTS_LIST:
|
||||
@ -323,6 +325,15 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL;
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION:
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = path;
|
||||
info_label = msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION);
|
||||
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION;
|
||||
dl_type = DISPLAYLIST_GENERIC;
|
||||
break;
|
||||
case ACTION_OK_DL_USER_BINDS_LIST:
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
@ -4449,6 +4460,18 @@ static int action_ok_push_dropdown_item(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_push_dropdown_item_resolution(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_push_default(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -4587,6 +4610,7 @@ default_action_ok_help(action_ok_help_load_content, MENU_ENUM_LABEL_HELP_LOADING
|
||||
static int action_ok_video_resolution(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#if defined(__CELLOS_LV2__) || defined(GEKKO)
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
|
||||
@ -4610,6 +4634,12 @@ static int action_ok_video_resolution(const char *path,
|
||||
width, height);
|
||||
runloop_msg_queue_push(msg, 1, 100, true);
|
||||
}
|
||||
#else
|
||||
generic_action_ok_displaylist_push(
|
||||
NULL,
|
||||
NULL, NULL, 0, 0, 0,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -5555,6 +5585,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_SETTING_DROPDOWN_ITEM:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_item);
|
||||
break;
|
||||
case MENU_SETTING_DROPDOWN_ITEM_RESOLUTION:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_dropdown_item_resolution);
|
||||
break;
|
||||
case MENU_SETTING_ACTION_CORE_DISK_OPTIONS:
|
||||
BIND_ACTION_OK(cbs, action_ok_push_default);
|
||||
break;
|
||||
|
@ -1251,6 +1251,12 @@ int menu_cbs_init_bind_title(menu_file_list_cbs_t *cbs,
|
||||
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_DROPDOWN_BOX_LIST_RESOLUTION)))
|
||||
{
|
||||
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);
|
||||
|
@ -45,6 +45,7 @@ enum
|
||||
ACTION_OK_DL_DEFAULT = 0,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST_SPECIAL,
|
||||
ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION,
|
||||
ACTION_OK_DL_OPEN_ARCHIVE,
|
||||
ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE,
|
||||
ACTION_OK_DL_MUSIC,
|
||||
|
@ -8322,56 +8322,201 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
|
||||
info->need_push = true;
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_DROPDOWN_LIST_SPECIAL:
|
||||
case DISPLAYLIST_DROPDOWN_LIST_RESOLUTION:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
{
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
unsigned i, size = 0;
|
||||
struct video_display_config *list = video_display_server_get_resolution_list(&size);
|
||||
|
||||
if (strstr(info->path, "core_option_"))
|
||||
if (list)
|
||||
{
|
||||
struct string_list *tmp_str_list = string_split(info->path, "_");
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
char val_d[256], str[256];
|
||||
snprintf(str, sizeof(str), "%dx%d (%dHz)", list[i].width, list[i].height, list[i].refreshrate);
|
||||
snprintf(val_d, sizeof(val_d), "%d", i);
|
||||
menu_entries_append_enum(info->list,
|
||||
str,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_ITEM_RESOLUTION, list[i].idx, 0);
|
||||
}
|
||||
|
||||
rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts);
|
||||
free(list);
|
||||
}
|
||||
else
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY),
|
||||
MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY,
|
||||
FILE_TYPE_NONE, 0, 0);
|
||||
|
||||
if (coreopts)
|
||||
}
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_DROPDOWN_LIST_SPECIAL:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
if (strstr(info->path, "core_option_"))
|
||||
{
|
||||
struct string_list *tmp_str_list = string_split(info->path, "_");
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
{
|
||||
core_option_manager_t *coreopts = NULL;
|
||||
|
||||
rarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts);
|
||||
|
||||
if (coreopts)
|
||||
{
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
unsigned i = atoi(tmp_str_list->elems[size-1].data);
|
||||
struct core_option *option = NULL;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
const char *val = core_option_manager_get_val(coreopts, i-1);
|
||||
|
||||
i--;
|
||||
|
||||
option = (struct core_option*)&coreopts->opts[i];
|
||||
|
||||
if (option)
|
||||
{
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
unsigned i = atoi(tmp_str_list->elems[size-1].data);
|
||||
struct core_option *option = NULL;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
const char *val = core_option_manager_get_val(coreopts, i-1);
|
||||
|
||||
i--;
|
||||
|
||||
option = (struct core_option*)&coreopts->opts[i];
|
||||
|
||||
if (option)
|
||||
unsigned k;
|
||||
for (k = 0; k < option->vals->size; k++)
|
||||
{
|
||||
unsigned k;
|
||||
for (k = 0; k < option->vals->size; k++)
|
||||
{
|
||||
const char *str = option->vals->elems[k].data;
|
||||
const char *str = option->vals->elems[k].data;
|
||||
|
||||
if (!string_is_empty(str))
|
||||
if (!string_is_empty(str))
|
||||
{
|
||||
char val_d[256];
|
||||
snprintf(val_d, sizeof(val_d), "%d", i);
|
||||
menu_entries_append_enum(info->list,
|
||||
str,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM_SPECIAL, k, 0);
|
||||
|
||||
if (!checked_found && string_is_equal(str, val))
|
||||
{
|
||||
checked = k;
|
||||
checked_found = true;
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(info->path);
|
||||
rarch_setting_t *setting = menu_setting_find_enum(enum_idx);
|
||||
|
||||
if (setting)
|
||||
{
|
||||
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 = (unsigned)tmp_str_list->size;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
char val_d[256];
|
||||
snprintf(val_d, sizeof(val_d), "%d", i);
|
||||
snprintf(val_d, sizeof(val_d), "%d", setting->enum_idx);
|
||||
menu_entries_append_enum(info->list,
|
||||
str,
|
||||
tmp_str_list->elems[i].data,
|
||||
val_d,
|
||||
MENU_ENUM_LABEL_NO_ITEMS,
|
||||
MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM_SPECIAL, k, 0);
|
||||
MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM_SPECIAL, i, 0);
|
||||
|
||||
if (!checked_found && string_is_equal(str, val))
|
||||
if (!checked_found && string_is_equal(tmp_str_list->elems[i].data, setting->value.target.string))
|
||||
{
|
||||
checked = k;
|
||||
checked = i;
|
||||
checked_found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ST_INT:
|
||||
{
|
||||
float i;
|
||||
int32_t orig_value = *setting->value.target.integer;
|
||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM_SPECIAL;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : 999.00;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
if (setting->get_string_representation)
|
||||
{
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
char val_s[256], val_d[256];
|
||||
int val = (int)i;
|
||||
|
||||
*setting->value.target.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,
|
||||
setting_type, val, 0);
|
||||
|
||||
if (!checked_found && val == orig_value)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
*setting->value.target.integer = orig_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = min; 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,
|
||||
setting_type, val, 0);
|
||||
|
||||
if (!checked_found && val == orig_value)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -8379,263 +8524,149 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ST_FLOAT:
|
||||
{
|
||||
float i;
|
||||
float orig_value = *setting->value.target.fraction;
|
||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM_SPECIAL;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : 999.00;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(info->path);
|
||||
rarch_setting_t *setting = menu_setting_find_enum(enum_idx);
|
||||
|
||||
if (setting)
|
||||
{
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_STRING_OPTIONS:
|
||||
if (setting->get_string_representation)
|
||||
{
|
||||
struct string_list *tmp_str_list = string_split(setting->values, "|");
|
||||
|
||||
if (tmp_str_list && tmp_str_list->size > 0)
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned size = (unsigned)tmp_str_list->size;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
char val_s[256], val_d[256];
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
*setting->value.target.fraction = i;
|
||||
|
||||
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,
|
||||
setting_type, 0, 0);
|
||||
|
||||
if (!checked_found && fabs(i - orig_value) <= 0.01f)
|
||||
{
|
||||
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_SPECIAL, i, 0);
|
||||
|
||||
if (!checked_found && string_is_equal(tmp_str_list->elems[i].data, setting->value.target.string))
|
||||
{
|
||||
checked = i;
|
||||
checked_found = true;
|
||||
}
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
*setting->value.target.fraction = orig_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
char val_s[16], val_d[16];
|
||||
|
||||
snprintf(val_s, sizeof(val_s), "%.2f", i);
|
||||
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,
|
||||
setting_type, 0, 0);
|
||||
|
||||
if (!checked_found && fabs(i - orig_value) <= 0.01f)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ST_INT:
|
||||
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
break;
|
||||
case ST_UINT:
|
||||
{
|
||||
float i;
|
||||
unsigned orig_value = *setting->value.target.unsigned_integer;
|
||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : 999.00;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
if (setting->get_string_representation)
|
||||
{
|
||||
float i;
|
||||
int32_t orig_value = *setting->value.target.integer;
|
||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_INT_ITEM_SPECIAL;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : 999.00;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
if (setting->get_string_representation)
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
for (i = min; i <= max; i += step)
|
||||
char val_s[256], val_d[256];
|
||||
int val = (int)i;
|
||||
|
||||
*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,
|
||||
setting_type, val, 0);
|
||||
|
||||
if (!checked_found && val == orig_value)
|
||||
{
|
||||
char val_s[256], val_d[256];
|
||||
int val = (int)i;
|
||||
|
||||
*setting->value.target.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,
|
||||
setting_type, val, 0);
|
||||
|
||||
if (!checked_found && val == orig_value)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
*setting->value.target.integer = orig_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = min; 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,
|
||||
setting_type, val, 0);
|
||||
|
||||
if (!checked_found && val == orig_value)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
*setting->value.target.unsigned_integer = orig_value;
|
||||
}
|
||||
break;
|
||||
case ST_FLOAT:
|
||||
else
|
||||
{
|
||||
float i;
|
||||
float orig_value = *setting->value.target.fraction;
|
||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM_SPECIAL;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : 999.00;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
if (setting->get_string_representation)
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
for (i = min; 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,
|
||||
setting_type, val, 0);
|
||||
|
||||
if (!checked_found && val == orig_value)
|
||||
{
|
||||
char val_s[256], val_d[256];
|
||||
|
||||
*setting->value.target.fraction = i;
|
||||
|
||||
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,
|
||||
setting_type, 0, 0);
|
||||
|
||||
if (!checked_found && fabs(i - orig_value) <= 0.01f)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
|
||||
*setting->value.target.fraction = orig_value;
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
char val_s[16], val_d[16];
|
||||
|
||||
snprintf(val_s, sizeof(val_s), "%.2f", i);
|
||||
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,
|
||||
setting_type, 0, 0);
|
||||
|
||||
if (!checked_found && fabs(i - orig_value) <= 0.01f)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
break;
|
||||
case ST_UINT:
|
||||
{
|
||||
float i;
|
||||
unsigned orig_value = *setting->value.target.unsigned_integer;
|
||||
unsigned setting_type = MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL;
|
||||
float step = setting->step;
|
||||
double min = setting->enforce_minrange ? setting->min : 0.00;
|
||||
double max = setting->enforce_maxrange ? setting->max : 999.00;
|
||||
bool checked_found = false;
|
||||
unsigned checked = 0;
|
||||
|
||||
if (setting->get_string_representation)
|
||||
{
|
||||
for (i = min; i <= max; i += step)
|
||||
{
|
||||
char val_s[256], val_d[256];
|
||||
int val = (int)i;
|
||||
|
||||
*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,
|
||||
setting_type, val, 0);
|
||||
|
||||
if (!checked_found && val == orig_value)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
*setting->value.target.unsigned_integer = orig_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = min; 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,
|
||||
setting_type, val, 0);
|
||||
|
||||
if (!checked_found && val == orig_value)
|
||||
{
|
||||
checked = count;
|
||||
checked_found = true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (checked_found)
|
||||
menu_entries_set_checked(info->list, checked, true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
}
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_NONE:
|
||||
break;
|
||||
|
@ -56,6 +56,7 @@ enum menu_displaylist_ctl_state
|
||||
DISPLAYLIST_NONE = 0,
|
||||
DISPLAYLIST_DROPDOWN_LIST,
|
||||
DISPLAYLIST_DROPDOWN_LIST_SPECIAL,
|
||||
DISPLAYLIST_DROPDOWN_LIST_RESOLUTION,
|
||||
DISPLAYLIST_INFO,
|
||||
DISPLAYLIST_HELP,
|
||||
DISPLAYLIST_HELP_SCREEN_LIST,
|
||||
|
@ -143,6 +143,7 @@ enum menu_settings_type
|
||||
MENU_ADD_TAB,
|
||||
MENU_PLAYLISTS_TAB,
|
||||
MENU_SETTING_DROPDOWN_ITEM,
|
||||
MENU_SETTING_DROPDOWN_ITEM_RESOLUTION,
|
||||
MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM,
|
||||
MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM,
|
||||
|
@ -5381,6 +5381,14 @@ static bool setting_append_list(
|
||||
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
|
||||
|
||||
CONFIG_ACTION(
|
||||
list, list_info,
|
||||
MENU_ENUM_LABEL_SCREEN_RESOLUTION,
|
||||
MENU_ENUM_LABEL_VALUE_SCREEN_RESOLUTION,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&custom_vp->width,
|
||||
|
@ -1015,6 +1015,7 @@ enum msg_hash_enums
|
||||
/* Deferred */
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST,
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL,
|
||||
MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION,
|
||||
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