diff --git a/config.def.h b/config.def.h index 625ae215fa..abf79e73fd 100644 --- a/config.def.h +++ b/config.def.h @@ -625,6 +625,7 @@ static bool back_as_menu_toggle_enable = true; #endif static bool all_users_control_menu = false; +static bool menu_swap_ok_cancel_buttons = false; /* Crop overscanned frames. */ static const bool crop_overscan = true; diff --git a/configuration.c b/configuration.c index 74cbc3f4df..009d6e2cf1 100644 --- a/configuration.c +++ b/configuration.c @@ -699,6 +699,7 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti SETTING_BOOL("input_remap_binds_enable", &settings->input.remap_binds_enable, true, true, false); SETTING_BOOL("back_as_menu_toggle_enable", &settings->input.back_as_menu_toggle_enable, true, true, false); SETTING_BOOL("all_users_control_menu", &settings->input.all_users_control_menu, true, all_users_control_menu, false); + SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->input.menu_swap_ok_cancel_buttons, true, menu_swap_ok_cancel_buttons, false); #ifdef HAVE_NETWORKING SETTING_BOOL("netplay_client_swap_input", &settings->netplay.swap_input, true, netplay_client_swap_input, false); #endif diff --git a/configuration.h b/configuration.h index 5eb700da4f..6d03dedc22 100644 --- a/configuration.h +++ b/configuration.h @@ -296,6 +296,8 @@ typedef struct settings unsigned menu_toggle_gamepad_combo; bool back_as_menu_toggle_enable; bool all_users_control_menu; + + bool menu_swap_ok_cancel_buttons; #if defined(VITA) bool backtouch_enable; bool backtouch_toggle; diff --git a/menu/menu_event.c b/menu/menu_event.c index 27574af55d..168cea11ba 100644 --- a/menu/menu_event.c +++ b/menu/menu_event.c @@ -347,6 +347,10 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input) trigger_input = 0; } + unsigned menu_ok_btn = settings->input.menu_swap_ok_cancel_buttons ? + RETRO_DEVICE_ID_JOYPAD_A: RETRO_DEVICE_ID_JOYPAD_B; + unsigned menu_cancel_btn = settings->input.menu_swap_ok_cancel_buttons ? + RETRO_DEVICE_ID_JOYPAD_B: RETRO_DEVICE_ID_JOYPAD_A; if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_UP)) ret = MENU_ACTION_UP; @@ -360,9 +364,9 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input) ret = MENU_ACTION_SCROLL_UP; else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_R)) ret = MENU_ACTION_SCROLL_DOWN; - else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_B)) + else if (trigger_input & (UINT64_C(1) << menu_ok_btn)) ret = MENU_ACTION_CANCEL; - else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_A)) + else if (trigger_input & (UINT64_C(1) << menu_cancel_btn)) ret = MENU_ACTION_OK; else if (trigger_input & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_X)) ret = MENU_ACTION_SEARCH;