diff --git a/menu/menu_driver.c b/menu/menu_driver.c index f89fb1fde6..4f3cbfcece 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -289,23 +289,25 @@ int menu_driver_bind_init(menu_file_list_cbs_t *cbs, label_hash, menu_label_hash); } -int menu_driver_iterate(enum menu_action action) +bool menu_driver_iterate(enum menu_action action) { if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL)) { menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_QUIT, NULL); - return -1; + return false; } if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_SHUTDOWN, NULL)) { menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_SHUTDOWN, NULL); if (!event_cmd_ctl(EVENT_CMD_QUIT, NULL)) - return -1; - return 0; + return false; + return true; } if (!menu_driver_ctx || !menu_driver_ctx->iterate) - return -1; - return menu_driver_ctx->iterate(menu_driver_data, menu_userdata, action); + return false; + if (menu_driver_ctx->iterate(menu_driver_data, menu_userdata, action) == -1) + return false; + return true; } static void menu_input_key_event(bool down, unsigned keycode, diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 5f922c7771..e8926e82c1 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -391,7 +391,7 @@ size_t menu_driver_list_get_selection(void); bool menu_environment_cb(menu_environ_cb_t type, void *data); -int menu_driver_iterate(enum menu_action action); +bool menu_driver_iterate(enum menu_action action); int menu_driver_bind_init(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx, diff --git a/runloop.c b/runloop.c index 2f5cc09484..360cea6ecd 100644 --- a/runloop.c +++ b/runloop.c @@ -1360,12 +1360,13 @@ int runloop_iterate(unsigned *sleep_ms) #ifdef HAVE_MENU if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) { - bool focused = runloop_ctl(RUNLOOP_CTL_CHECK_FOCUS, NULL) + bool focused = runloop_ctl(RUNLOOP_CTL_CHECK_FOCUS, NULL) && !ui_companion_is_on_foreground(); - bool is_idle = runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL); + bool is_idle = runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL); + enum menu_action action = (enum menu_action) + menu_input_frame_retropad(cmd.state[0], cmd.state[2]); - if (menu_driver_iterate((enum menu_action) - menu_input_frame_retropad(cmd.state[0], cmd.state[2])) == -1) + if (!menu_driver_iterate(action)) rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); if (focused || !is_idle)