content: preserve info for history/favorites

If the content came from a playlist, use the original label.
Preserve the core path and name in the favorites list.
This commit is contained in:
Brian Koropoff 2017-11-08 19:41:13 -08:00
parent 1db8ae9f60
commit 711877b056
5 changed files with 40 additions and 9 deletions

View File

@ -2237,18 +2237,35 @@ TODO: Add a setting for these tweaks */
ui_companion_driver_toggle();
break;
case CMD_EVENT_ADD_TO_FAVORITES:
{
global_t *global = global_get_ptr();
rarch_system_info_t *sys_info = runloop_get_system_info();
const char *core_name = NULL;
const char *core_path = NULL;
const char *label = NULL;
if (sys_info)
{
core_name = sys_info->info.library_name;
core_path = path_get(RARCH_PATH_CORE);
}
if (!string_is_empty(global->name.label))
label = global->name.label;
playlist_push(
g_defaults.content_favorites,
(const char*)data,
NULL,
file_path_str(FILE_PATH_DETECT),
file_path_str(FILE_PATH_DETECT),
label,
core_path,
core_name,
NULL,
NULL
);
playlist_write_file(g_defaults.content_favorites);
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true);
break;
}
case CMD_EVENT_RESTART_RETROARCH:
if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART))
return false;

View File

@ -1566,7 +1566,7 @@ static int action_ok_playlist_entry_collection(const char *path,
if (!task_push_load_content_from_playlist_from_menu(
new_core_path, path,
new_core_path, path, entry_label,
&content_info,
NULL, NULL))
return -1;
@ -1582,6 +1582,7 @@ static int action_ok_playlist_entry(const char *path,
size_t selection_ptr = 0;
playlist_t *playlist = g_defaults.content_history;
const char *entry_path = NULL;
const char *entry_label = NULL;
const char *core_path = NULL;
const char *core_name = NULL;
playlist_t *tmp_playlist = NULL;
@ -1598,7 +1599,7 @@ static int action_ok_playlist_entry(const char *path,
selection_ptr = entry_idx;
playlist_get_index(playlist, selection_ptr,
&entry_path, NULL, &core_path, &core_name, NULL, NULL);
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
@ -1662,7 +1663,7 @@ static int action_ok_playlist_entry(const char *path,
NULL, NULL);
if (!task_push_load_content_from_playlist_from_menu(
core_path, path,
core_path, path, entry_label,
&content_info,
NULL, NULL))
return -1;
@ -1679,6 +1680,7 @@ static int action_ok_playlist_entry_start_content(const char *path,
bool playlist_initialized = false;
playlist_t *playlist = NULL;
const char *entry_path = NULL;
const char *entry_label = NULL;
const char *core_path = NULL;
const char *core_name = NULL;
playlist_t *tmp_playlist = NULL;
@ -1708,7 +1710,7 @@ static int action_ok_playlist_entry_start_content(const char *path,
selection_ptr = rdb_entry_start_game_selection_ptr;
playlist_get_index(playlist, selection_ptr,
&entry_path, NULL, &core_path, &core_name, NULL, NULL);
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
@ -1772,7 +1774,7 @@ static int action_ok_playlist_entry_start_content(const char *path,
playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL);
if (!task_push_load_content_from_playlist_from_menu(
core_path, path,
core_path, path, entry_label,
&content_info,
NULL, NULL))
return -1;

View File

@ -225,6 +225,7 @@ typedef struct global
char ups[8192];
char bps[8192];
char ips[8192];
char label[8192];
char *remapfile;
} name;

View File

@ -920,7 +920,9 @@ static bool task_load_content(content_ctx_info_t *content_info,
{
const char *core_path = NULL;
const char *core_name = NULL;
const char *label = NULL;
playlist_t *playlist_tmp = g_defaults.content_history;
global_t *global = global_get_ptr();
switch (path_is_media_type(tmp))
{
@ -955,13 +957,16 @@ static bool task_load_content(content_ctx_info_t *content_info,
content_ctx->history_list_enable = settings->bools.history_list_enable;
}
if (global && !string_is_empty(global->name.label))
label = global->name.label;
if (
content_ctx->history_list_enable
&& playlist_tmp
&& playlist_push(
playlist_tmp,
tmp,
NULL,
label,
core_path,
core_name,
NULL,
@ -1150,6 +1155,7 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
bool task_push_load_content_from_playlist_from_menu(
const char *core_path,
const char *fullpath,
const char *label,
content_ctx_info_t *content_info,
retro_task_callback_t cb,
void *user_data)
@ -1191,6 +1197,10 @@ bool task_push_load_content_from_playlist_from_menu(
content_ctx.name_bps = strdup(global->name.bps);
if (!string_is_empty(global->name.ups))
content_ctx.name_ups = strdup(global->name.ups);
if (label)
strlcpy(global->name.label, label, sizeof(global->name.label));
else
global->name.label[0] = '\0';
}
if (!string_is_empty(settings->paths.directory_system))

View File

@ -198,6 +198,7 @@ bool task_push_load_content_with_new_core_from_menu(
bool task_push_load_content_from_playlist_from_menu(
const char *core_path,
const char *fullpath,
const char *label,
content_ctx_info_t *content_info,
retro_task_callback_t cb,
void *user_data);