diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index d4c8f36eca..188a1b71fe 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1020,15 +1020,9 @@ static void mui_context_destroy(void) mui_context_bg_destroy(mui); } -static bool mui_load_image(void *data, menu_image_type_t type) +static bool mui_load_image(void *userdata, void *data, menu_image_type_t type) { - mui_handle_t *mui = NULL; - menu_handle_t *menu = menu_driver_get_ptr(); - - if (!menu || !menu->userdata) - return false; - - mui = (mui_handle_t*)menu->userdata; + mui_handle_t *mui = (mui_handle_t*)userdata; switch (type) { diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 2f8be5def5..1bb3224ad3 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2005,15 +2005,9 @@ static void xmb_context_bg_destroy(xmb_handle_t *xmb) menu_display_texture_unload((uintptr_t*)&xmb->textures.bg.id); } -static bool xmb_load_image(void *data, menu_image_type_t type) +static bool xmb_load_image(void *userdata, void *data, menu_image_type_t type) { - xmb_handle_t *xmb = NULL; - menu_handle_t *menu = menu_driver_get_ptr(); - - if (!menu) - return false; - - xmb = (xmb_handle_t*)menu->userdata; + xmb_handle_t *xmb = (xmb_handle_t*)userdata; if (!xmb || !data) return false; @@ -2040,8 +2034,6 @@ static bool xmb_load_image(void *data, menu_image_type_t type) return true; } - - static void xmb_context_reset_textures(xmb_handle_t *xmb, const char *iconpath) { unsigned i; diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 0a05c4a6ee..85b26d264c 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -1130,15 +1130,10 @@ static void zarch_context_destroy(void) zarch_context_bg_destroy(zui); } -static bool zarch_load_image(void *data, menu_image_type_t type) +static bool zarch_load_image(void *userdata, + void *data, menu_image_type_t type) { - zui_t *zui = NULL; - menu_handle_t *menu = menu_driver_get_ptr(); - - if (!menu) - return false; - - zui = (zui_t*)menu->userdata; + zui_t *zui = (zui_t*)userdata; if (!zui || !data) return false; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index fff2034d2c..373b2547b4 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -330,9 +330,10 @@ static void menu_driver_toggle(bool latch) bool menu_driver_load_image(void *data, menu_image_type_t type) { const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); + menu_handle_t *menu = menu_driver_get_ptr(); if (driver->load_image) - return driver->load_image(data, type); + return driver->load_image(menu->userdata, data, type); return false; } diff --git a/menu/menu_driver.h b/menu/menu_driver.h index e2f867b68e..0b7499d75d 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -282,7 +282,7 @@ typedef struct menu_ctx_driver 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); - bool (*load_image)(void *data, menu_image_type_t type); + bool (*load_image)(void *userdata, void *data, menu_image_type_t type); const char *ident; int (*environ_cb)(menu_environ_cb_t type, void *data, void *userdata); int (*pointer_tap)(void *data, unsigned x, unsigned y, unsigned ptr,