Merge branch 'favorites' of github.com:Kivutar/RetroArch into favorites

This commit is contained in:
Rob Loach 2017-08-13 19:22:33 -04:00
commit 0a9143b999
No known key found for this signature in database
GPG Key ID: 627C60834A74A21A
4 changed files with 29 additions and 5 deletions

View File

@ -1991,6 +1991,13 @@ bool command_event(enum event_command cmd, void *data)
}
g_defaults.content_history = NULL;
if (g_defaults.content_favorites)
{
playlist_write_file(g_defaults.content_favorites);
playlist_free(g_defaults.content_favorites);
}
g_defaults.content_favorites = NULL;
if (g_defaults.music_history)
{
playlist_write_file(g_defaults.music_history);
@ -2173,6 +2180,17 @@ bool command_event(enum event_command cmd, void *data)
if (ui_companion_is_on_foreground())
ui_companion_driver_toggle();
break;
case CMD_EVENT_ADD_TO_FAVORITES:
playlist_push(
g_defaults.content_favorites,
path_get(RARCH_PATH_CONTENT),
NULL,
file_path_str(FILE_PATH_DETECT),
file_path_str(FILE_PATH_DETECT),
NULL,
NULL
);
break;
case CMD_EVENT_RESTART_RETROARCH:
if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART))
return false;

View File

@ -134,6 +134,8 @@ enum event_command
CMD_EVENT_REBOOT,
/* Resume RetroArch when in menu. */
CMD_EVENT_RESUME,
/* Add a playlist entry to favorites. */
CMD_EVENT_ADD_TO_FAVORITES,
/* Toggles pause. */
CMD_EVENT_PAUSE_TOGGLE,
/* Pauses RetroArch. */

View File

@ -3103,6 +3103,12 @@ static int action_ok_resume_content(const char *path,
return generic_action_ok_command(CMD_EVENT_RESUME);
}
static int action_ok_add_to_favorites(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_command(CMD_EVENT_ADD_TO_FAVORITES);
}
static int action_ok_restart_content(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -4590,6 +4596,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_RESUME_CONTENT:
BIND_ACTION_OK(cbs, action_ok_resume_content);
break;
case MENU_ENUM_LABEL_ADD_TO_FAVORITES:
BIND_ACTION_OK(cbs, action_ok_add_to_favorites);
break;
case MENU_ENUM_LABEL_RESTART_CONTENT:
BIND_ACTION_OK(cbs, action_ok_restart_content);
break;

View File

@ -3001,11 +3001,6 @@ static int menu_displaylist_parse_horizontal_content_actions(
msg_hash_to_str(MENU_ENUM_LABEL_RUN),
MENU_ENUM_LABEL_RUN, FILE_TYPE_PLAYLIST_ENTRY, 0, idx);
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES),
msg_hash_to_str(MENU_ENUM_LABEL_ADD_TO_FAVORITES),
MENU_ENUM_LABEL_ADD_TO_FAVORITES, FILE_TYPE_PLAYLIST_ENTRY, 0, idx);
if (settings->bools.playlist_entry_remove)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DELETE_ENTRY),