From 0815055906acfae52e5ea234d5fc86b4af2448d4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 8 May 2017 03:41:23 +0200 Subject: [PATCH] Pressing hotkey should invoke same operation as manually selecting 'Quit' from the menu - should hopefully fix issues with flushing SRAM to disk/saving autostate --- command.c | 7 ++++--- command.h | 2 ++ runloop.c | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/command.c b/command.c index cc38296d53..9651d266b8 100644 --- a/command.c +++ b/command.c @@ -1756,7 +1756,7 @@ static bool command_event_main_state(unsigned cmd) return ret; } -void handle_quit_event(void) +bool command_event_quit(void) { command_event(CMD_EVENT_AUTOSAVE_STATE, NULL); command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL); @@ -1772,6 +1772,8 @@ void handle_quit_event(void) #ifdef HAVE_MENU rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); #endif + + return true; } static bool command_event_resize_windowed_scale(void) @@ -1993,8 +1995,7 @@ bool command_event(enum event_command cmd, void *data) } break; case CMD_EVENT_QUIT: - handle_quit_event(); - break; + return command_event_quit(); case CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE: #ifdef HAVE_CHEEVOS cheevos_toggle_hardcore_mode(); diff --git a/command.h b/command.h index f15b108388..d5365c4c73 100644 --- a/command.h +++ b/command.h @@ -243,6 +243,8 @@ bool command_set(command_handle_t *handle); bool command_free(command_t *handle); +bool command_event_quit(void); + /** * command_event: * @cmd : Command index. diff --git a/runloop.c b/runloop.c index a46fc524ae..73b79ef05b 100644 --- a/runloop.c +++ b/runloop.c @@ -56,6 +56,7 @@ #endif #include "autosave.h" +#include "command.h" #include "configuration.h" #include "driver.h" #include "movie.h" @@ -758,7 +759,10 @@ static enum runloop_state runloop_check_state( runloop_core_shutdown_initiated = false; } else + { + command_event_quit(); return RUNLOOP_STATE_QUIT; + } } #ifdef HAVE_MENU