Add RARCH_MENU_CTL_BIND_INIT

This commit is contained in:
twinaphex 2016-02-11 00:53:49 +01:00
parent ddf5283ecd
commit 9e69551408
3 changed files with 51 additions and 19 deletions

View File

@ -39,6 +39,7 @@ void menu_cbs_init(void *data,
const char *path, const char *label, const char *path, const char *label,
unsigned type, size_t idx) unsigned type, size_t idx)
{ {
menu_ctx_bind_t bind_info;
char elem0[PATH_MAX_LENGTH]; char elem0[PATH_MAX_LENGTH];
char elem1[PATH_MAX_LENGTH]; char elem1[PATH_MAX_LENGTH];
const char *repr_label = NULL; 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); 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; (void)ret;

View File

@ -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); 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, static void menu_input_key_event(bool down, unsigned keycode,
uint32_t character, uint16_t mod) 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); point->cbs, point->entry, point->action);
} }
break; 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: default:
case RARCH_MENU_CTL_NONE: case RARCH_MENU_CTL_NONE:
break; break;

View File

@ -161,7 +161,8 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_ITERATE, RARCH_MENU_CTL_ITERATE,
RARCH_MENU_CTL_ENVIRONMENT, RARCH_MENU_CTL_ENVIRONMENT,
RARCH_MENU_CTL_DRIVER_DATA_GET, RARCH_MENU_CTL_DRIVER_DATA_GET,
RARCH_MENU_CTL_POINTER_TAP RARCH_MENU_CTL_POINTER_TAP,
RARCH_MENU_CTL_BIND_INIT
}; };
typedef enum typedef enum
@ -383,6 +384,20 @@ typedef struct menu_ctx_pointer
int retcode; int retcode;
} menu_ctx_pointer_t; } 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: * menu_driver_find_handle:
* @index : index of driver to get handle to. * @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); 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 */ /* HACK */
extern unsigned int rdb_entry_start_game_selection_ptr; extern unsigned int rdb_entry_start_game_selection_ptr;