Support for glui showing system icons in explore view

This commit is contained in:
Bernhard Schelling 2020-08-04 03:32:49 +09:00
parent 849f88b8ff
commit 948e2f9f8e
4 changed files with 23 additions and 6 deletions

View file

@ -270,7 +270,7 @@ void fill_pathname_application_special(char *s,
} }
break; break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ICONS: case APPLICATION_SPECIAL_DIRECTORY_ASSETS_SYSICONS:
{ {
#ifdef HAVE_MENU #ifdef HAVE_MENU
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -279,7 +279,12 @@ void fill_pathname_application_special(char *s,
if (string_is_equal(menu_ident, "xmb")) if (string_is_equal(menu_ident, "xmb"))
fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS);
else if (string_is_equal(menu_ident, "glui")) else if (string_is_equal(menu_ident, "glui"))
fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS); {
/* Type APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS
* contains no core system icons so we use the icon directory
* from ozone here */
fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS);
}
else if (string_is_equal(menu_ident, "ozone")) else if (string_is_equal(menu_ident, "ozone"))
fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS); fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS);
else if (len) else if (len)

View file

@ -120,7 +120,7 @@ enum application_special_type
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_SOUNDS, APPLICATION_SPECIAL_DIRECTORY_ASSETS_SOUNDS,
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ICONS, APPLICATION_SPECIAL_DIRECTORY_ASSETS_SYSICONS,
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES, APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES,
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS
}; };

View file

@ -1245,7 +1245,10 @@ enum
MUI_TEXTURE_BATTERY_100, MUI_TEXTURE_BATTERY_100,
MUI_TEXTURE_BATTERY_CHARGING, MUI_TEXTURE_BATTERY_CHARGING,
MUI_TEXTURE_SWITCH_VIEW, MUI_TEXTURE_SWITCH_VIEW,
MUI_TEXTURE_LAST MUI_TEXTURE_LAST,
/* special textures that use externally loaded texture ids */
MUI_TEXTURE_EXTERNAL_EXPLORE
}; };
/* This structure holds all runtime parameters /* This structure holds all runtime parameters
@ -2369,7 +2372,9 @@ static void materialui_compute_entries_box_default(
num_sublabel_lines = materialui_count_sublabel_lines( num_sublabel_lines = materialui_count_sublabel_lines(
mui, usable_width, i, mui, usable_width, i,
(node->has_icon && mui->textures.list[node->icon_texture_index])); (node->has_icon &&
(node->icon_texture_index >= MUI_TEXTURE_LAST ||
mui->textures.list[node->icon_texture_index])));
node->text_height = mui->font_data.list.line_height + node->text_height = mui->font_data.list.line_height +
(num_sublabel_lines * mui->font_data.hint.line_height); (num_sublabel_lines * mui->font_data.hint.line_height);
@ -3483,6 +3488,8 @@ static void materialui_render_menu_entry_default(
((entry_type >= MENU_SETTING_DROPDOWN_ITEM) && ((entry_type >= MENU_SETTING_DROPDOWN_ITEM) &&
(entry_type <= MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL))) (entry_type <= MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM_SPECIAL)))
node->has_icon = false; node->has_icon = false;
else if (node->icon_texture_index == MUI_TEXTURE_EXTERNAL_EXPLORE)
icon_texture = menu_explore_get_entry_icon(entry_type);
else else
icon_texture = mui->textures.list[node->icon_texture_index]; icon_texture = mui->textures.list[node->icon_texture_index];
} }
@ -9660,6 +9667,11 @@ static void materialui_list_insert(
node->icon_texture_index = MUI_TEXTURE_PLAYLIST; node->icon_texture_index = MUI_TEXTURE_PLAYLIST;
node->has_icon = true; node->has_icon = true;
} }
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_ITEM)))
{
node->icon_texture_index = MUI_TEXTURE_EXTERNAL_EXPLORE;
node->has_icon = true;
}
else if (string_ends_with_size(label, "_input_binds_list", else if (string_ends_with_size(label, "_input_binds_list",
strlen(label), STRLEN_CONST("_input_binds_list"))) strlen(label), STRLEN_CONST("_input_binds_list")))
{ {

View file

@ -527,7 +527,7 @@ static void explore_load_icons(explore_state_t *state)
EX_BUF_RESIZE(state->icons, system_count); EX_BUF_RESIZE(state->icons, system_count);
fill_pathname_application_special(path, sizeof(path), fill_pathname_application_special(path, sizeof(path),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_ICONS); APPLICATION_SPECIAL_DIRECTORY_ASSETS_SYSICONS);
if (string_is_empty(path)) if (string_is_empty(path))
return; return;