From a96c5f77c8b9b07e3623723f023161e80eaa79ac Mon Sep 17 00:00:00 2001 From: sonninnos <45124675+sonninnos@users.noreply.github.com> Date: Wed, 31 Aug 2022 15:42:10 +0300 Subject: [PATCH] (Ozone/XMB/RGUI) Explore menu thumbnails (#14365) --- gfx/gfx_thumbnail_path.c | 8 +- gfx/gfx_thumbnail_path.h | 4 +- menu/drivers/materialui.c | 2 + menu/drivers/ozone.c | 392 +++++++++++++++++++++++--------------- menu/drivers/rgui.c | 100 +++++++--- menu/drivers/xmb.c | 125 ++++++++---- menu/menu_driver.c | 24 ++- menu/menu_driver.h | 7 +- menu/menu_explore.c | 61 ++++++ 9 files changed, 498 insertions(+), 225 deletions(-) diff --git a/gfx/gfx_thumbnail_path.c b/gfx/gfx_thumbnail_path.c index 2a9acc6745..f94fc46d6d 100644 --- a/gfx/gfx_thumbnail_path.c +++ b/gfx/gfx_thumbnail_path.c @@ -319,9 +319,9 @@ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data, return true; } -/* Sets current thumbnail content according to the specified label. +/* Sets current thumbnail content according to the specified label and optional database name. * Returns true if content is valid */ -bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label) +bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label, const char *db_name) { if (!path_data) return false; @@ -354,6 +354,10 @@ bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char /* Have to set content path to *something*... * Just use label value (it doesn't matter) */ strlcpy(path_data->content_path, label, sizeof(path_data->content_path)); + + /* Database name required for Explore thumbnails */ + if (!string_is_empty(db_name)) + strlcpy(path_data->content_db_name, db_name, sizeof(path_data->content_db_name)); /* Redundant error check... */ return !string_is_empty(path_data->content_img); diff --git a/gfx/gfx_thumbnail_path.h b/gfx/gfx_thumbnail_path.h index 65534e0efc..059f158053 100644 --- a/gfx/gfx_thumbnail_path.h +++ b/gfx/gfx_thumbnail_path.h @@ -85,9 +85,9 @@ bool gfx_thumbnail_is_enabled(gfx_thumbnail_path_data_t *path_data, enum gfx_thu * associated database name */ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data, const char *system, playlist_t *playlist); -/* Sets current thumbnail content according to the specified label. +/* Sets current thumbnail content according to the specified label and optional database name. * Returns true if content is valid */ -bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label); +bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label, const char *db_name); /* Sets current thumbnail content to the specified image. * Returns true if content is valid */ diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 9c0abe84e6..173dce319b 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -4043,9 +4043,11 @@ static void materialui_render_menu_entry_default( if (!entry->checked) icon_texture = mui->textures.list[node->icon_texture_index]; break; +#if defined(HAVE_LIBRETRODB) case MUI_ICON_TYPE_MENU_EXPLORE: icon_texture = menu_explore_get_entry_icon(entry_type); break; +#endif case MUI_ICON_TYPE_MENU_CONTENTLESS_CORE: icon_texture = menu_contentless_cores_get_entry_icon(entry->label); break; diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 8a6435870f..f9fb678580 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -456,7 +456,6 @@ struct ozone_handle size_t categories_selection_ptr; /* active tab id */ size_t categories_active_idx_old; size_t playlist_index; - size_t playlist_size; size_t playlist_collection_offset; size_t selection; /* currently selected entry */ @@ -598,6 +597,7 @@ struct ozone_handle bool messagebox_state_old; bool should_draw_messagebox; + bool first_frame; bool need_compute; bool draw_old_list; bool has_all_assets; @@ -621,16 +621,15 @@ struct ozone_handle bool show_fullscreen_thumbnails; bool selection_core_is_viewer; bool selection_core_is_viewer_real; - bool force_metadata_display; bool is_db_manager_list; + bool is_explore_list; + bool is_contentless_cores; bool is_file_list; bool is_quick_menu; bool was_quick_menu; bool is_state_slot; - bool is_contentless_cores; - bool first_frame; bool libretro_running; struct @@ -3476,7 +3475,7 @@ static void ozone_update_savestate_thumbnail_path(void *data, unsigned i) ozone->fullscreen_thumbnail_label, sizeof(ozone->fullscreen_thumbnail_label), ozone->is_quick_menu, - ozone->playlist_index); + NULL); } else if (!ozone->is_state_slot) { @@ -3807,7 +3806,7 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone) ozone->selection_core_is_viewer_real = ozone->selection_core_is_viewer; - if ((playlist && (ozone->is_playlist || (ozone->is_quick_menu && !menu_is_running_quick_menu()))) || + if ((playlist && (ozone->is_playlist || ozone->is_explore_list || (ozone->is_quick_menu && !menu_is_running_quick_menu()))) || (ozone->is_db_manager_list && ozone->depth == 4)) { size_t _len; @@ -3816,43 +3815,63 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone) size_t list_size = menu_entries_get_size(); file_list_t *list = menu_entries_get_selection_buf_ptr(0); size_t playlist_index = selection; + bool content_runtime_log = settings->bools.content_runtime_log; + bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate; if (ozone->is_quick_menu) { - bool content_runtime_log = settings->bools.content_runtime_log; - bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate; - playlist_index = ozone->playlist_index; - list_size = ozone->playlist_size; + playlist_index = ozone->playlist_index; + list_size = playlist_get_size(playlist); /* Fill play time if applicable */ if (content_runtime_log || content_runtime_log_aggr) playlist_get_index(playlist, playlist_index, &entry); } +#if defined(HAVE_LIBRETRODB) + else if (list && + (selection < list_size) && + ozone->is_explore_list) + { + playlist_index = menu_explore_get_entry_playlist_index(list->list[selection].type, &playlist, &entry); + + /* Fill play time if applicable */ + if (content_runtime_log || content_runtime_log_aggr) + playlist_get_index(playlist, playlist_index, &entry); + + /* Corrections */ + list_size--; + + /* Remember playlist index for metadata */ + ozone->playlist_index = playlist_index; + } +#endif /* Get playlist index corresponding * to the selected entry */ else if (list && (selection < list_size) && (list->list[selection].type == FILE_TYPE_RPL_ENTRY)) { - bool content_runtime_log = settings->bools.content_runtime_log; - bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate; - playlist_index = list->list[selection].entry_idx; - - /* Remember playlist index for Quick Menu fullscreen thumbnail title */ - ozone->playlist_index = playlist_index; - ozone->playlist_size = list_size; + playlist_index = list->list[selection].entry_idx; /* Fill play time if applicable */ if (content_runtime_log || content_runtime_log_aggr) playlist_get_index(playlist, playlist_index, &entry); + + /* Remember playlist index for metadata */ + ozone->playlist_index = playlist_index; } /* Fill entry enumeration */ if (show_entry_idx) { - snprintf(ozone->selection_entry_enumeration, sizeof(ozone->selection_entry_enumeration), - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_ENTRY_IDX), - (unsigned long)(playlist_index + 1), (unsigned long)list_size); + if (ozone->is_explore_list) + snprintf(ozone->selection_entry_enumeration, sizeof(ozone->selection_entry_enumeration), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_ENTRY_IDX), + (unsigned long)(selection), (unsigned long)list_size); + else + snprintf(ozone->selection_entry_enumeration, sizeof(ozone->selection_entry_enumeration), + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_ENTRY_IDX), + (unsigned long)(playlist_index + 1), (unsigned long)list_size); if (!scroll_content_metadata) linebreak_after_colon(&ozone->selection_entry_enumeration); @@ -3964,7 +3983,7 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone) strlcpy(tmpstr, ozone->selection_lastplayed, sizeof(tmpstr)); (ozone->word_wrap)(ozone->selection_lastplayed, -sizeof(ozone->selection_lastplayed), tmpstr, strlen(tmpstr), 30, 100, 0); + sizeof(ozone->selection_lastplayed), tmpstr, strlen(tmpstr), 30, 100, 0); ozone->selection_lastplayed_lines = ozone_count_lines(ozone->selection_lastplayed); } else @@ -5255,7 +5274,7 @@ border_iterate: char rich_label[255]; char entry_value_ticker[255]; char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH]; - uintptr_t tex; + uintptr_t texture; menu_entry_t entry; gfx_animation_ctx_ticker_t ticker; gfx_animation_ctx_ticker_smooth_t ticker_smooth; @@ -5390,12 +5409,11 @@ border_iterate: } /* Icon */ - tex = ozone_entries_icon_get_texture(ozone, + texture = ozone_entries_icon_get_texture(ozone, entry.enum_idx, entry.path, entry.label, entry.type, entry_selected); - if (tex != ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING]) - { - uintptr_t texture = tex; + if (texture != ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SUBSETTING]) + { /* Console specific icons */ if ( entry.type == FILE_TYPE_RPL_ENTRY && ozone->categories_selection_ptr > ozone->system_tab_end) @@ -5892,6 +5910,9 @@ static void ozone_draw_thumbnail_bar( menu_ticker_type = (enum gfx_animation_ticker_type) settings->uints.menu_ticker_type; bool show_entry_idx = settings->bools.playlist_show_entry_idx; + bool show_entry_core = !ozone->is_db_manager_list; + bool show_entry_playtime = !ozone->is_db_manager_list; + bool show_entry_last_played = !ozone->is_db_manager_list; unsigned y = (unsigned)bottom_row_y_position; unsigned separator_padding = ozone->dimensions.sidebar_entry_icon_padding*2; unsigned column_x = x_position + separator_padding; @@ -5984,80 +6005,89 @@ static void ozone_draw_thumbnail_bar( } /* Core association */ - ticker_buf[0] = '\0'; - - if (use_smooth_ticker) + if (show_entry_core) { - ticker_smooth.src_str = ozone->selection_core_name; - gfx_animation_ticker_smooth(&ticker_smooth); - } - else - { - ticker.str = ozone->selection_core_name; - gfx_animation_ticker(&ticker); - } + ticker_buf[0] = '\0'; - ozone_content_metadata_line( - video_width, - video_height, - ozone, - &y, - ticker_x_offset + column_x, - ticker_buf, - text_color, - 1); + if (use_smooth_ticker) + { + ticker_smooth.src_str = ozone->selection_core_name; + gfx_animation_ticker_smooth(&ticker_smooth); + } + else + { + ticker.str = ozone->selection_core_name; + gfx_animation_ticker(&ticker); + } + + ozone_content_metadata_line( + video_width, + video_height, + ozone, + &y, + ticker_x_offset + column_x, + ticker_buf, + text_color, + 1); + } /* Playtime * Note: It is essentially impossible for this string * to exceed the width of the sidebar, but since we * are ticker-texting everything else, we include this * by default */ - ticker_buf[0] = '\0'; - - if (use_smooth_ticker) + if (show_entry_playtime) { - ticker_smooth.src_str = ozone->selection_playtime; - gfx_animation_ticker_smooth(&ticker_smooth); - } - else - { - ticker.str = ozone->selection_playtime; - gfx_animation_ticker(&ticker); - } + ticker_buf[0] = '\0'; - ozone_content_metadata_line( - video_width, - video_height, - ozone, - &y, - ticker_x_offset + column_x, - ticker_buf, - text_color, - 1); + if (use_smooth_ticker) + { + ticker_smooth.src_str = ozone->selection_playtime; + gfx_animation_ticker_smooth(&ticker_smooth); + } + else + { + ticker.str = ozone->selection_playtime; + gfx_animation_ticker(&ticker); + } + + ozone_content_metadata_line( + video_width, + video_height, + ozone, + &y, + ticker_x_offset + column_x, + ticker_buf, + text_color, + 1); + } /* Last played */ - ticker_buf[0] = '\0'; - - if (use_smooth_ticker) + if (show_entry_last_played) { - ticker_smooth.src_str = ozone->selection_lastplayed; - gfx_animation_ticker_smooth(&ticker_smooth); - } - else - { - ticker.str = ozone->selection_lastplayed; - gfx_animation_ticker(&ticker); - } + ticker_buf[0] = '\0'; - ozone_content_metadata_line( - video_width, - video_height, - ozone, - &y, - ticker_x_offset + column_x, - ticker_buf, - text_color, - 1); + if (use_smooth_ticker) + { + ticker_smooth.src_str = ozone->selection_lastplayed; + gfx_animation_ticker_smooth(&ticker_smooth); + } + else + { + ticker.str = ozone->selection_lastplayed; + gfx_animation_ticker(&ticker); + } + + ozone_content_metadata_line( + video_width, + video_height, + ozone, + &y, + ticker_x_offset + column_x, + ticker_buf, + text_color, + 1); + } } else { @@ -6074,37 +6104,40 @@ static void ozone_draw_thumbnail_bar( ozone_count_lines(ozone->selection_entry_enumeration)); /* Core association */ - ozone_content_metadata_line( - video_width, - video_height, - ozone, - &y, - column_x, - ozone->selection_core_name, - text_color, - ozone->selection_core_name_lines); + if (show_entry_core) + ozone_content_metadata_line( + video_width, + video_height, + ozone, + &y, + column_x, + ozone->selection_core_name, + text_color, + ozone->selection_core_name_lines); /* Playtime */ - ozone_content_metadata_line( - video_width, - video_height, - ozone, - &y, - column_x, - ozone->selection_playtime, - text_color, - ozone_count_lines(ozone->selection_playtime)); + if (show_entry_playtime) + ozone_content_metadata_line( + video_width, + video_height, + ozone, + &y, + column_x, + ozone->selection_playtime, + text_color, + ozone_count_lines(ozone->selection_playtime)); /* Last played */ - ozone_content_metadata_line( - video_width, - video_height, - ozone, - &y, - column_x, - ozone->selection_lastplayed, - text_color, - ozone->selection_lastplayed_lines); + if (show_entry_last_played) + ozone_content_metadata_line( + video_width, + video_height, + ozone, + &y, + column_x, + ozone->selection_lastplayed, + text_color, + ozone->selection_lastplayed_lines); } /* If metadata override is active, display an @@ -6622,7 +6655,7 @@ static void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone) ozone->fullscreen_thumbnail_label, sizeof(ozone->fullscreen_thumbnail_label), ozone->is_quick_menu, - ozone->playlist_index) == 0) + ozone->title) == 0) ozone->fullscreen_thumbnail_label[0] = '\0'; /* Configure fade in animation */ @@ -6654,11 +6687,8 @@ static void ozone_draw_fullscreen_thumbnails( /* Check whether fullscreen thumbnails are visible */ if (ozone->animations.fullscreen_thumbnail_alpha > 0.0f || ozone->want_fullscreen_thumbnails) { - /* Note: right thumbnail is drawn at the top - * in the sidebar, so it becomes the *left* - * thumbnail when viewed fullscreen */ - gfx_thumbnail_t *right_thumbnail = &ozone->thumbnails.left; - gfx_thumbnail_t *left_thumbnail = &ozone->thumbnails.right; + gfx_thumbnail_t *right_thumbnail = &ozone->thumbnails.right; + gfx_thumbnail_t *left_thumbnail = &ozone->thumbnails.left; unsigned width = video_width; unsigned height = video_height; int view_width = (int)width; @@ -7048,9 +7078,41 @@ static void ozone_set_thumbnail_content(void *data, const char *s) menu_entry_get(&entry, 0, selection, NULL, true); if (!string_is_empty(entry.path)) - gfx_thumbnail_set_content(ozone->thumbnail_path_data, entry.path); + gfx_thumbnail_set_content(ozone->thumbnail_path_data, entry.path, NULL); } } +#if defined(HAVE_LIBRETRODB) + else if (ozone->is_explore_list) + { + /* Explore list */ + if (string_is_empty(s)) + { + menu_entry_t entry; + const char *db_name; + size_t selection = menu_navigation_get_selection(); + + MENU_ENTRY_INIT(entry); + entry.label_enabled = false; + entry.rich_label_enabled = false; + entry.value_enabled = false; + entry.sublabel_enabled = false; + menu_entry_get(&entry, 0, selection, NULL, true); + + if (!entry.type) + return; + + db_name = menu_explore_get_entry_database(entry.type); + + if (!string_is_empty(entry.path) && !string_is_empty(db_name)) + gfx_thumbnail_set_content(ozone->thumbnail_path_data, + entry.path, + db_name); + + ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available = + (!string_is_empty(db_name) && menu_explore_get_entry_icon(entry.type)); + } + } +#endif else if (string_is_equal(s, "imageviewer")) { /* Filebrowser image updates */ @@ -7080,7 +7142,7 @@ static void ozone_set_thumbnail_content(void *data, const char *s) * the sublevels of database manager lists. * Showing thumbnails on database entries is a * pointless nuisance and a waste of CPU cycles, IMHO... */ - gfx_thumbnail_set_content(ozone->thumbnail_path_data, s); + gfx_thumbnail_set_content(ozone->thumbnail_path_data, s, NULL); } ozone_update_content_metadata(ozone); @@ -7152,7 +7214,7 @@ static bool INLINE ozone_metadata_override_available(ozone_handle_t *ozone) * Short circuiting means that in most cases * only 'ozone->is_playlist' will be evaluated, * so this isn't too much of a performance hog... */ - return ozone->is_playlist + return (ozone->is_playlist || ozone->is_explore_list) && ozone->show_thumbnail_bar && !ozone->selection_core_is_viewer && (ozone->thumbnails.left.status == GFX_THUMBNAIL_STATUS_AVAILABLE || @@ -7322,6 +7384,11 @@ static void ozone_start_cursor_wiggle( ozone->cursor_wiggle_state.wiggling = true; } +/* Common thumbnail switch requires FILE_TYPE_RPL_ENTRY, + * which only works with playlists, therefore activate it + * manually for Quick Menu, Explore and Database */ +extern int action_switch_thumbnail(const char *path, + const char *label, unsigned type, size_t idx); static enum menu_action ozone_parse_menu_entry_action( ozone_handle_t *ozone, @@ -7368,7 +7435,7 @@ static enum menu_action ozone_parse_menu_entry_action( case MENU_ACTION_START: ozone->cursor_mode = false; if (ozone->is_state_slot || - (ozone->is_quick_menu && !string_is_empty(ozone->savestate_thumbnail_file_path))) + (ozone->is_quick_menu && menu_is_running_quick_menu())) break; /* If this is a menu with thumbnails and cursor @@ -7391,6 +7458,7 @@ static enum menu_action ozone_parse_menu_entry_action( break; case MENU_ACTION_SCAN: ozone->cursor_mode = false; + ozone->skip_thumbnail_reset = false; if (ozone->fullscreen_thumbnails_available && !ozone->show_fullscreen_thumbnails && @@ -7401,12 +7469,18 @@ static enum menu_action ozone_parse_menu_entry_action( ozone->want_fullscreen_thumbnails = true; new_action = MENU_ACTION_NOOP; } - else if (ozone->show_fullscreen_thumbnails && !ozone->is_playlist) + else if (ozone->show_fullscreen_thumbnails && + (ozone->is_state_slot || (ozone->is_quick_menu && menu_is_running_quick_menu()))) { ozone_hide_fullscreen_thumbnails(ozone, true); ozone->want_fullscreen_thumbnails = false; new_action = MENU_ACTION_NOOP; } + else if (ozone->is_explore_list || ozone->is_quick_menu || ozone->is_db_manager_list) + { + action_switch_thumbnail(NULL, NULL, 0, 0); + new_action = MENU_ACTION_NOOP; + } break; case MENU_ACTION_DOWN: if (ozone->cursor_in_sidebar) @@ -7554,7 +7628,7 @@ static enum menu_action ozone_parse_menu_entry_action( { ozone_hide_fullscreen_thumbnails(ozone, true); ozone->want_fullscreen_thumbnails = false; - if (!ozone->is_state_slot && !ozone->is_playlist) + if (!ozone->is_state_slot && !ozone->is_playlist && !ozone->is_explore_list) new_action = MENU_ACTION_NOOP; break; } @@ -8040,6 +8114,8 @@ static void ozone_refresh_thumbnail_image(void *data, unsigned i) if (!ozone) return; + ozone->skip_thumbnail_reset = false; + /* Refresh metadata */ if (!i) ozone_update_content_metadata(ozone); @@ -8048,8 +8124,8 @@ static void ozone_refresh_thumbnail_image(void *data, unsigned i) * and we are currently viewing a playlist */ if ((gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) || gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) && - ((ozone->is_playlist && ozone->depth == 1) || - (ozone->is_quick_menu && ozone->want_thumbnail_bar))) + ozone->want_thumbnail_bar && + (ozone->is_quick_menu || ozone->is_playlist || ozone->is_explore_list)) ozone_update_thumbnail_image(ozone); } @@ -10032,13 +10108,12 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation) update_thumbnails = true; ozone->skip_thumbnail_reset = false; } - /* Database list updates - * (pointless nuisance...) */ - else if (ozone->is_db_manager_list && ozone->depth == 4) + /* Database + Explore list updates */ + else if ((ozone->is_db_manager_list && ozone->depth == 4) || + ozone->is_explore_list) { ozone_set_thumbnail_content(ozone, ""); update_thumbnails = true; - ozone->want_thumbnail_bar = true; ozone->skip_thumbnail_reset = false; } /* Filebrowser image updates */ @@ -10059,7 +10134,7 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation) * content + right/left thumbnails * (otherwise last loaded thumbnail will * persist, and be shown on the wrong entry) */ - gfx_thumbnail_set_content(ozone->thumbnail_path_data, NULL); + gfx_thumbnail_set_content(ozone->thumbnail_path_data, NULL, NULL); ozone_unload_thumbnail_textures(ozone); update_thumbnails = true; ozone->want_thumbnail_bar = false; @@ -10701,6 +10776,8 @@ static void ozone_populate_entries(void *data, ozone->fade_direction = new_depth <= ozone->depth; ozone->depth = new_depth; ozone->is_db_manager_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST)); + ozone->is_explore_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_EXPLORE_LIST)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB)); ozone->is_file_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES)); ozone->is_quick_menu = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_SETTINGS)) || @@ -10718,6 +10795,14 @@ static void ozone_populate_entries(void *data, ozone->skip_thumbnail_reset = true; } + /* Quick Menu under Explore list must also be Quick Menu */ + if (ozone->is_explore_list) + { + ozone->is_quick_menu |= menu_is_nonrunning_quick_menu() || menu_is_running_quick_menu(); + if (ozone->is_quick_menu) + ozone->is_explore_list = false; + } + /* Determine the first playlist item under "Load Content > Playlists" */ ozone->playlist_collection_offset = 0; if (settings->uints.menu_content_show_add_entry) @@ -10753,7 +10838,30 @@ static void ozone_populate_entries(void *data, ozone->thumbnails.right.status == GFX_THUMBNAIL_STATUS_MISSING)) ozone->skip_thumbnail_reset = true; - if (!ozone->is_quick_menu && !ozone->is_state_slot && !ozone->skip_thumbnail_reset) + if (ozone->is_quick_menu) + { + if (menu_is_running_quick_menu()) + { + ozone->want_thumbnail_bar = false; + ozone->skip_thumbnail_reset = false; + ozone_update_savestate_thumbnail_path(ozone, menu_navigation_get_selection()); + ozone_update_savestate_thumbnail_image(ozone); + } + else if (gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) || + gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) + { + ozone->want_thumbnail_bar = true; + ozone->skip_thumbnail_reset = true; + ozone_update_thumbnail_image(ozone); + } + } + else if (ozone->is_explore_list) + { + ozone->want_thumbnail_bar = false; + ozone_set_thumbnail_content(ozone, ""); + ozone_update_thumbnail_image(ozone); + } + else if (!ozone->is_state_slot && !ozone->skip_thumbnail_reset) { if (ozone->is_db_manager_list && ozone->depth == 4) ozone->skip_thumbnail_reset = true; @@ -10779,23 +10887,6 @@ static void ozone_populate_entries(void *data, ozone->want_thumbnail_bar = false; } } - else if (ozone->is_quick_menu) - { - if (menu_is_running_quick_menu()) - { - ozone->want_thumbnail_bar = false; - ozone->skip_thumbnail_reset = false; - ozone_update_savestate_thumbnail_path(ozone, menu_navigation_get_selection()); - ozone_update_savestate_thumbnail_image(ozone); - } - else if (gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) || - gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) - { - ozone->want_thumbnail_bar = true; - ozone->skip_thumbnail_reset = true; - ozone_update_thumbnail_image(ozone); - } - } if (ozone->skip_thumbnail_reset && (gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) || @@ -10821,6 +10912,7 @@ static void ozone_populate_entries(void *data, (ozone->is_db_manager_list && ozone->want_thumbnail_bar && ozone->depth >= 4) || (ozone->is_quick_menu && ozone->want_thumbnail_bar) || (ozone->is_file_list && ozone->want_thumbnail_bar) || + (ozone->is_explore_list && ozone->want_thumbnail_bar) || (ozone->is_state_slot); if (ozone->fullscreen_thumbnails_available != ozone->want_thumbnail_bar) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 206a1e60e0..fdcf9cbb8c 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -339,6 +339,7 @@ typedef struct bool shadow_enable; bool extended_ascii_enable; bool is_playlist; + bool is_explore_list; bool is_quick_menu; bool is_state_slot; bool entry_has_thumbnail; @@ -5090,7 +5091,7 @@ static void rgui_render(void *data, ((timedate_x - rgui->term_layout.start_x) / rgui->font_width_stride) - 3 : rgui->term_layout.width - 1; bool show_mini_thumbnails = rgui_inline_thumbnails && - (rgui->is_playlist || (rgui->is_quick_menu && !menu_is_running_quick_menu())); + (rgui->is_playlist || rgui->is_explore_list || (rgui->is_quick_menu && !menu_is_running_quick_menu())); bool show_thumbnail = false; bool show_left_thumbnail = false; bool show_savestate_thumbnail = (!string_is_empty(rgui->savestate_thumbnail_file_path) && @@ -6651,7 +6652,7 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load) /* Update thumbnail content/path */ if ((rgui->show_fs_thumbnail || menu_rgui_inline_thumbnails) - && (rgui->is_playlist || rgui->is_quick_menu)) + && (rgui->is_playlist || rgui->is_explore_list || rgui->is_quick_menu)) { size_t selection = menu_navigation_get_selection(); size_t list_size = menu_entries_get_size(); @@ -6671,25 +6672,65 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load) playlist_index = list->list[selection].entry_idx; rgui->playlist_index = playlist_index; } - } - else if (rgui->is_quick_menu && - string_is_empty(rgui->savestate_thumbnail_file_path)) - { - playlist_valid = true; - playlist_index = rgui->playlist_index; - } - if (gfx_thumbnail_set_content_playlist(rgui->thumbnail_path_data, - playlist_valid ? playlist_get_cached() : NULL, playlist_index)) - { - if (gfx_thumbnail_is_enabled(rgui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)) - has_thumbnail = gfx_thumbnail_update_path(rgui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT); - - if (menu_rgui_inline_thumbnails && - gfx_thumbnail_is_enabled(rgui->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) - has_thumbnail = gfx_thumbnail_update_path(rgui->thumbnail_path_data, GFX_THUMBNAIL_LEFT) || - has_thumbnail; + gfx_thumbnail_set_content_playlist(rgui->thumbnail_path_data, + playlist_valid ? playlist_get_cached() : NULL, playlist_index); } + else if (rgui->is_quick_menu) + { + if (string_is_empty(rgui->savestate_thumbnail_file_path)) + playlist_valid = true; + + playlist_index = rgui->playlist_index; + + gfx_thumbnail_set_content_playlist(rgui->thumbnail_path_data, + playlist_valid ? playlist_get_cached() : NULL, playlist_index); + } +#if defined(HAVE_LIBRETRODB) + else if (rgui->is_explore_list) + { + /* Get playlist index corresponding + * to the selected entry */ + if (list && + (selection < list_size)) + { + menu_entry_t entry; + const char *db_name; + + MENU_ENTRY_INIT(entry); + entry.label_enabled = false; + entry.rich_label_enabled = false; + entry.value_enabled = false; + entry.sublabel_enabled = false; + menu_entry_get(&entry, 0, selection, NULL, true); + + if (!entry.type) + return; + + db_name = menu_explore_get_entry_database(entry.type); + + if (!string_is_empty(entry.path) && !string_is_empty(db_name)) + { + playlist_t *playlist = playlist_get_cached(); + const struct playlist_entry *playlist_entry = NULL; + size_t playlist_index = + menu_explore_get_entry_playlist_index(list->list[selection].type, &playlist, &playlist_entry); + + rgui->playlist_index = playlist_index; + + gfx_thumbnail_set_content(rgui->thumbnail_path_data, entry.path, db_name); + } + else + gfx_thumbnail_set_content(rgui->thumbnail_path_data, NULL, NULL); + } + } +#endif + + if (gfx_thumbnail_is_enabled(rgui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)) + has_thumbnail = gfx_thumbnail_update_path(rgui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT); + + if (menu_rgui_inline_thumbnails && gfx_thumbnail_is_enabled(rgui->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) + has_thumbnail = gfx_thumbnail_update_path(rgui->thumbnail_path_data, GFX_THUMBNAIL_LEFT) || has_thumbnail; } /* Save state thumbnails */ @@ -6724,7 +6765,7 @@ static void rgui_update_thumbnail_image(void *data) { rgui_t *rgui = (rgui_t*)data; - if (rgui->is_playlist) + if (rgui->is_playlist || rgui->is_explore_list) rgui_scan_selected_entry_thumbnail(rgui, true); } @@ -6798,7 +6839,7 @@ static void rgui_refresh_thumbnail_image(void *userdata, unsigned i) /* Only load thumbnails if currently viewing a * playlist (note that thumbnails are loaded * immediately, for an optimal user experience) */ - if (rgui->is_playlist) + if (rgui->is_playlist || rgui->is_explore_list || rgui->is_quick_menu) rgui_scan_selected_entry_thumbnail(rgui, true); } } @@ -6944,11 +6985,22 @@ static void rgui_populate_entries(void *data, || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST)); + rgui->is_explore_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_EXPLORE_LIST)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB)); + /* Determine whether this is the quick menu */ rgui->is_quick_menu = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_SETTINGS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SAVESTATE_LIST)); rgui->is_state_slot = string_to_unsigned(path) == MENU_ENUM_LABEL_STATE_SLOT; + + /* Quick Menu under Explore list must also be Quick Menu */ + if (rgui->is_explore_list) + { + rgui->is_quick_menu |= menu_is_nonrunning_quick_menu() || menu_is_running_quick_menu(); + if (rgui->is_quick_menu) + rgui->is_explore_list = false; + } /* Set menu title */ menu_entries_get_title(rgui->menu_title, sizeof(rgui->menu_title)); @@ -7520,7 +7572,7 @@ static enum menu_action rgui_parse_menu_entry_action( rgui_thumbnail_cycle_dupe(rgui); rgui_toggle_fs_thumbnail(rgui, config_get_ptr()->bools.menu_rgui_inline_thumbnails); - if (!rgui->is_state_slot && !rgui->is_playlist) + if (!rgui->is_state_slot && !rgui->is_playlist && !rgui->is_explore_list) new_action = MENU_ACTION_NOOP; } break; @@ -7534,7 +7586,7 @@ static enum menu_action rgui_parse_menu_entry_action( break; case MENU_ACTION_START: /* Playlist thumbnail fullscreen toggle */ - if (rgui->is_playlist || (rgui->is_quick_menu && !menu_is_running_quick_menu())) + if (rgui->is_playlist || rgui->is_explore_list || (rgui->is_quick_menu && !menu_is_running_quick_menu())) { settings_t *settings = config_get_ptr(); @@ -7578,7 +7630,7 @@ static enum menu_action rgui_parse_menu_entry_action( new_action = MENU_ACTION_NOOP; } /* Playlist thumbnail cycle */ - else if (rgui->is_playlist) + else if (rgui->is_playlist || rgui->is_explore_list || rgui->is_quick_menu) { settings_t *settings = config_get_ptr(); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 3b1bbeab68..f955a90120 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -342,7 +342,6 @@ typedef struct xmb_handle size_t categories_selection_ptr_old; size_t selection_ptr_old; size_t fullscreen_thumbnail_selection; - size_t playlist_index; size_t playlist_collection_offset; /* size of the current list */ @@ -423,6 +422,7 @@ typedef struct xmb_handle /* Favorites, History, Images, Music, Videos, user generated */ bool is_playlist; bool is_db_manager_list; + bool is_explore_list; bool is_contentless_cores; /* Load Content file browser */ @@ -1228,7 +1228,7 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) xmb->fullscreen_thumbnail_label, sizeof(xmb->fullscreen_thumbnail_label), xmb->is_quick_menu, - xmb->playlist_index); + NULL); } } } @@ -1382,9 +1382,6 @@ static void xmb_set_thumbnail_content(void *data, const char *s) playlist_index = list->list[selection].entry_idx; } - /* Remember playlist index for Quick Menu fullscreen thumbnail title */ - xmb->playlist_index = playlist_index; - gfx_thumbnail_set_content_playlist(xmb->thumbnail_path_data, playlist_valid ? playlist_get_cached() : NULL, playlist_index); xmb->fullscreen_thumbnails_available = true; @@ -1407,11 +1404,43 @@ static void xmb_set_thumbnail_content(void *data, const char *s) if (!string_is_empty(entry.path)) { - gfx_thumbnail_set_content(xmb->thumbnail_path_data, entry.path); + gfx_thumbnail_set_content(xmb->thumbnail_path_data, entry.path, NULL); xmb->fullscreen_thumbnails_available = true; } } } +#if defined(HAVE_LIBRETRODB) + else if (xmb->is_explore_list) + { + /* Explore list */ + if (string_is_empty(s)) + { + menu_entry_t entry; + const char *db_name; + size_t selection = menu_navigation_get_selection(); + + MENU_ENTRY_INIT(entry); + entry.label_enabled = false; + entry.rich_label_enabled = false; + entry.value_enabled = false; + entry.sublabel_enabled = false; + menu_entry_get(&entry, 0, selection, NULL, true); + + if (!entry.type) + return; + + db_name = menu_explore_get_entry_database(entry.type); + + if (!string_is_empty(entry.path) && !string_is_empty(db_name)) + gfx_thumbnail_set_content(xmb->thumbnail_path_data, + entry.path, + db_name); + + xmb->fullscreen_thumbnails_available = + (!string_is_empty(db_name) && menu_explore_get_entry_icon(entry.type)); + } + } +#endif else if (string_is_equal(s, "imageviewer")) { /* Filebrowser image updates */ @@ -1445,7 +1474,7 @@ static void xmb_set_thumbnail_content(void *data, const char *s) * the sublevels of database manager lists. * Showing thumbnails on database entries is a * pointless nuisance and a waste of CPU cycles, IMHO... */ - gfx_thumbnail_set_content(xmb->thumbnail_path_data, s); + gfx_thumbnail_set_content(xmb->thumbnail_path_data, s, NULL); xmb->fullscreen_thumbnails_available = true; } } @@ -1549,9 +1578,9 @@ static void xmb_selection_pointer_changed( xmb_set_thumbnail_content(xmb, NULL); update_thumbnails = true; } - /* Database list updates - * (pointless nuisance...) */ - else if (xmb->is_db_manager_list && depth <= 4) + /* Database + Explore list updates */ + else if ((xmb->is_db_manager_list && depth <= 4) || + xmb->is_explore_list) { xmb_set_thumbnail_content(xmb, NULL); update_thumbnails = true; @@ -1590,7 +1619,7 @@ static void xmb_selection_pointer_changed( * persist, and be shown on the wrong entry) */ xmb->fullscreen_thumbnails_available = false; xmb->thumbnails.pending = XMB_PENDING_THUMBNAIL_NONE; - gfx_thumbnail_set_content(xmb->thumbnail_path_data, NULL); + gfx_thumbnail_set_content(xmb->thumbnail_path_data, NULL, NULL); gfx_thumbnail_cancel_pending_requests(); gfx_thumbnail_reset(&xmb->thumbnails.right); gfx_thumbnail_reset(&xmb->thumbnails.left); @@ -1797,21 +1826,18 @@ static void xmb_list_open_new(xmb_handle_t *xmb, xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr); - if (xmb_system_tab <= XMB_SYSTEM_TAB_SETTINGS) + if (xmb_system_tab <= XMB_SYSTEM_TAB_SETTINGS && xmb->depth > xmb->old_depth) { if ( gfx_thumbnail_is_enabled(xmb->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) || gfx_thumbnail_is_enabled(xmb->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) { if (xmb->is_playlist || xmb->is_db_manager_list) { - if (xmb->is_db_manager_list && xmb->depth < 5) + if (!(xmb->is_db_manager_list && xmb->depth > 4)) xmb_unload_thumbnail_textures(xmb); - if (!(xmb->is_playlist && xmb->depth == 4 && xmb->old_depth == 5)) - { - xmb_set_thumbnail_content(xmb, NULL); - xmb_update_thumbnail_image(xmb); - } + xmb_set_thumbnail_content(xmb, NULL); + xmb_update_thumbnail_image(xmb); } } } @@ -2576,6 +2602,20 @@ static void xmb_populate_entries(void *data, string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SAVESTATE_LIST)); xmb->is_state_slot = string_to_unsigned(path) == MENU_ENUM_LABEL_STATE_SLOT; + /* Explore list */ + xmb->is_explore_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_EXPLORE_LIST)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB)); + + /* Quick Menu under Explore list must also be Quick Menu */ + if (xmb->is_explore_list) + { + xmb->is_quick_menu |= menu_is_nonrunning_quick_menu() || menu_is_running_quick_menu(); + if (xmb->is_quick_menu) + xmb->is_explore_list = false; + else + xmb->skip_thumbnail_reset = true; + } + /* Determine the first playlist item under "Load Content > Playlists" */ xmb->playlist_collection_offset = 0; if (settings->uints.menu_content_show_add_entry) @@ -2611,12 +2651,13 @@ static void xmb_populate_entries(void *data, /* Determine whether to show entry index */ /* Update list size & entry index texts */ - if ((xmb->entry_idx_enabled = show_entry_idx && xmb->is_playlist)) + if ((xmb->entry_idx_enabled = show_entry_idx && + (xmb->is_playlist || (xmb->is_explore_list && xmb->depth > 1)))) { xmb->list_size = menu_entries_get_size(); snprintf(xmb->entry_index_str, sizeof(xmb->entry_index_str), - "%lu/%lu", (unsigned long)menu_navigation_get_selection() + 1, - (unsigned long)xmb->list_size); + "%lu/%lu", (unsigned long)menu_navigation_get_selection() + 1, + (unsigned long)xmb->list_size); } /* By default, fullscreen thumbnails are only @@ -2634,18 +2675,14 @@ static void xmb_populate_entries(void *data, { xmb->fullscreen_thumbnails_available = true; } - else if (xmb->is_quick_menu && xmb->depth < 6) + else if (xmb->is_quick_menu) { - const char *thumbnail_content_path = NULL; - runloop_state_t *runloop_st = runloop_state_get_ptr(); - gfx_thumbnail_get_content_path(xmb->thumbnail_path_data, &thumbnail_content_path); - - if (xmb->libretro_running) - xmb->fullscreen_thumbnails_available = false; - - if (!string_is_empty(thumbnail_content_path) && - !string_is_equal(thumbnail_content_path, runloop_st->runtime_content_path)) - xmb->fullscreen_thumbnails_available = true; + xmb->fullscreen_thumbnails_available = !menu_is_running_quick_menu(); + } + else if (xmb->is_explore_list) + { + xmb_set_thumbnail_content(xmb, ""); + xmb_update_thumbnail_image(xmb); } /* Hack: XMB gets into complete muddle when @@ -2657,7 +2694,7 @@ static void xmb_populate_entries(void *data, { xmb->fullscreen_thumbnails_available = false; xmb->thumbnails.pending = XMB_PENDING_THUMBNAIL_NONE; - gfx_thumbnail_set_content(xmb->thumbnail_path_data, NULL); + gfx_thumbnail_set_content(xmb->thumbnail_path_data, NULL, NULL); gfx_thumbnail_cancel_pending_requests(); gfx_thumbnail_reset(&xmb->thumbnails.right); gfx_thumbnail_reset(&xmb->thumbnails.left); @@ -4127,7 +4164,7 @@ static void xmb_show_fullscreen_thumbnails( xmb->fullscreen_thumbnail_label, sizeof(xmb->fullscreen_thumbnail_label), xmb->is_quick_menu, - xmb->playlist_index) == 0) + xmb->title_name) == 0) xmb->fullscreen_thumbnail_label[0] = '\0'; /* Configure fade in animation */ @@ -4147,6 +4184,12 @@ static void xmb_show_fullscreen_thumbnails( xmb->show_fullscreen_thumbnails = true; } +/* Common thumbnail switch requires FILE_TYPE_RPL_ENTRY, + * which only works with playlists, therefore activate it + * manually for Quick Menu, Explore and Database */ +extern int action_switch_thumbnail(const char *path, + const char *label, unsigned type, size_t idx); + static enum menu_action xmb_parse_menu_entry_action( xmb_handle_t *xmb, enum menu_action action) { @@ -4190,8 +4233,7 @@ static enum menu_action xmb_parse_menu_entry_action( break; case MENU_ACTION_START: if (xmb->is_state_slot || - (xmb->is_quick_menu && - (!string_is_empty(xmb->savestate_thumbnail_file_path) || xmb->depth > 2))) + (xmb->is_quick_menu && menu_is_running_quick_menu())) break; /* If this is a menu with thumbnails, attempt @@ -4221,12 +4263,18 @@ static enum menu_action xmb_parse_menu_entry_action( xmb->want_fullscreen_thumbnails = true; new_action = MENU_ACTION_NOOP; } - else if (xmb->show_fullscreen_thumbnails && !xmb->is_playlist) + else if (xmb->show_fullscreen_thumbnails && + (xmb->is_state_slot || (xmb->is_quick_menu && menu_is_running_quick_menu()))) { xmb_hide_fullscreen_thumbnails(xmb, true); xmb->want_fullscreen_thumbnails = false; new_action = MENU_ACTION_NOOP; } + else if (xmb->is_explore_list || xmb->is_quick_menu || xmb->is_db_manager_list) + { + action_switch_thumbnail(NULL, NULL, 0, 0); + new_action = MENU_ACTION_NOOP; + } break; case MENU_ACTION_OK: if (xmb->is_state_slot) @@ -4246,7 +4294,7 @@ static enum menu_action xmb_parse_menu_entry_action( { xmb_hide_fullscreen_thumbnails(xmb, true); xmb->want_fullscreen_thumbnails = false; - if (!xmb->is_state_slot && !xmb->is_playlist) + if (!xmb->is_state_slot && !xmb->is_playlist && !xmb->is_explore_list) return MENU_ACTION_NOOP; } break; @@ -6902,6 +6950,7 @@ static void xmb_context_reset_internal(xmb_handle_t *xmb, (xmb_system_tab < XMB_SYSTEM_TAB_SETTINGS && depth == 4)) && xmb->is_playlist)) || xmb->is_db_manager_list + || xmb->is_explore_list || xmb->is_file_list || xmb->is_quick_menu) xmb_update_thumbnail_image(xmb); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 1c52085206..248cc2bc8a 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -8158,7 +8158,7 @@ bool menu_input_dialog_start(menu_input_ctx_line_t *line) size_t menu_update_fullscreen_thumbnail_label( char *s, size_t len, - bool is_quick_menu, size_t playlist_index) + bool is_quick_menu, const char *title) { menu_entry_t selected_entry; const char *thumbnail_label = NULL; @@ -8196,13 +8196,8 @@ size_t menu_update_fullscreen_thumbnail_label( thumbnail_label = tmpstr; } /* > Quick Menu playlist label */ - else if (is_quick_menu) - { - const struct playlist_entry *entry = NULL; - playlist_get_index(playlist_get_cached(), playlist_index, &entry); - if (entry) - thumbnail_label = entry->label; - } + else if (is_quick_menu && title) + thumbnail_label = title; else thumbnail_label = selected_entry.path; @@ -8225,3 +8220,16 @@ bool menu_is_running_quick_menu(void) return string_is_equal(entry.label, "resume_content") || string_is_equal(entry.label, "state_slot"); } + +bool menu_is_nonrunning_quick_menu(void) +{ + menu_entry_t entry; + + MENU_ENTRY_INIT(entry); + entry.path_enabled = false; + entry.value_enabled = false; + entry.sublabel_enabled = false; + menu_entry_get(&entry, 0, 0, NULL, true); + + return string_is_equal(entry.label, "collection"); +} diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 41ef666938..c6499cedaf 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -663,6 +663,10 @@ typedef struct explore_state explore_state_t; explore_state_t *menu_explore_build_list(const char *directory_playlist, const char *directory_database); uintptr_t menu_explore_get_entry_icon(unsigned type); +const char *menu_explore_get_entry_database(unsigned type); +ssize_t menu_explore_get_entry_playlist_index(unsigned type, + playlist_t **playlist, + const struct playlist_entry **entry); void menu_explore_context_init(void); void menu_explore_context_deinit(void); void menu_explore_free_state(explore_state_t *state); @@ -1006,9 +1010,10 @@ bool menu_driver_iterate( size_t menu_update_fullscreen_thumbnail_label( char *s, size_t len, - bool is_quick_menu, size_t playlist_index); + bool is_quick_menu, const char *title); bool menu_is_running_quick_menu(void); +bool menu_is_nonrunning_quick_menu(void); extern const menu_ctx_driver_t *menu_ctx_drivers[]; diff --git a/menu/menu_explore.c b/menu/menu_explore.c index 8bd542d396..f1e574c9bc 100644 --- a/menu/menu_explore.c +++ b/menu/menu_explore.c @@ -1279,6 +1279,67 @@ uintptr_t menu_explore_get_entry_icon(unsigned type) return 0; } +const char *menu_explore_get_entry_database(unsigned type) +{ + explore_entry_t* e = NULL; + unsigned i; + + if (!explore_state || type < EXPLORE_TYPE_FIRSTITEM) + return 0; + + i = (type - EXPLORE_TYPE_FIRSTITEM); + e = &explore_state->entries[i]; + + if (e < RBUF_END(explore_state->entries)) + return e->by[EXPLORE_BY_SYSTEM]->str; + + return NULL; +} + +ssize_t menu_explore_get_entry_playlist_index(unsigned type, + playlist_t **playlist, + const struct playlist_entry **playlist_entry) +{ + explore_entry_t* e = NULL; + playlist_t* p = NULL; + unsigned i; + + if (!explore_state || type < EXPLORE_TYPE_FIRSTITEM) + return 0; + + i = (type - EXPLORE_TYPE_FIRSTITEM); + e = &explore_state->entries[i]; + p = explore_state->playlists[0]; + + if (e < RBUF_END(explore_state->entries)) + { + const struct playlist_entry *entry = NULL; + size_t pi = 0; + size_t j = 0; + + playlist_get_index(p, 0, &entry); + while (!string_is_equal(e->playlist_entry->db_name, entry->db_name)) + { + p = explore_state->playlists[pi]; + playlist_get_index(p, 0, &entry); + pi++; + } + + for (j = 0; j < playlist_size(p); j++) + { + playlist_get_index(p, j, &entry); + if (string_is_equal(entry->label, e->playlist_entry->label)) + { + *playlist_entry = entry; + *playlist = p; + return j; + } + } + } + + return -1; +} + void menu_explore_context_init(void) { if (!explore_state)