Reimplement rarch_task_push_content_load_default

This commit is contained in:
twinaphex 2016-02-12 04:55:18 +01:00
parent e26c88b4bb
commit c6220a9e66
5 changed files with 44 additions and 41 deletions

View File

@ -496,10 +496,9 @@ static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx,
case -1: case -1:
event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL); event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL);
if (rarch_task_push_content_load_default(NULL, NULL, rarch_task_push_content_load_default(NULL, NULL,
false, CORE_TYPE_PLAIN, NULL, NULL)) false, CORE_TYPE_PLAIN, NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); return 0;
return menu_cbs_exit();
case 0: case 0:
return generic_action_ok_displaylist_push(path, label, type, return generic_action_ok_displaylist_push(path, label, type,
idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST); idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST);
@ -542,12 +541,8 @@ static int action_ok_file_load_with_detect_core(const char *path,
static int action_ok_file_load_detect_core(const char *path, static int action_ok_file_load_detect_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
if (rarch_task_push_content_load_default(path, detect_content_path, rarch_task_push_content_load_default(path, detect_content_path,
false, CORE_TYPE_PLAIN, NULL, NULL)) false, CORE_TYPE_PLAIN, NULL, NULL);
{
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return menu_cbs_exit();
}
return 0; return 0;
} }
@ -1097,11 +1092,10 @@ static int action_ok_core_load_deferred(const char *path,
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit(); return menu_cbs_exit();
if (rarch_task_push_content_load_default(path, menu->deferred_path, rarch_task_push_content_load_default(path, menu->deferred_path,
false, CORE_TYPE_PLAIN, NULL, NULL)) false, CORE_TYPE_PLAIN, NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return menu_cbs_exit(); return 0;
} }
static int action_ok_deferred_list_stub(const char *path, static int action_ok_deferred_list_stub(const char *path,
@ -1128,9 +1122,8 @@ static int generic_action_ok_file_load(const char *path,
{ {
case ACTION_OK_FFMPEG: case ACTION_OK_FFMPEG:
case ACTION_OK_IMAGEVIEWER: case ACTION_OK_IMAGEVIEWER:
if (rarch_task_push_content_load_default( rarch_task_push_content_load_default(
NULL, new_path, true, action_type, NULL, NULL)) NULL, new_path, true, action_type, NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
break; break;
default: default:
break; break;
@ -1196,10 +1189,10 @@ static int action_ok_file_load(const char *path,
fill_pathname_join(full_path_new, menu_path_new, path, fill_pathname_join(full_path_new, menu_path_new, path,
sizeof(full_path_new)); sizeof(full_path_new));
if (rarch_task_push_content_load_default(NULL, full_path_new, rarch_task_push_content_load_default(NULL, full_path_new,
true, CORE_TYPE_PLAIN, NULL, NULL)) true, CORE_TYPE_PLAIN, NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return menu_cbs_exit(); return 0;
} }
@ -1945,9 +1938,8 @@ static int action_ok_start_core(const char *path,
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL)) if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
{ {
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL); runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
if (rarch_task_push_content_load_default(NULL, NULL, rarch_task_push_content_load_default(NULL, NULL,
false, CORE_TYPE_PLAIN, NULL, NULL)) false, CORE_TYPE_PLAIN, NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
} }
return 0; return 0;
@ -2026,9 +2018,8 @@ static int action_ok_load_archive(const char *path,
sizeof(detect_content_path)); sizeof(detect_content_path));
event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL); event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL);
if (rarch_task_push_content_load_default( rarch_task_push_content_load_default(
NULL, detect_content_path, false, CORE_TYPE_PLAIN, NULL, NULL)) NULL, detect_content_path, false, CORE_TYPE_PLAIN, NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
return 0; return 0;
} }
@ -2071,10 +2062,9 @@ static int action_ok_load_archive_detect_core(const char *path,
{ {
case -1: case -1:
event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL); event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL);
if (rarch_task_push_content_load_default(NULL, NULL, rarch_task_push_content_load_default(NULL, NULL,
false, CORE_TYPE_PLAIN, NULL, NULL)) false, CORE_TYPE_PLAIN, NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); return 0;
return menu_cbs_exit();
case 0: case 0:
return generic_action_ok_displaylist_push(path, label, type, return generic_action_ok_displaylist_push(path, label, type,
idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST); idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST);

View File

@ -889,15 +889,12 @@ static int zarch_zui_render_sidebar(zui_t *zui)
static int zarch_zui_load_content(zui_t *zui, unsigned i) static int zarch_zui_load_content(zui_t *zui, unsigned i)
{ {
int ret = 0; rarch_task_push_content_load_default(zui->pick_cores[i].path,
zui->pick_content, false, CORE_TYPE_PLAIN, NULL, NULL);
if (rarch_task_push_content_load_default(zui->pick_cores[i].path,
zui->pick_content, false, CORE_TYPE_PLAIN, NULL, NULL))
ret = -1;
layout = LAY_HOME; layout = LAY_HOME;
return ret; return 0;
} }
static void zarch_zui_draw_cursor(float x, float y) static void zarch_zui_draw_cursor(float x, float y)

View File

@ -807,6 +807,13 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
generic_action_ok_displaylist_push("", generic_action_ok_displaylist_push("",
"", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS); "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL))
{
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_QUIT, NULL);
return false;
}
return true; return true;
} }

View File

@ -15,6 +15,10 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_MENU
#include "../menu/menu_driver.h"
#endif
#include "tasks_internal.h" #include "tasks_internal.h"
#include "../command_event.h" #include "../command_event.h"
@ -58,5 +62,10 @@ bool rarch_task_push_content_load_default(
if (cmd != EVENT_CMD_NONE) if (cmd != EVENT_CMD_NONE)
event_cmd_ctl(cmd, NULL); event_cmd_ctl(cmd, NULL);
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUIT, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
#endif
return true; return true;
} }

View File

@ -303,13 +303,13 @@ static void open_core_handler(NSOpenPanel *panel, NSInteger result)
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)__core.UTF8String); runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)__core.UTF8String);
ui_companion_event_command(EVENT_CMD_LOAD_CORE); ui_companion_event_command(EVENT_CMD_LOAD_CORE);
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL) && settings->set_supports_no_game_enable) if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL)
&& settings->set_supports_no_game_enable)
{ {
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL); runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
if (rarch_task_push_content_load_default( rarch_task_push_content_load_default(
NULL, NULL, false, CORE_TYPE_PLAIN, NULL, NULL, false, CORE_TYPE_PLAIN,
NULL, NULL)) NULL, NULL);
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
} }
} }
break; break;