Skip to content

Commit

Permalink
Fix thumbnails in History for content loaded through Load Content (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven authored Dec 21, 2023
1 parent 799e56c commit f4fbcd1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
2 changes: 2 additions & 0 deletions gfx/gfx_thumbnail_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ bool gfx_thumbnail_set_content_playlist(

/* Thumbnail image name is done -> now check if
* per-content database name is defined */
if (string_is_empty(db_name))
playlist_get_db_name(playlist, idx, &db_name);
if (!string_is_empty(db_name))
{
/* Hack: There is only one MAME thumbnail repo,
Expand Down
41 changes: 22 additions & 19 deletions playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -3191,28 +3191,31 @@ void playlist_get_crc32(playlist_t *playlist, size_t idx,
void playlist_get_db_name(playlist_t *playlist, size_t idx,
const char **db_name)
{
if (!playlist || idx >= RBUF_LEN(playlist->entries))
if (!playlist || !db_name || idx >= RBUF_LEN(playlist->entries))
return;

if (db_name)
if (!string_is_empty(playlist->entries[idx].db_name))
*db_name = playlist->entries[idx].db_name;
else
{
if (!string_is_empty(playlist->entries[idx].db_name))
*db_name = playlist->entries[idx].db_name;
else
{
const char *conf_path_basename = path_basename_nocompression(playlist->config.path);

/* Only use file basename if this is a 'collection' playlist
* (i.e. ignore history/favourites) */
if (
!string_is_empty(conf_path_basename)
&& !string_is_equal(conf_path_basename,
FILE_PATH_CONTENT_HISTORY)
&& !string_is_equal(conf_path_basename,
FILE_PATH_CONTENT_FAVORITES)
)
*db_name = conf_path_basename;
}
const char *conf_path_basename = path_basename_nocompression(playlist->config.path);

/* Only use file basename if this is a 'collection' playlist
* (i.e. ignore history/favourites) */
if (
!string_is_empty(conf_path_basename)
&& !string_is_equal(conf_path_basename,
FILE_PATH_CONTENT_HISTORY)
&& !string_is_equal(conf_path_basename,
FILE_PATH_CONTENT_FAVORITES)
)
*db_name = conf_path_basename;
else
{
core_info_t *core_info = playlist_entry_get_core_info(&playlist->entries[idx]);
if (core_info && core_info->databases)
*db_name = core_info->databases;
}
}
}

Expand Down

0 comments on commit f4fbcd1

Please sign in to comment.