From 391ba55b810b21ca427573982ad246584fc98074 Mon Sep 17 00:00:00 2001 From: sonninnos <45124675+sonninnos@users.noreply.github.com> Date: Mon, 20 Jan 2025 19:25:41 +0200 Subject: [PATCH] Add playlist random selector (#17441) * Add playlist random selector * Buildfix attempt * ORBIS buildfix attempt --- intl/msg_hash_us.h | 4 + libretro-common/include/retro_math.h | 14 + menu/drivers/materialui.c | 229 +++++++-- menu/drivers/ozone.c | 684 ++++++++++++++++----------- menu/drivers/rgui.c | 229 ++++++--- menu/drivers/xmb.c | 118 ++++- menu/menu_driver.c | 12 +- msg_hash.h | 1 + 8 files changed, 871 insertions(+), 420 deletions(-) diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 95a4eb025f50..e89daf0b10be 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -10452,6 +10452,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CYCLE_THUMBNAILS, "Cycle thumbnails" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_RANDOM_SELECT, + "Random select" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK, "Back" diff --git a/libretro-common/include/retro_math.h b/libretro-common/include/retro_math.h index d1cb86294d32..916ddd4e1002 100644 --- a/libretro-common/include/retro_math.h +++ b/libretro-common/include/retro_math.h @@ -24,6 +24,7 @@ #define _LIBRETRO_COMMON_MATH_H #include +#include #if defined(_WIN32) && !defined(_XBOX) #define WIN32_LEAN_AND_MEAN @@ -187,4 +188,17 @@ static INLINE void convert_yxy_to_rgb(const float* Yxy, float* rgb) rgb[2] = dot_product(xyz_rgb[2], xyz); } +/** + * Picks a random value between a specified range. + * + * @param \c min unsigned minimum possible value. + * @param \c max unsigned maximum possible value. + * + * @return unsigned random value between \c min and \c max (inclusive). + */ +static INLINE unsigned random_range(unsigned min, unsigned max) +{ + return (min == max) ? min : (unsigned)((float)rand() / (float)RAND_MAX * (max + 1 - min) + min); +} + #endif diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 8cbd4de76a3f..aee58cb8f384 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -46,15 +47,17 @@ #include "../../gfx/gfx_thumbnail_path.h" #include "../../gfx/gfx_thumbnail.h" -#include "../../input/input_osk.h" - #include "../../core_info.h" #include "../../configuration.h" -#include "../../audio/audio_driver.h" -#include "../../tasks/tasks_internal.h" #include "../../runtime_file.h" #include "../../file_path_special.h" +#include "../../input/input_osk.h" #include "../../list_special.h" +#include "../../tasks/tasks_internal.h" + +#ifdef HAVE_AUDIOMIXER +#include "../../audio/audio_driver.h" +#endif #ifdef HAVE_CHEEVOS #include "../../cheevos/cheevos_menu.h" @@ -543,28 +546,31 @@ enum materialui_handle_flags MUI_FLAG_NEED_COMPUTE = (1 << 1), MUI_FLAG_SHOW_MOUSE = (1 << 2), MUI_FLAG_SHOW_SCREENSAVER = (1 << 3), - MUI_FLAG_IS_PLAYLIST_TAB = (1 << 4), + MUI_FLAG_IS_PLAYLISTS_TAB = (1 << 4), MUI_FLAG_IS_PLAYLIST = (1 << 5), - MUI_FLAG_IS_FILE_LIST = (1 << 6), - MUI_FLAG_IS_DROPDOWN_LIST = (1 << 7), - MUI_FLAG_IS_CORE_UPDATER_LIST = (1 << 8), - MUI_FLAG_LAST_SHOW_NAVBAR = (1 << 9), - MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR = (1 << 10), - MUI_FLAG_MENU_STACK_FLUSHED = (1 << 11), + MUI_FLAG_IS_EXPLORE_LIST = (1 << 6), + MUI_FLAG_IS_FILE_LIST = (1 << 7), + MUI_FLAG_IS_DROPDOWN_LIST = (1 << 8), + MUI_FLAG_IS_CORE_UPDATER_LIST = (1 << 9), + MUI_FLAG_LAST_SHOW_NAVBAR = (1 << 10), + MUI_FLAG_LAST_AUTO_ROTATE_NAVBAR = (1 << 11), + MUI_FLAG_MENU_STACK_FLUSHED = (1 << 12), /* Used to track scroll animations */ - MUI_FLAG_SCROLL_ANIMATION_ACTIVE = (1 << 12), - MUI_FLAG_USE_SMOOTH_TICKER = (1 << 13), - MUI_FLAG_TOUCH_FEEDBACK_UPDATE_SELECTION = (1 << 14), - MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE = (1 << 15), - MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED = (1 << 16), - MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS = (1 << 17), - MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW = (1 << 18), - MUI_FLAG_STATUSBAR_ENABLED = (1 << 19), - MUI_FLAG_STATUSBAR_CACHED = (1 << 20), - MUI_FLAG_SCROLLBAR_ACTIVE = (1 << 21), - MUI_FLAG_SCROLLBAR_DRAGGED = (1 << 22), - MUI_FLAG_NAVBAR_MENU_NAVIGATION_WRAPPED = (1 << 23), - MUI_FLAG_COL_DIVIDER_IS_LIST_BG = (1 << 24) + MUI_FLAG_SCROLL_ANIMATION_ACTIVE = (1 << 13), + MUI_FLAG_USE_SMOOTH_TICKER = (1 << 14), + MUI_FLAG_TOUCH_FEEDBACK_UPDATE_SELECTION = (1 << 15), + MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE = (1 << 16), + MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED = (1 << 17), + MUI_FLAG_PRIMARY_THUMBNAIL_BLOCKED = (1 << 18), + MUI_FLAG_SECONDARY_THUMBNAIL_BLOCKED = (1 << 19), + MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS = (1 << 20), + MUI_FLAG_SHOW_SELECTION_MARKER_SHADOW = (1 << 21), + MUI_FLAG_STATUSBAR_ENABLED = (1 << 22), + MUI_FLAG_STATUSBAR_CACHED = (1 << 23), + MUI_FLAG_SCROLLBAR_ACTIVE = (1 << 24), + MUI_FLAG_SCROLLBAR_DRAGGED = (1 << 25), + MUI_FLAG_NAVBAR_MENU_NAVIGATION_WRAPPED = (1 << 26), + MUI_FLAG_COL_DIVIDER_IS_LIST_BG = (1 << 27) }; typedef struct materialui_handle @@ -4688,6 +4694,8 @@ static void materialui_render_menu_entry_playlist_dual_icon( const char *entry_label = NULL; float entry_x = (float)x_offset + node->x; float entry_y = (float)header_height - mui->scroll_y + node->y; + float entry_center = (!(mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED)) + ? (float)mui->thumbnail_width_max / 2 : 0.0f; int usable_width = (int)node->entry_width - (int)(mui->margin * 2); float thumbnail_y = entry_y + ((float)mui->dip_base_unit_size / 10.0f); float divider_y = thumbnail_y + (float)mui->thumbnail_height_max + @@ -4740,13 +4748,14 @@ static void materialui_render_menu_entry_playlist_dual_icon( userdata, video_width, video_height, - entry_x + (float)mui->margin, + entry_x + (float)mui->margin + entry_center, thumbnail_y, 1.0f, &mymat); /* > Secondary thumbnail */ - materialui_draw_thumbnail( + if (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) + materialui_draw_thumbnail( mui, &node->thumbnails.secondary, settings, @@ -5090,7 +5099,8 @@ static void materialui_render_selected_entry_aux_playlist_desktop( &mymat); /* Draw secondary */ - materialui_draw_thumbnail( + if (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) + materialui_draw_thumbnail( mui, secondary_thumbnail, settings, @@ -6576,7 +6586,8 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui, show_primary_thumbnail = (primary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING); show_secondary_thumbnail = - (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) + !(mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_BLOCKED) + && (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED) && (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING); if (show_primary_thumbnail) @@ -7310,8 +7321,8 @@ static void materialui_set_list_view_type(materialui_handle_t *mui, mui->list_view_type = MUI_LIST_VIEW_PLAYLIST; /* Check whether primary thumbnail is enabled */ - if (gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, - GFX_THUMBNAIL_RIGHT)) + if ( !(mui->flags & MUI_FLAG_PRIMARY_THUMBNAIL_BLOCKED) + && gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)) { mui->flags |= MUI_FLAG_PRIMARY_THUMBNAIL_AVAILABLE; /* Get thumbnail view mode based on current @@ -7744,6 +7755,12 @@ static bool materialui_force_enable_secondary_thumbnail( static void materialui_set_secondary_thumbnail_enable(materialui_handle_t *mui, struct menu_state *menu_st, settings_t *settings) { + if (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_BLOCKED) + { + mui->flags &= ~MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED; + return; + } + switch (mui->list_view_type) { case MUI_LIST_VIEW_PLAYLIST_THUMB_LIST_SMALL: @@ -8616,17 +8633,17 @@ static void materialui_populate_entries(void *data, const char *path, * (this requires special handling when * scrolling via an alphabet search) */ if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB))) - mui->flags |= MUI_FLAG_IS_PLAYLIST_TAB; + mui->flags |= MUI_FLAG_IS_PLAYLISTS_TAB; else - mui->flags &= ~MUI_FLAG_IS_PLAYLIST_TAB; + mui->flags &= ~MUI_FLAG_IS_PLAYLISTS_TAB; /* Check whether this is the core updater menu * (this requires special handling when long * pressing an entry) */ if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CORE_UPDATER_LIST))) - mui->flags |= MUI_FLAG_IS_CORE_UPDATER_LIST; + mui->flags |= MUI_FLAG_IS_CORE_UPDATER_LIST; else - mui->flags &= ~(MUI_FLAG_IS_CORE_UPDATER_LIST); + mui->flags &= ~MUI_FLAG_IS_CORE_UPDATER_LIST; /* Check whether we are currently viewing a playlist, * file-browser-type list or dropdown list @@ -8639,8 +8656,27 @@ static void materialui_populate_entries(void *data, const char *path, if ( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST)) || 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))) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST)) + ) + { mui->flags |= MUI_FLAG_IS_PLAYLIST; + mui->flags &= ~(MUI_FLAG_PRIMARY_THUMBNAIL_BLOCKED + | MUI_FLAG_SECONDARY_THUMBNAIL_BLOCKED); + + /* Image playlist must block secondary thumbnail + * or the same image will be shown twice */ + if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST))) + mui->flags |= MUI_FLAG_SECONDARY_THUMBNAIL_BLOCKED; + + /* Music and video playlists must block both thumbnails + * since there is nothing to show */ + if ( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST))) + mui->flags |= MUI_FLAG_PRIMARY_THUMBNAIL_BLOCKED | MUI_FLAG_SECONDARY_THUMBNAIL_BLOCKED; + } else { /* > All of the following count as a 'file list' @@ -8704,6 +8740,30 @@ static void materialui_populate_entries(void *data, const char *path, mui->playlist = playlist_get_cached(); } +#if defined(HAVE_LIBRETRODB) + /* Explore list */ + if ( 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))) + mui->flags |= MUI_FLAG_IS_EXPLORE_LIST; + else + mui->flags &= ~MUI_FLAG_IS_EXPLORE_LIST; + + if (mui->flags & MUI_FLAG_IS_EXPLORE_LIST) + { + menu_entry_t entry; + MENU_ENTRY_INITIALIZE(entry); + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; + menu_entry_get(&entry, 0, 0, NULL, true); + + /* Quick Menu under Explore list must also be Quick Menu */ + if ( string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_RUN)) + || string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_RESUME_CONTENT)) + || string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_STATE_SLOT)) + ) + mui->flags &= ~MUI_FLAG_IS_EXPLORE_LIST; + } +#endif + /* Update navigation bar tabs * > Note: We do this regardless of whether * the navigation bar is currently shown. @@ -8834,7 +8894,7 @@ static int materialui_environ(enum menu_environ_cb type, void *data, /* If we are currently viewing the playlists tab, * the menu must be refreshed (since icon indices * may have changed) */ - if (mui->flags & MUI_FLAG_IS_PLAYLIST_TAB) + if (mui->flags & MUI_FLAG_IS_PLAYLISTS_TAB) menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE | MENU_ST_FLAG_ENTRIES_NEED_REFRESH; } @@ -9215,7 +9275,7 @@ static enum menu_action materialui_parse_menu_entry_action( * > If this is the playlists tab, an alphabet * search is highly ineffective - instead, * interpret this as a 'left' scroll action */ - if (mui->flags & MUI_FLAG_IS_PLAYLIST_TAB) + if (mui->flags & MUI_FLAG_IS_PLAYLISTS_TAB) { materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); new_action = MENU_ACTION_LEFT; @@ -9231,7 +9291,7 @@ static enum menu_action materialui_parse_menu_entry_action( * > If this is the playlists tab, an alphabet * search is highly ineffective - instead, * interpret this as a 'right' scroll action */ - if (mui->flags & MUI_FLAG_IS_PLAYLIST_TAB) + if (mui->flags & MUI_FLAG_IS_PLAYLISTS_TAB) { materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); new_action = MENU_ACTION_RIGHT; @@ -9244,7 +9304,7 @@ static enum menu_action materialui_parse_menu_entry_action( break; case MENU_ACTION_SCAN: /* - If this is a playlist, 'scan' command is used - * to cycle current thumbnail view + * to randomize current selection * - If this is not a playlist, perform default * 'scan' action *if* current selection is * on screen */ @@ -9252,12 +9312,79 @@ static enum menu_action materialui_parse_menu_entry_action( struct menu_state *menu_st = menu_state_get_ptr(); size_t selection = menu_st->selection_ptr; - if (mui->flags & MUI_FLAG_IS_PLAYLIST) + if (mui->flags & MUI_FLAG_IS_PLAYLISTS_TAB) { - settings_t *settings = config_get_ptr(); - if (settings) - materialui_switch_list_view(mui, menu_st, settings); + struct menu_state *menu_st = menu_state_get_ptr(); + size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0; + size_t selection = menu_st->selection_ptr; + size_t new_selection = random_range(0, selection_total - 1); + menu_entry_t entry_new; + + MENU_ENTRY_INITIALIZE(entry_new); + menu_entry_get(&entry_new, 0, new_selection, NULL, false); + /* Keep randomizing until selection is a fresh playlist */ + while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION) + { + new_selection = random_range(0, selection_total - 1); + menu_entry_get(&entry_new, 0, new_selection, NULL, false); + } + + if (new_selection != selection) + { + menu_st->selection_ptr = new_selection; + if (menu_st->driver_ctx->navigation_set) + menu_st->driver_ctx->navigation_set(menu_st->userdata, true); + } + new_action = MENU_ACTION_NOOP; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(true); +#endif + break; + } + else if ((mui->flags & MUI_FLAG_IS_PLAYLIST) + || (mui->flags & MUI_FLAG_IS_EXPLORE_LIST)) + { + struct menu_state *menu_st = menu_state_get_ptr(); + size_t selection_start = 0; + size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0; + size_t selection = menu_st->selection_ptr; + size_t new_selection = selection; + + /* Skip header items (Search Name + Add Additional Filter + Save as View) */ + if (mui->flags & MUI_FLAG_IS_EXPLORE_LIST) + { + menu_entry_t entry; + MENU_ENTRY_INITIALIZE(entry); + menu_entry_get(&entry, 0, 0, NULL, true); + + if (entry.type == MENU_SETTINGS_LAST + 1) + selection_start = 1; + else if (entry.type == FILE_TYPE_RDB) + selection_start = 2; + } + + new_selection = random_range(selection_start, selection_total - 1); + + while (new_selection == selection && selection_start != selection_total - 1) + new_selection = random_range(selection_start, selection_total - 1); + + if (new_selection != selection) + { + menu_st->selection_ptr = new_selection; + if (menu_st->driver_ctx->navigation_set) + menu_st->driver_ctx->navigation_set(menu_st->userdata, true); + materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); + } + + new_action = MENU_ACTION_NOOP; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(true); +#endif } else if (!materialui_entry_onscreen(mui, selection)) new_action = MENU_ACTION_NOOP; @@ -9313,8 +9440,20 @@ static enum menu_action materialui_parse_menu_entry_action( struct menu_state *menu_st = menu_state_get_ptr(); size_t selection = menu_st->selection_ptr; - if ( (mui->flags & MUI_FLAG_IS_PLAYLIST) - || !materialui_entry_onscreen(mui, selection)) + /* - If this is a playlist, 'info' command is used + * to cycle current thumbnail view + * - If this is not a playlist, perform default + * 'info' action *if* current selection is + * on screen */ + + if (mui->flags & MUI_FLAG_IS_PLAYLIST) + { + settings_t *settings = config_get_ptr(); + if (settings) + materialui_switch_list_view(mui, menu_st, settings); + new_action = MENU_ACTION_NOOP; + } + else if (!materialui_entry_onscreen(mui, selection)) new_action = MENU_ACTION_NOOP; } break; diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index de36345ca8f3..c28aa8d06dd6 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -32,34 +32,36 @@ #include #include #include - -#include "../../config.def.h" -#include "../../file_path_special.h" - -#ifdef HAVE_DISCORD_OWN_AVATAR -#include "../../discord/discord.h" -#endif +#include #include "../menu_cbs.h" #include "../menu_driver.h" #include "../menu_screensaver.h" -#ifdef HAVE_CHEEVOS -#include "../../cheevos/cheevos_menu.h" -#endif - #include "../../gfx/gfx_animation.h" #include "../../gfx/gfx_display.h" #include "../../gfx/gfx_thumbnail_path.h" #include "../../gfx/gfx_thumbnail.h" -#include "../../runtime_file.h" - -#include "../../input/input_osk.h" +#include "../../config.def.h" #include "../../configuration.h" -#include "../../audio/audio_driver.h" #include "../../content.h" #include "../../core_info.h" +#include "../../file_path_special.h" +#include "../../runtime_file.h" +#include "../../input/input_osk.h" + +#ifdef HAVE_AUDIOMIXER +#include "../../audio/audio_driver.h" +#endif + +#ifdef HAVE_CHEEVOS +#include "../../cheevos/cheevos_menu.h" +#endif + +#ifdef HAVE_DISCORD_OWN_AVATAR +#include "../../discord/discord.h" +#endif #define ANIMATION_PUSH_ENTRY_DURATION 166.66667f #define ANIMATION_CURSOR_DURATION 166.66667f @@ -340,7 +342,9 @@ enum ozone_pending_thumbnail_type typedef struct { const char *str; + float x; size_t width; + bool show; } ozone_footer_label_t; typedef struct ozone_theme @@ -447,7 +451,8 @@ enum ozone_handle_flags2 OZONE_FLAG2_LAST_USE_PREFERRED_SYSTEM_COLOR_THEME = (1 << 7), OZONE_FLAG2_RESET_DEPTH = (1 << 8), OZONE_FLAG2_PENDING_CURSOR_IN_SIDEBAR = (1 << 9), - OZONE_FLAG2_IS_QUICK_MENU = (1 << 10) + OZONE_FLAG2_IS_QUICK_MENU = (1 << 10), + OZONE_FLAG2_IS_PLAYLISTS_TAB = (1 << 11) }; struct ozone_handle @@ -481,15 +486,16 @@ struct ozone_handle { ozone_footer_label_t ok; ozone_footer_label_t back; - ozone_footer_label_t cycle; + ozone_footer_label_t scan; + ozone_footer_label_t clear_setting; + ozone_footer_label_t random_select; ozone_footer_label_t search; - ozone_footer_label_t fullscreen_thumbs; + ozone_footer_label_t cycle_thumbnails; + ozone_footer_label_t fullscreen_thumbnails; ozone_footer_label_t reset_to_default; ozone_footer_label_t manage; - ozone_footer_label_t metadata_toggle; + ozone_footer_label_t metadata_override; ozone_footer_label_t help; - ozone_footer_label_t clear; - ozone_footer_label_t scan; ozone_footer_label_t resume; } footer_labels; @@ -1616,7 +1622,7 @@ static void ozone_animate_cursor(ozone_handle_t *ozone, static void ozone_cursor_animation_cb(void *userdata) { float *target = NULL; - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; switch (ozone->theme_dynamic_cursor_state) { @@ -3650,7 +3656,7 @@ static void ozone_draw_sidebar( static void ozone_thumbnail_bar_hide_end(void *userdata) { - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; ozone->show_thumbnail_bar = false; ozone->flags &= ~(OZONE_FLAG_PENDING_HIDE_THUMBNAIL_BAR); @@ -3660,7 +3666,7 @@ static void ozone_thumbnail_bar_hide_end(void *userdata) static bool ozone_is_load_content_playlist(void *userdata) { - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; menu_entry_t entry; if ( (ozone->depth != 4) @@ -8062,8 +8068,7 @@ static enum menu_action ozone_parse_menu_entry_action( if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR) { char playlist_path[PATH_MAX_LENGTH]; - struct menu_state *menu_st = menu_state_get_ptr(); - size_t new_selection = 0; + /* If cursor is active, ensure we target * an on screen category */ size_t tab_selection = (ozone->flags & OZONE_FLAG_CURSOR_MODE) @@ -8125,36 +8130,127 @@ static enum menu_action ozone_parse_menu_entry_action( } break; case MENU_ACTION_SCAN: - ozone->flags &= ~(OZONE_FLAG_SKIP_THUMBNAIL_RESET - | OZONE_FLAG_CURSOR_MODE); - if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR) { - new_action = MENU_ACTION_NOOP; + /* If cursor is active, ensure we target + * an on screen category */ + size_t tab_selection = (ozone->flags & OZONE_FLAG_CURSOR_MODE) + ? ozone_get_onscreen_category_selection(ozone) + : ozone->categories_selection_ptr; + + new_selection = random_range(ozone->system_tab_end + 1, ozone->system_tab_end + horizontal_list_size); + while (new_selection == (int)tab_selection) + new_selection = random_range(ozone->system_tab_end + 1, ozone->system_tab_end + horizontal_list_size); + + if (new_selection != (int)tab_selection) + ozone_sidebar_goto(ozone, new_selection); + + ozone->flags &= ~OZONE_FLAG_CURSOR_MODE; + new_action = MENU_ACTION_NOOP; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != (int)selection) + audio_driver_mixer_play_scroll_sound(true); +#endif break; } + else if (ozone->flags2 & OZONE_FLAG2_IS_PLAYLISTS_TAB) + { + struct menu_state *menu_st = menu_state_get_ptr(); + size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0; + size_t selection = menu_st->selection_ptr; + size_t new_selection = random_range(0, selection_total - 1); + menu_entry_t entry_new; + + MENU_ENTRY_INITIALIZE(entry_new); + menu_entry_get(&entry_new, 0, new_selection, NULL, false); + /* Keep randomizing until selection is a fresh playlist */ + while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION) + { + new_selection = random_range(0, selection_total - 1); + menu_entry_get(&entry_new, 0, new_selection, NULL, false); + } - if ( (ozone->flags & OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE) + if (new_selection != selection) + { + menu_st->selection_ptr = new_selection; + if (menu_st->driver_ctx->navigation_set) + menu_st->driver_ctx->navigation_set(menu_st->userdata, true); + } + + new_action = MENU_ACTION_NOOP; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(true); +#endif + } + else if ((ozone->flags & OZONE_FLAG_IS_PLAYLIST) + || (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST)) + { + size_t selection_start = 0; + + /* Skip header items (Search Name + Add Additional Filter + Save as View) */ + if (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST) + { + menu_entry_t entry; + MENU_ENTRY_INITIALIZE(entry); + menu_entry_get(&entry, 0, 0, NULL, true); + + if (entry.type == MENU_SETTINGS_LAST + 1) + selection_start = 1; + else if (entry.type == FILE_TYPE_RDB) + selection_start = 2; + } + + new_selection = random_range(selection_start, selection_total - 1); + + while (new_selection == (int)selection && selection_start != selection_total - 1) + new_selection = random_range(selection_start, selection_total - 1); + + if (new_selection != (int)selection) + { + menu_st->selection_ptr = new_selection; + ozone_selection_changed(ozone, false); + } + + ozone->flags &= ~OZONE_FLAG_CURSOR_MODE; + new_action = MENU_ACTION_NOOP; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != (int)selection) + audio_driver_mixer_play_scroll_sound(true); +#endif + break; + } + + ozone->flags &= ~(OZONE_FLAG_SKIP_THUMBNAIL_RESET + | OZONE_FLAG_CURSOR_MODE); + + if ( (ozone->flags & OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE) && (!(ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)) - && ( (ozone->flags & OZONE_FLAG_IS_STATE_SLOT) - || ((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && !string_is_empty(ozone->savestate_thumbnail_file_path)))) + && ( (ozone->flags & OZONE_FLAG_IS_STATE_SLOT) + || ((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && !string_is_empty(ozone->savestate_thumbnail_file_path)))) { ozone_show_fullscreen_thumbnails(ozone); ozone->flags2 |= OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS; new_action = MENU_ACTION_NOOP; } - else if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) - && ( (ozone->flags & OZONE_FLAG_IS_STATE_SLOT) - || ((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && menu_is_running_quick_menu()))) + else if ((ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) + && ( (ozone->flags & OZONE_FLAG_IS_STATE_SLOT) + || ((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && menu_is_running_quick_menu()))) { ozone_hide_fullscreen_thumbnails(ozone, true); ozone->flags2 &= ~OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS; new_action = MENU_ACTION_NOOP; } - else if ( (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST) - || (ozone->flags & OZONE_FLAG_IS_DB_MANAGER_LIST) - || (ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU)) + break; + case MENU_ACTION_SEARCH: + /* Playlist thumbnail cycle */ + if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) + || ((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && !menu_is_running_quick_menu())) { + ozone->flags &= ~OZONE_FLAG_SKIP_THUMBNAIL_RESET; action_switch_thumbnail(NULL, NULL, 0, 0); new_action = MENU_ACTION_NOOP; } @@ -8204,10 +8300,9 @@ static enum menu_action ozone_parse_menu_entry_action( /* If pointer is active and current selection * is off screen, auto select *centre* item */ - if (ozone->flags & OZONE_FLAG_CURSOR_MODE) - if (!OZONE_ENTRY_ONSCREEN(ozone, selection)) - ozone_auto_select_onscreen_entry(ozone, - OZONE_ONSCREEN_ENTRY_CENTRE); + if ( (ozone->flags & OZONE_FLAG_CURSOR_MODE) + && (!OZONE_ENTRY_ONSCREEN(ozone, selection))) + ozone_auto_select_onscreen_entry(ozone, OZONE_ONSCREEN_ENTRY_CENTRE); ozone->flags &= ~OZONE_FLAG_CURSOR_MODE; break; case MENU_ACTION_UP: @@ -8253,10 +8348,9 @@ static enum menu_action ozone_parse_menu_entry_action( /* If pointer is active and current selection * is off screen, auto select *centre* item */ - if (ozone->flags & OZONE_FLAG_CURSOR_MODE) - if (!OZONE_ENTRY_ONSCREEN(ozone, selection)) - ozone_auto_select_onscreen_entry(ozone, - OZONE_ONSCREEN_ENTRY_CENTRE); + if ( (ozone->flags & OZONE_FLAG_CURSOR_MODE) + && (!OZONE_ENTRY_ONSCREEN(ozone, selection))) + ozone_auto_select_onscreen_entry(ozone, OZONE_ONSCREEN_ENTRY_CENTRE); ozone->flags &= ~OZONE_FLAG_CURSOR_MODE; break; case MENU_ACTION_LEFT: @@ -8309,7 +8403,7 @@ static enum menu_action ozone_parse_menu_entry_action( && !is_current_entry_settings) ozone_start_cursor_wiggle(ozone, MENU_ACTION_DOWN); - if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) + if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) && ( (ozone->flags & OZONE_FLAG_IS_PLAYLIST) || ((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && !menu_is_running_quick_menu()))) return MENU_ACTION_NOOP; @@ -8442,15 +8536,12 @@ static enum menu_action ozone_parse_menu_entry_action( ozone_sidebar_goto(ozone, (unsigned)ozone->categories_selection_ptr); } break; - case MENU_ACTION_SCROLL_UP: /* Descend 10 items or to previous alphabet (Z towards A) */ /* Scroll sidebar tabs */ if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR) { - struct menu_state *menu_st = menu_state_get_ptr(); - /* If cursor is active, ensure we target * an on screen category */ size_t tab_selection = (ozone->flags & OZONE_FLAG_CURSOR_MODE) @@ -8510,8 +8601,6 @@ static enum menu_action ozone_parse_menu_entry_action( /* Scroll sidebar tabs */ if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR) { - struct menu_state *menu_st = menu_state_get_ptr(); - /* If cursor is active, ensure we target * an on screen category */ size_t tab_selection = (ozone->flags & OZONE_FLAG_CURSOR_MODE) @@ -8561,13 +8650,11 @@ static enum menu_action ozone_parse_menu_entry_action( /* If pointer is active and current selection * is off screen, auto select *first* item */ - if (ozone->flags & OZONE_FLAG_CURSOR_MODE) - if (!OZONE_ENTRY_ONSCREEN(ozone, selection)) - ozone_auto_select_onscreen_entry(ozone, - OZONE_ONSCREEN_ENTRY_FIRST); + if ( (ozone->flags & OZONE_FLAG_CURSOR_MODE) + && (!OZONE_ENTRY_ONSCREEN(ozone, selection))) + ozone_auto_select_onscreen_entry(ozone, OZONE_ONSCREEN_ENTRY_FIRST); ozone->flags &= ~OZONE_FLAG_CURSOR_MODE; break; - case MENU_ACTION_SCROLL_HOME: if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR) { @@ -9094,6 +9181,7 @@ static void ozone_cache_footer_label( /* Assign string */ label->str = str; label->width = font_driver_get_message_width(ozone->fonts.footer.font, label->str, _len, 1.0f); + /* If font_driver_get_message_width() fails, * use predetermined glyph_width as a fallback */ if (label->width < 0) @@ -9127,15 +9215,19 @@ static void ozone_cache_footer_labels(ozone_handle_t *ozone) MENU_ENUM_LABEL_VALUE_RESET_TO_DEFAULT_CONFIG); ozone_cache_footer_label(ozone, - &ozone->footer_labels.cycle, + &ozone->footer_labels.random_select, + MENU_ENUM_LABEL_VALUE_RANDOM_SELECT); + + ozone_cache_footer_label(ozone, + &ozone->footer_labels.cycle_thumbnails, MENU_ENUM_LABEL_VALUE_CYCLE_THUMBNAILS); ozone_cache_footer_label(ozone, - &ozone->footer_labels.fullscreen_thumbs, + &ozone->footer_labels.fullscreen_thumbnails, MSG_TOGGLE_FULLSCREEN_THUMBNAILS); ozone_cache_footer_label(ozone, - &ozone->footer_labels.metadata_toggle, + &ozone->footer_labels.metadata_override, MSG_TOGGLE_CONTENT_METADATA); ozone_cache_footer_label(ozone, @@ -9143,7 +9235,7 @@ static void ozone_cache_footer_labels(ozone_handle_t *ozone) MENU_ENUM_LABEL_VALUE_HELP); ozone_cache_footer_label(ozone, - &ozone->footer_labels.clear, + &ozone->footer_labels.clear_setting, MENU_ENUM_LABEL_VALUE_CLEAR_SETTING); ozone_cache_footer_label(ozone, @@ -9447,7 +9539,7 @@ static void ozone_context_reset(void *data, bool is_threaded) static void ozone_collapse_end(void *userdata) { - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; ozone->flags &= ~OZONE_FLAG_DRAW_SIDEBAR; } @@ -10656,15 +10748,15 @@ static void ozone_draw_footer( void *userdata, unsigned video_width, unsigned video_height, - bool input_menu_swap_ok_cancel_buttons, settings_t *settings, math_matrix_4x4 *mymat) { + gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; bool menu_core_enable = settings->bools.menu_core_enable; - bool search_enabled = !settings->bools.menu_disable_search_button; + bool input_menu_swap_ok_cancel_buttons = settings->bools.input_menu_swap_ok_cancel_buttons; size_t selection = ozone->selection; + float *col = ozone->theme_dynamic.entries_icon; float scale_factor = ozone->last_scale_factor; - unsigned separator_margin = 30 * scale_factor; float footer_margin = 42 * scale_factor; float footer_text_y = (float)video_height - (ozone->dimensions.footer_height / 2.0f) @@ -10672,42 +10764,70 @@ static void ozone_draw_footer( float icon_size = 35 * scale_factor; float icon_padding = 10 * scale_factor; float icon_padding_small = icon_padding / 5; + float icon_spacer = icon_size + (2.0f * icon_padding); float icon_y = (float)video_height - (ozone->dimensions.footer_height / 2.0f) - (icon_size / 2.0f); + unsigned separator_margin = 30 * scale_factor; + /* Button enable states - * > Note: Only show 'metadata_toggle' if - * 'fullscreen_thumbs' is shown. This condition + * > Note: Only show 'metadata_override' if + * 'fullscreen_thumbnails' is shown. This condition * should be guaranteed anyway, but enforce it * here to prevent 'gaps' in the button list in * the event of unknown errors */ - bool fs_thumbnails_available = + + ozone->footer_labels.fullscreen_thumbnails.show = ozone_fullscreen_thumbnails_available(ozone, menu_st); - bool metadata_override_available = - fs_thumbnails_available + + ozone->footer_labels.metadata_override.show = + ozone->footer_labels.fullscreen_thumbnails.show && ozone_metadata_override_available(ozone, settings); - bool thumbnail_cycle_enabled = - fs_thumbnails_available + + ozone->footer_labels.random_select.show = + (ozone->flags & OZONE_FLAG_IS_PLAYLIST) + || (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST) + || (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR) + || (ozone->flags2 & OZONE_FLAG2_IS_PLAYLISTS_TAB); + + ozone->footer_labels.cycle_thumbnails.show = + ozone->footer_labels.fullscreen_thumbnails.show + && !ozone->footer_labels.random_select.show && !(ozone->flags & OZONE_FLAG_IS_FILE_LIST) && !(((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && menu_is_running_quick_menu()) || (ozone->flags & OZONE_FLAG_IS_STATE_SLOT)); - bool clear_setting_enabled = - !thumbnail_cycle_enabled + + ozone->footer_labels.cycle_thumbnails.show |= + (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS) + || (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS); + + ozone->footer_labels.clear_setting.show = + !ozone->footer_labels.cycle_thumbnails.show && ozone_clear_available(ozone, selection); - bool scan_enabled = - !thumbnail_cycle_enabled - && !clear_setting_enabled + + ozone->footer_labels.scan.show = + !ozone->footer_labels.cycle_thumbnails.show + && !ozone->footer_labels.clear_setting.show && ozone_scan_available(ozone, selection); - bool reset_to_default_available = - !fs_thumbnails_available + + ozone->footer_labels.reset_to_default.show = + !ozone->footer_labels.fullscreen_thumbnails.show && ozone_is_current_entry_settings(selection); - bool help_available = - !metadata_override_available + + ozone->footer_labels.help.show = + !ozone->footer_labels.metadata_override.show && ozone_help_available(ozone, selection, settings->bools.menu_show_sublabels); - bool manage_available = + + ozone->footer_labels.manage.show = ozone_manage_available(ozone, selection); - bool resume_enabled = + ozone->footer_labels.search.show = + !settings->bools.menu_disable_search_button + && !((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && !menu_is_running_quick_menu()) + && !(ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS) + && !(ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS); + + ozone->footer_labels.resume.show = !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL); /* Determine x origin positions of each @@ -10717,7 +10837,8 @@ static void ozone_draw_footer( * - ok * - back * - (X) search - * - (Y) cycle thumbnails (playlists only) + * - (X) cycle thumbnails (fullscreen thumbnail + quick menu only + * - (Y) random selector (playlists only) * - (Y) clear settings (keybinds only) * - (Y) scan entry (certain file types only) * - (Start) toggle fullscreen thumbs (playlists only) @@ -10726,42 +10847,59 @@ static void ozone_draw_footer( * - (Select) toggle metadata (playlists only) * - (Select) help (non-playlist only)*/ - float resume_x = (resume_enabled) + ozone->footer_labels.resume.x = (ozone->footer_labels.resume.show) ? (float)video_width - footer_margin - ozone->footer_labels.resume.width - icon_size - icon_padding : (float)video_width - footer_margin; - float ok_x = resume_x - - ozone->footer_labels.ok.width - icon_size - (2.0f * icon_padding); - float back_x = ok_x - - ozone->footer_labels.back.width - icon_size - (2.0f * icon_padding); - float search_x = (search_enabled) - ? back_x - ozone->footer_labels.search.width - icon_size - (2.0f * icon_padding) - : back_x; - float cycle_x = (thumbnail_cycle_enabled) - ? search_x - ozone->footer_labels.cycle.width - icon_size - (2.0f * icon_padding) - : search_x; - float clear_x = (clear_setting_enabled) - ? cycle_x - ozone->footer_labels.clear.width - icon_size - (2.0f * icon_padding) - : cycle_x; - float scan_x = (scan_enabled) - ? clear_x - ozone->footer_labels.scan.width - icon_size - (2.0f * icon_padding) - : clear_x; - float reset_to_default_x = (reset_to_default_available) - ? scan_x - ozone->footer_labels.reset_to_default.width - icon_size - (2.0f * icon_padding) - : scan_x; - float help_x = (help_available) - ? reset_to_default_x - ozone->footer_labels.help.width - icon_size - (2.0f * icon_padding) - : reset_to_default_x; - float fullscreen_thumbs_x = (fs_thumbnails_available) - ? help_x - ozone->footer_labels.fullscreen_thumbs.width - icon_size - (2.0f * icon_padding) - : help_x; - float manage_x = (manage_available) - ? fullscreen_thumbs_x - ozone->footer_labels.manage.width - icon_size - (2.0f * icon_padding) - : fullscreen_thumbs_x; - float metadata_toggle_x = manage_x - - ozone->footer_labels.metadata_toggle.width - icon_size - (2.0f * icon_padding); - gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; - float *col = ozone->theme_dynamic.entries_icon; + if (input_menu_swap_ok_cancel_buttons) + { + ozone->footer_labels.back.x = ozone->footer_labels.resume.x - ozone->footer_labels.back.width - icon_spacer; + ozone->footer_labels.ok.x = ozone->footer_labels.back.x - ozone->footer_labels.ok.width - icon_spacer; + } + else + { + ozone->footer_labels.ok.x = ozone->footer_labels.resume.x - ozone->footer_labels.ok.width - icon_spacer; + ozone->footer_labels.back.x = ozone->footer_labels.ok.x - ozone->footer_labels.back.width - icon_spacer; + } + + ozone->footer_labels.search.x = (ozone->footer_labels.search.show) + ? ((input_menu_swap_ok_cancel_buttons) ? ozone->footer_labels.ok.x : ozone->footer_labels.back.x) - ozone->footer_labels.search.width - icon_spacer + : ((input_menu_swap_ok_cancel_buttons) ? ozone->footer_labels.ok.x : ozone->footer_labels.back.x); + + ozone->footer_labels.cycle_thumbnails.x = (ozone->footer_labels.cycle_thumbnails.show) + ? ozone->footer_labels.search.x - ozone->footer_labels.cycle_thumbnails.width - icon_spacer + : ozone->footer_labels.search.x; + + ozone->footer_labels.random_select.x = (ozone->footer_labels.random_select.show) + ? ozone->footer_labels.cycle_thumbnails.x - ozone->footer_labels.random_select.width - icon_spacer + : ozone->footer_labels.cycle_thumbnails.x; + + ozone->footer_labels.clear_setting.x = (ozone->footer_labels.clear_setting.show) + ? ozone->footer_labels.random_select.x - ozone->footer_labels.clear_setting.width - icon_spacer + : ozone->footer_labels.random_select.x; + + ozone->footer_labels.scan.x = (ozone->footer_labels.scan.show) + ? ozone->footer_labels.clear_setting.x - ozone->footer_labels.scan.width - icon_spacer + : ozone->footer_labels.clear_setting.x; + + ozone->footer_labels.reset_to_default.x = (ozone->footer_labels.reset_to_default.show) + ? ozone->footer_labels.scan.x - ozone->footer_labels.reset_to_default.width - icon_spacer + : ozone->footer_labels.scan.x; + + ozone->footer_labels.help.x = (ozone->footer_labels.help.show) + ? ozone->footer_labels.reset_to_default.x - ozone->footer_labels.help.width - icon_spacer + : ozone->footer_labels.reset_to_default.x; + + ozone->footer_labels.fullscreen_thumbnails.x = (ozone->footer_labels.fullscreen_thumbnails.show) + ? ozone->footer_labels.help.x - ozone->footer_labels.fullscreen_thumbnails.width - icon_spacer + : ozone->footer_labels.help.x; + + ozone->footer_labels.manage.x = (ozone->footer_labels.manage.show) + ? ozone->footer_labels.fullscreen_thumbnails.x - ozone->footer_labels.manage.width - icon_spacer + : ozone->footer_labels.fullscreen_thumbnails.x; + + ozone->footer_labels.metadata_override.x = ozone->footer_labels.manage.x + - ozone->footer_labels.metadata_override.width - icon_spacer; /* Separator */ gfx_display_draw_quad( @@ -10790,7 +10928,7 @@ static void ozone_draw_footer( if (dispctx->draw) { /* > Resume */ - if (resume_enabled) + if (ozone->footer_labels.resume.show) ozone_draw_icon( p_disp, userdata, @@ -10799,7 +10937,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_RESUME], - resume_x, + ozone->footer_labels.resume.x, icon_y, video_width, video_height, @@ -10819,7 +10957,7 @@ static void ozone_draw_footer( input_menu_swap_ok_cancel_buttons ? ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D] : ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R], - ok_x, + ozone->footer_labels.ok.x, icon_y, video_width, video_height, @@ -10839,7 +10977,7 @@ static void ozone_draw_footer( input_menu_swap_ok_cancel_buttons ? ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R] : ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D], - back_x, + ozone->footer_labels.back.x, icon_y, video_width, video_height, @@ -10849,7 +10987,7 @@ static void ozone_draw_footer( mymat); /* > Search */ - if (search_enabled) + if (ozone->footer_labels.search.show) ozone_draw_icon( p_disp, userdata, @@ -10858,7 +10996,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_U], - search_x, + ozone->footer_labels.search.x, icon_y, video_width, video_height, @@ -10868,7 +11006,26 @@ static void ozone_draw_footer( mymat); /* > Thumbnail cycle */ - if (thumbnail_cycle_enabled) + if (ozone->footer_labels.cycle_thumbnails.show) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + icon_size, + icon_size, + ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_U], + ozone->footer_labels.cycle_thumbnails.x, + icon_y, + video_width, + video_height, + 0.0f, + 1.0f, + col, + mymat); + + /* > Random select */ + if (ozone->footer_labels.random_select.show) ozone_draw_icon( p_disp, userdata, @@ -10877,7 +11034,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_L], - cycle_x, + ozone->footer_labels.random_select.x, icon_y, video_width, video_height, @@ -10887,7 +11044,7 @@ static void ozone_draw_footer( mymat); /* > Fullscreen thumbnais */ - if (fs_thumbnails_available) + if (ozone->footer_labels.fullscreen_thumbnails.show) ozone_draw_icon( p_disp, userdata, @@ -10899,7 +11056,7 @@ static void ozone_draw_footer( ozone->thumbnails.savestate.status == GFX_THUMBNAIL_STATUS_PENDING) ? ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_L] : ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_START], - fullscreen_thumbs_x, + ozone->footer_labels.fullscreen_thumbnails.x, icon_y, video_width, video_height, @@ -10909,7 +11066,7 @@ static void ozone_draw_footer( mymat); /* > Metadata toggle */ - if (metadata_override_available) + if (ozone->footer_labels.metadata_override.show) ozone_draw_icon( p_disp, userdata, @@ -10918,7 +11075,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_SELECT], - metadata_toggle_x, + ozone->footer_labels.metadata_override.x, icon_y, video_width, video_height, @@ -10928,7 +11085,7 @@ static void ozone_draw_footer( mymat); /* > Reset to default */ - if (reset_to_default_available) + if (ozone->footer_labels.reset_to_default.show) ozone_draw_icon( p_disp, userdata, @@ -10937,7 +11094,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_START], - reset_to_default_x, + ozone->footer_labels.reset_to_default.x, icon_y, video_width, video_height, @@ -10947,7 +11104,7 @@ static void ozone_draw_footer( mymat); /* > Help */ - if (help_available) + if (ozone->footer_labels.help.show) ozone_draw_icon( p_disp, userdata, @@ -10956,7 +11113,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_SELECT], - help_x, + ozone->footer_labels.help.x, icon_y, video_width, video_height, @@ -10966,7 +11123,7 @@ static void ozone_draw_footer( mymat); /* > Clear setting */ - if (clear_setting_enabled) + if (ozone->footer_labels.clear_setting.show) ozone_draw_icon( p_disp, userdata, @@ -10975,7 +11132,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_L], - clear_x, + ozone->footer_labels.clear_setting.x, icon_y, video_width, video_height, @@ -10985,7 +11142,7 @@ static void ozone_draw_footer( mymat); /* > Scan entry */ - if (scan_enabled) + if (ozone->footer_labels.scan.show) ozone_draw_icon( p_disp, userdata, @@ -10994,7 +11151,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_L], - scan_x, + ozone->footer_labels.scan.x, icon_y, video_width, video_height, @@ -11004,7 +11161,7 @@ static void ozone_draw_footer( mymat); /* > Manage */ - if (manage_available) + if (ozone->footer_labels.manage.show) ozone_draw_icon( p_disp, userdata, @@ -11013,7 +11170,7 @@ static void ozone_draw_footer( icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_START], - manage_x, + ozone->footer_labels.manage.x, icon_y, video_width, video_height, @@ -11029,11 +11186,27 @@ static void ozone_draw_footer( /* Draw labels */ + /* > Resume */ + if (ozone->footer_labels.resume.show) + gfx_display_draw_text( + ozone->fonts.footer.font, + ozone->footer_labels.resume.str, + ozone->footer_labels.resume.x + icon_size + icon_padding_small, + footer_text_y, + video_width, + video_height, + ozone->theme->text_rgba, + TEXT_ALIGN_LEFT, + 1.0f, + false, + 1.0f, + false); + /* > Ok */ gfx_display_draw_text( ozone->fonts.footer.font, ozone->footer_labels.ok.str, - ok_x + icon_size + icon_padding_small, + ozone->footer_labels.ok.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11048,7 +11221,7 @@ static void ozone_draw_footer( gfx_display_draw_text( ozone->fonts.footer.font, ozone->footer_labels.back.str, - back_x + icon_size + icon_padding_small, + ozone->footer_labels.back.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11060,11 +11233,11 @@ static void ozone_draw_footer( false); /* > Search */ - if (search_enabled) + if (ozone->footer_labels.search.show) gfx_display_draw_text( ozone->fonts.footer.font, ozone->footer_labels.search.str, - search_x + icon_size + icon_padding_small, + ozone->footer_labels.search.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11076,11 +11249,27 @@ static void ozone_draw_footer( false); /* > Thumbnail cycle */ - if (thumbnail_cycle_enabled) + if (ozone->footer_labels.cycle_thumbnails.show) + gfx_display_draw_text( + ozone->fonts.footer.font, + ozone->footer_labels.cycle_thumbnails.str, + ozone->footer_labels.cycle_thumbnails.x + icon_size + icon_padding_small, + footer_text_y, + video_width, + video_height, + ozone->theme->text_rgba, + TEXT_ALIGN_LEFT, + 1.0f, + false, + 1.0f, + false); + + /* > Random select */ + if (ozone->footer_labels.random_select.show) gfx_display_draw_text( ozone->fonts.footer.font, - ozone->footer_labels.cycle.str, - cycle_x + icon_size + icon_padding_small, + ozone->footer_labels.random_select.str, + ozone->footer_labels.random_select.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11092,11 +11281,11 @@ static void ozone_draw_footer( false); /* > Fullscreen thumbnails */ - if (fs_thumbnails_available) + if (ozone->footer_labels.fullscreen_thumbnails.show) gfx_display_draw_text( ozone->fonts.footer.font, - ozone->footer_labels.fullscreen_thumbs.str, - fullscreen_thumbs_x + icon_size + icon_padding_small, + ozone->footer_labels.fullscreen_thumbnails.str, + ozone->footer_labels.fullscreen_thumbnails.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11108,11 +11297,11 @@ static void ozone_draw_footer( false); /* > Metadata toggle */ - if (metadata_override_available) + if (ozone->footer_labels.metadata_override.show) gfx_display_draw_text( ozone->fonts.footer.font, - ozone->footer_labels.metadata_toggle.str, - metadata_toggle_x + icon_size + icon_padding_small, + ozone->footer_labels.metadata_override.str, + ozone->footer_labels.metadata_override.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11123,27 +11312,12 @@ static void ozone_draw_footer( 1.0f, false); - /* > Resume */ - gfx_display_draw_text( - ozone->fonts.footer.font, - ozone->footer_labels.resume.str, - resume_x + icon_size + icon_padding_small, - footer_text_y, - video_width, - video_height, - ozone->theme->text_rgba, - TEXT_ALIGN_LEFT, - 1.0f, - false, - 1.0f, - false); - /* > Reset to default */ - if (reset_to_default_available) + if (ozone->footer_labels.reset_to_default.show) gfx_display_draw_text( ozone->fonts.footer.font, ozone->footer_labels.reset_to_default.str, - reset_to_default_x + icon_size + icon_padding_small, + ozone->footer_labels.reset_to_default.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11155,11 +11329,11 @@ static void ozone_draw_footer( false); /* > Help */ - if (help_available) + if (ozone->footer_labels.help.show) gfx_display_draw_text( ozone->fonts.footer.font, ozone->footer_labels.help.str, - help_x + icon_size + icon_padding_small, + ozone->footer_labels.help.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11171,11 +11345,11 @@ static void ozone_draw_footer( false); /* > Clear settings */ - if (clear_setting_enabled) + if (ozone->footer_labels.clear_setting.show) gfx_display_draw_text( ozone->fonts.footer.font, - ozone->footer_labels.clear.str, - clear_x + icon_size + icon_padding_small, + ozone->footer_labels.clear_setting.str, + ozone->footer_labels.clear_setting.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11187,11 +11361,11 @@ static void ozone_draw_footer( false); /* > Scan entry */ - if (scan_enabled) + if (ozone->footer_labels.scan.show) gfx_display_draw_text( ozone->fonts.footer.font, ozone->footer_labels.scan.str, - scan_x + icon_size + icon_padding_small, + ozone->footer_labels.scan.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11203,11 +11377,11 @@ static void ozone_draw_footer( false); /* > Manage */ - if (manage_available) + if (ozone->footer_labels.manage.show) gfx_display_draw_text( ozone->fonts.footer.font, ozone->footer_labels.manage.str, - manage_x + icon_size + icon_padding_small, + ozone->footer_labels.manage.x + icon_size + icon_padding_small, footer_text_y, video_width, video_height, @@ -11238,11 +11412,11 @@ static void ozone_draw_footer( /* Determine available width for core * title string */ - usable_width = metadata_override_available - ? metadata_toggle_x - : fs_thumbnails_available - ? fullscreen_thumbs_x - : search_x; + usable_width = ozone->footer_labels.metadata_override.show + ? ozone->footer_labels.metadata_override.x + : ozone->footer_labels.fullscreen_thumbnails.show + ? ozone->footer_labels.fullscreen_thumbnails.x + : ozone->footer_labels.search.x; usable_width -= footer_margin + (icon_padding * 2); if (usable_width > 0) @@ -11448,7 +11622,7 @@ static void ozone_navigation_alphabet(void *data, size_t *unused) static void ozone_messagebox_fadeout_cb(void *userdata) { - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; free(ozone->pending_message); ozone->pending_message = NULL; @@ -11647,7 +11821,6 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) userdata, video_width, video_height, - input_menu_swap_ok_cancel_buttons, settings, &mymat); @@ -11888,7 +12061,7 @@ static void ozone_set_header(ozone_handle_t *ozone) static void ozone_animation_end(void *userdata) { - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; ozone->flags &= ~OZONE_FLAG_DRAW_OLD_LIST; ozone->animations.cursor_alpha = 1.0f; } @@ -12087,12 +12260,14 @@ static void ozone_populate_entries( else ozone->flags &= ~OZONE_FLAG_IS_DB_MANAGER_LIST; - if ( 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_get_horizontal_selection_type(ozone) == MENU_EXPLORE_TAB) +#if defined(HAVE_LIBRETRODB) + if ( 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_get_horizontal_selection_type(ozone) == MENU_EXPLORE_TAB) ozone->flags |= OZONE_FLAG_IS_EXPLORE_LIST; else ozone->flags &= ~OZONE_FLAG_IS_EXPLORE_LIST; +#endif if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES))) ozone->flags |= OZONE_FLAG_IS_FILE_LIST; @@ -12106,8 +12281,8 @@ static void ozone_populate_entries( else ozone->flags2 &= ~OZONE_FLAG2_IS_QUICK_MENU; - if ( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENTLESS_CORES_TAB)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CONTENTLESS_CORES_LIST))) + if ( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENTLESS_CORES_TAB)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CONTENTLESS_CORES_LIST))) ozone->flags |= OZONE_FLAG_IS_CONTENTLESS_CORES; else ozone->flags &= ~OZONE_FLAG_IS_CONTENTLESS_CORES; @@ -12122,6 +12297,12 @@ static void ozone_populate_entries( else ozone->flags &= ~OZONE_FLAG_IS_PLAYLIST; + if ( !(ozone->flags & OZONE_FLAG_IS_PLAYLIST) + && string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB))) + ozone->flags2 |= OZONE_FLAG2_IS_PLAYLISTS_TAB; + else + ozone->flags2 &= ~OZONE_FLAG2_IS_PLAYLISTS_TAB; + ozone_set_header(ozone); if (was_db_manager_list) @@ -12132,20 +12313,19 @@ static void ozone_populate_entries( if (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST) { menu_entry_t entry; - MENU_ENTRY_INITIALIZE(entry); - entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED - | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, 0, NULL, true); /* Quick Menu under Explore list must also be Quick Menu */ - if ( string_is_equal(entry.label, "collection") - || (string_is_equal(entry.label, "resume_content") - || string_is_equal(entry.label, "state_slot")) + if ( string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_RUN)) + || string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_RESUME_CONTENT)) + || string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_STATE_SLOT)) ) - ozone->flags2 |= OZONE_FLAG2_IS_QUICK_MENU; - if (!menu_explore_is_content_list() || (ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU)) - ozone->flags &= ~OZONE_FLAG_IS_EXPLORE_LIST; + { + ozone->flags2 |= OZONE_FLAG2_IS_QUICK_MENU; + ozone->flags &= ~OZONE_FLAG_IS_EXPLORE_LIST; + } } #endif @@ -12285,7 +12465,7 @@ static void ozone_toggle(void *userdata, bool menu_on) { settings_t *settings = NULL; struct menu_state *menu_st = menu_state_get_ptr(); - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; if (!ozone) return; @@ -12369,7 +12549,7 @@ static void ozone_list_insert(void *userdata, size_t list_size, unsigned type) { - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; ozone_node_t *node = NULL; int i = (int)list_size; @@ -12397,7 +12577,7 @@ static void ozone_list_insert(void *userdata, static int ozone_environ_cb(enum menu_environ_cb type, void *data, void *userdata) { - ozone_handle_t *ozone = (ozone_handle_t*) userdata; + ozone_handle_t *ozone = (ozone_handle_t*)userdata; if (!ozone) return -1; @@ -12494,101 +12674,43 @@ static int ozone_tap_footer( struct menu_state *menu_st = menu_state_get_ptr(); size_t selection = menu_st->selection_ptr; settings_t *settings = config_get_ptr(); + bool input_menu_swap_ok_cancel_buttons = settings->bools.input_menu_swap_ok_cancel_buttons; /* values below should all be kept in sync with ozone_draw_footer */ - bool search_enabled = !settings->bools.menu_disable_search_button; float scale_factor = ozone->last_scale_factor; float footer_margin = 42 * scale_factor; - float icon_size = 35 * scale_factor; - float icon_padding = 10 * scale_factor; - - bool fs_thumbnails_available = - ozone_fullscreen_thumbnails_available(ozone, menu_st); - bool metadata_override_available = - fs_thumbnails_available - && ozone_metadata_override_available(ozone, settings); - bool thumbnail_cycle_enabled = - fs_thumbnails_available - && !(ozone->flags & OZONE_FLAG_IS_FILE_LIST) - && !(((ozone->flags2 & OZONE_FLAG2_IS_QUICK_MENU) && menu_is_running_quick_menu()) - || (ozone->flags & OZONE_FLAG_IS_STATE_SLOT)); - bool clear_setting_enabled = - !thumbnail_cycle_enabled - && ozone_clear_available(ozone, selection); - bool scan_enabled = - !thumbnail_cycle_enabled - && !clear_setting_enabled - && ozone_scan_available(ozone, selection); - bool reset_to_default_available = - !fs_thumbnails_available - && ozone_is_current_entry_settings(selection); - bool help_available = - !metadata_override_available - && ozone_help_available(ozone, selection, settings->bools.menu_show_sublabels); - bool manage_available = - ozone_manage_available(ozone, selection); - bool resume_enabled = - !retroarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL); - - float resume_x = (resume_enabled) - ? (float)video_width - footer_margin - ozone->footer_labels.resume.width - icon_size - icon_padding - : (float)video_width - footer_margin; - float ok_x = resume_x - - ozone->footer_labels.ok.width - icon_size - (2.0f * icon_padding); - float back_x = ok_x - - ozone->footer_labels.back.width - icon_size - (2.0f * icon_padding); - float search_x = (search_enabled) - ? back_x - ozone->footer_labels.search.width - icon_size - (2.0f * icon_padding) - : back_x; - float cycle_x = (thumbnail_cycle_enabled) - ? search_x - ozone->footer_labels.cycle.width - icon_size - (2.0f * icon_padding) - : search_x; - float clear_x = (clear_setting_enabled) - ? cycle_x - ozone->footer_labels.clear.width - icon_size - (2.0f * icon_padding) - : cycle_x; - float scan_x = (scan_enabled) - ? clear_x - ozone->footer_labels.scan.width - icon_size - (2.0f * icon_padding) - : clear_x; - float reset_to_default_x = (reset_to_default_available) - ? scan_x - ozone->footer_labels.reset_to_default.width - icon_size - (2.0f * icon_padding) - : scan_x; - float help_x = (help_available) - ? reset_to_default_x - ozone->footer_labels.help.width - icon_size - (2.0f * icon_padding) - : reset_to_default_x; - float fullscreen_thumbs_x = (fs_thumbnails_available) - ? help_x - ozone->footer_labels.fullscreen_thumbs.width - icon_size - (2.0f * icon_padding) - : help_x; - float manage_x = (manage_available) - ? fullscreen_thumbs_x - ozone->footer_labels.manage.width - icon_size - (2.0f * icon_padding) - : fullscreen_thumbs_x; - float metadata_toggle_x = manage_x - - ozone->footer_labels.metadata_toggle.width - icon_size - (2.0f * icon_padding); if (x > (float)video_width - footer_margin) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_CANCEL); - else if (resume_enabled && x > resume_x) + else if (ozone->footer_labels.resume.show && x > ozone->footer_labels.resume.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_RESUME); - else if (x > ok_x) + else if (input_menu_swap_ok_cancel_buttons && x > ozone->footer_labels.back.x) + return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_CANCEL); + else if (input_menu_swap_ok_cancel_buttons && x > ozone->footer_labels.ok.x) + return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_OK); + else if (!input_menu_swap_ok_cancel_buttons && x > ozone->footer_labels.ok.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_OK); - else if (x > back_x) + else if (!input_menu_swap_ok_cancel_buttons && x > ozone->footer_labels.back.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_CANCEL); - else if (search_enabled && x > search_x) + else if (ozone->footer_labels.search.show && x > ozone->footer_labels.search.x) + return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_SEARCH); + else if (ozone->footer_labels.cycle_thumbnails.show && x > ozone->footer_labels.cycle_thumbnails.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_SEARCH); - else if (thumbnail_cycle_enabled && x > cycle_x) + else if (ozone->footer_labels.random_select.show && x > ozone->footer_labels.random_select.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_SCAN); - else if (clear_setting_enabled && x > clear_x) + else if (ozone->footer_labels.clear_setting.show && x > ozone->footer_labels.clear_setting.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_SCAN); - else if (scan_enabled && x > scan_x) + else if (ozone->footer_labels.scan.show && x > ozone->footer_labels.scan.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_SCAN); - else if (reset_to_default_available && x > reset_to_default_x) + else if (ozone->footer_labels.reset_to_default.show && x > ozone->footer_labels.reset_to_default.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_START); - else if (help_available && x > help_x) + else if (ozone->footer_labels.help.show && x > ozone->footer_labels.help.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_INFO); - else if (fs_thumbnails_available && x > fullscreen_thumbs_x) + else if (ozone->footer_labels.fullscreen_thumbnails.show && x > ozone->footer_labels.fullscreen_thumbnails.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_START); - else if (manage_available && x > manage_x) + else if (ozone->footer_labels.manage.show && x > ozone->footer_labels.manage.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_START); - else if (fs_thumbnails_available && x > metadata_toggle_x) + else if (ozone->footer_labels.fullscreen_thumbnails.show && x > ozone->footer_labels.metadata_override.x) return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_INFO); else return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_CANCEL); diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index e5475ec5f19b..5002a6835a2a 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -31,9 +31,9 @@ #include #include #include - -#include #include +#include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -47,21 +47,22 @@ #include "../menu_driver.h" #include "../../gfx/gfx_animation.h" - -#include "../../input/input_osk.h" +#include "../../gfx/gfx_thumbnail_path.h" #include "../../configuration.h" #include "../../file_path_special.h" -#include "../../gfx/drivers_font_renderer/bitmap.h" +#include "../../input/input_osk.h" +#include "../../tasks/tasks_internal.h" +#include "../../gfx/drivers_font_renderer/bitmap.h" #ifdef HAVE_LANGEXTRA #include "../../gfx/drivers_font_renderer/bitmapfont_10x10.h" #include "../../gfx/drivers_font_renderer/bitmapfont_6x10.h" #endif -/* Thumbnail additions */ -#include "../../gfx/gfx_thumbnail_path.h" -#include "../../tasks/tasks_internal.h" +#ifdef HAVE_AUDIOMIXER +#include "../../audio/audio_driver.h" +#endif #if defined(GEKKO) /* Required for the Wii build, since we have @@ -7153,6 +7154,58 @@ static void rgui_refresh_thumbnail_image(void *userdata, unsigned i) } } +static void rgui_action_switch_thumbnail(rgui_t *rgui) +{ + settings_t *settings = config_get_ptr(); + + if (settings->uints.gfx_thumbnails == 0) + { + configuration_set_uint(settings, + settings->uints.menu_left_thumbnails, + settings->uints.menu_left_thumbnails + 1); + + if ( (!(rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL)) + && (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)) + configuration_set_uint(settings, + settings->uints.menu_left_thumbnails, + settings->uints.menu_left_thumbnails + 1); + + if (settings->uints.menu_left_thumbnails > 3) + configuration_set_uint(settings, + settings->uints.menu_left_thumbnails, 1); + + if ( (!(rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL)) + && (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)) + configuration_set_uint(settings, + settings->uints.menu_left_thumbnails, + settings->uints.menu_left_thumbnails + 1); + } + else + { + configuration_set_uint(settings, + settings->uints.gfx_thumbnails, + settings->uints.gfx_thumbnails + 1); + + if ( (!(rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL)) + && (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)) + configuration_set_uint(settings, + settings->uints.gfx_thumbnails, + settings->uints.gfx_thumbnails + 1); + + if (settings->uints.gfx_thumbnails > 3) + configuration_set_uint(settings, + settings->uints.gfx_thumbnails, 1); + + if ( (!(rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL)) + && (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)) + configuration_set_uint(settings, + settings->uints.gfx_thumbnails, + settings->uints.gfx_thumbnails + 1); + } + + rgui_refresh_thumbnail_image(rgui, 0); +} + static void rgui_update_menu_sublabel(rgui_t *rgui, size_t selection) { menu_entry_t entry; @@ -7297,7 +7350,11 @@ static void rgui_populate_entries( /* Check whether we are currently viewing a playlist */ if ( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST)) || 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))) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST)) + ) rgui->flags |= RGUI_FLAG_IS_PLAYLIST; else rgui->flags &= ~RGUI_FLAG_IS_PLAYLIST; @@ -7307,12 +7364,6 @@ static void rgui_populate_entries( else rgui->flags &= ~RGUI_FLAG_IS_PLAYLISTS_TAB; - if ( 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))) - rgui->flags |= RGUI_FLAG_IS_EXPLORE_LIST; - else - rgui->flags &= ~RGUI_FLAG_IS_EXPLORE_LIST; - /* Determine whether this is the quick menu */ if ( 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)) @@ -7326,25 +7377,32 @@ static void rgui_populate_entries( else rgui->flags &= ~RGUI_FLAG_IS_STATE_SLOT; +#if defined(HAVE_LIBRETRODB) + if ( 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))) + rgui->flags |= RGUI_FLAG_IS_EXPLORE_LIST; + else + rgui->flags &= ~RGUI_FLAG_IS_EXPLORE_LIST; + /* Quick Menu under Explore list must also be Quick Menu */ if (rgui->flags & RGUI_FLAG_IS_EXPLORE_LIST) { menu_entry_t entry; - MENU_ENTRY_INITIALIZE(entry); - entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED - | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, 0, NULL, true); /* Quick Menu under Explore list must also be Quick Menu */ - if ( string_is_equal(entry.label, "collection") - || (string_is_equal(entry.label, "resume_content") - || string_is_equal(entry.label, "state_slot")) + if ( string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_RUN)) + || string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_RESUME_CONTENT)) + || string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_STATE_SLOT)) ) - rgui->flags |= RGUI_FLAG_IS_QUICK_MENU; - if (rgui->flags & RGUI_FLAG_IS_QUICK_MENU) + { + rgui->flags |= RGUI_FLAG_IS_QUICK_MENU; rgui->flags &= ~RGUI_FLAG_IS_EXPLORE_LIST; + } } +#endif /* Set menu title */ menu_entries_get_title(rgui->menu_title, sizeof(rgui->menu_title)); @@ -7925,7 +7983,8 @@ static void rgui_thumbnail_cycle_dupe(rgui_t *rgui) } static enum menu_action rgui_parse_menu_entry_action( - rgui_t *rgui, menu_entry_t *entry, + rgui_t *rgui, + menu_entry_t *entry, enum menu_action action) { enum menu_action new_action = action; @@ -8049,66 +8108,96 @@ static enum menu_action rgui_parse_menu_entry_action( } break; case MENU_ACTION_SCAN: - /* Save state slot fullscreen toggle */ - if ( ((rgui->flags & RGUI_FLAG_IS_STATE_SLOT) || (rgui->flags & RGUI_FLAG_IS_QUICK_MENU)) - && !string_is_empty(rgui->savestate_thumbnail_file_path)) + if (rgui->flags & RGUI_FLAG_IS_PLAYLISTS_TAB) { - rgui_toggle_fs_thumbnail(rgui, true); + struct menu_state *menu_st = menu_state_get_ptr(); + size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0; + size_t selection = menu_st->selection_ptr; + size_t new_selection = random_range(0, selection_total - 1); + menu_entry_t entry_new; + + MENU_ENTRY_INITIALIZE(entry_new); + menu_entry_get(&entry_new, 0, new_selection, NULL, false); + /* Keep randomizing until selection is a fresh playlist */ + while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION) + { + new_selection = random_range(0, selection_total - 1); + menu_entry_get(&entry_new, 0, new_selection, NULL, false); + } + + if (new_selection != selection) + { + menu_st->selection_ptr = new_selection; + if (menu_st->driver_ctx->navigation_set) + menu_st->driver_ctx->navigation_set(menu_st->userdata, true); + } + new_action = MENU_ACTION_NOOP; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(true); +#endif + break; } - /* Playlist thumbnail cycle */ else if ((rgui->flags & RGUI_FLAG_IS_PLAYLIST) - || (rgui->flags & RGUI_FLAG_IS_EXPLORE_LIST) - || (rgui->flags & RGUI_FLAG_IS_QUICK_MENU)) + || (rgui->flags & RGUI_FLAG_IS_EXPLORE_LIST)) { - settings_t *settings = config_get_ptr(); + struct menu_state *menu_st = menu_state_get_ptr(); + size_t selection_start = 0; + size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0; + size_t selection = menu_st->selection_ptr; + size_t new_selection = selection; - if (settings->uints.gfx_thumbnails == 0) + /* Skip header items (Search Name + Add Additional Filter + Save as View) */ + if (rgui->flags & RGUI_FLAG_IS_EXPLORE_LIST) { - configuration_set_uint(settings, - settings->uints.menu_left_thumbnails, - settings->uints.menu_left_thumbnails + 1); + menu_entry_t entry; + MENU_ENTRY_INITIALIZE(entry); + menu_entry_get(&entry, 0, 0, NULL, true); + + if (entry.type == MENU_SETTINGS_LAST + 1) + selection_start = 1; + else if (entry.type == FILE_TYPE_RDB) + selection_start = 2; + } - if ( (!(rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL)) - && (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)) - configuration_set_uint(settings, - settings->uints.menu_left_thumbnails, - settings->uints.menu_left_thumbnails + 1); + new_selection = random_range(selection_start, selection_total - 1); - if (settings->uints.menu_left_thumbnails > 3) - configuration_set_uint(settings, - settings->uints.menu_left_thumbnails, 1); + while (new_selection == selection && selection_start != selection_total - 1) + new_selection = random_range(selection_start, selection_total - 1); - if ( (!(rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL)) - && (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)) - configuration_set_uint(settings, - settings->uints.menu_left_thumbnails, - settings->uints.menu_left_thumbnails + 1); - } - else + if (new_selection != selection) { - configuration_set_uint(settings, - settings->uints.gfx_thumbnails, - settings->uints.gfx_thumbnails + 1); - - if ( (!(rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL)) - && (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)) - configuration_set_uint(settings, - settings->uints.gfx_thumbnails, - settings->uints.gfx_thumbnails + 1); + menu_st->selection_ptr = new_selection; + if (menu_st->driver_ctx->navigation_set) + menu_st->driver_ctx->navigation_set(menu_st->userdata, true); + } - if (settings->uints.gfx_thumbnails > 3) - configuration_set_uint(settings, - settings->uints.gfx_thumbnails, 1); + new_action = MENU_ACTION_NOOP; - if ( (!(rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL)) - && (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)) - configuration_set_uint(settings, - settings->uints.gfx_thumbnails, - settings->uints.gfx_thumbnails + 1); - } +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(true); +#endif + break; + } - rgui_refresh_thumbnail_image(rgui, 0); + /* Save state slot fullscreen toggle */ + if ( ((rgui->flags & RGUI_FLAG_IS_STATE_SLOT) || (rgui->flags & RGUI_FLAG_IS_QUICK_MENU)) + && !string_is_empty(rgui->savestate_thumbnail_file_path)) + { + rgui_toggle_fs_thumbnail(rgui, true); + new_action = MENU_ACTION_NOOP; + } + break; + case MENU_ACTION_SEARCH: + /* Playlist thumbnail cycle */ + if ( (rgui->flags & RGUI_FLAG_SHOW_FULLSCREEN_THUMBNAIL) + || ((rgui->flags & RGUI_FLAG_IS_QUICK_MENU) && !menu_is_running_quick_menu())) + { + rgui_action_switch_thumbnail(rgui); + new_action = MENU_ACTION_NOOP; } break; case MENU_ACTION_INFO: diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index cfefd35067fe..90cce2e476e9 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -48,21 +49,20 @@ #include "../../gfx/gfx_thumbnail_path.h" #include "../../gfx/gfx_thumbnail.h" +#include "../../configuration.h" +#include "../../content.h" #include "../../core_info.h" -#include "../../core.h" - +#include "../../file_path_special.h" #include "../../input/input_osk.h" +#include "../../tasks/tasks_internal.h" -#include "../../file_path_special.h" -#include "../../configuration.h" +#ifdef HAVE_AUDIOMIXER #include "../../audio/audio_driver.h" - -#include "../../tasks/tasks_internal.h" +#endif #ifdef HAVE_CHEEVOS #include "../../cheevos/cheevos_menu.h" #endif -#include "../../content.h" #define XMB_RIBBON_ROWS 64 #define XMB_RIBBON_COLS 64 @@ -453,6 +453,7 @@ typedef struct xmb_handle /* Favorites, History, Images, Music, Videos, user generated */ bool is_playlist; + bool is_playlist_tab; bool is_playlist_information; bool is_db_manager_list; bool is_explore_list; @@ -1150,7 +1151,7 @@ static char *xmb_path_dynamic_wallpaper(xmb_handle_t *xmb) path[0] = '\0'; /* Do not update wallpaper in "Load Content" playlists and inside playlist items */ - if ( (xmb->categories_selection_ptr == 0 && depth > 4) + if ( (xmb->categories_selection_ptr == XMB_SYSTEM_TAB_MAIN && depth > 4) || (xmb->categories_selection_ptr > xmb->system_tab_end && depth > 1)) { if (string_is_empty(xmb->bg_file_path)) @@ -3002,6 +3003,8 @@ static void xmb_populate_entries(void *data, && !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_INFORMATION)) && !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL)); + xmb->is_playlist_tab = !xmb->is_playlist && string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)); + xmb->is_playlist_information = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_INFORMATION)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL)); @@ -3039,31 +3042,29 @@ static void xmb_populate_entries(void *data, xmb->is_state_slot = string_to_unsigned(path) == MENU_ENUM_LABEL_STATE_SLOT; +#if defined(HAVE_LIBRETRODB) /* 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)) || xmb_horizontal_type == MENU_EXPLORE_TAB; -#if defined(HAVE_LIBRETRODB) if (xmb->is_explore_list) { menu_entry_t entry; - MENU_ENTRY_INITIALIZE(entry); - entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED - | MENU_ENTRY_FLAG_RICH_LABEL_ENABLED; + entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED; menu_entry_get(&entry, 0, 0, NULL, true); /* Quick Menu under Explore list must also be Quick Menu */ - xmb->is_quick_menu |= ( - string_is_equal(entry.label, "collection") - || (string_is_equal(entry.label, "resume_content") - || string_is_equal(entry.label, "state_slot")) - ); - - if (!menu_explore_is_content_list() || xmb->is_quick_menu) + if ( string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_RUN)) + || string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_RESUME_CONTENT)) + || string_is_equal(entry.label, msg_hash_to_str(MENU_ENUM_LABEL_STATE_SLOT)) + ) + { + xmb->is_quick_menu = true; xmb->is_explore_list = false; + } else if (!xmb->is_quick_menu && depth < xmb->old_depth) xmb->skip_thumbnail_reset = true; @@ -5527,6 +5528,78 @@ static enum menu_action xmb_parse_menu_entry_action( } break; case MENU_ACTION_SCAN: + if (xmb->is_playlist_tab) + { + struct menu_state *menu_st = menu_state_get_ptr(); + size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0; + size_t selection = menu_st->selection_ptr; + size_t new_selection = random_range(0, selection_total - 1); + menu_entry_t entry_new; + + MENU_ENTRY_INITIALIZE(entry_new); + menu_entry_get(&entry_new, 0, new_selection, NULL, false); + /* Keep randomizing until selection is a fresh playlist */ + while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION) + { + new_selection = random_range(0, selection_total - 1); + menu_entry_get(&entry_new, 0, new_selection, NULL, false); + } + + if (new_selection != selection) + { + menu_st->selection_ptr = new_selection; + if (menu_st->driver_ctx->navigation_set) + menu_st->driver_ctx->navigation_set(menu_st->userdata, true); + } + + new_action = MENU_ACTION_NOOP; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(true); +#endif + } + else if ((xmb->is_playlist) + || (xmb->is_explore_list)) + { + size_t selection_start = 0; + size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0; + size_t selection = menu_st->selection_ptr; + size_t new_selection = selection; + + /* Skip header items (Search Name + Add Additional Filter + Save as View) */ + if (xmb->is_explore_list) + { + menu_entry_t entry; + MENU_ENTRY_INITIALIZE(entry); + menu_entry_get(&entry, 0, 0, NULL, true); + + if (entry.type == MENU_SETTINGS_LAST + 1) + selection_start = 1; + else if (entry.type == FILE_TYPE_RDB) + selection_start = 2; + } + + new_selection = random_range(selection_start, selection_total - 1); + + while (new_selection == selection && selection_start != selection_total - 1) + new_selection = random_range(selection_start, selection_total - 1); + + if (new_selection != selection) + { + menu_st->selection_ptr = new_selection; + xmb_selection_pointer_changed(xmb, true); + } + + new_action = MENU_ACTION_NOOP; + +#ifdef HAVE_AUDIOMIXER + if (new_selection != selection) + audio_driver_mixer_play_scroll_sound(true); +#endif + break; + } + if ( xmb->fullscreen_thumbnails_available && !xmb->show_fullscreen_thumbnails && ( (xmb->is_state_slot) @@ -5544,8 +5617,13 @@ static enum menu_action xmb_parse_menu_entry_action( 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) + break; + case MENU_ACTION_SEARCH: + /* Playlist thumbnail cycle */ + if ( (xmb->show_fullscreen_thumbnails) + || ((xmb->is_quick_menu) && !menu_is_running_quick_menu())) { + xmb->skip_thumbnail_reset = false; action_switch_thumbnail(NULL, NULL, 0, 0); new_action = MENU_ACTION_NOOP; } diff --git a/menu/menu_driver.c b/menu/menu_driver.c index fff84f92d562..4633bf36a515 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -93,6 +93,9 @@ typedef struct menu_input_ctx_bind extern u32 __nx_applet_type; #endif +/* Accelerated navigation buttons */ +#define NAVIGATION_BUTTONS 9 + struct key_desc key_descriptors[RARCH_MAX_KEYS] = { {RETROK_FIRST, "Unmapped"}, @@ -5240,7 +5243,7 @@ unsigned menu_event( unsigned ok_trigger = ok_current & ~ok_old; static unsigned navigation_initial = 0; unsigned navigation_current = 0; - unsigned navigation_buttons[8] = + unsigned navigation_buttons[NAVIGATION_BUTTONS] = { RETRO_DEVICE_ID_JOYPAD_UP, RETRO_DEVICE_ID_JOYPAD_DOWN, @@ -5249,7 +5252,8 @@ unsigned menu_event( RETRO_DEVICE_ID_JOYPAD_L, RETRO_DEVICE_ID_JOYPAD_R, RETRO_DEVICE_ID_JOYPAD_L2, - RETRO_DEVICE_ID_JOYPAD_R2 + RETRO_DEVICE_ID_JOYPAD_R2, + RETRO_DEVICE_ID_JOYPAD_Y }; ok_old = ok_current; @@ -5374,7 +5378,7 @@ unsigned menu_event( } /* Accelerate only navigation buttons */ - for (i = 0; i < 6; i++) + for (i = 0; i < NAVIGATION_BUTTONS; i++) { if (BIT256_GET_PTR(p_input, navigation_buttons[i])) navigation_current |= (1 << navigation_buttons[i]); @@ -5406,7 +5410,7 @@ unsigned menu_event( if (delay_count >= delay_timer) { uint32_t input_repeat = 0; - for (i = 0; i < 6; i++) + for (i = 0; i < NAVIGATION_BUTTONS; i++) BIT32_SET(input_repeat, navigation_buttons[i]); p_trigger_input->data[0] |= p_input->data[0] & input_repeat; diff --git a/msg_hash.h b/msg_hash.h index eddaa01f258f..f879dedd3207 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2165,6 +2165,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_SEARCH, MENU_ENUM_LABEL_VALUE_CYCLE_THUMBNAILS, + MENU_ENUM_LABEL_VALUE_RANDOM_SELECT, MENU_LABEL(DOWNLOAD_CORE_CONTENT), MENU_LABEL(DOWNLOAD_CORE_CONTENT_DIRS),