mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 13:14:04 +00:00
Merge pull request #9312 from jdgleaver/thumb-path-api-cleanup
(menu_thumbnail_path) API clean-up + tiny bug fix
This commit is contained in:
commit
099c06c3c0
@ -1340,7 +1340,8 @@ static void ozone_set_thumbnail_system(void *data, char*s, size_t len)
|
||||
if (!ozone)
|
||||
return;
|
||||
|
||||
menu_thumbnail_set_system(ozone->thumbnail_path_data, s);
|
||||
menu_thumbnail_set_system(
|
||||
ozone->thumbnail_path_data, s, playlist_get_cached());
|
||||
}
|
||||
|
||||
static void ozone_get_thumbnail_system(void *data, char*s, size_t len)
|
||||
|
@ -4260,7 +4260,8 @@ static void rgui_set_thumbnail_system(void *userdata, char *s, size_t len)
|
||||
rgui_t *rgui = (rgui_t*)userdata;
|
||||
if (!rgui)
|
||||
return;
|
||||
menu_thumbnail_set_system(rgui->thumbnail_path_data, s);
|
||||
menu_thumbnail_set_system(
|
||||
rgui->thumbnail_path_data, s, playlist_get_cached());
|
||||
}
|
||||
|
||||
static void rgui_get_thumbnail_system(void *userdata, char *s, size_t len)
|
||||
|
@ -1132,7 +1132,8 @@ static void xmb_set_thumbnail_system(void *data, char*s, size_t len)
|
||||
if (!xmb)
|
||||
return;
|
||||
|
||||
menu_thumbnail_set_system(xmb->thumbnail_path_data, s);
|
||||
menu_thumbnail_set_system(
|
||||
xmb->thumbnail_path_data, s, playlist_get_cached());
|
||||
}
|
||||
|
||||
static void xmb_get_thumbnail_system(void *data, char*s, size_t len)
|
||||
|
@ -225,12 +225,13 @@ static void fill_content_img(menu_thumbnail_path_data_t *path_data)
|
||||
|
||||
/* Sets current 'system' (default database name).
|
||||
* Returns true if 'system' is valid.
|
||||
* If playlist is provided, extracts system-specific
|
||||
* thumbnail assignment metadata (required for accurate
|
||||
* usage of menu_thumbnail_is_enabled())
|
||||
* > Used as a fallback when individual content lacks an
|
||||
* associated database name */
|
||||
bool menu_thumbnail_set_system(menu_thumbnail_path_data_t *path_data, const char *system)
|
||||
bool menu_thumbnail_set_system(menu_thumbnail_path_data_t *path_data, const char *system, playlist_t *playlist)
|
||||
{
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
if (!path_data)
|
||||
return false;
|
||||
|
||||
@ -261,26 +262,42 @@ bool menu_thumbnail_set_system(menu_thumbnail_path_data_t *path_data, const char
|
||||
* menu_thumbnail_is_enabled() will go out of sync */
|
||||
if (playlist)
|
||||
{
|
||||
/* History/favourites are a special case: 'system'
|
||||
* can only be set to these values if we have a
|
||||
* valid playlist (cf. menu_displaylist_parse_playlist()) */
|
||||
bool playlist_valid =
|
||||
string_is_equal(system, "history") ||
|
||||
string_is_equal(system, "favorites");
|
||||
const char *playlist_path = playlist_get_conf_path(playlist);
|
||||
const char *playlist_file = NULL;
|
||||
bool playlist_valid = false;
|
||||
|
||||
/* Note: This is not considered an error
|
||||
* (just means that input playlist is ignored) */
|
||||
if (string_is_empty(playlist_path))
|
||||
return true;
|
||||
|
||||
playlist_file = path_basename(playlist_path);
|
||||
|
||||
/* Note: This is not considered an error
|
||||
* (just means that input playlist is ignored) */
|
||||
if (string_is_empty(playlist_file))
|
||||
return true;
|
||||
|
||||
/* Check for history/favourites playlists */
|
||||
playlist_valid =
|
||||
(string_is_equal(system, "history") &&
|
||||
string_is_equal(playlist_file, file_path_str(FILE_PATH_CONTENT_HISTORY))) ||
|
||||
(string_is_equal(system, "favorites") &&
|
||||
string_is_equal(playlist_file, file_path_str(FILE_PATH_CONTENT_FAVORITES)));
|
||||
|
||||
if (!playlist_valid)
|
||||
{
|
||||
/* This means we have to work a little harder
|
||||
* i.e. check whether the cached playlist file
|
||||
* matches the database name */
|
||||
const char *playlist_path = playlist_get_conf_path(playlist);
|
||||
char playlist_name[PATH_MAX_LENGTH];
|
||||
char *playlist_name = NULL;
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
|
||||
tmp[0] = '\0';
|
||||
|
||||
strlcpy(tmp, playlist_file, sizeof(tmp));
|
||||
playlist_name = path_remove_extension(tmp);
|
||||
|
||||
playlist_name[0] = '\0';
|
||||
|
||||
if (!string_is_empty(playlist_path))
|
||||
fill_pathname_base_noext(playlist_name, playlist_path, sizeof(playlist_name));
|
||||
|
||||
playlist_valid = string_is_equal(playlist_name, system);
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,12 @@ bool menu_thumbnail_is_enabled(menu_thumbnail_path_data_t *path_data, enum menu_
|
||||
|
||||
/* Sets current 'system' (default database name).
|
||||
* Returns true if 'system' is valid.
|
||||
* If playlist is provided, extracts system-specific
|
||||
* thumbnail assignment metadata (required for accurate
|
||||
* usage of menu_thumbnail_is_enabled())
|
||||
* > Used as a fallback when individual content lacks an
|
||||
* associated database name */
|
||||
bool menu_thumbnail_set_system(menu_thumbnail_path_data_t *path_data, const char *system);
|
||||
bool menu_thumbnail_set_system(menu_thumbnail_path_data_t *path_data, const char *system, playlist_t *playlist);
|
||||
|
||||
/* Sets current thumbnail content according to the specified label.
|
||||
* Returns true if content is valid */
|
||||
|
@ -276,7 +276,8 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task)
|
||||
if (!pl_thumb->thumbnail_path_data)
|
||||
goto task_finished;
|
||||
|
||||
if (!menu_thumbnail_set_system(pl_thumb->thumbnail_path_data, pl_thumb->system))
|
||||
if (!menu_thumbnail_set_system(
|
||||
pl_thumb->thumbnail_path_data, pl_thumb->system, pl_thumb->playlist))
|
||||
goto task_finished;
|
||||
|
||||
/* All good - can start iterating */
|
||||
@ -565,7 +566,8 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
|
||||
if (!pl_thumb->thumbnail_path_data)
|
||||
goto task_finished;
|
||||
|
||||
if (!menu_thumbnail_set_system(pl_thumb->thumbnail_path_data, pl_thumb->system))
|
||||
if (!menu_thumbnail_set_system(
|
||||
pl_thumb->thumbnail_path_data, pl_thumb->system, pl_thumb->playlist))
|
||||
goto task_finished;
|
||||
|
||||
if (!menu_thumbnail_set_content_playlist(
|
||||
|
Loading…
x
Reference in New Issue
Block a user