(XMB+Ozone) Category + History/Favorites icons (#13433)

* (XMB+Ozone) Icons for matching core option categories

* (XMB+Ozone) Playlist content icon option for history/favorites
This commit is contained in:
Tony 2021-12-30 21:14:57 +02:00 committed by GitHub
parent d017ce7b03
commit 17f63e6e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 248 additions and 11 deletions

View File

@ -1333,6 +1333,8 @@ static const int default_content_favorites_size = 200;
#define DEFAULT_PLAYLIST_SHOW_SUBLABELS true
#endif
#define DEFAULT_PLAYLIST_SHOW_HISTORY_ICONS PLAYLIST_SHOW_HISTORY_ICONS_DEFAULT
/* Show the indices of playlist entries in
* a menu-driver-specific fashion */
#define DEFAULT_PLAYLIST_SHOW_ENTRY_IDX true

View File

@ -2298,6 +2298,7 @@ static struct config_uint_setting *populate_settings_uint(
#ifdef HAVE_MENU
SETTING_UINT("playlist_entry_remove_enable", &settings->uints.playlist_entry_remove_enable, true, DEFAULT_PLAYLIST_ENTRY_REMOVE_ENABLE, false);
SETTING_UINT("playlist_show_inline_core_name", &settings->uints.playlist_show_inline_core_name, true, DEFAULT_PLAYLIST_SHOW_INLINE_CORE_NAME, false);
SETTING_UINT("playlist_show_history_icons", &settings->uints.playlist_show_history_icons, true, DEFAULT_PLAYLIST_SHOW_HISTORY_ICONS, false);
SETTING_UINT("playlist_sublabel_runtime_type", &settings->uints.playlist_sublabel_runtime_type, true, DEFAULT_PLAYLIST_SUBLABEL_RUNTIME_TYPE, false);
SETTING_UINT("playlist_sublabel_last_played_style", &settings->uints.playlist_sublabel_last_played_style, true, DEFAULT_PLAYLIST_SUBLABEL_LAST_PLAYED_STYLE, false);

View File

@ -299,6 +299,7 @@ typedef struct settings
unsigned playlist_entry_remove_enable;
unsigned playlist_show_inline_core_name;
unsigned playlist_show_history_icons;
unsigned playlist_sublabel_runtime_type;
unsigned playlist_sublabel_last_played_style;

View File

@ -4738,6 +4738,10 @@ MSG_HASH(
MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS,
"playlist_show_sublabels"
)
MSG_HASH(
MENU_ENUM_LABEL_PLAYLIST_SHOW_HISTORY_ICONS,
"playlist_show_history_icons"
)
MSG_HASH(
MENU_ENUM_LABEL_PLAYLIST_SHOW_ENTRY_IDX,
"playlist_show_entry_idx"

View File

@ -5605,6 +5605,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_SUBLABELS,
"Show additional information for each playlist entry, such as current core association and runtime (if available). Has a variable performance impact."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_HISTORY_ICONS,
"Show Content Specific Icons in History and Favorites"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_HISTORY_ICONS,
"Show specific icons for each history and favorites playlist entry. Has a variable performance impact."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE,
"Core:"
@ -8371,6 +8379,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_NEAREST,
"Nearest"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MAIN,
"Main"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT,
"Content"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_SYSTEM_NAME_USE_CONTENT_DIR,
"<Content Directory>"

View File

@ -978,6 +978,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_offset_y, ME
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_show_sublabels, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_SUBLABELS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_show_history_icons, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_HISTORY_ICONS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_show_entry_idx, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_ENTRY_IDX)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_border_filler_enable, MENU_ENUM_SUBLABEL_MENU_RGUI_BORDER_FILLER_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_border_filler_thickness_enable, MENU_ENUM_SUBLABEL_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE)
@ -4386,6 +4387,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_show_sublabels);
break;
case MENU_ENUM_LABEL_PLAYLIST_SHOW_HISTORY_ICONS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_show_history_icons);
break;
case MENU_ENUM_LABEL_PLAYLIST_SHOW_ENTRY_IDX:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_show_entry_idx);
break;

View File

@ -1596,7 +1596,8 @@ static void ozone_set_background_running_opacity(
}
static uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
enum msg_hash_enums enum_idx, unsigned type, bool active)
enum msg_hash_enums enum_idx, const char *enum_path,
unsigned type, bool active)
{
switch (enum_idx)
{
@ -1607,7 +1608,6 @@ static uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
#endif
case MENU_ENUM_LABEL_DISC_INFORMATION:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DISC];
case MENU_ENUM_LABEL_CORE_OPTIONS:
case MENU_ENUM_LABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE_OPTIONS];
case MENU_ENUM_LABEL_ADD_TO_FAVORITES:
@ -1984,7 +1984,20 @@ static uintptr_t ozone_entries_icon_get_texture(ozone_handle_t *ozone,
case FILE_TYPE_RDB_ENTRY:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO];
case MENU_SETTING_ACTION_CORE_OPTIONS:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE_OPTIONS];
if (string_is_equal(enum_path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS)))
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_VIDEO];
else if (string_is_equal(enum_path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS)))
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_AUDIO];
else if (string_is_equal(enum_path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS)))
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_SETTINGS];
else if (string_is_equal(enum_path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS)))
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_OSD];
else if (string_is_equal(enum_path, "Media"))
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_RDB];
else if (string_is_equal(enum_path, "System"))
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DRIVERS];
else
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE_OPTIONS];
case MENU_SETTING_ACTION_CORE_OPTION_OVERRIDE_LIST:
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SETTING];
case MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS:
@ -4476,7 +4489,8 @@ static void ozone_compute_entries_position(
OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO */
if (ozone->is_playlist && entries_end == 1)
{
uintptr_t tex = ozone_entries_icon_get_texture(ozone, entry.enum_idx, entry.type, false);
uintptr_t tex = ozone_entries_icon_get_texture(ozone,
entry.enum_idx, entry.path, entry.type, false);
ozone->empty_playlist = tex == ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO];
}
else
@ -4560,6 +4574,7 @@ static void ozone_draw_entries(
unsigned video_info_height, video_info_width;
bool menu_show_sublabels = settings->bools.menu_show_sublabels;
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;
unsigned show_history_icons = settings->uints.playlist_show_history_icons;
enum gfx_animation_ticker_type
menu_ticker_type = (enum gfx_animation_ticker_type)
settings->uints.menu_ticker_type;
@ -4840,7 +4855,8 @@ border_iterate:
}
/* Icon */
tex = ozone_entries_icon_get_texture(ozone, entry.enum_idx, entry.type, entry_selected);
tex = ozone_entries_icon_get_texture(ozone,
entry.enum_idx, entry.path, entry.type, entry_selected);
if (tex != ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING])
{
uintptr_t texture = tex;
@ -4856,6 +4872,70 @@ border_iterate:
else
texture = sidebar_node->content_icon;
}
/* History/Favorite console specific content icons */
else if ( entry.type == FILE_TYPE_RPL_ENTRY
&& show_history_icons)
{
switch (ozone->tabs[ozone->categories_selection_ptr])
{
case OZONE_SYSTEM_TAB_HISTORY:
case OZONE_SYSTEM_TAB_FAVORITES:
{
unsigned j = 0;
unsigned p = 0;
size_t icon_list_size = ozone_list_get_size(ozone, MENU_LIST_HORIZONTAL);
size_t playlist_size = 0;
playlist_t *playlist = NULL;
const struct playlist_entry
*playlist_entry = NULL;
/* Get current playlist */
playlist = playlist_get_cached();
if (!playlist)
break;
playlist_size = playlist_get_size(playlist);
if (i >= playlist_size)
break;
/* Read playlist entry */
for (p = i; p < playlist_size && playlist_entry == NULL; p++)
{
playlist_get_index(playlist, p, &playlist_entry);
if (playlist_entry && !string_is_equal(playlist_entry->label, entry.path))
playlist_entry = NULL;
}
if (!playlist_entry)
break;
for (j = 0; j < icon_list_size; j++)
{
ozone_node_t *node = ozone->horizontal_list.list[j].userdata;
if (!node)
continue;
if (!string_is_empty(playlist_entry->db_name)
&& string_is_equal(ozone->horizontal_list.list[j].path, playlist_entry->db_name))
{
switch (show_history_icons)
{
case PLAYLIST_SHOW_HISTORY_ICONS_MAIN:
texture = node->icon;
break;
case PLAYLIST_SHOW_HISTORY_ICONS_CONTENT:
texture = node->content_icon;
break;
}
break;
}
}
}
break;
default:
break;
}
}
/* Cheevos badges should not be recolored */
if (!(

View File

@ -2538,11 +2538,11 @@ static void xmb_populate_entries(void *data,
static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
xmb_node_t *core_node, xmb_node_t *node,
enum msg_hash_enums enum_idx, unsigned type, bool active, bool checked)
enum msg_hash_enums enum_idx, const char *enum_path,
unsigned type, bool active, bool checked)
{
switch (enum_idx)
{
case MENU_ENUM_LABEL_CORE_OPTIONS:
case MENU_ENUM_LABEL_NAVIGATION_BROWSER_FILTER_SUPPORTED_EXTENSIONS_ENABLE:
return xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS];
case MENU_ENUM_LABEL_CORE_OPTION_OVERRIDE_LIST:
@ -2938,7 +2938,21 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case FILE_TYPE_RDB_ENTRY:
return xmb->textures.list[XMB_TEXTURE_CORE_INFO];
case MENU_SETTING_ACTION_CORE_OPTIONS:
return xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS];
if (string_is_equal(enum_path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SETTINGS)))
return xmb->textures.list[XMB_TEXTURE_VIDEO];
else if (string_is_equal(enum_path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS)))
return xmb->textures.list[XMB_TEXTURE_AUDIO];
else if (string_is_equal(enum_path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_SETTINGS)))
return xmb->textures.list[XMB_TEXTURE_INPUT_SETTINGS];
else if (string_is_equal(enum_path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONSCREEN_DISPLAY_SETTINGS)))
return xmb->textures.list[XMB_TEXTURE_OSD];
else if (string_is_equal(enum_path, "Media"))
return xmb->textures.list[XMB_TEXTURE_RDB];
else if (string_is_equal(enum_path, "System"))
return xmb->textures.list[XMB_TEXTURE_DRIVERS];
else
return xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS];
break;
case MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS:
return xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS];
case MENU_SETTING_ACTION_CORE_CHEAT_OPTIONS:
@ -3168,6 +3182,7 @@ static int xmb_draw_item(
settings->uints.menu_xmb_thumbnail_scale_factor;
bool menu_xmb_vertical_thumbnails = settings->bools.menu_xmb_vertical_thumbnails;
bool menu_show_sublabels = settings->bools.menu_show_sublabels;
unsigned show_history_icons = settings->uints.playlist_show_history_icons;
/* Initial ticker configuration */
if (use_smooth_ticker)
@ -3537,11 +3552,76 @@ static int xmb_draw_item(
math_matrix_4x4 mymat_tmp;
gfx_display_ctx_rotate_draw_t rotate_draw;
uintptr_t texture = xmb_icon_get_id(xmb, core_node, node,
entry.enum_idx, entry_type, (i == current), entry.checked);
entry.enum_idx, entry.path, entry_type, (i == current), entry.checked);
float x = icon_x;
float y = icon_y;
float scale_factor = node->zoom;
/* History/Favorite console specific content icons */
if ( entry_type == FILE_TYPE_RPL_ENTRY
&& show_history_icons)
{
switch (xmb_get_system_tab(xmb, xmb->categories_selection_ptr))
{
case XMB_SYSTEM_TAB_HISTORY:
case XMB_SYSTEM_TAB_FAVORITES:
{
unsigned j = 0;
unsigned p = 0;
size_t icon_list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL);
size_t playlist_size = 0;
playlist_t *playlist = NULL;
const struct playlist_entry
*playlist_entry = NULL;
/* Get current playlist */
playlist = playlist_get_cached();
if (!playlist)
break;
playlist_size = playlist_get_size(playlist);
if (i >= playlist_size)
break;
/* Read playlist entry */
for (p = i; p < playlist_size && playlist_entry == NULL; p++)
{
playlist_get_index(playlist, p, &playlist_entry);
if (playlist_entry && !string_is_equal(playlist_entry->label, entry.path))
playlist_entry = NULL;
}
if (!playlist_entry)
break;
for (j = 0; j < icon_list_size; j++)
{
xmb_node_t *node = xmb_get_userdata_from_horizontal_list(xmb, j);
if (!node)
continue;
if (!string_is_empty(playlist_entry->db_name)
&& string_is_equal(xmb->horizontal_list.list[j].path, playlist_entry->db_name))
{
switch (show_history_icons)
{
case PLAYLIST_SHOW_HISTORY_ICONS_MAIN:
texture = node->icon;
break;
case PLAYLIST_SHOW_HISTORY_ICONS_CONTENT:
texture = node->content_icon;
break;
}
break;
}
}
}
break;
default:
break;
}
}
rotate_draw.matrix = &mymat_tmp;
rotate_draw.rotation = 0;
rotate_draw.scale_x = scale_factor;

View File

@ -410,6 +410,14 @@ enum playlist_entry_remove_enable_type
PLAYLIST_ENTRY_REMOVE_ENABLE_LAST
};
enum playlist_show_history_icons_type
{
PLAYLIST_SHOW_HISTORY_ICONS_DEFAULT = 0,
PLAYLIST_SHOW_HISTORY_ICONS_MAIN,
PLAYLIST_SHOW_HISTORY_ICONS_CONTENT,
PLAYLIST_SHOW_HISTORY_ICONS_LAST
};
enum quit_on_close_content_type
{
QUIT_ON_CLOSE_CONTENT_DISABLED = 0,

View File

@ -5544,6 +5544,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_PLAYLIST_SHOW_ENTRY_IDX, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_PLAYLIST_SHOW_HISTORY_ICONS, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_RUNTIME_TYPE, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_LAST_PLAYED_STYLE, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_PLAYLIST_FUZZY_ARCHIVE_MATCH, PARSE_ONLY_BOOL, true},

View File

@ -6704,6 +6704,27 @@ static void setting_get_string_representation_uint_quit_on_close_content(
}
}
static void setting_get_string_representation_uint_playlist_show_history_icons(
rarch_setting_t *setting,
char *s, size_t len)
{
if (!setting)
return;
switch (*setting->value.target.unsigned_integer)
{
case PLAYLIST_SHOW_HISTORY_ICONS_DEFAULT:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE), len);
break;
case PLAYLIST_SHOW_HISTORY_ICONS_MAIN:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MAIN), len);
break;
case PLAYLIST_SHOW_HISTORY_ICONS_CONTENT:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT), len);
break;
}
}
static void setting_get_string_representation_uint_menu_screensaver_timeout(
rarch_setting_t *setting,
char *s, size_t len)
@ -18659,11 +18680,27 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_left = setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_right = setting_bool_action_right_with_refresh;
/* Playlist entry index display is currently
* supported only by Ozone & XMB */
/* Playlist entry index display and content specific history icon
* are currently supported only by Ozone & XMB */
if (string_is_equal(settings->arrays.menu_driver, "xmb") ||
string_is_equal(settings->arrays.menu_driver, "ozone"))
{
CONFIG_UINT(
list, list_info,
&settings->uints.playlist_show_history_icons,
MENU_ENUM_LABEL_PLAYLIST_SHOW_HISTORY_ICONS,
MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_HISTORY_ICONS,
DEFAULT_PLAYLIST_SHOW_HISTORY_ICONS,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_playlist_show_history_icons;
menu_settings_list_current_add_range(list, list_info, 0, PLAYLIST_SHOW_HISTORY_ICONS_LAST-1, 1, true, true);
CONFIG_BOOL(
list, list_info,
&settings->bools.playlist_show_entry_idx,

View File

@ -1656,6 +1656,8 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_DONT_CARE,
MENU_ENUM_LABEL_VALUE_LINEAR,
MENU_ENUM_LABEL_VALUE_NEAREST,
MENU_ENUM_LABEL_VALUE_MAIN,
MENU_ENUM_LABEL_VALUE_CONTENT,
MENU_ENUM_LABEL_VALUE_UNKNOWN,
MENU_ENUM_LABEL_VALUE_USER,
MENU_ENUM_LABEL_VALUE_KEYBOARD,
@ -3219,6 +3221,7 @@ enum msg_hash_enums
MENU_LABEL(PLAYLIST_SHOW_INLINE_CORE_NAME),
MENU_LABEL(PLAYLIST_SORT_ALPHABETICAL),
MENU_LABEL(PLAYLIST_SHOW_SUBLABELS),
MENU_LABEL(PLAYLIST_SHOW_HISTORY_ICONS),
MENU_LABEL(PLAYLIST_SHOW_ENTRY_IDX),
MENU_LABEL(PLAYLIST_FUZZY_ARCHIVE_MATCH),
MENU_LABEL(PLAYLIST_SUBLABEL_RUNTIME_TYPE),