From 471ffc53fd4b65518537e7e4c12d5abb743fcaa7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 30 Jun 2016 18:25:19 +0200 Subject: [PATCH] Refactor menu_content_load_from_playlist --- menu/cbs/menu_cbs_ok.c | 28 ++++++++++++++++++++++++++++ menu/menu_content.c | 16 ++-------------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 67da6c3d27..3a02ba19a2 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -647,6 +647,7 @@ static int action_ok_playlist_entry_collection(const char *path, const char *core_name = NULL; playlist_t *tmp_playlist = NULL; menu_handle_t *menu = NULL; + content_ctx_info_t content_info = {0}; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return menu_cbs_exit(); @@ -730,6 +731,19 @@ static int action_ok_playlist_entry_collection(const char *path, if (!menu_content_load_from_playlist(&playlist_info)) return menu_cbs_exit(); + playlist_get_index(playlist, + playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL); + + if (!task_push_content_load_default( + core_path, + path, + &content_info, + CORE_TYPE_PLAIN, + CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU, + NULL, + NULL)) + return menu_cbs_exit(); + return menu_cbs_exit(); } @@ -748,6 +762,7 @@ static int action_ok_playlist_entry(const char *path, const char *core_name = NULL; playlist_t *tmp_playlist = NULL; menu_handle_t *menu = NULL; + content_ctx_info_t content_info = {0}; uint32_t hash_label = msg_hash_calculate(label); if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) @@ -846,6 +861,19 @@ static int action_ok_playlist_entry(const char *path, if (!menu_content_load_from_playlist(&playlist_info)) return menu_cbs_exit(); + playlist_get_index(playlist, + playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL); + + if (!task_push_content_load_default( + core_path, + path, + &content_info, + CORE_TYPE_PLAIN, + CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU, + NULL, + NULL)) + return menu_cbs_exit(); + if (is_history) { switch (hash_label) diff --git a/menu/menu_content.c b/menu/menu_content.c index 39c3e8d577..c43de006cc 100644 --- a/menu/menu_content.c +++ b/menu/menu_content.c @@ -46,23 +46,19 @@ **/ bool menu_content_load_from_playlist(menu_content_ctx_playlist_info_t *info) { - unsigned idx; playlist_t *playlist = NULL; - const char *core_path = NULL; const char *path = NULL; - content_ctx_info_t content_info = {0}; if (!info) return false; playlist = (playlist_t*)info->data; - idx = info->idx; if (!playlist) return false; playlist_get_index(playlist, - idx, &path, NULL, &core_path, NULL, NULL, NULL); + info->idx, &path, NULL, NULL, NULL, NULL, NULL); if (!string_is_empty(path)) { @@ -93,15 +89,7 @@ bool menu_content_load_from_playlist(menu_content_ctx_playlist_info_t *info) goto error; } - if (task_push_content_load_default( - core_path, - path, - &content_info, - CORE_TYPE_PLAIN, - CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU, - NULL, - NULL)) - return true; + return true; error: runloop_msg_queue_push("File could not be loaded.\n", 1, 100, true);