From 14bf640bf6a6d115578b3447ae6965b14d3835ea Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 22 Oct 2015 04:12:32 +0200 Subject: [PATCH] Create list_push callback - allows us to override lists --- menu/drivers/glui.c | 1 + menu/drivers/null.c | 1 + menu/drivers/rgui.c | 1 + menu/drivers/rmenu.c | 1 + menu/drivers/xmb.c | 6 ++++++ menu/drivers/zarch.c | 1 + menu/menu_displaylist.c | 3 +++ menu/menu_driver.c | 10 ++++++++++ menu/menu_driver.h | 3 +++ 9 files changed, 27 insertions(+) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index cd89d53e41..1e87a0713e 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -865,6 +865,7 @@ menu_ctx_driver_t menu_ctx_glui = { NULL, NULL, NULL, + NULL, glui_list_set_selection, NULL, glui_load_image, diff --git a/menu/drivers/null.c b/menu/drivers/null.c index c43cf2093d..d8e464d01b 100644 --- a/menu/drivers/null.c +++ b/menu/drivers/null.c @@ -47,6 +47,7 @@ menu_ctx_driver_t menu_ctx_null = { NULL, /* list_delete */ NULL, /* list_clear */ NULL, /* list_cache */ + NULL, /* list_push */ NULL, /* list_get_selection */ NULL, /* list_get_size */ NULL, /* list_get_entry */ diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 36194cec14..2a1d85e7e6 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -867,6 +867,7 @@ menu_ctx_driver_t menu_ctx_rgui = { NULL, NULL, NULL, + NULL, "rgui", MENU_VIDEO_DRIVER_GENERIC, rgui_environ, diff --git a/menu/drivers/rmenu.c b/menu/drivers/rmenu.c index e8b145f7a9..47e7506512 100644 --- a/menu/drivers/rmenu.c +++ b/menu/drivers/rmenu.c @@ -355,6 +355,7 @@ menu_ctx_driver_t menu_ctx_rmenu = { NULL, NULL, NULL, + NULL, "rmenu", MENU_VIDEO_DRIVER_DIRECT3D, rmenu_environ, diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 25dabffbf5..bce269e4f0 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2590,6 +2590,11 @@ static int xmb_list_bind_init(menu_file_list_cbs_t *cbs, return -1; } +static int xmb_list_push(menu_displaylist_info_t *info, unsigned type) +{ + return -1; +} + static bool xmb_menu_init_list(void *data) { int ret; @@ -2638,6 +2643,7 @@ menu_ctx_driver_t menu_ctx_xmb = { xmb_list_free, xmb_list_clear, xmb_list_cache, + xmb_list_push, xmb_list_get_selection, xmb_list_get_size, xmb_list_get_entry, diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 59c4f52a5c..4c44ef6f1b 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -1244,6 +1244,7 @@ menu_ctx_driver_t menu_ctx_zarch = { NULL, NULL, NULL, + NULL, zarch_load_image, "zarch", MENU_VIDEO_DRIVER_OPENGL, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 7317a5916d..7204c4deef 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2188,6 +2188,9 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) struct video_shader *shader = video_shader_driver_get_current_shader(); #endif + if (menu_driver_list_push(info, type)) + return 0; + switch (type) { case DISPLAYLIST_HELP_SCREEN_LIST: diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 9d20e1dca1..90131234f7 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -245,6 +245,16 @@ size_t menu_driver_list_get_selection(void) return 0; } +bool menu_driver_list_push(menu_displaylist_info_t *info, unsigned type) +{ + const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); + + if (driver->list_push) + if (driver->list_push(info, type) == 0) + return true; + return false; +} + void menu_driver_list_cache(menu_list_type_t type, unsigned action) { const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 5a028633fc..44499f15de 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -129,6 +129,7 @@ typedef struct menu_ctx_driver void (*list_free)(file_list_t *list, size_t, size_t); void (*list_clear)(file_list_t *list); void (*list_cache)(menu_list_type_t, unsigned); + int (*list_push)(menu_displaylist_info_t*, unsigned); size_t(*list_get_selection)(void *data); size_t(*list_get_size)(void *data, menu_list_type_t type); void *(*list_get_entry)(void *data, menu_list_type_t type, unsigned i); @@ -214,6 +215,8 @@ void menu_driver_context_destroy(void); bool menu_driver_alive(void); +bool menu_driver_list_push(menu_displaylist_info_t *info, unsigned type); + size_t menu_driver_list_get_selection(void); bool menu_environment_cb(menu_environ_cb_t type, void *data);