mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 10:40:39 +00:00
(menu_entries) Create action_title_cache
This commit is contained in:
parent
bf03395040
commit
bb6a42f8f0
@ -43,7 +43,7 @@ static int action_get_title_action_generic(const char *path, const char *label,
|
||||
{
|
||||
sanitize_to_string(s, label, len);
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define default_title_macro(func_name, lbl) \
|
||||
@ -54,7 +54,7 @@ static int action_get_title_action_generic(const char *path, const char *label,
|
||||
{ \
|
||||
sanitize_to_string(s, str, len); \
|
||||
} \
|
||||
return 0; \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define default_fill_title_macro(func_name, lbl) \
|
||||
@ -63,14 +63,14 @@ static int action_get_title_action_generic(const char *path, const char *label,
|
||||
const char *title = msg_hash_to_str(lbl); \
|
||||
if (!string_is_empty(path) && !string_is_empty(title)) \
|
||||
fill_pathname_join_delim(s, title, path, ' ', len); \
|
||||
return 0; \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define default_title_copy_macro(func_name, lbl) \
|
||||
static int (func_name)(const char *path, const char *label, unsigned menu_type, char *s, size_t len) \
|
||||
{ \
|
||||
strlcpy(s, msg_hash_to_str(lbl), len); \
|
||||
return 0; \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
static int action_get_title_dropdown_item(const char *path, const char *label, unsigned menu_type, char *s, size_t len)
|
||||
|
@ -895,7 +895,18 @@ int menu_entries_get_title(char *s, size_t len)
|
||||
menu_entries_get_last_stack(&path, &label, &menu_type, &enum_idx, NULL);
|
||||
|
||||
if (cbs && cbs->action_get_title)
|
||||
return cbs->action_get_title(path, label, menu_type, s, len);
|
||||
{
|
||||
int ret;
|
||||
if (!string_is_empty(cbs->action_title_cache))
|
||||
{
|
||||
strlcpy(s, cbs->action_title_cache, len);
|
||||
return 0;
|
||||
}
|
||||
ret = cbs->action_get_title(path, label, menu_type, s, len);
|
||||
if (ret == 1)
|
||||
strlcpy(cbs->action_title_cache, s, sizeof(cbs->action_title_cache));
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ typedef struct menu_ctx_list
|
||||
typedef struct menu_file_list_cbs
|
||||
{
|
||||
char action_sublabel_cache[512];
|
||||
char action_title_cache [512];
|
||||
|
||||
enum msg_hash_enums enum_idx;
|
||||
const char *action_iterate_ident;
|
||||
|
Loading…
Reference in New Issue
Block a user