From 4ba004a1e818d4078f79fc3208b9dbc04bfbe525 Mon Sep 17 00:00:00 2001 From: sonninnos <45124675+sonninnos@users.noreply.github.com> Date: Fri, 23 May 2025 16:06:53 +0300 Subject: [PATCH] Add 'Show Favorites First' visibility option (#17933) --- config.def.h | 1 + configuration.c | 1 + configuration.h | 1 + intl/msg_hash_lbl.h | 4 ++ intl/msg_hash_us.h | 8 ++++ menu/cbs/menu_cbs_sublabel.c | 4 ++ menu/drivers/ozone.c | 26 ++++++++-- menu/drivers/xmb.c | 25 ++++++++-- menu/menu_displaylist.c | 93 ++++++++++++++++++++++++++---------- menu/menu_setting.c | 15 ++++++ msg_hash.h | 1 + 11 files changed, 145 insertions(+), 34 deletions(-) diff --git a/config.def.h b/config.def.h index dda01137e7..141123765d 100644 --- a/config.def.h +++ b/config.def.h @@ -795,6 +795,7 @@ #define DEFAULT_CONTENT_SHOW_SETTINGS true #define DEFAULT_CONTENT_SHOW_HISTORY true #define DEFAULT_CONTENT_SHOW_FAVORITES true +#define DEFAULT_CONTENT_SHOW_FAVORITES_FIRST false #ifdef HAVE_IMAGEVIEWER #define DEFAULT_CONTENT_SHOW_IMAGES true #endif diff --git a/configuration.c b/configuration.c index 34ef4ceb84..d7215b10e2 100644 --- a/configuration.c +++ b/configuration.c @@ -2022,6 +2022,7 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("content_show_settings", &settings->bools.menu_content_show_settings, true, DEFAULT_CONTENT_SHOW_SETTINGS, false); SETTING_BOOL("content_show_favorites", &settings->bools.menu_content_show_favorites, true, DEFAULT_CONTENT_SHOW_FAVORITES, false); + SETTING_BOOL("content_show_favorites_first", &settings->bools.menu_content_show_favorites_first, true, DEFAULT_CONTENT_SHOW_FAVORITES_FIRST, false); #ifdef HAVE_IMAGEVIEWER SETTING_BOOL("content_show_images", &settings->bools.menu_content_show_images, true, DEFAULT_CONTENT_SHOW_IMAGES, false); #endif diff --git a/configuration.h b/configuration.h index c1d8cd67ee..3b0daa3655 100644 --- a/configuration.h +++ b/configuration.h @@ -820,6 +820,7 @@ typedef struct settings bool menu_xmb_vertical_thumbnails; bool menu_content_show_settings; bool menu_content_show_favorites; + bool menu_content_show_favorites_first; bool menu_content_show_images; bool menu_content_show_music; bool menu_content_show_video; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 5f081b6651..6fa47a6a88 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -4856,6 +4856,10 @@ MSG_HASH( MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES, "content_show_favorites" ) +MSG_HASH( + MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES_FIRST, + "content_show_favorites_first" + ) MSG_HASH( MENU_ENUM_LABEL_CONTENT_SHOW_IMAGES, "content_show_images" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index c233e8cfe8..3f63fb2cc4 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -6456,6 +6456,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES, "Show the 'Favorites' menu. (Restart required on Ozone/XMB)" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES_FIRST, + "Show Favorites First" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES_FIRST, + "Show 'Favorites' before 'History'. (Restart required on Ozone/XMB)" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES, "Show 'Images'" diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index dbac9f0523..395e2c6aa1 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -1164,6 +1164,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_enable_kiosk_mode, DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_disable_kiosk_mode, MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_kiosk_mode_password, MENU_ENUM_SUBLABEL_MENU_KIOSK_MODE_PASSWORD) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_favorites_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_favorites_first, MENU_ENUM_SUBLABEL_CONTENT_SHOW_FAVORITES_FIRST) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_images_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_IMAGES) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_load_core, MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CORE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_load_content, MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT) @@ -3055,6 +3056,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_favorites_tab); break; + case MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES_FIRST: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_favorites_first); + break; case MENU_ENUM_LABEL_CONTENT_SHOW_IMAGES: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_images_tab); break; diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index bb4c099a43..a1115ba5e9 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -8913,32 +8913,50 @@ static void *ozone_init(void **userdata, bool video_is_threaded) ozone->system_tab_end = 0; ozone->tabs[ozone->system_tab_end] = OZONE_SYSTEM_TAB_MAIN; + if ( settings->bools.menu_content_show_settings && !settings->bools.kiosk_mode_enable) ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_SETTINGS; - if (settings->bools.menu_content_show_history) - ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_HISTORY; - if (settings->bools.menu_content_show_favorites) - ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_FAVORITES; + + if (settings->bools.menu_content_show_favorites_first) + { + if (settings->bools.menu_content_show_favorites) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_FAVORITES; + if (settings->bools.menu_content_show_history) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_HISTORY; + } + else + { + if (settings->bools.menu_content_show_history) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_HISTORY; + if (settings->bools.menu_content_show_favorites) + ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_FAVORITES; + } + #ifdef HAVE_IMAGEVIEWER if (settings->bools.menu_content_show_images) ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_IMAGES; #endif + if (settings->bools.menu_content_show_music) ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_MUSIC; + #if defined(HAVE_FFMPEG) || defined(HAVE_MPV) if (settings->bools.menu_content_show_video) ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_VIDEO; #endif + #if 0 /* Move Netplay and Import Content to Main Menu */ #ifdef HAVE_NETWORKING if (settings->bools.menu_content_show_netplay) ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_NETPLAY; #endif + if ( settings->bools.menu_content_show_add && !settings->bools.kiosk_mode_enable) ozone->tabs[++ozone->system_tab_end] = OZONE_SYSTEM_TAB_ADD; #endif /* 0 */ + #if defined(HAVE_DYNAMIC) if (settings->uints.menu_content_show_contentless_cores != MENU_CONTENTLESS_CORES_DISPLAY_NONE) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 7315c901a6..43844ee3bc 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -8657,29 +8657,46 @@ static void *xmb_init(void **userdata, bool video_is_threaded) if ( settings->bools.menu_content_show_settings && !settings->bools.kiosk_mode_enable) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_SETTINGS; - if (settings->bools.menu_content_show_history) - xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_HISTORY; - if (settings->bools.menu_content_show_favorites) - xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_FAVORITES; + + if (settings->bools.menu_content_show_favorites_first) + { + if (settings->bools.menu_content_show_favorites) + xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_FAVORITES; + if (settings->bools.menu_content_show_history) + xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_HISTORY; + } + else + { + if (settings->bools.menu_content_show_history) + xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_HISTORY; + if (settings->bools.menu_content_show_favorites) + xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_FAVORITES; + } + #ifdef HAVE_IMAGEVIEWER if (settings->bools.menu_content_show_images) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_IMAGES; #endif + if (settings->bools.menu_content_show_music) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_MUSIC; + #if defined(HAVE_FFMPEG) || defined(HAVE_MPV) if (settings->bools.menu_content_show_video) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_VIDEO; #endif + #if 0 /* Move Netplay and Import Content to Main Menu */ #ifdef HAVE_NETWORKING if (settings->bools.menu_content_show_netplay) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_NETPLAY; #endif + if ( settings->bools.menu_content_show_add && !settings->bools.kiosk_mode_enable) xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_ADD; #endif /* 0 */ + #if defined(HAVE_DYNAMIC) if ( settings->uints.menu_content_show_contentless_cores != MENU_CONTENTLESS_CORES_DISPLAY_NONE) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index d191f2a0c7..69206589ff 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4317,21 +4317,42 @@ static unsigned menu_displaylist_parse_playlists( if (show_history) { - if (settings->bools.menu_content_show_history) - if (menu_entries_append(info_list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY), - msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY), - MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY, - MENU_SETTING_ACTION, 0, 0, NULL)) - count++; + if (settings->bools.menu_content_show_favorites_first) + { + if (settings->bools.menu_content_show_favorites) + if (menu_entries_append(info_list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES), + msg_hash_to_str(MENU_ENUM_LABEL_GOTO_FAVORITES), + MENU_ENUM_LABEL_GOTO_FAVORITES, + MENU_SETTING_ACTION, 0, 0, NULL)) + count++; - if (settings->bools.menu_content_show_favorites) - if (menu_entries_append(info_list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES), - msg_hash_to_str(MENU_ENUM_LABEL_GOTO_FAVORITES), - MENU_ENUM_LABEL_GOTO_FAVORITES, - MENU_SETTING_ACTION, 0, 0, NULL)) - count++; + if (settings->bools.menu_content_show_history) + if (menu_entries_append(info_list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY), + msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY), + MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY, + MENU_SETTING_ACTION, 0, 0, NULL)) + count++; + } + else + { + if (settings->bools.menu_content_show_history) + if (menu_entries_append(info_list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_HISTORY), + msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY), + MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY, + MENU_SETTING_ACTION, 0, 0, NULL)) + count++; + + if (settings->bools.menu_content_show_favorites) + if (menu_entries_append(info_list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES), + msg_hash_to_str(MENU_ENUM_LABEL_GOTO_FAVORITES), + MENU_ENUM_LABEL_GOTO_FAVORITES, + MENU_SETTING_ACTION, 0, 0, NULL)) + count++; + } } if (settings->bools.menu_content_show_images) @@ -10088,6 +10109,7 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_CONTENT_SHOW_PLAYLIST_TABS, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_CONTENT_SHOW_HISTORY, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES, PARSE_ONLY_BOOL, true }, + {MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES_FIRST, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_CONTENT_SHOW_IMAGES, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_CONTENT_SHOW_MUSIC, PARSE_ONLY_BOOL, true }, {MENU_ENUM_LABEL_CONTENT_SHOW_VIDEO, PARSE_ONLY_BOOL, true }, @@ -15135,19 +15157,38 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, || (string_is_equal(menu_ident, "glui") && !settings->bools.menu_materialui_show_nav_bar)) { - if (settings->bools.menu_content_show_history) - if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list, - MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY, - PARSE_ACTION, false) == 0) - count++; + if (settings->bools.menu_content_show_favorites_first) + { + if (settings->bools.menu_content_show_favorites) + if (menu_entries_append(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES), + msg_hash_to_str(MENU_ENUM_LABEL_GOTO_FAVORITES), + MENU_ENUM_LABEL_GOTO_FAVORITES, + MENU_SETTING_ACTION, 0, 0, NULL)) + count++; - if (settings->bools.menu_content_show_favorites) - if (menu_entries_append(info->list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES), - msg_hash_to_str(MENU_ENUM_LABEL_GOTO_FAVORITES), - MENU_ENUM_LABEL_GOTO_FAVORITES, - MENU_SETTING_ACTION, 0, 0, NULL)) - count++; + if (settings->bools.menu_content_show_history) + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list, + MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY, + PARSE_ACTION, false) == 0) + count++; + } + else + { + if (settings->bools.menu_content_show_history) + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(info->list, + MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY, + PARSE_ACTION, false) == 0) + count++; + + if (settings->bools.menu_content_show_favorites) + if (menu_entries_append(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES), + msg_hash_to_str(MENU_ENUM_LABEL_GOTO_FAVORITES), + MENU_ENUM_LABEL_GOTO_FAVORITES, + MENU_SETTING_ACTION, 0, 0, NULL)) + count++; + } } #ifdef HAVE_CDROM diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 462120b67a..0fef269c98 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -19254,6 +19254,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_BOOL( + list, list_info, + &settings->bools.menu_content_show_favorites_first, + MENU_ENUM_LABEL_CONTENT_SHOW_FAVORITES_FIRST, + MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES_FIRST, + DEFAULT_CONTENT_SHOW_FAVORITES_FIRST, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + #ifdef HAVE_IMAGEVIEWER CONFIG_BOOL( list, list_info, diff --git a/msg_hash.h b/msg_hash.h index 7a8a3c7e2e..e0b19bca35 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1598,6 +1598,7 @@ enum msg_hash_enums MENU_LABEL(CONTENT_SHOW_SETTINGS), MENU_LABEL(CONTENT_SHOW_SETTINGS_PASSWORD), MENU_LABEL(CONTENT_SHOW_FAVORITES), + MENU_LABEL(CONTENT_SHOW_FAVORITES_FIRST), MENU_LABEL(CONTENT_SHOW_IMAGES), MENU_LABEL(CONTENT_SHOW_MUSIC), MENU_LABEL(CONTENT_SHOW_VIDEO),