Enable 'Add to Favorites' without loading a core

This commit is contained in:
jdgleaver 2019-03-02 14:08:48 +00:00
parent 389138197b
commit a8f2381155
2 changed files with 29 additions and 2 deletions

View File

@ -2416,8 +2416,26 @@ TODO: Add a setting for these tweaks */
global_t *global = global_get_ptr();
struct retro_system_info *system = runloop_get_libretro_system_info();
const char *label = NULL;
const char *core_path = system ? path_get(RARCH_PATH_CORE) : NULL;
const char *core_name = system ? system->library_name : NULL;
char core_path[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
core_path[0] = '\0';
core_name[0] = '\0';
if (system)
{
if (!string_is_empty(path_get(RARCH_PATH_CORE)))
strlcpy(core_path, path_get(RARCH_PATH_CORE), sizeof(core_path));
if (!string_is_empty(system->library_name))
strlcpy(core_name, system->library_name, sizeof(core_name));
}
if (string_is_empty(core_path))
strlcpy(core_path, file_path_str(FILE_PATH_DETECT), sizeof(core_path));
if (string_is_empty(core_name))
strlcpy(core_name, file_path_str(FILE_PATH_DETECT), sizeof(core_name));
if (!string_is_empty(global->name.label))
label = global->name.label;

View File

@ -2987,6 +2987,15 @@ static int menu_displaylist_parse_horizontal_content_actions(
if (settings->bools.quick_menu_show_add_to_favorites)
{
global_t *global = global_get_ptr();
/* Have to update global->name.label here, otherwise
* the 'Add to Favorites' option will produce nonsensical
* playlist entries... */
if (global)
if (!string_is_empty(label))
strlcpy(global->name.label, label, sizeof(global->name.label));
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST),
msg_hash_to_str(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST),