Refactor menu_content_load_from_playlist

This commit is contained in:
twinaphex 2016-06-30 18:25:19 +02:00
parent 9836b97554
commit 471ffc53fd
2 changed files with 30 additions and 14 deletions

View File

@ -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)

View File

@ -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);