Create typedefs

This commit is contained in:
twinaphex 2016-03-02 22:17:05 +01:00
parent 885966c16b
commit 7df467422b
2 changed files with 85 additions and 89 deletions

View File

@ -68,10 +68,7 @@ enum
#define MUI_SYSTEM_TAB_END MUI_SYSTEM_TAB_SETTINGS
struct mui_texture_item
{
uintptr_t id;
};
typedef uintptr_t mui_texture_item;
typedef struct mui_handle
{
@ -91,8 +88,8 @@ typedef struct mui_handle
float alpha;
} arrow;
struct mui_texture_item bg;
struct mui_texture_item list[MUI_TEXTURE_LAST];
mui_texture_item bg;
mui_texture_item list[MUI_TEXTURE_LAST];
uintptr_t white;
} textures;
@ -172,7 +169,7 @@ static void mui_context_reset_textures(mui_handle_t *mui,
video_texture_image_load(&ti, path);
video_driver_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR, &mui->textures.list[i].id);
TEXTURE_FILTER_MIPMAP_LINEAR, &mui->textures.list[i]);
video_texture_image_free(&ti);
}
@ -247,7 +244,7 @@ static void mui_draw_tab(mui_handle_t *mui,
break;
}
mui_draw_icon(mui, mui->textures.list[tab_icon].id,
mui_draw_icon(mui, mui->textures.list[tab_icon],
width / (MUI_SYSTEM_TAB_END+1) * (i+0.5) - mui->icon_size/2,
height - mui->tabs_height,
width, height, 0, 1, &pure_white[0]);
@ -545,15 +542,15 @@ static void mui_render_label_value(mui_handle_t *mui,
if (string_is_equal(value, "disabled") || string_is_equal(value, "off"))
{
if (mui->textures.list[MUI_TEXTURE_SWITCH_OFF].id)
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_OFF].id;
if (mui->textures.list[MUI_TEXTURE_SWITCH_OFF])
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_OFF];
else
do_draw_text = true;
}
else if (string_is_equal(value, "enabled") || string_is_equal(value, "on"))
{
if (mui->textures.list[MUI_TEXTURE_SWITCH_ON].id)
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_ON].id;
if (mui->textures.list[MUI_TEXTURE_SWITCH_ON])
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_ON];
else
do_draw_text = true;
}
@ -582,14 +579,14 @@ static void mui_render_label_value(mui_handle_t *mui,
case MENU_VALUE_MOVIE:
break;
case MENU_VALUE_ON:
if (mui->textures.list[MUI_TEXTURE_SWITCH_ON].id)
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_ON].id;
if (mui->textures.list[MUI_TEXTURE_SWITCH_ON])
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_ON];
else
do_draw_text = true;
break;
case MENU_VALUE_OFF:
if (mui->textures.list[MUI_TEXTURE_SWITCH_OFF].id)
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_OFF].id;
if (mui->textures.list[MUI_TEXTURE_SWITCH_OFF])
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_OFF];
else
do_draw_text = true;
break;
@ -678,7 +675,7 @@ static void mui_draw_cursor(mui_handle_t *mui,
draw.height = 64;
draw.coords = &coords;
draw.matrix_data = NULL;
draw.texture = mui->textures.list[MUI_TEXTURE_POINTER].id;
draw.texture = mui->textures.list[MUI_TEXTURE_POINTER];
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
@ -863,7 +860,7 @@ static void mui_frame(void *data)
menu_display_ctl(MENU_DISPLAY_CTL_CLEAR_COLOR, &clearcolor);
if (mui->textures.bg.id)
if (mui->textures.bg)
{
background_rendered = true;
@ -874,7 +871,7 @@ static void mui_frame(void *data)
draw.width = width;
draw.height = height;
draw.texture = mui->textures.bg.id;
draw.texture = mui->textures.bg;
draw.handle_alpha = 0.75f;
draw.force_transparency = true;
draw.color = &white_transp_bg[0];
@ -943,7 +940,7 @@ static void mui_frame(void *data)
if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
{
title_margin = mui->icon_size;
mui_draw_icon(mui, mui->textures.list[MUI_TEXTURE_BACK].id,
mui_draw_icon(mui, mui->textures.list[MUI_TEXTURE_BACK],
0, 0, width, height, 0, 1, &pure_white[0]);
}
@ -1151,7 +1148,7 @@ static void mui_context_bg_destroy(mui_handle_t *mui)
if (!mui)
return;
video_driver_texture_unload(&mui->textures.bg.id);
video_driver_texture_unload(&mui->textures.bg);
video_driver_texture_unload(&mui->textures.white);
}
@ -1164,7 +1161,7 @@ static void mui_context_destroy(void *data)
return;
for (i = 0; i < MUI_TEXTURE_LAST; i++)
video_driver_texture_unload(&mui->textures.list[i].id);
video_driver_texture_unload(&mui->textures.list[i]);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_DEINIT, NULL);
@ -1182,7 +1179,7 @@ static bool mui_load_image(void *userdata, void *data, enum menu_image_type type
case MENU_IMAGE_WALLPAPER:
mui_context_bg_destroy(mui);
video_driver_texture_load(data,
TEXTURE_FILTER_MIPMAP_LINEAR, &mui->textures.bg.id);
TEXTURE_FILTER_MIPMAP_LINEAR, &mui->textures.bg);
mui_allocate_white_texture(mui);
break;
case MENU_IMAGE_BOXART:

View File

@ -134,10 +134,7 @@ enum
#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_HISTORY
#endif
struct xmb_texture_item
{
uintptr_t id;
};
typedef uintptr_t xmb_texture_item;
typedef struct xmb_handle
{
@ -193,8 +190,8 @@ typedef struct xmb_handle
float alpha;
} arrow;
struct xmb_texture_item bg;
struct xmb_texture_item list[XMB_TEXTURE_LAST];
xmb_texture_item bg;
xmb_texture_item list[XMB_TEXTURE_LAST];
} textures;
struct
@ -1395,64 +1392,64 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
switch(type)
{
case MENU_FILE_DIRECTORY:
return xmb->textures.list[XMB_TEXTURE_FOLDER].id;
return xmb->textures.list[XMB_TEXTURE_FOLDER];
case MENU_FILE_PLAIN:
return xmb->textures.list[XMB_TEXTURE_FILE].id;
return xmb->textures.list[XMB_TEXTURE_FILE];
case MENU_FILE_RPL_ENTRY:
if (core_node)
return core_node->content_icon;
return xmb->textures.list[XMB_TEXTURE_FILE].id;
return xmb->textures.list[XMB_TEXTURE_FILE];
case MENU_FILE_CARCHIVE:
return xmb->textures.list[XMB_TEXTURE_ZIP].id;
return xmb->textures.list[XMB_TEXTURE_ZIP];
case MENU_FILE_MUSIC:
return xmb->textures.list[XMB_TEXTURE_MUSIC].id;
return xmb->textures.list[XMB_TEXTURE_MUSIC];
case MENU_FILE_IMAGEVIEWER:
return xmb->textures.list[XMB_TEXTURE_IMAGE].id;
return xmb->textures.list[XMB_TEXTURE_IMAGE];
case MENU_FILE_MOVIE:
return xmb->textures.list[XMB_TEXTURE_MOVIE].id;
return xmb->textures.list[XMB_TEXTURE_MOVIE];
case MENU_FILE_CORE:
return xmb->textures.list[XMB_TEXTURE_CORE].id;
return xmb->textures.list[XMB_TEXTURE_CORE];
case MENU_FILE_RDB:
return xmb->textures.list[XMB_TEXTURE_RDB].id;
return xmb->textures.list[XMB_TEXTURE_RDB];
case MENU_FILE_CURSOR:
return xmb->textures.list[XMB_TEXTURE_CURSOR].id;
return xmb->textures.list[XMB_TEXTURE_CURSOR];
case MENU_FILE_PLAYLIST_ENTRY:
case MENU_SETTING_ACTION_RUN:
return xmb->textures.list[XMB_TEXTURE_RUN].id;
return xmb->textures.list[XMB_TEXTURE_RUN];
case MENU_SETTING_ACTION_CLOSE:
return xmb->textures.list[XMB_TEXTURE_CLOSE].id;
return xmb->textures.list[XMB_TEXTURE_CLOSE];
case MENU_SETTING_ACTION_SAVESTATE:
return xmb->textures.list[XMB_TEXTURE_SAVESTATE].id;
return xmb->textures.list[XMB_TEXTURE_SAVESTATE];
case MENU_SETTING_ACTION_LOADSTATE:
return xmb->textures.list[XMB_TEXTURE_LOADSTATE].id;
return xmb->textures.list[XMB_TEXTURE_LOADSTATE];
case MENU_FILE_RDB_ENTRY:
case MENU_SETTING_ACTION_CORE_INFORMATION:
return xmb->textures.list[XMB_TEXTURE_CORE_INFO].id;
return xmb->textures.list[XMB_TEXTURE_CORE_INFO];
case MENU_SETTING_ACTION_CORE_OPTIONS:
return xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS].id;
return xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS];
case MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS:
return xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS].id;
return xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS];
case MENU_SETTING_ACTION_CORE_CHEAT_OPTIONS:
return xmb->textures.list[XMB_TEXTURE_CHEAT_OPTIONS].id;
return xmb->textures.list[XMB_TEXTURE_CHEAT_OPTIONS];
case MENU_SETTING_ACTION_CORE_DISK_OPTIONS:
return xmb->textures.list[XMB_TEXTURE_DISK_OPTIONS].id;
return xmb->textures.list[XMB_TEXTURE_DISK_OPTIONS];
case MENU_SETTING_ACTION_CORE_SHADER_OPTIONS:
return xmb->textures.list[XMB_TEXTURE_SHADER_OPTIONS].id;
return xmb->textures.list[XMB_TEXTURE_SHADER_OPTIONS];
case MENU_SETTING_ACTION_SCREENSHOT:
return xmb->textures.list[XMB_TEXTURE_SCREENSHOT].id;
return xmb->textures.list[XMB_TEXTURE_SCREENSHOT];
case MENU_SETTING_ACTION_RESET:
return xmb->textures.list[XMB_TEXTURE_RELOAD].id;
return xmb->textures.list[XMB_TEXTURE_RELOAD];
case MENU_SETTING_ACTION:
if (xmb->depth == 3)
return xmb->textures.list[XMB_TEXTURE_SUBSETTING].id;
return xmb->textures.list[XMB_TEXTURE_SETTING].id;
return xmb->textures.list[XMB_TEXTURE_SUBSETTING];
return xmb->textures.list[XMB_TEXTURE_SETTING];
case MENU_SETTING_GROUP:
return xmb->textures.list[XMB_TEXTURE_SETTING].id;
return xmb->textures.list[XMB_TEXTURE_SETTING];
case MENU_INFO_MESSAGE:
return xmb->textures.list[XMB_TEXTURE_CORE_INFO].id;
return xmb->textures.list[XMB_TEXTURE_CORE_INFO];
}
return xmb->textures.list[XMB_TEXTURE_SUBSETTING].id;
return xmb->textures.list[XMB_TEXTURE_SUBSETTING];
}
static void xmb_draw_items(xmb_handle_t *xmb,
@ -1542,53 +1539,53 @@ static void xmb_draw_items(xmb_handle_t *xmb,
switch (hash_label)
{
case MENU_LABEL_CORE_OPTIONS:
icon = xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS].id;
icon = xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS];
break;
case MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS:
icon = xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS].id;
icon = xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS];
break;
case MENU_LABEL_CORE_CHEAT_OPTIONS:
icon = xmb->textures.list[XMB_TEXTURE_CHEAT_OPTIONS].id;
icon = xmb->textures.list[XMB_TEXTURE_CHEAT_OPTIONS];
break;
case MENU_LABEL_DISK_OPTIONS:
icon = xmb->textures.list[XMB_TEXTURE_DISK_OPTIONS].id;
icon = xmb->textures.list[XMB_TEXTURE_DISK_OPTIONS];
break;
case MENU_LABEL_SHADER_OPTIONS:
icon = xmb->textures.list[XMB_TEXTURE_SHADER_OPTIONS].id;
icon = xmb->textures.list[XMB_TEXTURE_SHADER_OPTIONS];
break;
case MENU_LABEL_ACHIEVEMENT_LIST:
icon = xmb->textures.list[XMB_TEXTURE_ACHIEVEMENT_LIST].id;
icon = xmb->textures.list[XMB_TEXTURE_ACHIEVEMENT_LIST];
break;
case MENU_LABEL_SAVESTATE:
icon = xmb->textures.list[XMB_TEXTURE_SAVESTATE].id;
icon = xmb->textures.list[XMB_TEXTURE_SAVESTATE];
break;
case MENU_LABEL_LOADSTATE:
icon = xmb->textures.list[XMB_TEXTURE_LOADSTATE].id;
icon = xmb->textures.list[XMB_TEXTURE_LOADSTATE];
break;
case MENU_LABEL_TAKE_SCREENSHOT:
icon = xmb->textures.list[XMB_TEXTURE_SCREENSHOT].id;
icon = xmb->textures.list[XMB_TEXTURE_SCREENSHOT];
break;
case MENU_LABEL_RESTART_CONTENT:
icon = xmb->textures.list[XMB_TEXTURE_RELOAD].id;
icon = xmb->textures.list[XMB_TEXTURE_RELOAD];
break;
case MENU_LABEL_RESUME_CONTENT:
icon = xmb->textures.list[XMB_TEXTURE_RESUME].id;
icon = xmb->textures.list[XMB_TEXTURE_RESUME];
break;
}
if (string_is_equal(entry.value, "disabled") ||
string_is_equal(entry.value, "off"))
{
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id)
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id;
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF])
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF];
else
do_draw_text = true;
}
else if (string_is_equal(entry.value, "enabled") ||
string_is_equal(entry.value, "on"))
{
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON].id)
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON].id;
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON])
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON];
else
do_draw_text = true;
}
@ -1617,14 +1614,14 @@ static void xmb_draw_items(xmb_handle_t *xmb,
case MENU_VALUE_MOVIE:
break;
case MENU_VALUE_ON:
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON].id)
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON].id;
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON])
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON];
else
do_draw_text = true;
break;
case MENU_VALUE_OFF:
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id)
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id;
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF])
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF];
else
do_draw_text = true;
break;
@ -1732,7 +1729,7 @@ static void xmb_draw_cursor(xmb_handle_t *xmb,
draw.height = xmb->cursor.size;
draw.coords = &coords;
draw.matrix_data = NULL;
draw.texture = xmb->textures.list[XMB_TEXTURE_POINTER].id;
draw.texture = xmb->textures.list[XMB_TEXTURE_POINTER];
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
@ -1891,7 +1888,7 @@ static void xmb_frame(void *data)
draw.width = width;
draw.height = height;
draw.texture = xmb->textures.bg.id;
draw.texture = xmb->textures.bg;
draw.handle_alpha = xmb->alpha;
draw.force_transparency = false;
draw.color = &coord_color[0];
@ -1966,8 +1963,10 @@ static void xmb_frame(void *data)
coord_color2[15] = (1.00f > xmb->alpha) ? xmb->alpha : 1.00f;
if (settings->menu.timedate_enable && coord_color2[3] != 0)
xmb_draw_icon_predone(xmb, &mymat, xmb->textures.list[XMB_TEXTURE_CLOCK].id,
width - xmb->icon.size, xmb->icon.size, width, height, 1, 0, 1, &coord_color2[0]);
xmb_draw_icon_predone(xmb, &mymat,
xmb->textures.list[XMB_TEXTURE_CLOCK],
width - xmb->icon.size, xmb->icon.size,width,
height, 1, 0, 1, &coord_color2[0]);
/* set alpha components of colors */
coord_color2[3] = coord_color2[7] = coord_color2[11] =
@ -1978,7 +1977,7 @@ static void xmb_frame(void *data)
xmb_draw_icon_predone(
xmb,
&mymat,
xmb->textures.list[XMB_TEXTURE_ARROW].id,
xmb->textures.list[XMB_TEXTURE_ARROW],
xmb->x + xmb->margins.screen.left +
xmb->icon.spacing.horizontal - xmb->icon.size / 2.0 + xmb->icon.size,
xmb->margins.screen.top +
@ -2021,7 +2020,7 @@ static void xmb_frame(void *data)
draw.width = width;
draw.height = height;
draw.texture = xmb->textures.bg.id;
draw.texture = xmb->textures.bg;
draw.handle_alpha = xmb->alpha;
draw.force_transparency = true;
draw.color = &coord_color[0];
@ -2269,7 +2268,7 @@ static void xmb_context_bg_destroy(xmb_handle_t *xmb)
{
if (!xmb)
return;
video_driver_texture_unload(&xmb->textures.bg.id);
video_driver_texture_unload(&xmb->textures.bg);
}
static bool xmb_load_image(void *userdata, void *data, enum menu_image_type type)
@ -2287,7 +2286,7 @@ static bool xmb_load_image(void *userdata, void *data, enum menu_image_type type
xmb_context_bg_destroy(xmb);
video_driver_texture_load(data,
TEXTURE_FILTER_MIPMAP_LINEAR,
&xmb->textures.bg.id);
&xmb->textures.bg);
break;
case MENU_IMAGE_BOXART:
{
@ -2435,24 +2434,24 @@ static void xmb_context_reset_textures(
video_driver_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR,
&xmb->textures.list[i].id);
&xmb->textures.list[i]);
video_texture_image_free(&ti);
}
xmb->main_menu_node.icon = xmb->textures.list[XMB_TEXTURE_MAIN_MENU].id;
xmb->main_menu_node.icon = xmb->textures.list[XMB_TEXTURE_MAIN_MENU];
xmb->main_menu_node.alpha = XMB_CATEGORIES_ACTIVE_ALPHA;
xmb->main_menu_node.zoom = XMB_CATEGORIES_ACTIVE_ZOOM;
xmb->settings_tab_node.icon = xmb->textures.list[XMB_TEXTURE_SETTINGS].id;
xmb->settings_tab_node.icon = xmb->textures.list[XMB_TEXTURE_SETTINGS];
xmb->settings_tab_node.alpha = XMB_CATEGORIES_ACTIVE_ALPHA;
xmb->settings_tab_node.zoom = XMB_CATEGORIES_ACTIVE_ZOOM;
xmb->history_tab_node.icon = xmb->textures.list[XMB_TEXTURE_HISTORY].id;
xmb->history_tab_node.icon = xmb->textures.list[XMB_TEXTURE_HISTORY];
xmb->history_tab_node.alpha = XMB_CATEGORIES_ACTIVE_ALPHA;
xmb->history_tab_node.zoom = XMB_CATEGORIES_ACTIVE_ZOOM;
xmb->add_tab_node.icon = xmb->textures.list[XMB_TEXTURE_ADD].id;
xmb->add_tab_node.icon = xmb->textures.list[XMB_TEXTURE_ADD];
xmb->add_tab_node.alpha = XMB_CATEGORIES_ACTIVE_ALPHA;
xmb->add_tab_node.zoom = XMB_CATEGORIES_ACTIVE_ZOOM;
}
@ -2759,7 +2758,7 @@ static void xmb_context_destroy(void *data)
return;
for (i = 0; i < XMB_TEXTURE_LAST; i++)
video_driver_texture_unload(&xmb->textures.list[i].id);
video_driver_texture_unload(&xmb->textures.list[i]);
xmb_context_destroy_horizontal_list(xmb);
xmb_context_bg_destroy(xmb);