Add representation to state slot setting

This commit is contained in:
twinaphex 2018-09-25 15:22:25 +02:00
parent 1e10ab1ab6
commit 839940b4bb
2 changed files with 14 additions and 25 deletions

View File

@ -751,27 +751,6 @@ static void menu_action_setting_disp_set_label_entry(
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_state(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
settings_t *settings = config_get_ptr();
if (!settings)
return;
strlcpy(s2, path, len2);
*w = 16;
snprintf(s, len, "%d", settings->ints.state_slot);
if (settings->ints.state_slot == -1)
strlcat(s, " (Auto)", len);
}
static void menu_action_setting_disp_set_label_wifi_is_online(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
@ -1366,10 +1345,6 @@ static int menu_cbs_init_bind_get_string_representation_compare_label(
case MENU_ENUM_LABEL_MENU_DRIVER:
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label);
break;
case MENU_ENUM_LABEL_STATE_SLOT:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_state);
break;
case MENU_ENUM_LABEL_CONNECT_WIFI:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_wifi_is_online);

View File

@ -175,6 +175,18 @@ static int setting_action_ok_uint(void *data, bool wraparound)
return 0;
}
static void setting_get_string_representation_state_slot(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return;
snprintf(s, len, "%d", *setting->value.target.integer);
if (*setting->value.target.integer == -1)
strlcat(s, " (Auto)", len);
}
static void setting_get_string_representation_float_video_msg_color(void *data,
char *s, size_t len)
{
@ -2945,6 +2957,8 @@ static bool setting_append_list(
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].offset_by = -1;
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_state_slot;
menu_settings_list_current_add_range(list, list_info, -1, 0, 1, true, false);
CONFIG_ACTION(