From 948e2f9f8ec3e5b63a8dc39023f58cc9f31d2bcd Mon Sep 17 00:00:00 2001 From: Bernhard Schelling <14200249+schellingb@users.noreply.github.com> Date: Tue, 4 Aug 2020 03:32:49 +0900 Subject: [PATCH] Support for glui showing system icons in explore view --- file_path_special.c | 9 +++++++-- file_path_special.h | 2 +- menu/drivers/materialui.c | 16 ++++++++++++++-- menu/menu_explore.c | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/file_path_special.c b/file_path_special.c index 841da2947c..e35a93fb38 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -270,7 +270,7 @@ void fill_pathname_application_special(char *s, } break; - case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ICONS: + case APPLICATION_SPECIAL_DIRECTORY_ASSETS_SYSICONS: { #ifdef HAVE_MENU settings_t *settings = config_get_ptr(); @@ -279,7 +279,12 @@ void fill_pathname_application_special(char *s, if (string_is_equal(menu_ident, "xmb")) fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS); 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")) fill_pathname_application_special(s, len, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS); else if (len) diff --git a/file_path_special.h b/file_path_special.h index 991da07a61..6a908fbe66 100644 --- a/file_path_special.h +++ b/file_path_special.h @@ -120,7 +120,7 @@ enum application_special_type APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE, APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS, 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_DISCORD_AVATARS }; diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index f80a4868be..95e0380c60 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1245,7 +1245,10 @@ enum MUI_TEXTURE_BATTERY_100, MUI_TEXTURE_BATTERY_CHARGING, 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 @@ -2369,7 +2372,9 @@ static void materialui_compute_entries_box_default( num_sublabel_lines = materialui_count_sublabel_lines( 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 + (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_SETTING_UINT_ITEM_SPECIAL))) node->has_icon = false; + else if (node->icon_texture_index == MUI_TEXTURE_EXTERNAL_EXPLORE) + icon_texture = menu_explore_get_entry_icon(entry_type); else 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->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", strlen(label), STRLEN_CONST("_input_binds_list"))) { diff --git a/menu/menu_explore.c b/menu/menu_explore.c index a1759cc71b..66b200b11a 100644 --- a/menu/menu_explore.c +++ b/menu/menu_explore.c @@ -527,7 +527,7 @@ static void explore_load_icons(explore_state_t *state) EX_BUF_RESIZE(state->icons, system_count); fill_pathname_application_special(path, sizeof(path), - APPLICATION_SPECIAL_DIRECTORY_ASSETS_ICONS); + APPLICATION_SPECIAL_DIRECTORY_ASSETS_SYSICONS); if (string_is_empty(path)) return;