mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-25 00:49:47 +00:00
Rewrite info.label
This commit is contained in:
parent
72087d1749
commit
08ecfc74ec
@ -41,9 +41,8 @@ static int action_info_default(unsigned type, const char *label)
|
||||
info.list = menu_stack;
|
||||
info.directory_ptr = selection;
|
||||
info.enum_idx = MENU_ENUM_LABEL_INFO_SCREEN;
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_INFO_SCREEN),
|
||||
sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_INFO_SCREEN));
|
||||
|
||||
if (!menu_displaylist_ctl(DISPLAYLIST_HELP, &info))
|
||||
goto error;
|
||||
|
@ -875,7 +875,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
}
|
||||
|
||||
if (info_label)
|
||||
strlcpy(info.label, info_label, sizeof(info.label));
|
||||
info.label = strdup(info_label);
|
||||
if (info_path)
|
||||
strlcpy(info.path, info_path, sizeof(info.path));
|
||||
|
||||
|
@ -266,8 +266,8 @@ bool generic_menu_init_list(void *data)
|
||||
|
||||
menu_displaylist_info_init(&info);
|
||||
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU), sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU));
|
||||
info.enum_idx = MENU_ENUM_LABEL_MAIN_MENU;
|
||||
|
||||
menu_entries_append_enum(menu_stack, info.path,
|
||||
|
@ -464,8 +464,8 @@ static bool nk_menu_init_list(void *data)
|
||||
|
||||
menu_displaylist_info_init(&info);
|
||||
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB), sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB));
|
||||
info.enum_idx = MENU_ENUM_LABEL_HISTORY_TAB;
|
||||
|
||||
menu_entries_append_enum(menu_stack,
|
||||
|
@ -1861,10 +1861,9 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb)
|
||||
|
||||
info.list = xmb->horizontal_list;
|
||||
strlcpy(info.path, settings->paths.directory_playlist, sizeof(info.path));
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST),
|
||||
sizeof(info.label));
|
||||
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST));
|
||||
info.exts = strdup(
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT));
|
||||
info.type_default = FILE_TYPE_PLAIN;
|
||||
@ -4377,8 +4376,8 @@ static bool xmb_menu_init_list(void *data)
|
||||
|
||||
menu_displaylist_info_init(&info);
|
||||
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU), sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU));
|
||||
info.exts =
|
||||
strdup(file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT));
|
||||
info.type_default = FILE_TYPE_PLAIN;
|
||||
|
@ -1130,8 +1130,8 @@ static bool zarch_menu_init_list(void *data)
|
||||
|
||||
menu_displaylist_info_free(&info);
|
||||
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB), sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB));
|
||||
info.enum_idx = MENU_ENUM_LABEL_HISTORY_TAB;
|
||||
|
||||
menu_entries_append_enum(menu_stack,
|
||||
|
@ -3992,12 +3992,13 @@ static bool menu_displaylist_push_internal(
|
||||
|
||||
if (info->exts && !string_is_empty(info->exts))
|
||||
free(info->exts);
|
||||
if (info->label && !string_is_empty(info->label))
|
||||
free(info->label);
|
||||
|
||||
info->exts = strdup(
|
||||
info->exts = strdup(
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT));
|
||||
strlcpy(info->label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST),
|
||||
sizeof(info->label));
|
||||
info->label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST));
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
menu_displaylist_ctl(DISPLAYLIST_MUSIC_HISTORY, info);
|
||||
@ -4010,11 +4011,13 @@ static bool menu_displaylist_push_internal(
|
||||
|
||||
if (info->exts && !string_is_empty(info->exts))
|
||||
free(info->exts);
|
||||
info->exts = strdup(
|
||||
if (info->label && !string_is_empty(info->label))
|
||||
free(info->label);
|
||||
|
||||
info->exts = strdup(
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT));
|
||||
strlcpy(info->label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST),
|
||||
sizeof(info->label));
|
||||
info->label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST));
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
menu_displaylist_ctl(DISPLAYLIST_VIDEO_HISTORY, info);
|
||||
@ -4027,11 +4030,13 @@ static bool menu_displaylist_push_internal(
|
||||
|
||||
if (info->exts && !string_is_empty(info->exts))
|
||||
free(info->exts);
|
||||
info->exts = strdup(
|
||||
if (info->label && !string_is_empty(info->label))
|
||||
free(info->label);
|
||||
|
||||
info->exts = strdup(
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT));
|
||||
strlcpy(info->label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST),
|
||||
sizeof(info->label));
|
||||
info->label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST));
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
@ -4064,11 +4069,13 @@ static bool menu_displaylist_push_internal(
|
||||
|
||||
if (info->exts && !string_is_empty(info->exts))
|
||||
free(info->exts);
|
||||
if (info->label && !string_is_empty(info->label))
|
||||
free(info->label);
|
||||
|
||||
info->exts = strdup(
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT));
|
||||
strlcpy(info->label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST),
|
||||
sizeof(info->label));
|
||||
info->label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST));
|
||||
|
||||
if (string_is_empty(settings->paths.directory_playlist))
|
||||
{
|
||||
@ -4141,10 +4148,10 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry)
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
|
||||
if (!string_is_empty(label))
|
||||
strlcpy(info.label, label, sizeof(info.label));
|
||||
info.label = strdup(label);
|
||||
|
||||
if (!info.list)
|
||||
return false;
|
||||
goto error;
|
||||
|
||||
if (menu_displaylist_push_internal(label, entry, &info))
|
||||
return menu_displaylist_process(&info);
|
||||
@ -4154,10 +4161,15 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry)
|
||||
if (cbs && cbs->action_deferred_push)
|
||||
{
|
||||
if (cbs->action_deferred_push(&info) != 0)
|
||||
return -1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
if (info.label)
|
||||
free(info.label);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void menu_displaylist_parse_playlist_history(
|
||||
@ -4317,16 +4329,16 @@ void menu_displaylist_info_free(menu_displaylist_info_t *info)
|
||||
free(info->path_b);
|
||||
if (info->path_c)
|
||||
free(info->path_c);
|
||||
if (info->label)
|
||||
free(info->label);
|
||||
info->exts = NULL;
|
||||
info->path_b = NULL;
|
||||
info->path_c = NULL;
|
||||
info->label = NULL;
|
||||
#if 0
|
||||
if (info->path)
|
||||
free(info->path);
|
||||
if (info->label)
|
||||
free(info->label);
|
||||
info->path = NULL;
|
||||
info->label = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -4345,12 +4357,12 @@ void menu_displaylist_info_init(menu_displaylist_info_t *info)
|
||||
info->download_core = false;
|
||||
info->need_navigation_clear = false;
|
||||
info->path[0] = '\0';
|
||||
info->label[0] = '\0';
|
||||
info->type = 0;
|
||||
info->type_default = 0;
|
||||
info->flags = 0;
|
||||
info->label_hash = 0;
|
||||
info->directory_ptr = 0;
|
||||
info->label = NULL;
|
||||
info->path_b = NULL;
|
||||
info->path_c = NULL;
|
||||
info->exts = NULL;
|
||||
@ -4439,8 +4451,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
|
||||
strlcpy(info->path_b,
|
||||
str_list->elems[1].data, sizeof(info->path_b));
|
||||
strlcpy(info->label,
|
||||
str_list->elems[0].data, sizeof(info->label));
|
||||
|
||||
if (info->label && !string_is_empty(info->label))
|
||||
free(info->label);
|
||||
|
||||
info->label = strdup(str_list->elems[0].data);
|
||||
|
||||
string_list_free(str_list);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ typedef struct menu_displaylist_info
|
||||
char *path_b;
|
||||
char *path_c;
|
||||
char *exts;
|
||||
char label[255];
|
||||
char *label;
|
||||
unsigned type;
|
||||
unsigned type_default;
|
||||
unsigned flags;
|
||||
|
@ -770,7 +770,7 @@ int menu_action_handle_setting(rarch_setting_t *setting,
|
||||
menu_displaylist_info_init(&info);
|
||||
|
||||
strlcpy(info.path, setting->default_value.string, sizeof(info.path));
|
||||
strlcpy(info.label, name, sizeof(info.label));
|
||||
info.label = strdup(name);
|
||||
info.type = type;
|
||||
info.directory_ptr = selection;
|
||||
info.list = menu_stack;
|
||||
@ -1674,9 +1674,8 @@ void general_write_handler(void *data)
|
||||
menu_displaylist_info_init(&info);
|
||||
|
||||
info.enum_idx = MENU_ENUM_LABEL_HELP;
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_HELP),
|
||||
sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_HELP));
|
||||
info.list = menu_stack;
|
||||
|
||||
if (menu_displaylist_ctl(DISPLAYLIST_GENERIC, &info))
|
||||
|
@ -263,10 +263,8 @@ void menu_dialog_push(void)
|
||||
|
||||
info.list = menu_entries_get_menu_stack_ptr(0);
|
||||
info.enum_idx = MENU_ENUM_LABEL_HELP;
|
||||
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_HELP),
|
||||
sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_HELP));
|
||||
|
||||
menu_displaylist_ctl(DISPLAYLIST_HELP, &info);
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ static int menu_input_key_bind_set_mode_common(
|
||||
info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD;
|
||||
info.directory_ptr = selection;
|
||||
info.enum_idx = MENU_ENUM_LABEL_CUSTOM_BIND;
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND), sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND));
|
||||
if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info))
|
||||
menu_displaylist_process(&info);
|
||||
menu_displaylist_info_free(&info);
|
||||
@ -125,9 +125,8 @@ static int menu_input_key_bind_set_mode_common(
|
||||
info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD;
|
||||
info.directory_ptr = selection;
|
||||
info.enum_idx = MENU_ENUM_LABEL_CUSTOM_BIND_ALL;
|
||||
strlcpy(info.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND_ALL),
|
||||
sizeof(info.label));
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND_ALL));
|
||||
|
||||
if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info))
|
||||
menu_displaylist_process(&info);
|
||||
|
Loading…
Reference in New Issue
Block a user