Create RARCH_MENU_CTL_ITERATE
This commit is contained in:
parent
9db5d45361
commit
b5e28cda58
|
@ -289,27 +289,6 @@ int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
|
||||||
label_hash, menu_label_hash);
|
label_hash, menu_label_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 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 false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!menu_driver_ctx || !menu_driver_ctx->iterate)
|
|
||||||
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,
|
static void menu_input_key_event(bool down, unsigned keycode,
|
||||||
uint32_t character, uint16_t mod)
|
uint32_t character, uint16_t mod)
|
||||||
{
|
{
|
||||||
|
@ -783,6 +762,28 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||||
return menu_driver_ctx->load_image(menu_userdata,
|
return menu_driver_ctx->load_image(menu_userdata,
|
||||||
load_image_info->data, load_image_info->type);
|
load_image_info->data, load_image_info->type);
|
||||||
}
|
}
|
||||||
|
case RARCH_MENU_CTL_ITERATE:
|
||||||
|
{
|
||||||
|
menu_ctx_iterate_t *iterate = (menu_ctx_iterate_t*)data;
|
||||||
|
|
||||||
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL))
|
||||||
|
{
|
||||||
|
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_QUIT, NULL);
|
||||||
|
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 false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!menu_driver_ctx || !menu_driver_ctx->iterate)
|
||||||
|
return false;
|
||||||
|
if (menu_driver_ctx->iterate(menu_driver_data, menu_userdata, iterate->action) == -1)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
case RARCH_MENU_CTL_NONE:
|
case RARCH_MENU_CTL_NONE:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -146,7 +146,8 @@ enum rarch_menu_ctl_state
|
||||||
RARCH_MENU_CTL_FIND_DRIVER,
|
RARCH_MENU_CTL_FIND_DRIVER,
|
||||||
RARCH_MENU_CTL_LOAD_IMAGE,
|
RARCH_MENU_CTL_LOAD_IMAGE,
|
||||||
RARCH_MENU_CTL_LIST_CACHE,
|
RARCH_MENU_CTL_LIST_CACHE,
|
||||||
RARCH_MENU_CTL_LIST_INSERT
|
RARCH_MENU_CTL_LIST_INSERT,
|
||||||
|
RARCH_MENU_CTL_ITERATE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -339,12 +340,10 @@ typedef struct menu_ctx_list
|
||||||
unsigned action;
|
unsigned action;
|
||||||
} menu_ctx_list_t;
|
} menu_ctx_list_t;
|
||||||
|
|
||||||
extern menu_ctx_driver_t menu_ctx_xui;
|
typedef struct menu_ctx_iterate
|
||||||
extern menu_ctx_driver_t menu_ctx_rgui;
|
{
|
||||||
extern menu_ctx_driver_t menu_ctx_mui;
|
enum menu_action action;
|
||||||
extern menu_ctx_driver_t menu_ctx_xmb;
|
} menu_ctx_iterate_t;
|
||||||
extern menu_ctx_driver_t menu_ctx_zarch;
|
|
||||||
extern menu_ctx_driver_t menu_ctx_null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* menu_driver_find_handle:
|
* menu_driver_find_handle:
|
||||||
|
@ -377,8 +376,6 @@ const char* config_get_menu_driver_options(void);
|
||||||
|
|
||||||
menu_handle_t *menu_driver_get_ptr(void);
|
menu_handle_t *menu_driver_get_ptr(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void menu_driver_list_free(file_list_t *list, size_t i, size_t list_size);
|
void menu_driver_list_free(file_list_t *list, size_t i, size_t list_size);
|
||||||
|
|
||||||
size_t menu_driver_list_get_size(menu_list_type_t type);
|
size_t menu_driver_list_get_size(menu_list_type_t type);
|
||||||
|
@ -391,8 +388,6 @@ 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);
|
||||||
|
|
||||||
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,
|
||||||
const char *elem0, const char *elem1,
|
const char *elem0, const char *elem1,
|
||||||
|
@ -409,6 +404,13 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data);
|
||||||
|
|
||||||
int menu_iterate_render(void *data, void *userdata);
|
int menu_iterate_render(void *data, void *userdata);
|
||||||
|
|
||||||
|
extern menu_ctx_driver_t menu_ctx_xui;
|
||||||
|
extern menu_ctx_driver_t menu_ctx_rgui;
|
||||||
|
extern menu_ctx_driver_t menu_ctx_mui;
|
||||||
|
extern menu_ctx_driver_t menu_ctx_xmb;
|
||||||
|
extern menu_ctx_driver_t menu_ctx_zarch;
|
||||||
|
extern menu_ctx_driver_t menu_ctx_null;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1360,13 +1360,16 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
||||||
{
|
{
|
||||||
|
menu_ctx_iterate_t iter;
|
||||||
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)
|
enum menu_action action = (enum menu_action)
|
||||||
menu_input_frame_retropad(cmd.state[0], cmd.state[2]);
|
menu_input_frame_retropad(cmd.state[0], cmd.state[2]);
|
||||||
|
|
||||||
if (!menu_driver_iterate(action))
|
iter.action = action;
|
||||||
|
|
||||||
|
if (!menu_driver_ctl(RARCH_MENU_CTL_ITERATE, &iter))
|
||||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||||
|
|
||||||
if (focused || !is_idle)
|
if (focused || !is_idle)
|
||||||
|
|
|
@ -613,12 +613,15 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
|
|
||||||
- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||||
{
|
{
|
||||||
switch (buttonIndex)
|
menu_ctx_iterate_t iter;
|
||||||
{
|
|
||||||
case 0:
|
switch (buttonIndex)
|
||||||
menu_driver_iterate(MENU_ACTION_OK);
|
{
|
||||||
break;
|
case 0:
|
||||||
}
|
iter.action = MENU_ACTION_OK;
|
||||||
|
menu_driver_ctl(RARCH_MENU_CTL_ITERATE, &iter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue