From cf3f8d587cd5333f900044c7693cc7f84fbcc85a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 11 May 2016 20:53:28 +0200 Subject: [PATCH] Cleanup --- command.c | 8 ++++---- retroarch.c | 10 ++++++---- retroarch.h | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/command.c b/command.c index 98ae2e3fec..55728c2845 100644 --- a/command.c +++ b/command.c @@ -1779,7 +1779,7 @@ bool command_event(enum event_command cmd, void *data) command_event(CMD_EVENT_LOAD_CORE_DEINIT, NULL); break; case CMD_EVENT_QUIT: - rarch_ctl(RARCH_CTL_QUIT, NULL); + retroarch_main_quit(); break; case CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE: #ifdef HAVE_CHEEVOS @@ -2034,19 +2034,19 @@ bool command_event(enum event_command cmd, void *data) } break; case CMD_EVENT_QUIT_RETROARCH: - rarch_ctl(RARCH_CTL_QUIT, NULL); + command_event(CMD_EVENT_QUIT, NULL); break; case CMD_EVENT_SHUTDOWN: #if defined(__linux__) && !defined(ANDROID) runloop_msg_queue_push("Shutting down...", 1, 180, true); - rarch_ctl(RARCH_CTL_QUIT, NULL); + command_event(CMD_EVENT_QUIT, NULL); system("shutdown -P now"); #endif break; case CMD_EVENT_REBOOT: #if defined(__linux__) && !defined(ANDROID) runloop_msg_queue_push("Rebooting...", 1, 180, true); - rarch_ctl(RARCH_CTL_QUIT, NULL); + command_event(CMD_EVENT_QUIT, NULL); system("shutdown -r now"); #endif break; diff --git a/retroarch.c b/retroarch.c index 9fe07f1327..73d24c472c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1505,10 +1505,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) command_event(CMD_EVENT_OVERLAY_INIT, NULL); #endif break; - case RARCH_CTL_QUIT: - runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL); - rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); - break; case RARCH_CTL_VALIDATE_CPU_FEATURES: { uint64_t cpu = cpu_features_get(); @@ -1666,3 +1662,9 @@ void retroarch_fail(int error_code, const char *error) strlcpy(error_string, error, sizeof(error_string)); longjmp(error_sjlj_context, error_code); } + +void retroarch_main_quit(void) +{ + runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL); + rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); +} diff --git a/retroarch.h b/retroarch.h index 77759ad38f..24b3c78a1f 100644 --- a/retroarch.h +++ b/retroarch.h @@ -86,8 +86,6 @@ enum rarch_ctl_state * properly. */ RARCH_CTL_REPLACE_CONFIG, - RARCH_CTL_QUIT, - /* Validates CPU features for given processor architecture. * Make sure we haven't compiled for something we cannot run. * Ideally, code would get swapped out depending on CPU support, @@ -188,6 +186,8 @@ void retroarch_fail(int error_code, const char *error); **/ bool retroarch_main_init(int argc, char *argv[]); +void retroarch_main_quit(void); + #ifdef __cplusplus } #endif