(GLUI/XMB) Use menu_display_setting_label too

This commit is contained in:
twinaphex 2015-05-05 20:09:29 +02:00
parent 06aa0126ab
commit 89b313da0c
5 changed files with 56 additions and 39 deletions

View File

@ -303,12 +303,17 @@ static void glui_render_menu_list(runloop_t *runloop,
char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH], char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH], entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
path_buf[PATH_MAX_LENGTH]; path_buf[PATH_MAX_LENGTH];
unsigned type = 0;
unsigned w = 0; unsigned w = 0;
bool selected = false; bool selected = false;
menu_display_setting_label(i, &w, label, menu_display_setting_label(i,
&w, &type,
label,
type_str, sizeof(type_str), type_str, sizeof(type_str),
path_buf, sizeof(path_buf)); path_buf, sizeof(path_buf),
NULL, 0,
NULL);
selected = (i == menu->navigation.selection_ptr); selected = (i == menu->navigation.selection_ptr);

View File

@ -491,12 +491,17 @@ static void rgui_render(void)
char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH], char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH], entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
path_buf[PATH_MAX_LENGTH]; path_buf[PATH_MAX_LENGTH];
unsigned w = 0; unsigned type = 0;
unsigned w = 0;
bool selected = false; bool selected = false;
menu_display_setting_label(i, &w, label, menu_display_setting_label(i,
&w, &type,
label,
type_str, sizeof(type_str), type_str, sizeof(type_str),
path_buf, sizeof(path_buf)); path_buf, sizeof(path_buf),
NULL, 0,
NULL);
selected = (i == menu->navigation.selection_ptr); selected = (i == menu->navigation.selection_ptr);

View File

@ -999,11 +999,11 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
{ {
GLuint texture_switch = 0; GLuint texture_switch = 0;
float icon_x, icon_y; float icon_x, icon_y;
char entry_label_buf[PATH_MAX_LENGTH];
char type_str[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH]; char type_str[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH];
char name[PATH_MAX_LENGTH], value[PATH_MAX_LENGTH]; char name[PATH_MAX_LENGTH], value[PATH_MAX_LENGTH];
const char *path = NULL, *entry_label = NULL; unsigned type = 0;
unsigned type = 0, w = 0; unsigned w = 0;
menu_file_list_cbs_t *cbs = NULL;
GLuint icon = 0; GLuint icon = 0;
xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(list, i); xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(list, i);
runloop_t *runloop = rarch_main_get_ptr(); 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) icon_y > global->video_data.height + xmb->icon.size)
continue; continue;
menu_list_get_at_offset(list, i, &path, &entry_label, &type); menu_display_setting_label(i,
&w, &type,
cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(list, i); label,
type_str, sizeof(type_str),
if (cbs && cbs->action_get_representation) path_buf, sizeof(path_buf),
cbs->action_get_representation(list, entry_label_buf, sizeof(entry_label_buf),
&w, type, i, label, list);
type_str, sizeof(type_str),
entry_label, path,
path_buf, sizeof(path_buf));
if (type == MENU_FILE_CONTENTLIST_ENTRY) if (type == MENU_FILE_CONTENTLIST_ENTRY)
strlcpy(path_buf, path_basename(path_buf), sizeof(path_buf)); strlcpy(path_buf, path_basename(path_buf), sizeof(path_buf));
icon = xmb_icon_get_type(xmb, core_node, type); 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; icon = xmb->textures.list[XMB_TEXTURE_RESUME].id;

View File

@ -20,6 +20,7 @@
#include "../../retroarch.h" #include "../../retroarch.h"
#include "../../config.def.h" #include "../../config.def.h"
#include "../gfx/video_context_driver.h" #include "../gfx/video_context_driver.h"
#include "menu_list.h"
bool menu_display_update_pending(void) 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); 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, const char *label,
char *type_str, size_t sizeof_type_str, 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 *entry_label = NULL;
const char *path = NULL;
menu_file_list_cbs_t *cbs = NULL; menu_file_list_cbs_t *cbs = NULL;
menu_handle_t *menu = menu_driver_get_ptr(); 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, menu_list_get_at_offset(list, i, &path, &entry_label, type);
&entry_label, &type);
cbs = (menu_file_list_cbs_t*) 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); i);
if (cbs && cbs->action_get_representation) if (cbs && cbs->action_get_representation)
cbs->action_get_representation(menu->menu_list->selection_buf, cbs->action_get_representation(list,
w, type, i, label, w, *type, i, label,
type_str, sizeof_type_str, type_str, sizeof_type_str,
entry_label, path, entry_label, path,
path_buf, sizeof_path_buf); path_buf, sizeof_path_buf);
if (entry_label && entry_label_buf != NULL)
strlcpy(entry_label_buf, entry_label, sizeof_entry_label_buf);
} }

View File

@ -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_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, const char *label,
char *type_str, size_t sizeof_type_str, 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 #ifdef __cplusplus
} }