diff --git a/command_event.c b/command_event.c index e98b3ebee8..edf3c69141 100644 --- a/command_event.c +++ b/command_event.c @@ -1214,22 +1214,8 @@ bool event_command(enum event_command cmd) if (!take_screenshot()) return false; break; - case EVENT_CMD_PREPARE_DUMMY: - { -#ifdef HAVE_MENU - menu_handle_t *menu = menu_driver_get_ptr(); - if (menu) - menu->load_no_content = false; -#endif - rarch_main_data_clear_state(); - - rarch_main_ctl(RARCH_MAIN_CTL_CLEAR_CONTENT_PATH, NULL); - - rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL); - } - break; case EVENT_CMD_UNLOAD_CORE: - event_command(EVENT_CMD_PREPARE_DUMMY); + rarch_main_ctl(RARCH_MAIN_CTL_PREPARE_DUMMY, NULL); event_command(EVENT_CMD_LOAD_CORE_DEINIT); break; case EVENT_CMD_QUIT: diff --git a/command_event.h b/command_event.h index 8870175d0c..404e794d66 100644 --- a/command_event.h +++ b/command_event.h @@ -46,8 +46,6 @@ enum event_command EVENT_CMD_SAVE_STATE_INCREMENT, /* Takes screenshot. */ EVENT_CMD_TAKE_SCREENSHOT, - /* Initializes dummy core. */ - EVENT_CMD_PREPARE_DUMMY, /* Quits RetroArch. */ EVENT_CMD_QUIT, /* Reinitialize all drivers. */ diff --git a/retroarch.c b/retroarch.c index 44826375c8..a267109f7e 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1337,7 +1337,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) global->block_config_read = false; *settings->libretro = '\0'; /* Load core in new config. */ } - event_command(EVENT_CMD_PREPARE_DUMMY); + rarch_main_ctl(RARCH_MAIN_CTL_PREPARE_DUMMY, NULL); return true; case RARCH_ACTION_STATE_MENU_RUNNING: #ifdef HAVE_MENU diff --git a/runloop.c b/runloop.c index 7284424847..4df391bdc2 100644 --- a/runloop.c +++ b/runloop.c @@ -767,6 +767,20 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data) rarch_main_ctl(RARCH_MAIN_CTL_MSG_QUEUE_DEINIT, NULL); rarch_main_msg_queue_init(); break; + case RARCH_MAIN_CTL_PREPARE_DUMMY: + { +#ifdef HAVE_MENU + menu_handle_t *menu = menu_driver_get_ptr(); + if (menu) + menu->load_no_content = false; +#endif + rarch_main_data_clear_state(); + + rarch_main_ctl(RARCH_MAIN_CTL_CLEAR_CONTENT_PATH, NULL); + + rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL); + } + break; default: return false; } @@ -921,7 +935,7 @@ static INLINE int rarch_main_iterate_time_to_exit(event_cmd_state_t *cmd) if (global->core_shutdown_initiated && settings->load_dummy_on_core_shutdown) { - if (!event_command(EVENT_CMD_PREPARE_DUMMY)) + if (!rarch_main_ctl(RARCH_MAIN_CTL_PREPARE_DUMMY, NULL)) return -1; system->shutdown = false; diff --git a/runloop.h b/runloop.h index c286df9825..06dc755e38 100644 --- a/runloop.h +++ b/runloop.h @@ -69,7 +69,9 @@ enum rarch_main_ctl_state /* Initializes message queue. */ RARCH_MAIN_CTL_MSG_QUEUE_INIT, /* Deinitializes message queue. */ - RARCH_MAIN_CTL_MSG_QUEUE_DEINIT + RARCH_MAIN_CTL_MSG_QUEUE_DEINIT, + /* Initializes dummy core. */ + RARCH_MAIN_CTL_PREPARE_DUMMY }; typedef struct rarch_dir_list