diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 73bdb20e09..c83454bd8d 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -303,12 +303,17 @@ static void glui_render_menu_list(runloop_t *runloop, char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH], entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH]; + unsigned type = 0; unsigned w = 0; bool selected = false; - menu_display_setting_label(i, &w, label, + menu_display_setting_label(i, + &w, &type, + label, type_str, sizeof(type_str), - path_buf, sizeof(path_buf)); + path_buf, sizeof(path_buf), + NULL, 0, + NULL); selected = (i == menu->navigation.selection_ptr); diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 1e33745001..7cc29a1b8a 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -491,12 +491,17 @@ static void rgui_render(void) char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH], entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH]; - unsigned w = 0; + unsigned type = 0; + unsigned w = 0; bool selected = false; - menu_display_setting_label(i, &w, label, + menu_display_setting_label(i, + &w, &type, + label, type_str, sizeof(type_str), - path_buf, sizeof(path_buf)); + path_buf, sizeof(path_buf), + NULL, 0, + NULL); selected = (i == menu->navigation.selection_ptr); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index ed807844e1..efb6cddb6c 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -999,11 +999,11 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl, { GLuint texture_switch = 0; float icon_x, icon_y; + char entry_label_buf[PATH_MAX_LENGTH]; char type_str[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH]; char name[PATH_MAX_LENGTH], value[PATH_MAX_LENGTH]; - const char *path = NULL, *entry_label = NULL; - unsigned type = 0, w = 0; - menu_file_list_cbs_t *cbs = NULL; + unsigned type = 0; + unsigned w = 0; GLuint icon = 0; xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(list, i); runloop_t *runloop = rarch_main_get_ptr(); @@ -1023,41 +1023,38 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl, icon_y > global->video_data.height + xmb->icon.size) continue; - menu_list_get_at_offset(list, i, &path, &entry_label, &type); - - cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(list, i); - - if (cbs && cbs->action_get_representation) - cbs->action_get_representation(list, - &w, type, i, label, - type_str, sizeof(type_str), - entry_label, path, - path_buf, sizeof(path_buf)); + menu_display_setting_label(i, + &w, &type, + label, + type_str, sizeof(type_str), + path_buf, sizeof(path_buf), + entry_label_buf, sizeof(entry_label_buf), + list); if (type == MENU_FILE_CONTENTLIST_ENTRY) strlcpy(path_buf, path_basename(path_buf), sizeof(path_buf)); icon = xmb_icon_get_type(xmb, core_node, type); - if (!strcmp(entry_label, "core_options")) + if (!strcmp(entry_label_buf, "core_options")) icon = xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS].id; - else if (!strcmp(entry_label, "core_information")) + else if (!strcmp(entry_label_buf, "core_information")) icon = xmb->textures.list[XMB_TEXTURE_CORE_INFO].id; - else if (!strcmp(entry_label, "core_input_remapping_options")) + else if (!strcmp(entry_label_buf, "core_input_remapping_options")) icon = xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS].id; - else if (!strcmp(entry_label, "core_cheat_options")) + else if (!strcmp(entry_label_buf, "core_cheat_options")) icon = xmb->textures.list[XMB_TEXTURE_CHEAT_OPTIONS].id; - else if (!strcmp(entry_label, "core_disk_options")) + else if (!strcmp(entry_label_buf, "core_disk_options")) icon = xmb->textures.list[XMB_TEXTURE_DISK_OPTIONS].id; - else if (!strcmp(entry_label, "savestate")) + else if (!strcmp(entry_label_buf, "savestate")) icon = xmb->textures.list[XMB_TEXTURE_SAVESTATE].id; - else if (!strcmp(entry_label, "loadstate")) + else if (!strcmp(entry_label_buf, "loadstate")) icon = xmb->textures.list[XMB_TEXTURE_LOADSTATE].id; - else if (!strcmp(entry_label, "take_screenshot")) + else if (!strcmp(entry_label_buf, "take_screenshot")) icon = xmb->textures.list[XMB_TEXTURE_SCREENSHOT].id; - else if (!strcmp(entry_label, "restart_content")) + else if (!strcmp(entry_label_buf, "restart_content")) icon = xmb->textures.list[XMB_TEXTURE_RELOAD].id; - else if (!strcmp(entry_label, "resume_content")) + else if (!strcmp(entry_label_buf, "resume_content")) icon = xmb->textures.list[XMB_TEXTURE_RESUME].id; diff --git a/menu/menu_display.c b/menu/menu_display.c index 2ee67a336d..d1854beec7 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -20,6 +20,7 @@ #include "../../retroarch.h" #include "../../config.def.h" #include "../gfx/video_context_driver.h" +#include "menu_list.h" bool menu_display_update_pending(void) { @@ -207,28 +208,34 @@ void menu_display_unset_viewport(menu_handle_t *menu) global->video_data.height, false, true); } -void menu_display_setting_label(unsigned i, unsigned *w, +void menu_display_setting_label(unsigned i, + unsigned *w, unsigned *type, const char *label, char *type_str, size_t sizeof_type_str, - char *path_buf, size_t sizeof_path_buf) + char *path_buf, size_t sizeof_path_buf, + char *entry_label_buf, size_t sizeof_entry_label_buf, + void *userdata) { - unsigned type = 0; - const char *path = NULL; const char *entry_label = NULL; + const char *path = NULL; menu_file_list_cbs_t *cbs = NULL; menu_handle_t *menu = menu_driver_get_ptr(); + file_list_t *list = userdata ? (file_list_t*)userdata + : menu->menu_list->selection_buf; - menu_list_get_at_offset(menu->menu_list->selection_buf, i, &path, - &entry_label, &type); + menu_list_get_at_offset(list, i, &path, &entry_label, type); cbs = (menu_file_list_cbs_t*) - menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf, + menu_list_get_actiondata_at_offset(list, i); if (cbs && cbs->action_get_representation) - cbs->action_get_representation(menu->menu_list->selection_buf, - w, type, i, label, + cbs->action_get_representation(list, + w, *type, i, label, type_str, sizeof_type_str, entry_label, path, path_buf, sizeof_path_buf); + + if (entry_label && entry_label_buf != NULL) + strlcpy(entry_label_buf, entry_label, sizeof_entry_label_buf); } diff --git a/menu/menu_display.h b/menu/menu_display.h index c712482ca8..3cb6ce2912 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -53,10 +53,13 @@ void menu_display_set_viewport(menu_handle_t *menu); void menu_display_unset_viewport(menu_handle_t *menu); -void menu_display_setting_label(unsigned i, unsigned *w, +void menu_display_setting_label(unsigned i, + unsigned *w, unsigned *type, const char *label, char *type_str, size_t sizeof_type_str, - char *path_buf, size_t sizeof_path_buf); + char *path_buf, size_t sizeof_path_buf, + char *entry_label_buf, size_t sizeof_entry_label_buf, + void *userdata); #ifdef __cplusplus }