diff --git a/command.c b/command.c index f37f7c6c08..07b2229ee5 100644 --- a/command.c +++ b/command.c @@ -322,7 +322,7 @@ bool rarch_cmd_get(rarch_cmd_t *handle, unsigned id) } #ifdef HAVE_NETWORK_CMD -static void network_cmd_pre_frame(rarch_cmd_t *handle) +static void network_cmd_poll(rarch_cmd_t *handle) { if (handle->net_fd < 0) return; @@ -453,7 +453,7 @@ static size_t read_stdin(char *buf, size_t size) } #endif -static void stdin_cmd_pre_frame(rarch_cmd_t *handle) +static void stdin_cmd_poll(rarch_cmd_t *handle) { if (!handle->stdin_enable) return; @@ -489,16 +489,16 @@ static void stdin_cmd_pre_frame(rarch_cmd_t *handle) } #endif -void rarch_cmd_pre_frame(rarch_cmd_t *handle) +void rarch_cmd_poll(rarch_cmd_t *handle) { memset(handle->state, 0, sizeof(handle->state)); #ifdef HAVE_NETWORK_CMD - network_cmd_pre_frame(handle); + network_cmd_poll(handle); #endif #ifdef HAVE_STDIN_CMD - stdin_cmd_pre_frame(handle); + stdin_cmd_poll(handle); #endif } diff --git a/command.h b/command.h index a4b866613a..11079eef76 100644 --- a/command.h +++ b/command.h @@ -32,7 +32,7 @@ typedef struct rarch_cmd rarch_cmd_t; rarch_cmd_t *rarch_cmd_new(bool stdin_enable, bool network_enable, uint16_t port); void rarch_cmd_free(rarch_cmd_t *handle); -void rarch_cmd_pre_frame(rarch_cmd_t *handle); +void rarch_cmd_poll(rarch_cmd_t *handle); void rarch_cmd_set(rarch_cmd_t *handle, unsigned id); bool rarch_cmd_get(rarch_cmd_t *handle, unsigned id); diff --git a/frontend/frontend.c b/frontend/frontend.c index f0795aea01..7f7502ef89 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -217,7 +217,7 @@ int main_entry_iterate(signature(), args_type() args) if (driver.audio_data) audio_stop_func(); - rgui->need_refresh= true; + rgui->need_refresh = true; rgui->old_input_state |= 1ULL << RARCH_MENU_TOGGLE; g_extern.lifecycle_state &= ~(1ULL << MODE_MENU_PREINIT); @@ -242,6 +242,10 @@ int main_entry_iterate(signature(), args_type() args) } g_extern.lifecycle_state |= (1ULL << MODE_CLEAR_INPUT); + + // If QUIT state came from command interface, we'll only see it once due to MODE_CLEAR_INPUT. + if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func()) + return 1; } } #endif diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index e15b865a0a..6019cbc870 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -1412,8 +1412,8 @@ bool menu_iterate(void *video_data) rgui->old_input_state |= 1ULL << RARCH_MENU_TOGGLE; } - rarch_check_block_hotkey(); rarch_input_poll(); + rarch_check_block_hotkey(); #ifdef HAVE_OVERLAY rarch_check_overlay(); #endif @@ -1425,7 +1425,7 @@ bool menu_iterate(void *video_data) if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func()) { g_extern.lifecycle_state |= (1ULL << MODE_GAME); - goto deinit; + return false; } input_state = menu_input(); @@ -1522,12 +1522,9 @@ bool menu_iterate(void *video_data) } if (ret || input_entry_ret) - goto deinit; + return false; return true; - -deinit: - return false; } #endif diff --git a/retroarch.c b/retroarch.c index 7a4aa24a66..756ba61b97 100644 --- a/retroarch.c +++ b/retroarch.c @@ -598,6 +598,11 @@ void rarch_input_poll(void) if (driver.overlay) // Poll overlay state input_poll_overlay(); #endif + +#ifdef HAVE_COMMAND + if (driver.command) + rarch_cmd_poll(driver.command); +#endif } #ifndef RARCH_CONSOLE @@ -3176,11 +3181,6 @@ bool rarch_main_iterate(void) return false; } -#ifdef HAVE_COMMAND - if (driver.command) - rarch_cmd_pre_frame(driver.command); -#endif - // Checks for stuff like fullscreen, save states, etc. do_state_checks(); @@ -3364,11 +3364,6 @@ int rarch_main_init_wrap(const struct rarch_main_wrap *args) bool rarch_main_idle_iterate(void) { -#ifdef HAVE_COMMAND - if (driver.command) - rarch_cmd_pre_frame(driver.command); -#endif - if (input_key_pressed_func(RARCH_QUIT_KEY) || !video_alive_func()) return false;