mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
Support for non-PNG local thumbnails (#16806)
Allow thumbnails (boxart, title, screenshot) to be loaded in any other supported format as well, currently jpg, bmp, tga. Support is for local thumbnails only, downloads are not changed. PNG format is always preferred. Menu option added for control, since trying for multiple thumbnail files may impact performance on slow storage media.
This commit is contained in:
parent
3f2ad22fce
commit
b090f85620
@ -1511,6 +1511,8 @@
|
||||
|
||||
#define DEFAULT_PLAYLIST_USE_FILENAME false
|
||||
|
||||
#define DEFAULT_PLAYLIST_ALLOW_NON_PNG false
|
||||
|
||||
/* Show Menu start-up screen on boot. */
|
||||
#define DEFAULT_MENU_SHOW_START_SCREEN true
|
||||
|
||||
|
@ -2155,6 +2155,7 @@ static struct config_bool_setting *populate_settings_bool(
|
||||
SETTING_BOOL("playlist_fuzzy_archive_match", &settings->bools.playlist_fuzzy_archive_match, true, DEFAULT_PLAYLIST_FUZZY_ARCHIVE_MATCH, false);
|
||||
SETTING_BOOL("playlist_portable_paths", &settings->bools.playlist_portable_paths, true, DEFAULT_PLAYLIST_PORTABLE_PATHS, false);
|
||||
SETTING_BOOL("playlist_use_filename", &settings->bools.playlist_use_filename, true, DEFAULT_PLAYLIST_USE_FILENAME, false);
|
||||
SETTING_BOOL("playlist_allow_non_png", &settings->bools.playlist_allow_non_png, true, DEFAULT_PLAYLIST_ALLOW_NON_PNG, false);
|
||||
|
||||
SETTING_BOOL("frame_time_counter_reset_after_fastforwarding", &settings->bools.frame_time_counter_reset_after_fastforwarding, true, false, false);
|
||||
SETTING_BOOL("frame_time_counter_reset_after_load_state", &settings->bools.frame_time_counter_reset_after_load_state, true, false, false);
|
||||
|
@ -1053,6 +1053,7 @@ typedef struct settings
|
||||
bool playlist_fuzzy_archive_match;
|
||||
bool playlist_portable_paths;
|
||||
bool playlist_use_filename;
|
||||
bool playlist_allow_non_png;
|
||||
|
||||
bool quit_press_twice;
|
||||
bool vibrate_on_keypress;
|
||||
|
@ -573,6 +573,9 @@ bool gfx_thumbnail_update_path(
|
||||
const char *system_name = NULL;
|
||||
char *thumbnail_path = NULL;
|
||||
const char *dir_thumbnails = NULL;
|
||||
/* Thumbnail extension order. The default (i.e. png) is always the first. */
|
||||
#define MAX_SUPPORTED_THUMBNAIL_EXTENSIONS 5
|
||||
const char* const SUPPORTED_THUMBNAIL_EXTENSIONS[] = { ".png", ".jpg", ".jpeg", ".bmp", ".tga", 0 };
|
||||
|
||||
if (!path_data)
|
||||
return false;
|
||||
@ -648,6 +651,8 @@ bool gfx_thumbnail_update_path(
|
||||
char tmp_buf[PATH_MAX_LENGTH];
|
||||
const char *type = gfx_thumbnail_get_type(settings,
|
||||
path_data, thumbnail_id);
|
||||
int i;
|
||||
bool thumbnail_found = false;
|
||||
/* > Normal content: assemble path */
|
||||
|
||||
/* >> Base + system name */
|
||||
@ -663,19 +668,49 @@ bool gfx_thumbnail_update_path(
|
||||
fill_pathname_join_special(thumbnail_path, tmp_buf,
|
||||
path_data->content_img_full, PATH_MAX_LENGTH * sizeof(char));
|
||||
}
|
||||
thumbnail_found = path_is_valid(thumbnail_path);
|
||||
|
||||
/* Try alternative file extensions in turn, if wanted */
|
||||
for( i=1 ;
|
||||
settings->bools.playlist_allow_non_png &&
|
||||
!thumbnail_found &&
|
||||
thumbnail_path[0]!='\0' &&
|
||||
i<MAX_SUPPORTED_THUMBNAIL_EXTENSIONS ; i++ )
|
||||
{
|
||||
strlcpy(path_get_extension_mutable(thumbnail_path),SUPPORTED_THUMBNAIL_EXTENSIONS[i],6);
|
||||
thumbnail_found = path_is_valid(thumbnail_path);
|
||||
}
|
||||
/* >> Add content image - second try with label (database name) */
|
||||
if(!path_is_valid(thumbnail_path) && path_data->content_img[0] != '\0')
|
||||
if(!thumbnail_found && path_data->content_img[0] != '\0')
|
||||
{
|
||||
thumbnail_path[0] = '\0';
|
||||
fill_pathname_join_special(thumbnail_path, tmp_buf,
|
||||
path_data->content_img, PATH_MAX_LENGTH * sizeof(char));
|
||||
thumbnail_found = path_is_valid(thumbnail_path);
|
||||
}
|
||||
for( i=1 ;
|
||||
settings->bools.playlist_allow_non_png &&
|
||||
!thumbnail_found &&
|
||||
i<MAX_SUPPORTED_THUMBNAIL_EXTENSIONS ; i++ )
|
||||
{
|
||||
strlcpy(path_get_extension_mutable(thumbnail_path),SUPPORTED_THUMBNAIL_EXTENSIONS[i],6);
|
||||
thumbnail_found = path_is_valid(thumbnail_path);
|
||||
}
|
||||
/* >> Add content image - third try with shortened name (title only) */
|
||||
if(!path_is_valid(thumbnail_path) && path_data->content_img_short[0] != '\0')
|
||||
if(!thumbnail_found && path_data->content_img_short[0] != '\0')
|
||||
{
|
||||
thumbnail_path[0] = '\0';
|
||||
fill_pathname_join_special(thumbnail_path, tmp_buf,
|
||||
path_data->content_img_short, PATH_MAX_LENGTH * sizeof(char));
|
||||
thumbnail_found = path_is_valid(thumbnail_path);
|
||||
}
|
||||
for( i=1 ;
|
||||
settings->bools.playlist_allow_non_png &&
|
||||
!thumbnail_found &&
|
||||
i<MAX_SUPPORTED_THUMBNAIL_EXTENSIONS ; i++ )
|
||||
{
|
||||
strlcpy(path_get_extension_mutable(thumbnail_path),SUPPORTED_THUMBNAIL_EXTENSIONS[i],6);
|
||||
thumbnail_found = path_is_valid(thumbnail_path);
|
||||
}
|
||||
/* This logic is valid for locally stored thumbnails. For optional downloads,
|
||||
* gfx_thumbnail_get_img_name() is used */
|
||||
|
@ -7945,7 +7945,15 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_PLAYLIST_USE_FILENAME,
|
||||
"When enabled, will find thumbnails by the entry's filename, rather than its label."
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_PLAYLIST_ALLOW_NON_PNG,
|
||||
"Allow All Supported Image Types for Thumbnails"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_PLAYLIST_ALLOW_NON_PNG,
|
||||
"When enabled, local thumbnails can be added in all image types supported by RetroArch (such as jpeg). May have a minor performance impact."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MANAGE,
|
||||
"Manage"
|
||||
)
|
||||
|
@ -1362,6 +1362,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_use_old_format,
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_compression, MENU_ENUM_SUBLABEL_PLAYLIST_COMPRESSION)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_portable_paths, MENU_ENUM_SUBLABEL_PLAYLIST_PORTABLE_PATHS)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_use_filename, MENU_ENUM_SUBLABEL_PLAYLIST_USE_FILENAME)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_allow_non_png, MENU_ENUM_SUBLABEL_PLAYLIST_ALLOW_NON_PNG)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_full_width_layout, MENU_ENUM_SUBLABEL_MENU_RGUI_FULL_WIDTH_LAYOUT)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_extended_ascii, MENU_ENUM_SUBLABEL_MENU_RGUI_EXTENDED_ASCII)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_switch_icons, MENU_ENUM_SUBLABEL_MENU_RGUI_SWITCH_ICONS)
|
||||
@ -5565,6 +5566,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_PLAYLIST_USE_FILENAME:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_use_filename);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_PLAYLIST_ALLOW_NON_PNG:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_allow_non_png);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_use_old_format);
|
||||
break;
|
||||
|
@ -7032,6 +7032,7 @@ unsigned menu_displaylist_build_list(
|
||||
{MENU_ENUM_LABEL_CONTENT_RUNTIME_LOG_AGGREGATE, PARSE_ONLY_BOOL, true},
|
||||
{MENU_ENUM_LABEL_PLAYLIST_PORTABLE_PATHS, PARSE_ONLY_BOOL, true},
|
||||
{MENU_ENUM_LABEL_PLAYLIST_USE_FILENAME, PARSE_ONLY_BOOL, true},
|
||||
{MENU_ENUM_LABEL_PLAYLIST_ALLOW_NON_PNG, PARSE_ONLY_BOOL, true},
|
||||
#ifdef HAVE_NETWORKING
|
||||
{MENU_ENUM_LABEL_NETWORK_ON_DEMAND_THUMBNAILS, PARSE_ONLY_BOOL, true},
|
||||
#endif
|
||||
|
@ -21848,6 +21848,22 @@ static bool setting_append_list(
|
||||
SD_FLAG_NONE
|
||||
);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.playlist_allow_non_png,
|
||||
MENU_ENUM_LABEL_PLAYLIST_ALLOW_NON_PNG,
|
||||
MENU_ENUM_LABEL_VALUE_PLAYLIST_ALLOW_NON_PNG,
|
||||
DEFAULT_PLAYLIST_ALLOW_NON_PNG,
|
||||
MENU_ENUM_LABEL_VALUE_OFF,
|
||||
MENU_ENUM_LABEL_VALUE_ON,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler,
|
||||
SD_FLAG_NONE
|
||||
);
|
||||
|
||||
#if defined(HAVE_OZONE) || defined(HAVE_XMB)
|
||||
if (string_is_equal(settings->arrays.menu_driver, "ozone") ||
|
||||
string_is_equal(settings->arrays.menu_driver, "xmb"))
|
||||
|
@ -4134,6 +4134,7 @@ enum msg_hash_enums
|
||||
MENU_LABEL(PLAYLIST_SUBLABEL_LAST_PLAYED_STYLE),
|
||||
MENU_LABEL(PLAYLIST_PORTABLE_PATHS),
|
||||
MENU_LABEL(PLAYLIST_USE_FILENAME),
|
||||
MENU_LABEL(PLAYLIST_ALLOW_NON_PNG),
|
||||
|
||||
MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_HIST_FAV,
|
||||
MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS,
|
||||
|
Loading…
x
Reference in New Issue
Block a user