Pass data to context_reset callback

This commit is contained in:
twinaphex 2015-12-10 17:01:06 +01:00
parent 02bac66c9e
commit 18d3cb0649
5 changed files with 14 additions and 19 deletions

View File

@ -1112,11 +1112,10 @@ static void mui_populate_entries(
mui->scroll_y = mui_get_scroll(mui);
}
static void mui_context_reset(void)
static void mui_context_reset(void *data)
{
char iconpath[PATH_MAX_LENGTH] = {0};
menu_handle_t *menu = menu_driver_get_ptr();
mui_handle_t *mui = menu ? (mui_handle_t*)menu->userdata : NULL;
mui_handle_t *mui = (mui_handle_t*)data;
settings_t *settings = config_get_ptr();
if (!mui || !settings)

View File

@ -2196,19 +2196,13 @@ static void xmb_context_reset_background(const char *iconpath)
menu_display_handle_wallpaper_upload, NULL);
}
static void xmb_context_reset(void)
static void xmb_context_reset(void *data)
{
char mediapath[PATH_MAX_LENGTH] = {0};
char themepath[PATH_MAX_LENGTH] = {0};
char iconpath[PATH_MAX_LENGTH] = {0};
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
if (!menu)
return;
xmb = (xmb_handle_t*)menu->userdata;
xmb_handle_t *xmb = (xmb_handle_t*)data;
if (!xmb)
return;

View File

@ -1166,17 +1166,16 @@ static void zarch_allocate_white_texture(zui_t *zui)
TEXTURE_FILTER_NEAREST);
}
static void zarch_context_reset(void)
static void zarch_context_reset(void *data)
{
zui_t *zui = NULL;
const char *font_path = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
const char *font_path = NULL;
zui_t *zui = (zui_t*)data;
if (!menu || !menu->userdata || !settings)
if (!zui || !settings)
return;
zui = (zui_t*)menu->userdata;
font_path = settings->video.font_enable ? settings->video.font_path : NULL;
if (!menu_display_init_main_font(font_path, zui->font_size))

View File

@ -171,7 +171,7 @@ void menu_driver_context_destroy(void)
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu || !menu->userdata)
if (!menu)
return;
if (driver && driver->context_destroy)
driver->context_destroy(menu->userdata);
@ -236,10 +236,13 @@ void *menu_driver_list_get_entry(menu_list_type_t type, unsigned i)
void menu_driver_context_reset(void)
{
menu_handle_t *menu = menu_driver_get_ptr();
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
if (!menu)
return;
if (driver->context_reset)
driver->context_reset();
driver->context_reset(menu->userdata);
}

View File

@ -255,7 +255,7 @@ typedef struct menu_ctx_driver
void (*frame)(void *data);
void* (*init)(void);
void (*free)(void*);
void (*context_reset)(void);
void (*context_reset)(void *data);
void (*context_destroy)(void *data);
void (*populate_entries)(void *data,
const char *path, const char *label,