From cdbd010726e0d0953059fd718367081dcfbac6b3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 19 Nov 2015 06:55:12 +0100 Subject: [PATCH] Fix label bug to do with CORE_OPTION_CREATE --- menu/cbs/menu_cbs_get_value.c | 39 ++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 18c5675335..fc18ab6800 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -948,6 +948,31 @@ static void menu_action_setting_disp_set_label_menu_file_cheat( path, "(CHEAT)", s2, len2); } +static void menu_action_setting_disp_set_label_core_option_create( + 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) +{ + rarch_system_info_t *system = rarch_system_info_get_ptr(); + global_t *global = global_get_ptr(); + if (!system) + return; + + *s = '\0'; + *w = 19; + + strlcpy(s, "", len); + + if (global->name.base[0] != '\0') + strlcpy(s, path_basename(global->name.base), len); + + strlcpy(s2, path, len2); +} + static void menu_action_setting_disp_set_label(file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, @@ -1033,16 +1058,6 @@ static void menu_action_setting_disp_set_label(file_list_t* list, if (core_opt) strlcpy(s, core_opt, len); } - else if (type >= MENU_SETTINGS_CORE_OPTION_CREATE) - { - if (!system) - return; - - strlcpy(s, "", len); - - if (global->name.base[0] != '\0') - strlcpy(s, path_basename(global->name.base), len); - } else menu_setting_get_label(list, s, len, w, type, label, entry_label, i); @@ -1175,6 +1190,10 @@ static int menu_cbs_init_bind_get_string_representation_compare_type( { switch (type) { + case MENU_SETTINGS_CORE_OPTION_CREATE: + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_core_option_create); + break; case MENU_FILE_CORE: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_menu_file_core);