diff --git a/input/input_driver.c b/input/input_driver.c index f3a88cbbe0..6b0fdc7802 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -817,14 +817,23 @@ uint64_t input_menu_keys_pressed(void) if (menu_input_dialog_get_display_kb()) return ret; - if (current_input->input_state(current_input_data, binds, 0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN)) - BIT64_SET(ret, RETRO_DEVICE_ID_JOYPAD_A); + { + if (!settings->input.menu_swap_ok_cancel_buttons) + BIT64_SET(ret, RETRO_DEVICE_ID_JOYPAD_A); + else + BIT64_SET(ret, RETRO_DEVICE_ID_JOYPAD_B); + } if (current_input->input_state(current_input_data, binds, 0, RETRO_DEVICE_KEYBOARD, 0, RETROK_BACKSPACE)) - BIT64_SET(ret, RETRO_DEVICE_ID_JOYPAD_B); + { + if (!settings->input.menu_swap_ok_cancel_buttons) + BIT64_SET(ret, RETRO_DEVICE_ID_JOYPAD_B); + else + BIT64_SET(ret, RETRO_DEVICE_ID_JOYPAD_A); + } if (current_input->input_state(current_input_data, binds, 0, RETRO_DEVICE_KEYBOARD, 0, RETROK_SPACE)) diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 1ccf0ebbce..6012342fdc 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -408,6 +408,8 @@ MSG_HASH(MENU_ENUM_LABEL_INFO_SCREEN, "info_screen") MSG_HASH(MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU, "all_users_control_menu") +MSG_HASH(MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL, + "menu_swap_ok_cancel") MSG_HASH(MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE, "input_autodetect_enable") MSG_HASH(MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index e2331c03ef..367eee2caf 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -612,6 +612,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AUTODETECT_ENABLE, "Autoconfig Enable") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, "Analog Stick Deadzone") +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, + "Menu Swap Ok & Cancel Buttons") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BACK_AS_MENU_ENUM_TOGGLE_ENABLE, "Back As Menu Toggle Enable") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index c4b0984e26..e6aec4b04a 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5317,6 +5317,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) #endif ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, PARSE_ONLY_UINT, false); + ret = menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL, PARSE_ONLY_BOOL, false); ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU, PARSE_ONLY_BOOL, false); ret = menu_displaylist_parse_settings_enum(menu, info, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 06906c21cb..9b0e53ce38 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3997,6 +3997,22 @@ static bool setting_append_list( general_read_handler); menu_settings_list_current_add_range(list, list_info, 0, 3, 1, true, true); + CONFIG_BOOL( + list, list_info, + &settings->input.menu_swap_ok_cancel_buttons, + MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL, + MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, + menu_swap_ok_cancel_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->input.all_users_control_menu, diff --git a/msg_hash.h b/msg_hash.h index d54dd29768..c594c1fb57 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -454,6 +454,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_INPUT_MAX_USERS, MENU_ENUM_LABEL_INPUT_REMAP_BINDS_ENABLE, MENU_ENUM_LABEL_INPUT_AXIS_THRESHOLD, + MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL, MENU_ENUM_LABEL_INPUT_SMALL_KEYBOARD_ENABLE, MENU_ENUM_LABEL_INPUT_TOUCH_ENABLE, MENU_ENUM_LABEL_INPUT_PREFER_FRONT_TOUCH, @@ -563,6 +564,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_INPUT_MAX_USERS, MENU_ENUM_LABEL_VALUE_INPUT_REMAP_BINDS_ENABLE, MENU_ENUM_LABEL_VALUE_INPUT_AXIS_THRESHOLD, + MENU_ENUM_LABEL_VALUE_MENU_INPUT_SWAP_OK_CANCEL, MENU_ENUM_LABEL_VALUE_INPUT_BIND_TIMEOUT, MENU_ENUM_LABEL_VALUE_INPUT_TURBO_PERIOD, MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_ENABLE,