Reimplement string representation for CRT Switch Resolution super

This commit is contained in:
twinaphex 2018-09-25 15:18:51 +02:00
parent b7be322170
commit 1e10ab1ab6
2 changed files with 15 additions and 26 deletions

View File

@ -125,28 +125,6 @@ static void menu_action_setting_disp_set_label_cheevos_locked_entry(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY), len);
}
static void menu_action_setting_disp_set_label_crt_switch_resolution_super(
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();
*w = 19;
strlcpy(s2, path, len2);
if (settings)
{
if (settings->uints.crt_switch_resolution_super == 0)
strlcpy(s, msg_hash_to_str(MSG_NATIVE), len);
else
snprintf(s, len, "%d", settings->uints.crt_switch_resolution_super);
}
}
static void menu_action_setting_disp_set_label_cheevos_unlocked_entry(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
@ -1688,10 +1666,6 @@ int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
{
switch (cbs->enum_idx)
{
case MENU_ENUM_LABEL_CRT_SWITCH_RESOLUTION_SUPER:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_crt_switch_resolution_super);
return 0;
case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_cheevos_unlocked_entry);

View File

@ -627,6 +627,19 @@ static void setting_get_string_representation_int_audio_wasapi_sh_buffer_length(
}
#endif
static void setting_get_string_representation_crt_switch_resolution_super(void *data,
char *s, size_t len)
{
rarch_setting_t *setting = (rarch_setting_t*)data;
if (!setting)
return;
if (*setting->value.target.unsigned_integer == 0)
strlcpy(s, msg_hash_to_str(MSG_NATIVE), len);
else
snprintf(s, len, "%d", *setting->value.target.unsigned_integer);
}
static int setting_uint_action_left_crt_switch_resolution_super(
void *data, bool wraparound)
{
@ -5273,6 +5286,8 @@ static bool setting_append_list(
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
(*list)[list_info->index - 1].action_left = &setting_uint_action_left_crt_switch_resolution_super;
(*list)[list_info->index - 1].action_right = &setting_uint_action_right_crt_switch_resolution_super;
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_crt_switch_resolution_super;
CONFIG_INT(
list, list_info,