Create runloop_prepare_dummy

This commit is contained in:
twinaphex 2016-05-12 09:04:31 +02:00
parent 1d98d3c17f
commit c1bfe795f8
4 changed files with 26 additions and 22 deletions

View File

@ -1775,7 +1775,7 @@ bool command_event(enum event_command cmd, void *data)
return false;
break;
case CMD_EVENT_UNLOAD_CORE:
runloop_ctl(RUNLOOP_CTL_PREPARE_DUMMY, NULL);
runloop_prepare_dummy();
command_event(CMD_EVENT_LOAD_CORE_DEINIT, NULL);
break;
case CMD_EVENT_QUIT:

View File

@ -1539,7 +1539,7 @@ bool retroarch_replace_config(char *path)
*settings->path.libretro = '\0'; /* Load core in new config. */
runloop_ctl(RUNLOOP_CTL_PREPARE_DUMMY, NULL);
runloop_prepare_dummy();
return true;
}

View File

@ -720,6 +720,26 @@ static bool runloop_is_frame_count_end(void)
}
bool runloop_prepare_dummy(void)
{
memset(&runloop_frame_time, 0, sizeof(struct retro_frame_time_callback));
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT, NULL);
#endif
runloop_ctl(RUNLOOP_CTL_DATA_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_TASK_INIT, NULL);
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
#ifdef HAVE_MENU
if (!menu_content_ctl(MENU_CONTENT_CTL_LOAD, NULL))
{
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
return false;
}
#endif
return true;
}
bool runloop_ctl(enum runloop_ctl_state state, void *data)
{
settings_t *settings = config_get_ptr();
@ -1056,23 +1076,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
task_queue_ctl(TASK_QUEUE_CTL_INIT, &threaded_enable);
}
break;
case RUNLOOP_CTL_PREPARE_DUMMY:
memset(&runloop_frame_time, 0, sizeof(struct retro_frame_time_callback));
#ifdef HAVE_MENU
menu_driver_ctl(RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT, NULL);
#endif
runloop_ctl(RUNLOOP_CTL_DATA_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_TASK_INIT, NULL);
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
#ifdef HAVE_MENU
if (!menu_content_ctl(MENU_CONTENT_CTL_LOAD, NULL))
{
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
return false;
}
#endif
break;
case RUNLOOP_CTL_SET_CORE_SHUTDOWN:
runloop_core_shutdown_initiated = true;
break;
@ -1262,7 +1265,7 @@ static void runloop_iterate_linefeed_overlay(settings_t *settings)
* Aborts core shutdown if invoked. */
static int runloop_iterate_time_to_exit_load_dummy(void)
{
if (!runloop_ctl(RUNLOOP_CTL_PREPARE_DUMMY, NULL))
if (!runloop_prepare_dummy())
return -1;
runloop_ctl(RUNLOOP_CTL_UNSET_SHUTDOWN, NULL);

View File

@ -102,8 +102,7 @@ enum runloop_ctl_state
RUNLOOP_CTL_SHADER_DIR_INIT,
RUNLOOP_CTL_SYSTEM_INFO_GET,
RUNLOOP_CTL_SYSTEM_INFO_INIT,
RUNLOOP_CTL_SYSTEM_INFO_FREE,
RUNLOOP_CTL_PREPARE_DUMMY
RUNLOOP_CTL_SYSTEM_INFO_FREE
};
typedef int (*transfer_cb_t)(void *data, size_t len);
@ -295,6 +294,8 @@ void runloop_msg_queue_push(const char *msg, unsigned prio,
char* runloop_msg_queue_pull(void);
bool runloop_prepare_dummy(void);
bool runloop_ctl(enum runloop_ctl_state state, void *data);