Skip to content

Commit 3111f62

Browse files
authored
Add menu startup page option (#18175)
1 parent 44746d5 commit 3111f62

14 files changed

Lines changed: 290 additions & 59 deletions

config.def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,7 @@
16641664
#define DEFAULT_MENU_TIMEDATE_STYLE MENU_TIMEDATE_STYLE_DDMM_HM
16651665
#define DEFAULT_MENU_TIMEDATE_DATE_SEPARATOR MENU_TIMEDATE_DATE_SEPARATOR_HYPHEN
16661666
#define DEFAULT_MENU_REMEMBER_SELECTION MENU_REMEMBER_SELECTION_ALWAYS
1667+
#define DEFAULT_MENU_STARTUP_PAGE MENU_STARTUP_PAGE_MAIN_MENU
16671668
#endif
16681669

16691670
#define DEFAULT_XMB_VERTICAL_THUMBNAILS false

configuration.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,7 @@ static struct config_uint_setting *populate_settings_uint(
24232423
#if defined(HAVE_XMB) || defined(HAVE_OZONE)
24242424
SETTING_UINT("menu_remember_selection", &settings->uints.menu_remember_selection, true, DEFAULT_MENU_REMEMBER_SELECTION, false);
24252425
#endif
2426+
SETTING_UINT("menu_startup_page", &settings->uints.menu_startup_page, true, DEFAULT_MENU_STARTUP_PAGE, false);
24262427
#ifdef HAVE_RGUI
24272428
SETTING_UINT("rgui_menu_color_theme", &settings->uints.menu_rgui_color_theme, true, DEFAULT_RGUI_COLOR_THEME, false);
24282429
SETTING_UINT("rgui_thumbnail_downscaler", &settings->uints.menu_rgui_thumbnail_downscaler, true, DEFAULT_RGUI_THUMBNAIL_DOWNSCALER, false);

configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ typedef struct settings
322322
unsigned menu_screensaver_timeout;
323323
unsigned menu_screensaver_animation;
324324
unsigned menu_remember_selection;
325+
unsigned menu_startup_page;
325326

326327
unsigned playlist_entry_remove_enable;
327328
unsigned playlist_show_inline_core_name;

intl/msg_hash_lbl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4032,6 +4032,10 @@ MSG_HASH(
40324032
MENU_ENUM_LABEL_MENU_REMEMBER_SELECTION,
40334033
"menu_remember_selection"
40344034
)
4035+
MSG_HASH(
4036+
MENU_ENUM_LABEL_MENU_STARTUP_PAGE,
4037+
"menu_startup_page"
4038+
)
40354039
MSG_HASH(
40364040
MENU_ENUM_LABEL_UI_COMPANION_ENABLE,
40374041
"ui_companion_enable"

intl/msg_hash_us.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7173,6 +7173,14 @@ MSG_HASH(
71737173
MENU_ENUM_LABEL_VALUE_MENU_REMEMBER_SELECTION_MAIN,
71747174
"Only for Main Menu and Settings"
71757175
)
7176+
MSG_HASH(
7177+
MENU_ENUM_LABEL_VALUE_MENU_STARTUP_PAGE,
7178+
"Startup Page"
7179+
)
7180+
MSG_HASH(
7181+
MENU_ENUM_SUBLABEL_MENU_STARTUP_PAGE,
7182+
"Initial menu page on startup."
7183+
)
71767184

71777185
/* Settings > AI Service */
71787186

menu/cbs/menu_cbs_sublabel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_screensaver_animation_speed, ME
842842
#if defined(HAVE_XMB) || defined(HAVE_OZONE)
843843
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_remember_selection, MENU_ENUM_SUBLABEL_MENU_REMEMBER_SELECTION)
844844
#endif
845+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_startup_page, MENU_ENUM_SUBLABEL_MENU_STARTUP_PAGE)
845846
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_driver, MENU_ENUM_SUBLABEL_VIDEO_DRIVER)
846847
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_audio_driver, MENU_ENUM_SUBLABEL_AUDIO_DRIVER)
847848
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_driver, MENU_ENUM_SUBLABEL_INPUT_DRIVER)
@@ -4071,6 +4072,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
40714072
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_remember_selection);
40724073
break;
40734074
#endif
4075+
case MENU_ENUM_LABEL_MENU_STARTUP_PAGE:
4076+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_startup_page);
4077+
break;
40744078
case MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL:
40754079
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_swap_ok_cancel);
40764080
break;

menu/drivers/ozone.c

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,9 @@ struct ozone_handle
589589
float scroll_y;
590590
float scroll_y_sidebar;
591591

592+
float alpha;
592593
float list_alpha;
593-
594594
float messagebox_alpha;
595-
596595
float sidebar_text_alpha;
597596
float thumbnail_bar_position;
598597

@@ -3518,6 +3517,8 @@ static void ozone_draw_sidebar(
35183517
if (dispctx && dispctx->blend_begin)
35193518
dispctx->blend_begin(userdata);
35203519

3520+
text_alpha *= ozone->animations.alpha;
3521+
35213522
for (i = 0; i < (unsigned)(ozone->system_tab_end + 1); i++)
35223523
{
35233524
float *col = NULL;
@@ -3527,6 +3528,8 @@ static void ozone_draw_sidebar(
35273528
if (!(col = selected ? ozone->theme->text_selected : ozone->theme->entries_icon))
35283529
col = ozone->pure_white;
35293530

3531+
gfx_display_set_alpha(col, ozone->animations.alpha);
3532+
35303533
/* Icon */
35313534
ozone_draw_icon(
35323535
p_disp,
@@ -3657,6 +3660,8 @@ static void ozone_draw_sidebar(
36573660
if (!(col = (selected ? ozone->theme->text_selected : ozone->theme->entries_icon)))
36583661
col = ozone->pure_white;
36593662

3663+
gfx_display_set_alpha(col, ozone->animations.alpha);
3664+
36603665
/* Icon */
36613666
ozone_draw_icon(
36623667
p_disp,
@@ -3763,11 +3768,6 @@ static bool ozone_is_main_menu_playlist(void *userdata)
37633768
ozone_handle_t *ozone = (ozone_handle_t*)userdata;
37643769
menu_entry_t entry;
37653770

3766-
if ( (ozone->depth != 3)
3767-
|| (ozone->flags & OZONE_FLAG_IS_DB_MANAGER_LIST)
3768-
|| (ozone->flags & OZONE_FLAG_IS_FILE_LIST))
3769-
return false;
3770-
37713771
MENU_ENTRY_INITIALIZE(entry);
37723772
menu_entry_get(&entry, 0, 0, NULL, true);
37733773
return entry.type == FILE_TYPE_RPL_ENTRY;
@@ -4069,15 +4069,15 @@ static void ozone_sidebar_update_collapse(ozone_handle_t *ozone,
40694069
if (ozone_get_horizontal_selection_type(ozone) == MENU_EXPLORE_TAB)
40704070
is_playlist = true;
40714071

4072-
/* Playlists under "Main Menu" don't need sidebar animations */
4073-
if (is_playlist && ozone->depth > 2)
4074-
goto end;
4072+
/* Do not animate sidebar above first depth level */
4073+
if (ozone->depth > 1)
4074+
allow_animation = false;
40754075

40764076
/* To collapse or not to collapse */
40774077
collapse = ozone_want_collapse(ozone, ozone_collapse_sidebar, is_playlist);
40784078

40794079
/* Skip if already at wanted state */
4080-
if ( (collapse && ozone->sidebar_collapsed)
4080+
if ( ( collapse && ozone->sidebar_collapsed)
40814081
|| (!collapse && !ozone->sidebar_collapsed))
40824082
goto end;
40834083

@@ -4112,9 +4112,7 @@ static void ozone_sidebar_update_collapse(ozone_handle_t *ozone,
41124112
{
41134113
if (allow_animation)
41144114
{
4115-
ozone->sidebar_collapsed = false;
4116-
4117-
entry.cb = NULL;
4115+
entry.cb = NULL;
41184116

41194117
/* Text alpha */
41204118
entry.subject = &ozone->animations.sidebar_text_alpha;
@@ -4127,6 +4125,8 @@ static void ozone_sidebar_update_collapse(ozone_handle_t *ozone,
41274125
entry.target_value = ozone->dimensions.sidebar_width_normal;
41284126

41294127
gfx_animation_push(&entry);
4128+
4129+
ozone->sidebar_collapsed = false;
41304130
}
41314131
else
41324132
{
@@ -5735,6 +5735,7 @@ static void ozone_draw_entries(
57355735
}
57365736

57375737
x_offset += (int)sidebar_offset;
5738+
alpha *= ozone->animations.alpha;
57385739
alpha_uint32 = (uint32_t)(alpha * 255.0f);
57395740

57405741
/* Borders layer */
@@ -5920,7 +5921,7 @@ static void ozone_draw_entries(
59205921
if (use_smooth_ticker)
59215922
{
59225923
ticker_smooth.selected = entry_selected && (!(ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR));
5923-
ticker_smooth.field_width = entry_width - entry_padding - ozone->dimensions.entry_icon_padding * 6;
5924+
ticker_smooth.field_width = entry_width - ozone->dimensions.entry_icon_padding * 6;
59245925
ticker_smooth.src_str = entry_rich_label;
59255926
ticker_smooth.dst_str = rich_label;
59265927
ticker_smooth.dst_str_len = sizeof(rich_label);
@@ -5932,7 +5933,7 @@ static void ozone_draw_entries(
59325933
ticker.s = rich_label;
59335934
ticker.str = entry_rich_label;
59345935
ticker.selected = entry_selected && (!(ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR));
5935-
ticker.len = (entry_width - entry_padding - ozone->dimensions.entry_icon_padding) / ozone->fonts.entries_label.glyph_width;
5936+
ticker.len = (entry_width - ozone->dimensions.entry_icon_padding * 6) / ozone->fonts.entries_label.glyph_width;
59365937

59375938
gfx_animation_ticker(&ticker);
59385939
}
@@ -6033,7 +6034,19 @@ static void ozone_draw_entries(
60336034
if (pl_entry
60346035
&& !string_is_empty(pl_entry->db_name)
60356036
&& (db_node = RHMAP_GET_STR(ozone->playlist_db_node_map, pl_entry->db_name)))
6036-
texture = db_node->content_icon;
6037+
{
6038+
switch (show_history_icons)
6039+
{
6040+
case PLAYLIST_SHOW_HISTORY_ICONS_MAIN:
6041+
texture = db_node->icon;
6042+
break;
6043+
case PLAYLIST_SHOW_HISTORY_ICONS_CONTENT:
6044+
texture = db_node->content_icon;
6045+
break;
6046+
default:
6047+
break;
6048+
}
6049+
}
60376050
}
60386051
else if (ozone->depth == 2 && entry.type == FILE_TYPE_PLAYLIST_COLLECTION)
60396052
{
@@ -9697,6 +9710,7 @@ static void ozone_context_reset(void *data, bool is_threaded)
96979710
ozone->animations.cursor_alpha = 1.0f;
96989711
ozone->animations.scroll_y = 0.0f;
96999712
ozone->animations.list_alpha = 1.0f;
9713+
ozone->animations.alpha = 1.0f;
97009714

97019715
/* Thumbnails */
97029716
ozone_update_thumbnail_image(ozone);
@@ -10517,8 +10531,7 @@ static void ozone_render(void *data,
1051710531
menu_st->selection_ptr = i;
1051810532

1051910533
/* If this is a playlist, must update thumbnails */
10520-
if ( ((ozone->flags & OZONE_FLAG_IS_PLAYLIST)
10521-
&& (ozone->depth == 1 || ozone->depth == 3))
10534+
if ( (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
1052210535
|| (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST))
1052310536
{
1052410537
ozone->flags &= ~OZONE_FLAG_SKIP_THUMBNAIL_RESET;
@@ -10555,8 +10568,7 @@ static void ozone_render(void *data,
1055510568
settings->uints.menu_remember_selection);
1055610569
}
1055710570
/* If this is a playlist, must update thumbnails */
10558-
else if ((ozone->flags & OZONE_FLAG_IS_PLAYLIST)
10559-
&& (ozone->depth == 1 || ozone->depth == 3))
10571+
else if (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
1056010572
{
1056110573
ozone_set_thumbnail_content(ozone, "");
1056210574
ozone_update_thumbnail_image(ozone);
@@ -10738,6 +10750,8 @@ static void ozone_draw_header(
1073810750
if (header_margin < header_margin_min)
1073910751
header_margin = header_margin_min;
1074010752

10753+
gfx_display_set_alpha(col, ozone->animations.alpha);
10754+
1074110755
/* Initial ticker configuration */
1074210756
if (use_smooth_ticker)
1074310757
{
@@ -11774,8 +11788,7 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
1177411788
bool update_thumbnails = false;
1177511789

1177611790
/* Playlist updates */
11777-
if ( (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
11778-
&& (ozone->depth == 1 || ozone->depth == 3))
11791+
if (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
1177911792
{
1178011793
ozone_set_thumbnail_content(ozone, "");
1178111794
update_thumbnails = true;
@@ -12014,6 +12027,8 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
1201412027
else
1201512028
background_color = ozone->theme->background;
1201612029

12030+
gfx_display_set_alpha(background_color, ozone->animations.alpha);
12031+
1201712032
gfx_display_draw_quad(p_disp,
1201812033
userdata,
1201912034
video_width,
@@ -12667,7 +12682,7 @@ static void ozone_populate_entries(
1266712682
* and savestate slots */
1266812683
if (
1266912684
( (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR))
12670-
&& ( ((ozone->flags & OZONE_FLAG_IS_PLAYLIST) && (ozone->depth == 1 || ozone->depth == 3))
12685+
&& ( (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
1267112686
|| ((ozone->flags & OZONE_FLAG_IS_DB_MANAGER_LIST) && (ozone->depth >= 4))
1267212687
|| (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST)
1267312688
|| (ozone->flags & OZONE_FLAG_IS_FILE_LIST)
@@ -12700,6 +12715,23 @@ static void ozone_toggle(void *userdata, bool menu_on)
1270012715
if (!ozone)
1270112716
return;
1270212717

12718+
/* Fade in animation */
12719+
if (menu_on)
12720+
{
12721+
struct gfx_animation_ctx_entry entry;
12722+
12723+
ozone->animations.alpha = 0.0f;
12724+
12725+
entry.cb = NULL;
12726+
entry.duration = ANIMATION_PUSH_ENTRY_DURATION * 1.25f;
12727+
entry.easing_enum = OZONE_EASING_ALPHA;
12728+
entry.subject = &ozone->animations.alpha;
12729+
entry.tag = (uintptr_t)NULL;
12730+
entry.target_value = 1.0f;
12731+
12732+
gfx_animation_push(&entry);
12733+
}
12734+
1270312735
/* Have to reset this, otherwise savestate
1270412736
* thumbnail won't update after selecting
1270512737
* 'save state' option */
@@ -13052,7 +13084,6 @@ static int ozone_pointer_up(void *userdata,
1305213084
/* If this is a playlist and the selection
1305313085
* has changed, must update thumbnails */
1305413086
else if ( (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
13055-
&& (ozone->depth == 1)
1305613087
&& (ptr != selection))
1305713088
{
1305813089
ozone_set_thumbnail_content(ozone, "");

0 commit comments

Comments
 (0)