Pass userdata handle to frame callback

This commit is contained in:
twinaphex 2015-12-10 15:44:26 +01:00
parent 6db1a8eb0d
commit 87ff4d7d82
5 changed files with 15 additions and 27 deletions

View File

@ -663,7 +663,7 @@ static void bgcolor_setalpha(float *bg, float alpha)
bg[15] = alpha;
}
static void mui_frame(void)
static void mui_frame(void *data)
{
unsigned header_height;
bool display_kb;
@ -722,8 +722,7 @@ static void mui_frame(void)
size_t selection;
size_t title_margin;
uint64_t *frame_count;
mui_handle_t *mui = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
mui_handle_t *mui = (mui_handle_t*)data;
settings_t *settings = config_get_ptr();
const uint32_t normal_color = 0x212121ff;
const uint32_t hover_color = 0x212121ff;
@ -737,11 +736,9 @@ static void mui_frame(void)
(void)passivetab_color;
(void)activetab_color;
if (!menu || !menu->userdata)
if (!mui)
return;
mui = (mui_handle_t*)menu->userdata;
msg[0] = '\0';
title[0] = '\0';
title_buf[0] = '\0';

View File

@ -1639,7 +1639,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
}
}
static void xmb_frame(void)
static void xmb_frame(void *data)
{
size_t selection;
math_matrix_4x4 mymat;
@ -1652,22 +1652,16 @@ static void xmb_frame(void)
float coord_color2[16];
bool display_kb;
bool render_background = false;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
xmb_handle_t *xmb = (xmb_handle_t*)data;
settings_t *settings = config_get_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
if (!menu)
if (!xmb)
return;
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return;
xmb = (xmb_handle_t*)menu->userdata;
if (!xmb)
return;
msg[0] = '\0';
title_msg[0] = '\0';
timedate[0] = '\0';

View File

@ -111,7 +111,6 @@ typedef struct zarch_handle
{
enum menu_action action;
bool rendering;
menu_handle_t *menu;
math_matrix_4x4 mvp;
unsigned width;
unsigned height;
@ -204,7 +203,7 @@ static enum
LAY_SETTINGS
} layout = LAY_HOME;
static void zarch_zui_font(menu_handle_t *menu)
static void zarch_zui_font(void)
{
int font_size;
char mediapath[PATH_MAX_LENGTH], fontpath[PATH_MAX_LENGTH];
@ -940,21 +939,18 @@ static int zarch_zui_render_pick_core(zui_t *zui)
return 0;
}
static void zarch_frame(void)
static void zarch_frame(void *data)
{
unsigned i;
float coord_color[16];
float coord_color2[16];
zui_t *zui = NULL;
zui_t *zui = (zui_t*)data;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
if (!zui)
return;
zui = (zui_t*)menu->userdata;
zui->menu = menu;
video_driver_get_size(&zui->width, &zui->height);
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
@ -1089,7 +1085,7 @@ static void *zarch_init(void)
matrix_4x4_ortho(&zui->mvp, 0, 1, 1, 0, 0, 1);
zarch_zui_font(menu);
zarch_zui_font();
return menu;
error:
@ -1201,7 +1197,7 @@ static void zarch_context_reset(void)
zarch_allocate_white_texture(zui);
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_SIZE, &zui->font_size);
zarch_zui_font(menu);
zarch_zui_font();
}
static int zarch_iterate(enum menu_action action)

View File

@ -633,6 +633,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
static bool menu_driver_alive = false;
static bool menu_driver_data_own = false;
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
switch (state)
{
@ -647,7 +648,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
if (!menu_driver_alive)
return false;
if (driver->frame)
driver->frame();
driver->frame(menu->userdata);
break;
case RARCH_MENU_CTL_SET_PREVENT_POPULATE:
menu_driver_prevent_populate = true;

View File

@ -252,7 +252,7 @@ typedef struct menu_ctx_driver
void (*render_messagebox)(void *data, const char *msg);
int (*iterate)(enum menu_action action);
void (*render)(void *data);
void (*frame)(void);
void (*frame)(void *data);
void* (*init)(void);
void (*free)(void*);
void (*context_reset)(void);