Merge pull request #1710 from natinusala/master

Added an input/action callback in the menu_ctx_driver
This commit is contained in:
Twinaphex 2015-05-19 21:49:13 +02:00
commit f0506843c0
8 changed files with 24 additions and 2 deletions

View File

@ -674,4 +674,5 @@ menu_ctx_driver_t menu_ctx_glui = {
NULL,
glui_load_wallpaper,
"glui",
NULL,
};

View File

@ -48,4 +48,5 @@ menu_ctx_driver_t menu_ctx_null = {
NULL, // list_set_selection
NULL,
"null",
NULL,
};

View File

@ -654,4 +654,5 @@ menu_ctx_driver_t menu_ctx_rgui = {
NULL,
NULL,
"rgui",
NULL,
};

View File

@ -329,4 +329,5 @@ menu_ctx_driver_t menu_ctx_rmenu = {
NULL,
NULL,
"rmenu",
NULL,
};

View File

@ -683,4 +683,5 @@ menu_ctx_driver_t menu_ctx_rmenu_xui = {
rmenu_xui_list_set_selection,
NULL,
"rmenu_xui",
NULL,
};

View File

@ -1936,4 +1936,5 @@ menu_ctx_driver_t menu_ctx_xmb = {
NULL,
xmb_load_wallpaper,
"xmb",
NULL,
};

View File

@ -254,6 +254,7 @@ typedef struct menu_ctx_driver
void (*list_set_selection)(file_list_t *list);
bool (*load_background)(void *data);
const char *ident;
bool (*perform_action)(void* data, unsigned action);
} menu_ctx_driver_t;
extern menu_ctx_driver_t menu_ctx_rmenu;

View File

@ -940,6 +940,14 @@ void menu_input_post_iterate(int *ret, unsigned action)
*ret |= menu_input_pointer_post_iterate(cbs, &entry, action);
}
static const menu_ctx_driver_t *menu_ctx_driver_get_ptr(void)
{
driver_t *driver = driver_get_ptr();
if (!driver || !driver->menu_ctx)
return NULL;
return driver->menu_ctx;
}
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
{
unsigned ret = 0;
@ -1029,6 +1037,13 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
if (settings->menu.pointer.enable)
menu_input_pointer(&ret);
return ret;
if (trigger_input && menu_ctx_driver_get_ptr()->perform_action && menu_ctx_driver_get_ptr()->perform_action(menu->userdata, ret))
{
return MENU_ACTION_NOOP;
}
else
{
return ret;
}
}