diff --git a/menu/menu_cbs.c b/menu/menu_cbs.c index 89f36095b0..4f318292ed 100644 --- a/menu/menu_cbs.c +++ b/menu/menu_cbs.c @@ -39,6 +39,7 @@ void menu_cbs_init(void *data, const char *path, const char *label, unsigned type, size_t idx) { + menu_ctx_bind_t bind_info; char elem0[PATH_MAX_LENGTH]; char elem1[PATH_MAX_LENGTH]; const char *repr_label = NULL; @@ -136,7 +137,19 @@ void menu_cbs_init(void *data, menu_cbs_init_log(repr_label, "GET TITLE", cbs->action_get_title_ident); - ret = menu_driver_bind_init(cbs, path, label, type, idx, elem0, elem1, label_hash, menu_label_hash); + bind_info.cbs = cbs; + bind_info.path = path; + bind_info.label = label; + bind_info.type = type; + bind_info.idx = idx; + bind_info.elem0 = elem0; + bind_info.elem1 = elem1; + bind_info.label_hash = label_hash; + bind_info.menu_label_hash = menu_label_hash; + + menu_driver_ctl(RARCH_MENU_CTL_BIND_INIT, &bind_info); + + ret = bind_info.retcode; (void)ret; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 7abc67b133..d4c5e91f63 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -210,18 +210,6 @@ void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i) return menu_driver_ctx->list_get_entry(menu_userdata, type, i); } -int menu_driver_bind_init(menu_file_list_cbs_t *cbs, - const char *path, const char *label, unsigned type, size_t idx, - const char *elem0, const char *elem1, - uint32_t label_hash, uint32_t menu_label_hash) -{ - if (!menu_driver_ctx || !menu_driver_ctx->bind_init) - return 0; - return menu_driver_ctx->bind_init(cbs, path, label, - type, idx, elem0, elem1, - label_hash, menu_label_hash); -} - static void menu_input_key_event(bool down, unsigned keycode, uint32_t character, uint16_t mod) { @@ -829,6 +817,27 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) point->cbs, point->entry, point->action); } break; + case RARCH_MENU_CTL_BIND_INIT: + { + menu_ctx_bind_t *bind = (menu_ctx_bind_t*)data; + + if (!menu_driver_ctx || !menu_driver_ctx->bind_init) + { + bind->retcode = 0; + return false; + } + bind->retcode = menu_driver_ctx->bind_init( + bind->cbs, + bind->path, + bind->label, + bind->type, + bind->idx, + bind->elem0, + bind->elem1, + bind->label_hash, + bind->menu_label_hash); + } + break; default: case RARCH_MENU_CTL_NONE: break; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index e6a4cc5edf..2bec60578d 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -161,7 +161,8 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_ITERATE, RARCH_MENU_CTL_ENVIRONMENT, RARCH_MENU_CTL_DRIVER_DATA_GET, - RARCH_MENU_CTL_POINTER_TAP + RARCH_MENU_CTL_POINTER_TAP, + RARCH_MENU_CTL_BIND_INIT }; typedef enum @@ -383,6 +384,20 @@ typedef struct menu_ctx_pointer int retcode; } menu_ctx_pointer_t; +typedef struct menu_ctx_bind +{ + menu_file_list_cbs_t *cbs; + const char *path; + const char *label; + unsigned type; + size_t idx; + const char *elem0; + const char *elem1; + uint32_t label_hash; + uint32_t menu_label_hash; + int retcode; +} menu_ctx_bind_t; + /** * menu_driver_find_handle: * @index : index of driver to get handle to. @@ -419,11 +434,6 @@ void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i); size_t menu_driver_list_get_selection(void); -int menu_driver_bind_init(menu_file_list_cbs_t *cbs, - const char *path, const char *label, unsigned type, size_t idx, - const char *elem0, const char *elem1, - uint32_t label_hash, uint32_t menu_label_hash); - /* HACK */ extern unsigned int rdb_entry_start_game_selection_ptr;