mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 13:20:30 +00:00
Simplify menu_entry_get_rich_label
This commit is contained in:
parent
2f10fd14d6
commit
c5255b1bff
@ -996,6 +996,7 @@ static void mui_render_menu_list(
|
||||
|
||||
for (i = 0; i < entries_end; i++)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
char rich_label[255];
|
||||
char entry_value[255];
|
||||
bool entry_selected = false;
|
||||
@ -1014,8 +1015,10 @@ static void mui_render_menu_list(
|
||||
if (y > (int)height)
|
||||
break;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, (unsigned)i, NULL, true);
|
||||
menu_entry_get_value((unsigned)i, NULL, entry_value, sizeof(entry_value));
|
||||
menu_entry_get_rich_label((unsigned)i, rich_label, sizeof(rich_label));
|
||||
menu_entry_get_rich_label(&entry, rich_label, sizeof(rich_label));
|
||||
|
||||
entry_selected = selection == i;
|
||||
|
||||
@ -1036,6 +1039,8 @@ static void mui_render_menu_list(
|
||||
menu_list_color,
|
||||
sublabel_color
|
||||
);
|
||||
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,6 +566,7 @@ static void rgui_render(void *data, bool is_idle)
|
||||
|
||||
for (; i < end; i++, y += FONT_HEIGHT_STRIDE)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
menu_animation_ctx_ticker_t ticker;
|
||||
char entry_path[255];
|
||||
char entry_value[255];
|
||||
@ -586,8 +587,11 @@ static void rgui_render(void *data, bool is_idle)
|
||||
entry_title_buf[0] = '\0';
|
||||
type_str_buf[0] = '\0';
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, (unsigned)i, NULL, true);
|
||||
|
||||
menu_entry_get_value((unsigned)i, NULL, entry_value, sizeof(entry_value));
|
||||
menu_entry_get_rich_label((unsigned)i, entry_path, sizeof(entry_path));
|
||||
menu_entry_get_rich_label(&entry, entry_path, sizeof(entry_path));
|
||||
|
||||
ticker.s = entry_title_buf;
|
||||
ticker.len = RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2);
|
||||
@ -617,6 +621,8 @@ static void rgui_render(void *data, bool is_idle)
|
||||
if (rgui_framebuf_data)
|
||||
blit_line(x, y, message,
|
||||
entry_selected ? hover_color : normal_color);
|
||||
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
|
||||
if (menu_input_dialog_get_display_kb())
|
||||
|
@ -2442,7 +2442,7 @@ static void xmb_draw_items(
|
||||
ticker_limit = 70;
|
||||
}
|
||||
|
||||
menu_entry_get_rich_label((unsigned)i, ticker_str, sizeof(ticker_str));
|
||||
menu_entry_get_rich_label(&entry, ticker_str, sizeof(ticker_str));
|
||||
|
||||
ticker.s = tmp;
|
||||
ticker.len = ticker_limit;
|
||||
|
@ -522,7 +522,7 @@ static int zarch_zui_render_lay_root_recent(
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, i, NULL, true);
|
||||
menu_entry_get_rich_label(i, rich_label, sizeof(rich_label));
|
||||
menu_entry_get_rich_label(&entry, rich_label, sizeof(rich_label));
|
||||
menu_entry_get_value(i, NULL, entry_value,sizeof(entry_value));
|
||||
|
||||
if (zarch_zui_list_item(
|
||||
|
@ -103,17 +103,14 @@ void menu_entry_get_path(uint32_t i, char *s, size_t len)
|
||||
strlcpy(s, entry.path, len);
|
||||
}
|
||||
|
||||
void menu_entry_get_rich_label(uint32_t i, char *s, size_t len)
|
||||
void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, i, NULL, true);
|
||||
|
||||
if (!string_is_empty(entry.rich_label))
|
||||
strlcpy(s, entry.rich_label, len);
|
||||
if (!entry)
|
||||
return;
|
||||
if (!string_is_empty(entry->rich_label))
|
||||
strlcpy(s, entry->rich_label, len);
|
||||
else
|
||||
strlcpy(s, entry.path, len);
|
||||
strlcpy(s, entry->path, len);
|
||||
}
|
||||
|
||||
bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len)
|
||||
@ -320,10 +317,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
||||
const char *entry_label = NULL;
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(stack_idx);
|
||||
file_list_t *list = selection_buf;
|
||||
|
||||
if (userdata)
|
||||
list = (file_list_t*)userdata;
|
||||
file_list_t *list = (userdata) ? (file_list_t*)userdata : selection_buf;
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
@ -338,7 +332,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
||||
const char *label = NULL;
|
||||
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
|
||||
|
||||
entry->enum_idx = cbs->enum_idx;
|
||||
entry->enum_idx = cbs->enum_idx;
|
||||
|
||||
menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL);
|
||||
|
||||
|
@ -93,7 +93,7 @@ void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len);
|
||||
|
||||
void menu_entry_reset(uint32_t i);
|
||||
|
||||
void menu_entry_get_rich_label(uint32_t i, char *s, size_t len);
|
||||
void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len);
|
||||
|
||||
bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user