From 23d558564f0c1c87d934e7ac7dd2c2ba422d2d37 Mon Sep 17 00:00:00 2001 From: sonninnos Date: Fri, 26 Mar 2021 03:06:56 +0200 Subject: [PATCH] Customizable menu scroll hold delay --- config.def.h | 2 ++ 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/menu_displaylist.c | 1 + menu/menu_setting.c | 15 +++++++++++++++ msg_hash.h | 1 + retroarch.c | 4 ++-- 10 files changed, 39 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 28f43ce69d..4f199f3b02 100644 --- a/config.def.h +++ b/config.def.h @@ -557,6 +557,8 @@ static const bool menu_show_sublabels = true; static const bool menu_dynamic_wallpaper_enable = true; static const bool menu_scroll_fast = false; +#define DEFAULT_MENU_SCROLL_DELAY 256 + #define DEFAULT_MENU_TICKER_TYPE (TICKER_TYPE_LOOP) static const float menu_ticker_speed = 2.0f; diff --git a/configuration.c b/configuration.c index 543cba8aca..82f2c32b00 100644 --- a/configuration.c +++ b/configuration.c @@ -1931,6 +1931,7 @@ static struct config_uint_setting *populate_settings_uint( SETTING_UINT("menu_timedate_style", &settings->uints.menu_timedate_style, true, DEFAULT_MENU_TIMEDATE_STYLE, false); SETTING_UINT("menu_timedate_date_separator", &settings->uints.menu_timedate_date_separator, true, DEFAULT_MENU_TIMEDATE_DATE_SEPARATOR, false); SETTING_UINT("menu_ticker_type", &settings->uints.menu_ticker_type, true, DEFAULT_MENU_TICKER_TYPE, false); + SETTING_UINT("menu_scroll_delay", &settings->uints.menu_scroll_delay, true, DEFAULT_MENU_SCROLL_DELAY, false); SETTING_UINT("content_show_add_entry", &settings->uints.menu_content_show_add_entry, true, DEFAULT_MENU_CONTENT_SHOW_ADD_ENTRY, false); #ifdef HAVE_RGUI SETTING_UINT("rgui_menu_color_theme", &settings->uints.menu_rgui_color_theme, true, DEFAULT_RGUI_COLOR_THEME, false); diff --git a/configuration.h b/configuration.h index d758fe630e..660d2db105 100644 --- a/configuration.h +++ b/configuration.h @@ -247,6 +247,7 @@ typedef struct settings unsigned menu_rgui_aspect_ratio_lock; unsigned menu_rgui_particle_effect; unsigned menu_ticker_type; + unsigned menu_scroll_delay; unsigned menu_content_show_add_entry; unsigned playlist_entry_remove_enable; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index a18aea217a..709f1d708c 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -3818,6 +3818,10 @@ MSG_HASH( MENU_ENUM_LABEL_MENU_SCROLL_FAST, "menu_scroll_fast" ) +MSG_HASH( + MENU_ENUM_LABEL_MENU_SCROLL_DELAY, + "menu_scroll_delay" + ) MSG_HASH( MENU_ENUM_LABEL_CORE_LOCK, "core_lock" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 46fb268262..2e0df9d1cb 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3987,6 +3987,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_MENU_SCROLL_FAST, "Maximum speed of the cursor when holding a direction to scroll." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_SCROLL_DELAY, + "Menu Scroll Delay" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MENU_SCROLL_DELAY, + "Initial delay in milliseconds when holding a direction to scroll." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE, "UI Companion" diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 50221cbb60..9875942d7a 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -784,6 +784,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_online_updater, DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_core_updater, MENU_ENUM_SUBLABEL_MENU_SHOW_CORE_UPDATER) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_legacy_thumbnail_updater, MENU_ENUM_SUBLABEL_MENU_SHOW_LEGACY_THUMBNAIL_UPDATER) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_scroll_fast, MENU_ENUM_SUBLABEL_MENU_SCROLL_FAST) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_scroll_delay, MENU_ENUM_SUBLABEL_MENU_SCROLL_DELAY) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_music_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_MUSIC) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_video_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_VIDEO) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_netplay_tab, MENU_ENUM_SUBLABEL_CONTENT_SHOW_NETPLAY) @@ -2303,6 +2304,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_MENU_SCROLL_FAST: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_scroll_fast); break; + case MENU_ENUM_LABEL_MENU_SCROLL_DELAY: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_scroll_delay); + break; case MENU_ENUM_LABEL_CONTENT_SHOW_NETPLAY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_netplay_tab); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index ccb48b80a3..8ef0c97aa8 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7297,6 +7297,7 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_MENU_KIOSK_MODE_PASSWORD, PARSE_ONLY_STRING, false}, {MENU_ENUM_LABEL_NAVIGATION_WRAPAROUND, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_MENU_SCROLL_FAST, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_MENU_SCROLL_DELAY, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_PAUSE_LIBRETRO, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_PAUSE_NONACTIVE, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_MENU_SAVESTATE_RESUME, PARSE_ONLY_BOOL, true}, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 94d449a0e5..1e9272cc90 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -16994,6 +16994,21 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_UINT( + list, list_info, + &settings->uints.menu_scroll_delay, + MENU_ENUM_LABEL_MENU_SCROLL_DELAY, + MENU_ENUM_LABEL_VALUE_MENU_SCROLL_DELAY, + DEFAULT_MENU_SCROLL_DELAY, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].offset_by = 1; + menu_settings_list_current_add_range(list, list_info, 1, 999, 1, true, true); + CONFIG_BOOL( list, list_info, &settings->bools.ui_companion_enable, diff --git a/msg_hash.h b/msg_hash.h index 368298c47b..811c01e473 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1091,6 +1091,7 @@ enum msg_hash_enums MENU_LABEL(MENU_SHOW_CORE_UPDATER), MENU_LABEL(MENU_SHOW_LEGACY_THUMBNAIL_UPDATER), MENU_LABEL(MENU_SCROLL_FAST), + MENU_LABEL(MENU_SCROLL_DELAY), MENU_LABEL(MENU_ENABLE_KIOSK_MODE), MENU_LABEL(MENU_DISABLE_KIOSK_MODE), MENU_LABEL(MENU_KIOSK_MODE_PASSWORD), diff --git a/retroarch.c b/retroarch.c index d4135b5267..77fa18a993 100644 --- a/retroarch.c +++ b/retroarch.c @@ -23724,9 +23724,9 @@ static unsigned menu_event( first_held = true; if (menu_scroll_fast) - delay_timer = initial_held ? 256 : 100; + delay_timer = initial_held ? settings->uints.menu_scroll_delay : 100; else - delay_timer = initial_held ? 256 : 20; + delay_timer = initial_held ? settings->uints.menu_scroll_delay : 20; delay_count = 0; }