Change return value to menu_driver_iterate

This commit is contained in:
twinaphex 2016-02-10 20:08:10 +01:00
parent 86e8c7a9f8
commit 9db5d45361
3 changed files with 14 additions and 11 deletions

View File

@ -289,23 +289,25 @@ int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
label_hash, menu_label_hash); 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)) if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL))
{ {
menu_driver_ctl(RARCH_MENU_CTL_UNSET_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)) if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_SHUTDOWN, NULL))
{ {
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_SHUTDOWN, NULL); menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_SHUTDOWN, NULL);
if (!event_cmd_ctl(EVENT_CMD_QUIT, NULL)) if (!event_cmd_ctl(EVENT_CMD_QUIT, NULL))
return -1; return false;
return 0; return true;
} }
if (!menu_driver_ctx || !menu_driver_ctx->iterate) if (!menu_driver_ctx || !menu_driver_ctx->iterate)
return -1; return false;
return menu_driver_ctx->iterate(menu_driver_data, menu_userdata, action); 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, static void menu_input_key_event(bool down, unsigned keycode,

View File

@ -391,7 +391,7 @@ size_t menu_driver_list_get_selection(void);
bool menu_environment_cb(menu_environ_cb_t type, void *data); 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, int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx, const char *path, const char *label, unsigned type, size_t idx,

View File

@ -1363,9 +1363,10 @@ int runloop_iterate(unsigned *sleep_ms)
bool focused = runloop_ctl(RUNLOOP_CTL_CHECK_FOCUS, NULL) bool focused = runloop_ctl(RUNLOOP_CTL_CHECK_FOCUS, NULL)
&& !ui_companion_is_on_foreground(); && !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) if (!menu_driver_iterate(action))
menu_input_frame_retropad(cmd.state[0], cmd.state[2])) == -1)
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
if (focused || !is_idle) if (focused || !is_idle)