Add option for swapping menu scrolling buttons (#14577)

This commit is contained in:
sonninnos 2022-11-01 20:48:28 +02:00 committed by GitHub
parent aa3c8de64c
commit 1c7855acc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 52 additions and 6 deletions

View File

@ -897,6 +897,7 @@ static const unsigned input_backtouch_toggle = false;
#else
#define DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS false
#endif
#define DEFAULT_MENU_SWAP_SCROLL_BUTTONS false
#if defined(WIIU)
#define DEFAULT_ALL_USERS_CONTROL_MENU true

View File

@ -1609,6 +1609,7 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("input_remap_binds_enable", &settings->bools.input_remap_binds_enable, true, true, false);
SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, DEFAULT_ALL_USERS_CONTROL_MENU, false);
SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->bools.input_menu_swap_ok_cancel_buttons, true, DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS, false);
SETTING_BOOL("menu_swap_scroll_buttons", &settings->bools.input_menu_swap_scroll_buttons, true, DEFAULT_MENU_SWAP_SCROLL_BUTTONS, false);
#ifdef HAVE_NETWORKING
SETTING_BOOL("netplay_show_only_connectable", &settings->bools.netplay_show_only_connectable, true, DEFAULT_NETPLAY_SHOW_ONLY_CONNECTABLE, false);
SETTING_BOOL("netplay_show_only_installed_cores", &settings->bools.netplay_show_only_installed_cores, true, DEFAULT_NETPLAY_SHOW_ONLY_INSTALLED_CORES, false);

View File

@ -612,6 +612,7 @@ typedef struct settings
bool input_descriptor_hide_unbound;
bool input_all_users_control_menu;
bool input_menu_swap_ok_cancel_buttons;
bool input_menu_swap_scroll_buttons;
bool input_backtouch_enable;
bool input_backtouch_toggle;
bool input_small_keyboard_enable;

View File

@ -1534,6 +1534,10 @@ MSG_HASH(
MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL,
"menu_swap_ok_cancel"
)
MSG_HASH(
MENU_ENUM_LABEL_MENU_INPUT_SWAP_SCROLL,
"menu_swap_scroll"
)
MSG_HASH(
MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE,
"input_autodetect_enable"

View File

@ -2674,6 +2674,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL,
"Swap buttons for OK/Cancel. Disabled is the Japanese button orientation, enabled is the western orientation."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_SCROLL,
"Menu Swap Scroll Buttons"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_SCROLL,
"Swap buttons for scrolling. Disabled scrolls 10 items with L/R and alphabetically with L2/R2."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_INPUT_ALL_USERS_CONTROL_MENU,
"All Users Control Menu"

View File

@ -693,6 +693,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_sensors_enable, MENU_
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_auto_mouse_grab, MENU_ENUM_SUBLABEL_INPUT_AUTO_MOUSE_GRAB)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_auto_game_focus, MENU_ENUM_SUBLABEL_INPUT_AUTO_GAME_FOCUS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_swap_ok_cancel, MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_swap_scroll, MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_SCROLL)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_pause_libretro, MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_savestate_resume, MENU_ENUM_SUBLABEL_MENU_SAVESTATE_RESUME)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_insert_disk_resume, MENU_ENUM_SUBLABEL_MENU_INSERT_DISK_RESUME)
@ -3513,6 +3514,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_swap_ok_cancel);
break;
case MENU_ENUM_LABEL_MENU_INPUT_SWAP_SCROLL:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_swap_scroll);
break;
case MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_autodetect_enable);
break;

View File

@ -6990,6 +6990,10 @@ unsigned menu_displaylist_build_list(
MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_MENU_INPUT_SWAP_SCROLL,
PARSE_ONLY_BOOL, false) == 0)
count++;
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU,
PARSE_ONLY_BOOL, false) == 0)

View File

@ -5672,6 +5672,7 @@ unsigned menu_event(
bool menu_mouse_enable = settings->bools.menu_mouse_enable;
bool menu_pointer_enable = settings->bools.menu_pointer_enable;
bool swap_ok_cancel_btns = settings->bools.input_menu_swap_ok_cancel_buttons;
bool swap_scroll_btns = settings->bools.input_menu_swap_scroll_buttons;
bool menu_scroll_fast = settings->bools.menu_scroll_fast;
bool pointer_enabled = settings->bools.menu_pointer_enable;
unsigned input_touch_scale = settings->uints.input_touch_scale;
@ -5695,14 +5696,16 @@ unsigned menu_event(
unsigned i = 0;
static unsigned navigation_initial = 0;
unsigned navigation_current = 0;
unsigned navigation_buttons[6] =
unsigned navigation_buttons[8] =
{
RETRO_DEVICE_ID_JOYPAD_UP,
RETRO_DEVICE_ID_JOYPAD_DOWN,
RETRO_DEVICE_ID_JOYPAD_LEFT,
RETRO_DEVICE_ID_JOYPAD_RIGHT,
RETRO_DEVICE_ID_JOYPAD_L,
RETRO_DEVICE_ID_JOYPAD_R
RETRO_DEVICE_ID_JOYPAD_R,
RETRO_DEVICE_ID_JOYPAD_L2,
RETRO_DEVICE_ID_JOYPAD_R2
};
ok_old = ok_current;
@ -5996,22 +5999,22 @@ unsigned menu_event(
if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L))
{
menu_st->scroll.mode = MENU_SCROLL_PAGE;
menu_st->scroll.mode = (swap_scroll_btns) ? MENU_SCROLL_START_LETTER : MENU_SCROLL_PAGE;
ret = MENU_ACTION_SCROLL_UP;
}
else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_R))
{
menu_st->scroll.mode = MENU_SCROLL_PAGE;
menu_st->scroll.mode = (swap_scroll_btns) ? MENU_SCROLL_START_LETTER : MENU_SCROLL_PAGE;
ret = MENU_ACTION_SCROLL_DOWN;
}
else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L2))
{
menu_st->scroll.mode = MENU_SCROLL_START_LETTER;
menu_st->scroll.mode = (swap_scroll_btns) ? MENU_SCROLL_PAGE : MENU_SCROLL_START_LETTER;
ret = MENU_ACTION_SCROLL_UP;
}
else if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_R2))
{
menu_st->scroll.mode = MENU_SCROLL_START_LETTER;
menu_st->scroll.mode = (swap_scroll_btns) ? MENU_SCROLL_PAGE : MENU_SCROLL_START_LETTER;
ret = MENU_ACTION_SCROLL_DOWN;
}
else if (ok_trigger)

View File

@ -13738,6 +13738,22 @@ static bool setting_append_list(
SD_FLAG_NONE
);
CONFIG_BOOL(
list, list_info,
&settings->bools.input_menu_swap_scroll_buttons,
MENU_ENUM_LABEL_MENU_INPUT_SWAP_SCROLL,
MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_SCROLL,
DEFAULT_MENU_SWAP_SCROLL_BUTTONS,
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
);
CONFIG_BOOL(
list, list_info,
&settings->bools.input_all_users_control_menu,

View File

@ -1037,6 +1037,7 @@ enum msg_hash_enums
MENU_LABEL(INPUT_BIND_HOLD),
MENU_LABEL(INPUT_REMAP_BINDS_ENABLE),
MENU_LABEL(MENU_INPUT_SWAP_OK_CANCEL),
MENU_LABEL(MENU_INPUT_SWAP_SCROLL),
MENU_LABEL(INPUT_OVERLAY_ENABLE),
MENU_LABEL(INPUT_OSK_OVERLAY_ENABLE),
MENU_LABEL(INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO),

View File

@ -529,6 +529,9 @@
# Swap buttons for OK/Cancel
# menu_swap_ok_cancel_buttons = false
# Swap buttons for scrolling (10 items vs alphabetical)
# menu_swap_scroll_buttons = false
# Axis for RetroArch D-Pad.
# Needs to be either '+' or '-' in the first character signaling either positive or negative direction of the axis, then the axis number.
# Do note that every other input option has the corresponding _btn and _axis binds as well; they are omitted here for clarity.