mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
(MaterialUI/XMB) Optimize refreshing of playlists
This commit is contained in:
parent
1b43e60c7c
commit
0edbe945b4
@ -2298,9 +2298,10 @@ static void materialui_refresh_playlist_icon_list(
|
|||||||
|
|
||||||
for (i = 0; i < file_list->size; i++)
|
for (i = 0; i < file_list->size; i++)
|
||||||
{
|
{
|
||||||
|
size_t _len;
|
||||||
const char *path = file_list->elems[i].data;
|
const char *path = file_list->elems[i].data;
|
||||||
const char *playlist_file = NULL;
|
const char *playlist_file = NULL;
|
||||||
char image_file[PATH_MAX_LENGTH];
|
char image_file[256];
|
||||||
|
|
||||||
/* We used malloc() to create the icons
|
/* We used malloc() to create the icons
|
||||||
* array - ensure struct members are
|
* array - ensure struct members are
|
||||||
@ -2331,12 +2332,12 @@ static void materialui_refresh_playlist_icon_list(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Playlist is valid - generate image file name */
|
/* Playlist is valid - generate image file name */
|
||||||
strlcpy(image_file, playlist_file, sizeof(image_file));
|
_len = strlcpy(image_file,
|
||||||
path_remove_extension(image_file);
|
playlist_file, sizeof(image_file));
|
||||||
strlcat(image_file, FILE_PATH_PNG_EXTENSION, sizeof(image_file));
|
/* Manually rename extension 'lpl' to 'png' in string */
|
||||||
|
image_file[_len-3] = 'p';
|
||||||
if (string_is_empty(image_file))
|
image_file[_len-2] = 'n';
|
||||||
continue;
|
image_file[_len-1] = 'g';
|
||||||
|
|
||||||
/* All good - cache paths */
|
/* All good - cache paths */
|
||||||
mui->textures.playlist.icons[i].playlist_file = strdup(playlist_file);
|
mui->textures.playlist.icons[i].playlist_file = strdup(playlist_file);
|
||||||
|
@ -2299,7 +2299,7 @@ static void xmb_context_reset_horizontal_list(
|
|||||||
if (string_ends_with_size(path, ".lpl",
|
if (string_ends_with_size(path, ".lpl",
|
||||||
strlen(path), STRLEN_CONST(".lpl")))
|
strlen(path), STRLEN_CONST(".lpl")))
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len, _len;
|
||||||
struct texture_image ti;
|
struct texture_image ti;
|
||||||
char sysname[PATH_MAX_LENGTH];
|
char sysname[PATH_MAX_LENGTH];
|
||||||
char texturepath[PATH_MAX_LENGTH];
|
char texturepath[PATH_MAX_LENGTH];
|
||||||
@ -2308,11 +2308,17 @@ static void xmb_context_reset_horizontal_list(
|
|||||||
/* Add current node to playlist database name map */
|
/* Add current node to playlist database name map */
|
||||||
RHMAP_SET_STR(xmb->playlist_db_node_map, path, node);
|
RHMAP_SET_STR(xmb->playlist_db_node_map, path, node);
|
||||||
|
|
||||||
fill_pathname_base(sysname, path, sizeof(sysname));
|
_len = fill_pathname_base(
|
||||||
path_remove_extension(sysname);
|
sysname, path, sizeof(sysname));
|
||||||
|
/* Manually strip the extension (and dot) from sysname */
|
||||||
len = fill_pathname_join_special(texturepath, iconpath, sysname,
|
sysname[_len-4] =
|
||||||
sizeof(texturepath));
|
sysname[_len-3] =
|
||||||
|
sysname[_len-2] =
|
||||||
|
sysname[_len-1] = '\0';
|
||||||
|
_len = _len-4;
|
||||||
|
len = fill_pathname_join_special(
|
||||||
|
texturepath, iconpath, sysname,
|
||||||
|
sizeof(texturepath));
|
||||||
texturepath[len ] = '.';
|
texturepath[len ] = '.';
|
||||||
texturepath[len+1] = 'p';
|
texturepath[len+1] = 'p';
|
||||||
texturepath[len+2] = 'n';
|
texturepath[len+2] = 'n';
|
||||||
@ -2349,7 +2355,21 @@ static void xmb_context_reset_horizontal_list(
|
|||||||
image_texture_free(&ti);
|
image_texture_free(&ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcat(sysname, "-content.png", sizeof(sysname));
|
/* Manually append '-content.png' to end of sysname string */
|
||||||
|
sysname[_len ] = '-';
|
||||||
|
sysname[_len+1 ] = 'c';
|
||||||
|
sysname[_len+2 ] = 'o';
|
||||||
|
sysname[_len+3 ] = 'n';
|
||||||
|
sysname[_len+4 ] = 't';
|
||||||
|
sysname[_len+5 ] = 'e';
|
||||||
|
sysname[_len+6 ] = 'n';
|
||||||
|
sysname[_len+7 ] = 't';
|
||||||
|
sysname[_len+8 ] = '.';
|
||||||
|
sysname[_len+9 ] = 'p';
|
||||||
|
sysname[_len+10] = 'n';
|
||||||
|
sysname[_len+11] = 'g';
|
||||||
|
sysname[_len+12] = '\0';
|
||||||
|
/* Assemble new icon path */
|
||||||
fill_pathname_join_special(content_texturepath, iconpath, sysname,
|
fill_pathname_join_special(content_texturepath, iconpath, sysname,
|
||||||
sizeof(content_texturepath));
|
sizeof(content_texturepath));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user