Reimplement content loading - task_content_load
This commit is contained in:
parent
43b88cfba9
commit
6ef0b86e30
28
command.c
28
command.c
|
@ -1624,34 +1624,6 @@ bool command_event(enum event_command cmd, void *data)
|
|||
}
|
||||
#endif
|
||||
break;
|
||||
case CMD_EVENT_LOAD_CONTENT_PERSIST:
|
||||
case CMD_EVENT_LOAD_CONTENT_FFMPEG:
|
||||
case CMD_EVENT_LOAD_CONTENT_IMAGEVIEWER:
|
||||
#ifdef HAVE_DYNAMIC
|
||||
if (cmd == CMD_EVENT_LOAD_CONTENT_PERSIST)
|
||||
command_event(CMD_EVENT_LOAD_CORE, NULL);
|
||||
#endif
|
||||
#ifdef HAVE_MENU
|
||||
if (!menu_content_ctl(MENU_CONTENT_CTL_LOAD, NULL))
|
||||
{
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case CMD_EVENT_LOAD_CONTENT:
|
||||
{
|
||||
#ifdef HAVE_DYNAMIC
|
||||
command_event(CMD_EVENT_LOAD_CONTENT_PERSIST, NULL);
|
||||
#else
|
||||
char *fullpath = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, settings->path.libretro);
|
||||
command_event(CMD_EVENT_EXEC, (void*)fullpath);
|
||||
command_event(CMD_EVENT_QUIT, NULL);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case CMD_EVENT_LOAD_CORE_DEINIT:
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_DEINIT, NULL);
|
||||
|
|
|
@ -41,11 +41,6 @@ enum event_command
|
|||
CMD_EVENT_NONE = 0,
|
||||
/* Resets RetroArch. */
|
||||
CMD_EVENT_RESET,
|
||||
/* Loads content file. */
|
||||
CMD_EVENT_LOAD_CONTENT,
|
||||
CMD_EVENT_LOAD_CONTENT_PERSIST,
|
||||
CMD_EVENT_LOAD_CONTENT_FFMPEG,
|
||||
CMD_EVENT_LOAD_CONTENT_IMAGEVIEWER,
|
||||
CMD_EVENT_SET_PER_GAME_RESOLUTION,
|
||||
CMD_EVENT_SET_FRAME_LIMIT,
|
||||
/* Loads core. */
|
||||
|
|
|
@ -17,50 +17,93 @@
|
|||
|
||||
#ifdef HAVE_MENU
|
||||
#include "../menu/menu_driver.h"
|
||||
#include "../menu/menu_content.h"
|
||||
#endif
|
||||
|
||||
#include "tasks_internal.h"
|
||||
|
||||
#include "../command.h"
|
||||
#include "../configuration.h"
|
||||
#include "../retroarch.h"
|
||||
|
||||
/* TODO/FIXME - turn this into actual task */
|
||||
|
||||
static bool task_content_load(bool persist, bool load_content)
|
||||
{
|
||||
if (persist)
|
||||
{
|
||||
#ifdef HAVE_DYNAMIC
|
||||
command_event(CMD_EVENT_LOAD_CORE, NULL);
|
||||
#endif
|
||||
load_content = true;
|
||||
}
|
||||
|
||||
if (load_content)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
if (!menu_content_ctl(MENU_CONTENT_CTL_LOAD, NULL))
|
||||
{
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
char *fullpath = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
command_event(CMD_EVENT_EXEC, (void*)fullpath);
|
||||
command_event(CMD_EVENT_QUIT, NULL);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rarch_task_push_content_load_default(
|
||||
const char *core_path, const char *fullpath,
|
||||
bool persist, enum rarch_core_type type,
|
||||
retro_task_callback_t cb, void *user_data)
|
||||
{
|
||||
bool load_content = false;
|
||||
enum event_command cmd = CMD_EVENT_NONE;
|
||||
|
||||
if (core_path)
|
||||
{
|
||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path);
|
||||
command_event(CMD_EVENT_LOAD_CORE, NULL);
|
||||
}
|
||||
|
||||
if (fullpath)
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)fullpath);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CORE_TYPE_PLAIN:
|
||||
case CORE_TYPE_DUMMY:
|
||||
cmd = persist ? CMD_EVENT_LOAD_CONTENT_PERSIST : CMD_EVENT_LOAD_CONTENT;
|
||||
load_content = false;
|
||||
if (persist)
|
||||
load_content = true;
|
||||
break;
|
||||
case CORE_TYPE_FFMPEG:
|
||||
#ifdef HAVE_FFMPEG
|
||||
cmd = CMD_EVENT_LOAD_CONTENT_FFMPEG;
|
||||
#endif
|
||||
persist = false;
|
||||
load_content = true;
|
||||
break;
|
||||
case CORE_TYPE_IMAGEVIEWER:
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
cmd = CMD_EVENT_LOAD_CONTENT_IMAGEVIEWER;
|
||||
#endif
|
||||
persist = false;
|
||||
load_content = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd != CMD_EVENT_NONE)
|
||||
command_event(cmd, NULL);
|
||||
if (load_content)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
core_path = settings->path.libretro;
|
||||
}
|
||||
|
||||
if (core_path)
|
||||
{
|
||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, (void*)core_path);
|
||||
persist = true;
|
||||
}
|
||||
|
||||
if (fullpath)
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)fullpath);
|
||||
|
||||
if (!task_content_load(persist, load_content))
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUIT, NULL);
|
||||
|
|
|
@ -277,10 +277,16 @@ static void poll_iteration(void)
|
|||
if (system)
|
||||
core_name = system->library_name;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)__core.UTF8String);
|
||||
|
||||
if (core_name)
|
||||
ui_companion_event_command(CMD_EVENT_LOAD_CONTENT);
|
||||
{
|
||||
rarch_task_push_content_load_default(
|
||||
NULL,
|
||||
__core.UTF8String,
|
||||
false, CORE_TYPE_PLAIN,
|
||||
NULL, NULL);
|
||||
}
|
||||
else
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)__core.UTF8String);
|
||||
|
||||
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
||||
}
|
||||
|
@ -343,7 +349,12 @@ static void open_document_handler(NSOpenPanel *panel, NSInteger result)
|
|||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)__core.UTF8String);
|
||||
|
||||
if (core_name)
|
||||
ui_companion_event_command(CMD_EVENT_LOAD_CONTENT);
|
||||
{
|
||||
rarch_task_push_content_load_default(
|
||||
NULL, NULL,
|
||||
false, CORE_TYPE_PLAIN,
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0: /* NSCancelButton/NSModalResponseCancel */
|
||||
|
|
|
@ -572,8 +572,12 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam)
|
|||
break;
|
||||
case ID_M_LOAD_CONTENT:
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, win32_file);
|
||||
cmd = CMD_EVENT_LOAD_CONTENT;
|
||||
|
||||
do_wm_close = true;
|
||||
rarch_task_push_content_load_default(
|
||||
NULL, NULL,
|
||||
false, CORE_TYPE_PLAIN,
|
||||
NULL, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue