Skip to content

Commit ec57382

Browse files
authored
Add 'Single-Click Playlists' option (#18218)
1 parent 9b4168d commit ec57382

15 files changed

Lines changed: 280 additions & 27 deletions

config.def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@
967967

968968
#define DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS true
969969
#define DEFAULT_MENU_SWAP_SCROLL_BUTTONS false
970+
#define DEFAULT_MENU_SINGLECLICK_PLAYLISTS false
970971
#define DEFAULT_MENU_ALLOW_TABS_BACK true
971972

972973
#if defined(WIIU)

configuration.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,6 +2180,7 @@ static struct config_bool_setting *populate_settings_bool(
21802180
SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, DEFAULT_ALL_USERS_CONTROL_MENU, false);
21812181
SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->bools.input_menu_swap_ok_cancel_buttons, true, DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS, false);
21822182
SETTING_BOOL("menu_swap_scroll_buttons", &settings->bools.input_menu_swap_scroll_buttons, true, DEFAULT_MENU_SWAP_SCROLL_BUTTONS, false);
2183+
SETTING_BOOL("menu_singleclick_playlists", &settings->bools.input_menu_singleclick_playlists, true, DEFAULT_MENU_SINGLECLICK_PLAYLISTS, false);
21832184
SETTING_BOOL("menu_allow_tabs_back", &settings->bools.input_menu_allow_tabs_back, true, DEFAULT_MENU_ALLOW_TABS_BACK, false);
21842185
#endif
21852186
#if defined(HAVE_DINPUT) || defined(HAVE_WINRAWINPUT)

configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ typedef struct settings
719719
bool input_descriptor_label_show;
720720
bool input_descriptor_hide_unbound;
721721
bool input_all_users_control_menu;
722+
bool input_menu_singleclick_playlists;
722723
bool input_menu_allow_tabs_back;
723724
bool input_menu_swap_ok_cancel_buttons;
724725
bool input_menu_swap_scroll_buttons;

intl/msg_hash_lbl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,10 @@ MSG_HASH(
18341834
MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU,
18351835
"all_users_control_menu"
18361836
)
1837+
MSG_HASH(
1838+
MENU_ENUM_LABEL_MENU_SINGLECLICK_PLAYLISTS,
1839+
"menu_singleclick_playlists"
1840+
)
18371841
MSG_HASH(
18381842
MENU_ENUM_LABEL_MENU_ALLOW_TABS_BACK,
18391843
"menu_allow_tabs_back"

intl/msg_hash_us.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,6 +3696,14 @@ MSG_HASH(
36963696
MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU,
36973697
"Allow any user to control the menu. If disabled, only User 1 can control the menu."
36983698
)
3699+
MSG_HASH(
3700+
MENU_ENUM_LABEL_VALUE_MENU_SINGLECLICK_PLAYLISTS,
3701+
"Single-Click Playlists"
3702+
)
3703+
MSG_HASH(
3704+
MENU_ENUM_SUBLABEL_MENU_SINGLECLICK_PLAYLISTS,
3705+
"Skip 'Run' menu when launching playlist entries. Press D-Pad while holding OK to access 'Run' menu."
3706+
)
36993707
MSG_HASH(
37003708
MENU_ENUM_LABEL_VALUE_MENU_ALLOW_TABS_BACK,
37013709
"Allow Back From Tabs"

menu/cbs/menu_cbs_ok.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5732,8 +5732,17 @@ int action_ok_close_content(const char *path, const char *label, unsigned type,
57325732
menu_st->flags &= ~MENU_ST_FLAG_PREVENT_POPULATE;
57335733
}
57345734

5735+
/* Single-click playlist return */
5736+
if (config_get_ptr()->bools.input_menu_singleclick_playlists)
5737+
{
5738+
size_t new_selection = menu_st->selection_ptr;
5739+
menu_entries_pop_stack(&new_selection, 0, 0);
5740+
menu_st->selection_ptr = new_selection;
5741+
menu_st->flags &= ~MENU_ST_FLAG_PREVENT_POPULATE;
5742+
}
5743+
57355744
/* Try to reload last core if loaded manually */
5736-
menu_state_get_ptr()->flags |= MENU_ST_FLAG_PENDING_RELOAD_CORE;
5745+
menu_st->flags |= MENU_ST_FLAG_PENDING_RELOAD_CORE;
57375746

57385747
return ret;
57395748
}

menu/cbs/menu_cbs_sublabel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_auto_game_focus, MENU_
831831
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_swap_ok_cancel, MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL)
832832
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_swap_scroll, MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_SCROLL)
833833
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_all_users_control_menu, MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU)
834+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_singleclick_playlists, MENU_ENUM_SUBLABEL_MENU_SINGLECLICK_PLAYLISTS)
834835
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_allow_tabs_back, MENU_ENUM_SUBLABEL_MENU_ALLOW_TABS_BACK)
835836
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_pause_libretro, MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO)
836837
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_savestate_resume, MENU_ENUM_SUBLABEL_MENU_SAVESTATE_RESUME)
@@ -4083,6 +4084,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
40834084
case MENU_ENUM_LABEL_MENU_INPUT_SWAP_SCROLL:
40844085
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_swap_scroll);
40854086
break;
4087+
case MENU_ENUM_LABEL_MENU_SINGLECLICK_PLAYLISTS:
4088+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_singleclick_playlists);
4089+
break;
40864090
case MENU_ENUM_LABEL_MENU_ALLOW_TABS_BACK:
40874091
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_allow_tabs_back);
40884092
break;

menu/drivers/materialui.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ typedef struct materialui_handle
697697
float touch_feedback_alpha;
698698
int16_t pointer_start_x;
699699
int16_t pointer_start_y;
700+
bool transition_alpha_lock;
700701

701702
/* Colour theme parameters */
702703
enum materialui_color_theme color_theme;
@@ -7616,6 +7617,9 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
76167617
* a transition animation is in process */
76177618
static void materialui_colors_set_transition_alpha(materialui_handle_t *mui)
76187619
{
7620+
if (mui->transition_alpha_lock)
7621+
mui->transition_alpha = 0.0f;
7622+
76197623
if (mui->transition_alpha < 1.0f)
76207624
{
76217625
float alpha = mui->transition_alpha;
@@ -7686,6 +7690,9 @@ static void materialui_colors_set_transition_alpha(materialui_handle_t *mui)
76867690
* previously altered by a menu transition animation */
76877691
static void materialui_colors_reset_transition_alpha(materialui_handle_t *mui)
76887692
{
7693+
if (mui->transition_alpha_lock)
7694+
mui->transition_alpha = 0.0f;
7695+
76897696
if (mui->transition_alpha < 1.0f)
76907697
{
76917698
/* Text colours */
@@ -9035,6 +9042,7 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
90359042
mui->last_stack_size = 1;
90369043

90379044
mui->scroll_animation_selection = 0;
9045+
mui->transition_alpha_lock = false;
90389046

90399047
/* Ensure message box string is empty */
90409048
mui->msgbox[0] = '\0';
@@ -10393,6 +10401,12 @@ static enum menu_action materialui_parse_menu_entry_action(
1039310401
if (!materialui_entry_onscreen(mui, selection))
1039410402
new_action = MENU_ACTION_NOOP;
1039510403
}
10404+
10405+
/* Make transition smoother for single-click playlist launching */
10406+
if ( config_get_ptr()->bools.input_menu_singleclick_playlists
10407+
&& ( mui->flags & MUI_FLAG_IS_PLAYLIST
10408+
|| mui->flags & MUI_FLAG_IS_EXPLORE_LIST))
10409+
mui->transition_alpha_lock = true;
1039610410
break;
1039710411
case MENU_ACTION_CANCEL:
1039810412
if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)
@@ -10454,6 +10468,25 @@ static enum menu_action materialui_parse_menu_entry_action(
1045410468
break;
1045510469
}
1045610470

10471+
switch (new_action)
10472+
{
10473+
case MENU_ACTION_UP:
10474+
case MENU_ACTION_DOWN:
10475+
case MENU_ACTION_LEFT:
10476+
case MENU_ACTION_RIGHT:
10477+
case MENU_ACTION_CANCEL:
10478+
if ( config_get_ptr()->bools.input_menu_singleclick_playlists
10479+
&& mui->transition_alpha_lock)
10480+
{
10481+
mui->transition_alpha_lock = false;
10482+
mui->transition_alpha = 1.0f;
10483+
new_action = MENU_ACTION_NOOP;
10484+
}
10485+
break;
10486+
default:
10487+
break;
10488+
}
10489+
1045710490
return new_action;
1045810491
}
1045910492

@@ -12245,6 +12278,9 @@ static void materialui_toggle(void *userdata, bool menu_on)
1224512278
if (!mui)
1224612279
return;
1224712280

12281+
/* Reset */
12282+
mui->transition_alpha_lock = false;
12283+
1224812284
/* Have to reset this, otherwise savestate
1224912285
* thumbnail won't update after selecting
1225012286
* 'save state' option */

menu/drivers/ozone.c

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#define OZONE_THUMBNAIL_STREAM_DELAY 16.66667f * 3
6868

6969
#define OZONE_EASING_ALPHA EASING_OUT_CIRC
70+
#define OZONE_EASING_ALPHA_IN EASING_IN_QUAD
7071
#define OZONE_EASING_XY EASING_OUT_QUAD
7172

7273
#define FONT_SIZE_FOOTER 18
@@ -1581,6 +1582,7 @@ static ozone_theme_t *ozone_default_theme = &ozone_theme_dark; /* also used as
15811582
static float ozone_last_framebuffer_opacity = -1.0f;
15821583

15831584
/* Forward declarations */
1585+
static void ozone_animation_list_alpha(ozone_handle_t *ozone, bool fade_in);
15841586
static void ozone_cursor_animation_cb(void *userdata);
15851587
static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation);
15861588
static void ozone_unload_thumbnail_textures(void *data);
@@ -8698,6 +8700,12 @@ static enum menu_action ozone_parse_menu_entry_action(
86988700
new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_LABEL;
86998701
break;
87008702
}
8703+
8704+
/* Make transition smoother for single-click playlist launching */
8705+
if ( settings->bools.input_menu_singleclick_playlists
8706+
&& ( ozone->flags & OZONE_FLAG_IS_PLAYLIST
8707+
|| ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST))
8708+
ozone->animations.list_alpha = 0.0f;
87018709
break;
87028710
case MENU_ACTION_CANCEL:
87038711
ozone->flags &= ~OZONE_FLAG_CURSOR_MODE;
@@ -8970,6 +8978,24 @@ static enum menu_action ozone_parse_menu_entry_action(
89708978
break;
89718979
}
89728980

8981+
switch (new_action)
8982+
{
8983+
case MENU_ACTION_UP:
8984+
case MENU_ACTION_DOWN:
8985+
case MENU_ACTION_LEFT:
8986+
case MENU_ACTION_RIGHT:
8987+
case MENU_ACTION_CANCEL:
8988+
if ( settings->bools.input_menu_singleclick_playlists
8989+
&& ozone->animations.list_alpha < 1.0f)
8990+
{
8991+
ozone_animation_list_alpha(ozone, true);
8992+
new_action = MENU_ACTION_NOOP;
8993+
}
8994+
break;
8995+
default:
8996+
break;
8997+
}
8998+
89738999
return new_action;
89749000
}
89759001

@@ -9310,6 +9336,8 @@ static void ozone_refresh_thumbnail_image(void *data, size_t i)
93109336
ozone->flags &= ~OZONE_FLAG_SKIP_THUMBNAIL_RESET;
93119337
ozone_unload_thumbnail_textures(ozone);
93129338

9339+
ozone->flags |= OZONE_FLAG_FIRST_FRAME;
9340+
93139341
/* Refresh metadata */
93149342
if (!i)
93159343
ozone_update_content_metadata(ozone);
@@ -11950,15 +11978,6 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
1195011978
}
1195111979
}
1195211980

11953-
if (ozone->flags & OZONE_FLAG_FIRST_FRAME)
11954-
{
11955-
menu_input_get_pointer_state(&ozone->pointer);
11956-
11957-
ozone->cursor_x_old = ozone->pointer.x;
11958-
ozone->cursor_y_old = ozone->pointer.y;
11959-
ozone->flags &= ~OZONE_FLAG_FIRST_FRAME;
11960-
}
11961-
1196211981
/* OSK Fade detection */
1196311982
if (draw_osk != draw_osk_old)
1196411983
{
@@ -12337,6 +12356,21 @@ static void ozone_animation_end(void *userdata)
1233712356
ozone->animations.cursor_alpha = 1.0f;
1233812357
}
1233912358

12359+
static void ozone_animation_list_alpha(ozone_handle_t *ozone, bool fade_in)
12360+
{
12361+
struct gfx_animation_ctx_entry entry;
12362+
12363+
entry.cb = ozone_animation_end;
12364+
entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
12365+
entry.easing_enum = (fade_in) ? OZONE_EASING_ALPHA_IN : OZONE_EASING_ALPHA;
12366+
entry.subject = &ozone->animations.list_alpha;
12367+
entry.tag = (uintptr_t)NULL;
12368+
entry.target_value = (fade_in) ? 1.0f : 0.0f;
12369+
entry.userdata = ozone;
12370+
12371+
gfx_animation_push(&entry);
12372+
}
12373+
1234012374
static void ozone_list_open(
1234112375
ozone_handle_t *ozone,
1234212376
bool ozone_collapse_sidebar,
@@ -12347,6 +12381,9 @@ static void ozone_list_open(
1234712381

1234812382
ozone->flags |= OZONE_FLAG_DRAW_OLD_LIST;
1234912383

12384+
if (ozone->flags & OZONE_FLAG_FIRST_FRAME)
12385+
animate = false;
12386+
1235012387
/* Sidebar animation */
1235112388
ozone_sidebar_update_collapse(ozone, ozone_collapse_sidebar, animate);
1235212389

@@ -12386,8 +12423,6 @@ static void ozone_list_open(
1238612423
{
1238712424
if (animate)
1238812425
{
12389-
struct gfx_animation_ctx_entry entry;
12390-
1239112426
entry.cb = ozone_collapse_end;
1239212427
entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
1239312428
entry.easing_enum = OZONE_EASING_XY;
@@ -12406,14 +12441,13 @@ static void ozone_list_open(
1240612441
ozone->sidebar_offset = -ozone->dimensions_sidebar_width;
1240712442
}
1240812443

12409-
/* Left/right animation */
1241012444
if (animate)
1241112445
{
1241212446
ozone->animations.list_alpha = 0.0f;
1241312447

1241412448
entry.cb = ozone_animation_end;
12415-
entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
12416-
entry.easing_enum = OZONE_EASING_ALPHA;
12449+
entry.duration = ANIMATION_PUSH_ENTRY_DURATION / 2;
12450+
entry.easing_enum = OZONE_EASING_ALPHA_IN;
1241712451
entry.subject = &ozone->animations.list_alpha;
1241812452
entry.tag = (uintptr_t)NULL;
1241912453
entry.target_value = 1.0f;
@@ -12604,6 +12638,15 @@ static void ozone_populate_entries(
1260412638
if (ozone->categories_selection_ptr == ozone->categories_active_idx_old)
1260512639
ozone_list_open(ozone, ozone_collapse_sidebar, (!(ozone->flags & OZONE_FLAG_FIRST_FRAME)));
1260612640

12641+
if (ozone->flags & OZONE_FLAG_FIRST_FRAME)
12642+
{
12643+
menu_input_get_pointer_state(&ozone->pointer);
12644+
12645+
ozone->cursor_x_old = ozone->pointer.x;
12646+
ozone->cursor_y_old = ozone->pointer.y;
12647+
ozone->flags &= ~OZONE_FLAG_FIRST_FRAME;
12648+
}
12649+
1260712650
/* Reset savestate thumbnails always */
1260812651
ozone_update_savestate_thumbnail_path(ozone, (unsigned)menu_st->selection_ptr);
1260912652
ozone_update_savestate_thumbnail_image(ozone);
@@ -12753,6 +12796,9 @@ static void ozone_toggle(void *userdata, bool menu_on)
1275312796
gfx_animation_push(&entry);
1275412797
}
1275512798

12799+
/* Reset */
12800+
ozone->animations.list_alpha = 1.0f;
12801+
1275612802
/* Have to reset this, otherwise savestate
1275712803
* thumbnail won't update after selecting
1275812804
* 'save state' option */

0 commit comments

Comments
 (0)