mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
(XMB) Cleanups
This commit is contained in:
parent
6bfbe1dc6d
commit
d84b6ee5ea
@ -89,15 +89,17 @@ static void rmenu_render_background(void)
|
||||
static void rmenu_render_messagebox(const char *message)
|
||||
{
|
||||
struct font_params font_parms;
|
||||
|
||||
size_t i, j;
|
||||
struct string_list *list = NULL;
|
||||
|
||||
if (!message || !*message)
|
||||
return;
|
||||
|
||||
struct string_list *list = string_split(message, "\n");
|
||||
list = string_split(message, "\n");
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
if (list->elems == 0)
|
||||
{
|
||||
string_list_free(list);
|
||||
@ -105,10 +107,12 @@ static void rmenu_render_messagebox(const char *message)
|
||||
}
|
||||
|
||||
j = 0;
|
||||
|
||||
for (i = 0; i < list->size; i++, j++)
|
||||
{
|
||||
char *msg = list->elems[i].data;
|
||||
unsigned msglen = strlen(msg);
|
||||
|
||||
if (msglen > RMENU_TERM_WIDTH)
|
||||
{
|
||||
msg[RMENU_TERM_WIDTH - 2] = '.';
|
||||
|
@ -178,10 +178,12 @@ static char *xmb_str_replace (const char *string,
|
||||
|
||||
if (!newstr)
|
||||
{
|
||||
/*failed to alloc mem, free old string and return NULL */
|
||||
/* Failed to allocate memory,
|
||||
* free old string and return NULL. */
|
||||
free (oldstr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(newstr, oldstr, tok - oldstr );
|
||||
memcpy(newstr + (tok - oldstr), replacement, strlen ( replacement ) );
|
||||
memcpy(newstr + (tok - oldstr) + strlen( replacement ), tok +
|
||||
@ -189,7 +191,8 @@ static char *xmb_str_replace (const char *string,
|
||||
strlen ( substr ) - ( tok - oldstr ) );
|
||||
memset(newstr + strlen ( oldstr ) - strlen ( substr ) +
|
||||
strlen ( replacement ) , 0, 1 );
|
||||
/* move back head right after the last replacement */
|
||||
|
||||
/* Move back head right after the last replacement. */
|
||||
head = newstr + (tok - oldstr) + strlen( replacement );
|
||||
free (oldstr);
|
||||
}
|
||||
@ -219,8 +222,11 @@ static void xmb_draw_icon(GLuint texture, float x, float y,
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
if (x < -xmb->icon_size/2 || x > gl->win_width
|
||||
|| y < xmb->icon_size/2 || y > gl->win_height + xmb->icon_size)
|
||||
if (
|
||||
x < -xmb->icon_size/2 ||
|
||||
x > gl->win_width ||
|
||||
y < xmb->icon_size/2 ||
|
||||
y > gl->win_height + xmb->icon_size)
|
||||
return;
|
||||
|
||||
GLfloat color[] = {
|
||||
@ -270,7 +276,9 @@ static void xmb_draw_text(const char *str, float x,
|
||||
|
||||
if (alpha > xmb->alpha)
|
||||
alpha = xmb->alpha;
|
||||
|
||||
a8 = 255 * alpha;
|
||||
|
||||
if (a8 == 0)
|
||||
return;
|
||||
|
||||
@ -676,7 +684,8 @@ static void xmb_list_switch_old(file_list_t *list, int dir, size_t current)
|
||||
|
||||
for (i = 0; i < file_list_get_size(list); i++)
|
||||
{
|
||||
xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(list, i);
|
||||
xmb_node_t *node = (xmb_node_t*)
|
||||
file_list_get_userdata_at_offset(list, i);
|
||||
|
||||
if (!xmb)
|
||||
continue;
|
||||
@ -698,7 +707,8 @@ static void xmb_list_switch_new(file_list_t *list, int dir, size_t current)
|
||||
for (i = 0; i < file_list_get_size(list); i++)
|
||||
{
|
||||
float ia = 0.5;
|
||||
xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(list, i);
|
||||
xmb_node_t *node = (xmb_node_t*)
|
||||
file_list_get_userdata_at_offset(list, i);
|
||||
|
||||
if (!xmb)
|
||||
continue;
|
||||
@ -709,6 +719,7 @@ static void xmb_list_switch_new(file_list_t *list, int dir, size_t current)
|
||||
|
||||
if (i == current)
|
||||
ia = 1.0;
|
||||
|
||||
add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL);
|
||||
add_tween(XMB_DELAY, ia, &node->label_alpha, &inOutQuad, NULL);
|
||||
add_tween(XMB_DELAY, 0, &node->x, &inOutQuad, NULL);
|
||||
@ -741,9 +752,7 @@ static void xmb_set_title(void)
|
||||
|
||||
info = (core_info_t*)&info_list->list[driver.menu->cat_selection_ptr - 1];
|
||||
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if (info)
|
||||
strlcpy(xmb->title, info->display_name, sizeof(xmb->title));
|
||||
}
|
||||
}
|
||||
@ -815,14 +824,17 @@ static void xmb_list_switch()
|
||||
xmb_list_open_old(xmb->selection_buf_old, dir, xmb->selection_ptr_old);
|
||||
xmb_list_open_new(driver.menu->menu_list->selection_buf, dir, driver.menu->selection_ptr);
|
||||
|
||||
if (xmb->depth == 1 || xmb->depth == 2)
|
||||
switch (xmb->depth)
|
||||
{
|
||||
case 1:
|
||||
add_tween(XMB_DELAY, xmb->icon_size*-(xmb->depth*2-2), &xmb->x, &inOutQuad, NULL);
|
||||
|
||||
if (xmb->depth == 1)
|
||||
add_tween(XMB_DELAY, 0, &xmb->arrow_alpha, &inOutQuad, NULL);
|
||||
|
||||
if (xmb->depth == 2)
|
||||
break;
|
||||
case 2:
|
||||
add_tween(XMB_DELAY, xmb->icon_size*-(xmb->depth*2-2), &xmb->x, &inOutQuad, NULL);
|
||||
add_tween(XMB_DELAY, 1, &xmb->arrow_alpha, &inOutQuad, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
xmb->old_depth = xmb->depth;
|
||||
}
|
||||
@ -878,6 +890,7 @@ static void xmb_draw_items(file_list_t *list, file_list_t *stack,
|
||||
unsigned type = 0, w = 0;
|
||||
xmb_node_t *node = NULL;
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
GLuint icon = 0;
|
||||
|
||||
menu_list_get_at_offset(list, i, &path, &entry_label, &type);
|
||||
node = (xmb_node_t*)file_list_get_userdata_at_offset(list, i);
|
||||
@ -896,7 +909,6 @@ static void xmb_draw_items(file_list_t *list, file_list_t *stack,
|
||||
if (type == MENU_FILE_CONTENTLIST_ENTRY)
|
||||
strlcpy(path_buf, path_basename(path_buf), sizeof(path_buf));
|
||||
|
||||
GLuint icon = 0;
|
||||
switch(type)
|
||||
{
|
||||
case MENU_FILE_DIRECTORY:
|
||||
@ -909,7 +921,9 @@ static void xmb_draw_items(file_list_t *list, file_list_t *stack,
|
||||
icon = xmb->textures[XMB_TEXTURE_FILE].id;
|
||||
break;
|
||||
case MENU_FILE_CONTENTLIST_ENTRY:
|
||||
icon = core_node ? core_node->content_icon : xmb->textures[XMB_TEXTURE_FILE].id;
|
||||
icon = xmb->textures[XMB_TEXTURE_FILE].id;
|
||||
if (core_node)
|
||||
icon = core_node->content_icon;
|
||||
break;
|
||||
case MENU_FILE_CARCHIVE:
|
||||
icon = xmb->textures[XMB_TEXTURE_ZIP].id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user