(RGUI) Fix information display bug

This commit is contained in:
jdgleaver 2019-01-21 11:07:32 +00:00
parent d2863e2ce6
commit 40e9fe5cf1
2 changed files with 40 additions and 13 deletions

View File

@ -423,6 +423,7 @@ typedef struct
char *thumbnail_system;
char *thumbnail_content;
char *thumbnail_path;
char *thumbnail_playlist;
} rgui_t;
#define THUMB_MAX_WIDTH 320
@ -1591,6 +1592,8 @@ static void rgui_free(void *data)
free(rgui->thumbnail_content);
if (!string_is_empty(rgui->thumbnail_path))
free(rgui->thumbnail_path);
if (!string_is_empty(rgui->thumbnail_playlist))
free(rgui->thumbnail_playlist);
}
fb_font_inited = menu_display_get_font_data_init();
@ -1737,11 +1740,23 @@ static void rgui_update_thumbnail_path(void *userdata)
static void rgui_set_thumbnail_system(void *userdata, char *s, size_t len)
{
rgui_t *rgui = (rgui_t*)userdata;
char tmp_path[PATH_MAX_LENGTH] = {0};
if (!rgui)
return;
if (!string_is_empty(rgui->thumbnail_system))
free(rgui->thumbnail_system);
if (!string_is_empty(rgui->thumbnail_playlist))
free(rgui->thumbnail_playlist);
rgui->thumbnail_system = strdup(s);
/* Get associated playlist file name
* (i.e. <rgui->thumbnail_system>.lpl) */
if (!string_is_empty(rgui->thumbnail_system))
{
strlcpy(tmp_path, rgui->thumbnail_system, sizeof(tmp_path));
strlcat(tmp_path, file_path_str(FILE_PATH_LPL_EXTENSION), sizeof(tmp_path));
if (!string_is_empty(tmp_path))
rgui->thumbnail_playlist = strdup(tmp_path);
}
}
static void rgui_update_thumbnail_content(void *userdata)
@ -1759,10 +1774,9 @@ static void rgui_update_thumbnail_content(void *userdata)
rgui->is_playlist_entry = false;
title[0] = '\0';
menu_entries_get_title(title, sizeof(title));
if (!string_is_empty(rgui->thumbnail_system))
if (!string_is_empty(rgui->thumbnail_playlist))
{
/* An ugly but effective test... */
if (strstr(path_basename(title), rgui->thumbnail_system) != NULL)
if (string_is_equal(path_basename(title), rgui->thumbnail_playlist))
{
/* Get label of currently selected playlist entry
* > This is pretty nasty, but I can't see any other way of doing

View File

@ -1290,6 +1290,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
unsigned i;
size_t selection = menu_navigation_get_selection();
size_t list_size = playlist_size(playlist);
settings_t *settings = config_get_ptr();
if (list_size == 0)
goto error;
@ -1330,7 +1331,11 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
if (core_name)
strlcpy(fill_buf, core_name, path_size);
if (!is_history && i == selection && !string_is_empty(label))
/* Note: this function is never called when using RGUI,
* but if it ever were then we must ensure that thumbnail
* updates are omitted (since this functionality is
* handled elsewhere) */
if (!is_history && i == selection && !string_is_empty(label) && !string_is_equal(settings->arrays.menu_driver, "rgui"))
{
char *content_basename = strdup(label);
@ -1659,6 +1664,13 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
snprintf(crc_str, sizeof(crc_str), "%08X", db_info_entry->crc32);
/* It is unclear why parsing a database should trigger a
* thumbnail update, but I guess this is here for a reason...
* Regardless, thumbnail updates must be disabled when using
* RGUI, since this functionality is handled elsewhere
* (and doing it here creates harmful conflicts) */
if (!string_is_equal(settings->arrays.menu_driver, "rgui"))
{
if (!string_is_empty(db_info_entry->name))
strlcpy(thumbnail_content, db_info_entry->name,
sizeof(thumbnail_content));
@ -1669,6 +1681,7 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL);
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
}
if (playlist)
{