diff --git a/menu/menu_entries_cbs_title.c b/menu/menu_entries_cbs_title.c index f14e674b3c..eaa9ea1821 100644 --- a/menu/menu_entries_cbs_title.c +++ b/menu/menu_entries_cbs_title.c @@ -46,7 +46,6 @@ static int action_get_title_default(const char *path, const char *label, struct string_list *list_label = string_split(label, "|"); struct string_list *list_path = string_split(path, "|"); driver_t *driver = driver_get_ptr(); - rarch_setting_t *setting = NULL; *elem0 = *elem1 = *elem0_path = *elem1_path = 0; @@ -78,22 +77,6 @@ static int action_get_title_default(const char *path, const char *label, RARCH_LOG("label %s, elem0 %s, elem1 %s\n", label, elem0, elem1); #endif - setting = menu_setting_find(label); - - if (setting) - { - if (!strcmp(setting->parent_group, "Main Menu") && setting->type == ST_GROUP) - { - strlcpy(s, string_to_upper(elem0), len); - if (elem1[0] != '\0') - { - strlcat(s, " - ", len); - strlcat(s, string_to_upper(elem1), len); - } - return 0; - } - } - switch (label_hash) { case MENU_LABEL_DEFERRED_DATABASE_MANAGER_LIST: @@ -327,15 +310,60 @@ static int action_get_title_default(const char *path, const char *label, return 0; } +static int action_get_title_group_settings(const char *path, const char *label, + unsigned menu_type, char *s, size_t len) +{ + char elem0[PATH_MAX_LENGTH], elem1[PATH_MAX_LENGTH]; + struct string_list *list_label = string_split(label, "|"); + + if (list_label) + { + if (list_label->size > 0) + { + strlcpy(elem0, list_label->elems[0].data, sizeof(elem0)); + if (list_label->size > 1) + strlcpy(elem1, list_label->elems[1].data, sizeof(elem1)); + } + string_list_free(list_label); + } + + strlcpy(s, string_to_upper(elem0), len); + if (elem1[0] != '\0') + { + strlcat(s, " - ", len); + strlcat(s, string_to_upper(elem1), len); + } + return 0; +} + int menu_entries_cbs_init_bind_title(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, const char *elem0, const char *elem1, uint32_t label_hash, uint32_t menu_label_hash) { + driver_t *driver = driver_get_ptr(); + rarch_setting_t *setting = NULL; + if (!cbs) return -1; cbs->action_get_title = action_get_title_default; +#if 0 + RARCH_LOG("label %s, elem0 %s, elem1 %s\n", label, elem0, elem1); +#endif + + setting = menu_setting_find(label); + + (void)setting; + if (setting) + { + if (!strcmp(setting->parent_group, "Main Menu") && setting->type == ST_GROUP) + { + cbs->action_get_title = action_get_title_group_settings; + return 0; + } + } + return -1; }