Revert "Add userdata pointer to frame callback"

This reverts commit ca9520a5224a3f701aea4a8aa0f7e7b67a4dfb02.
This commit is contained in:
twinaphex 2015-12-10 15:17:37 +01:00
parent ca9520a522
commit d2c5139ab1
7 changed files with 55 additions and 32 deletions

View File

@ -567,6 +567,7 @@ static void mui_render_label_value(mui_handle_t *mui,
static void mui_render_menu_list(mui_handle_t *mui,
unsigned width, unsigned height,
menu_handle_t *menu,
uint32_t normal_color,
uint32_t hover_color,
float *pure_white)
@ -663,7 +664,7 @@ static void bgcolor_setalpha(float *bg, float alpha)
bg[15] = alpha;
}
static void mui_frame(void *data)
static void mui_frame(void)
{
unsigned header_height;
bool display_kb;
@ -722,7 +723,8 @@ static void mui_frame(void *data)
size_t selection;
size_t title_margin;
uint64_t *frame_count;
mui_handle_t *mui = (mui_handle_t*)data;
mui_handle_t *mui = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
const uint32_t normal_color = 0x212121ff;
const uint32_t hover_color = 0x212121ff;
@ -736,9 +738,11 @@ static void mui_frame(void *data)
(void)passivetab_color;
(void)activetab_color;
if (!mui)
if (!menu || !menu->userdata)
return;
mui = (mui_handle_t*)menu->userdata;
msg[0] = '\0';
title[0] = '\0';
title_buf[0] = '\0';
@ -799,7 +803,7 @@ static void mui_frame(void *data)
menu_display_font_bind_block(&mui->list_block);
mui_render_menu_list(mui, width, height, normal_color, hover_color, &pure_white[0]);
mui_render_menu_list(mui, width, height, menu, normal_color, hover_color, &pure_white[0]);
menu_display_font_flush_block();
@ -811,7 +815,7 @@ static void mui_frame(void *data)
mui->tabs_height = 0;
/* display tabs if depth equal one, if not hide them */
if (mui_list_get_size(mui, MENU_LIST_PLAIN) == 1)
if (mui_list_get_size(menu, MENU_LIST_PLAIN) == 1)
{
mui_draw_tab_begin(mui, width, height, &white_bg[0], &grey_bg[0]);

View File

@ -124,6 +124,7 @@ static void rmenu_render(void *data)
char title[256] = {0};
char title_buf[256] = {0};
char title_msg[64] = {0};
menu_handle_t *menu = menu_driver_get_ptr();
size_t entries_end = menu_entries_get_end();
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
@ -131,6 +132,9 @@ static void rmenu_render(void *data)
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return;
if (!menu)
return;
if (!render_normal)
{
render_normal = true;

View File

@ -398,7 +398,7 @@ end:
string_list_free(list);
}
static void rmenu_xui_frame(void *data)
static void rmenu_xui_frame(void)
{
XUIMessage msg;
XUIMessageRender msgRender;
@ -406,8 +406,13 @@ static void rmenu_xui_frame(void *data)
LPDIRECT3DDEVICE d3dr;
const char *message;
D3DVIEWPORT vp_full = {0};
d3d_video_t *d3d = (d3d_video_t*)
video_driver_get_ptr(false);
d3d_video_t *d3d = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
return;
d3d = (d3d_video_t*)video_driver_get_ptr(false);
if (!d3d)
return;

View File

@ -265,7 +265,8 @@ static size_t xmb_list_get_selection(void *data)
static size_t xmb_list_get_size(void *data, menu_list_type_t type)
{
size_t list_size = 0;
xmb_handle_t *xmb = (xmb_handle_t*)data;
menu_handle_t *menu = (menu_handle_t*)data;
xmb_handle_t *xmb = menu ? (xmb_handle_t*)menu->userdata : NULL;
switch (type)
{
@ -593,7 +594,7 @@ static void xmb_selection_pointer_changed(bool allow_animations)
ia = XMB_ITEM_ACTIVE_ALPHA;
iz = XMB_ITEM_ACTIVE_ZOOM;
depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN);
depth = xmb_list_get_size(menu, MENU_LIST_PLAIN);
if (settings->menu.boxart_enable && depth == 1)
{
xmb_update_boxart_path(xmb, i);
@ -894,7 +895,7 @@ static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i)
static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu)
{
unsigned j;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
for (j = 0; j <= list_size; j++)
{
@ -962,7 +963,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
static void xmb_list_open_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu)
{
unsigned j;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
for (j = 0; j <= list_size; j++)
{
@ -986,7 +987,7 @@ static void xmb_context_destroy_horizontal_list(xmb_handle_t *xmb,
menu_handle_t *menu)
{
unsigned i;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL);
size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL);
for (i = 0; i < list_size; i++)
{
@ -1027,7 +1028,7 @@ static void xmb_init_horizontal_list(menu_handle_t *menu, xmb_handle_t *xmb)
static void xmb_toggle_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu)
{
unsigned i;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
for (i = 0; i <= list_size; i++)
{
@ -1054,7 +1055,7 @@ static void xmb_context_reset_horizontal_list(xmb_handle_t *xmb,
{
unsigned i;
int depth; /* keep this integer */
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL);
size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL);
xmb->categories.x_pos = xmb->icon.spacing.horizontal *
-(float)xmb->categories.selection_ptr;
@ -1171,7 +1172,7 @@ static void xmb_list_open(xmb_handle_t *xmb)
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return;
xmb->depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN);
xmb->depth = xmb_list_get_size(menu, MENU_LIST_PLAIN);
if (xmb->depth > xmb->old_depth)
dir = 1;
@ -1612,11 +1613,11 @@ static void xmb_render(void *data)
}
static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
unsigned width, unsigned height,
menu_handle_t *menu, unsigned width, unsigned height,
float *color)
{
unsigned i;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
size_t list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
for (i = 0; i <= list_size; i++)
{
@ -1645,7 +1646,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
}
}
static void xmb_frame(void *data)
static void xmb_frame(void)
{
size_t selection;
math_matrix_4x4 mymat;
@ -1658,13 +1659,19 @@ static void xmb_frame(void *data)
float coord_color2[16];
bool display_kb;
bool render_background = false;
xmb_handle_t *xmb = (xmb_handle_t*)data;
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
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)
return;
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return;
xmb = (xmb_handle_t*)menu->userdata;
if (!xmb)
return;
@ -1714,7 +1721,7 @@ static void xmb_frame(void *data)
height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT,
width, height);
depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN);
depth = xmb_list_get_size(menu, MENU_LIST_PLAIN);
xmb_draw_items(xmb,
xmb->selection_buf_old,
@ -1765,7 +1772,7 @@ static void xmb_frame(void *data)
0,
1, &coord_color2[0]);
xmb_frame_horizontal_list(xmb, width, height, &item_color[0]);
xmb_frame_horizontal_list(xmb, menu, width, height, &item_color[0]);
menu_display_font_flush_block();
@ -2442,7 +2449,7 @@ static void xmb_list_cache(menu_list_type_t type, unsigned action)
xmb_list_deep_copy(menu, menu_stack, xmb->menu_stack_old);
xmb->selection_ptr_old = selection;
list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
list_size = xmb_list_get_size(menu, MENU_LIST_HORIZONTAL) + XMB_SYSTEM_TAB_END;
switch (type)
{
@ -2555,7 +2562,7 @@ static void xmb_toggle(bool menu_on)
if (!xmb)
return;
xmb->depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN);
xmb->depth = xmb_list_get_size(menu, MENU_LIST_PLAIN);
if (!menu_on)
{

View File

@ -111,6 +111,7 @@ typedef struct zarch_handle
{
enum menu_action action;
bool rendering;
menu_handle_t *menu;
math_matrix_4x4 mvp;
unsigned width;
unsigned height;
@ -939,18 +940,21 @@ static int zarch_zui_render_pick_core(zui_t *zui)
return 0;
}
static void zarch_frame(void *data)
static void zarch_frame(void)
{
unsigned i;
float coord_color[16];
float coord_color2[16];
zui_t *zui = (zui_t*)data;
zui_t *zui = NULL;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (!zui)
return;
if (!menu)
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);

View File

@ -632,7 +632,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
static bool menu_driver_load_no_content = false;
static bool menu_driver_alive = false;
static bool menu_driver_data_own = false;
menu_handle_t *menu = menu_driver_get_ptr();
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
switch (state)
@ -648,7 +647,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
if (!menu_driver_alive)
return false;
if (driver->frame)
driver->frame(menu->userdata);
driver->frame();
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 *data);
void (*frame)(void);
void* (*init)(void);
void (*free)(void*);
void (*context_reset)(void);