diff --git a/dynamic.c b/dynamic.c index 5c5023a39b..346a7b3434 100644 --- a/dynamic.c +++ b/dynamic.c @@ -768,7 +768,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) case RETRO_ENVIRONMENT_SHUTDOWN: RARCH_LOG("Environ SHUTDOWN.\n"); system->shutdown = true; - global->core_shutdown_initiated = true; + rarch_main_ctl(RARCH_MAIN_CTL_SET_CORE_SHUTDOWN, NULL); break; case RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL: diff --git a/runloop.c b/runloop.c index e6ce174b1d..8634ef6e1e 100644 --- a/runloop.c +++ b/runloop.c @@ -57,6 +57,7 @@ static struct global g_extern; +static bool main_core_shutdown_initiated; static bool main_is_idle; static bool main_is_paused; static bool main_is_slowmotion; @@ -792,6 +793,9 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data) rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL); } break; + case RARCH_MAIN_CTL_SET_CORE_SHUTDOWN: + main_core_shutdown_initiated = true; + break; default: return false; } @@ -943,14 +947,14 @@ static INLINE int rarch_main_iterate_time_to_exit(event_cmd_state_t *cmd) * instead of exiting RetroArch completely. * Aborts core shutdown if invoked. */ - if (global->core_shutdown_initiated + if (main_core_shutdown_initiated && settings->load_dummy_on_core_shutdown) { if (!rarch_main_ctl(RARCH_MAIN_CTL_PREPARE_DUMMY, NULL)) return -1; - system->shutdown = false; - global->core_shutdown_initiated = false; + system->shutdown = false; + main_core_shutdown_initiated = false; return 0; } diff --git a/runloop.h b/runloop.h index 6c57385df6..48df1b906b 100644 --- a/runloop.h +++ b/runloop.h @@ -55,6 +55,7 @@ enum rarch_main_ctl_state RARCH_MAIN_CTL_CLEAR_STATE, RARCH_MAIN_CTL_STATE_FREE, RARCH_MAIN_CTL_GLOBAL_FREE, + RARCH_MAIN_CTL_SET_CORE_SHUTDOWN, /* Checks for state changes in this frame. */ RARCH_MAIN_CTL_CHECK_STATE, RARCH_MAIN_CTL_CHECK_MOVIE, @@ -122,7 +123,6 @@ typedef struct global { bool perfcnt_enable; bool force_fullscreen; - bool core_shutdown_initiated; struct string_list *temporary_content;