add setting to swap menu_ok and menu_cancel

This commit is contained in:
radius 2016-11-19 13:09:07 -05:00
parent f343bc45fb
commit a99a9c0810
4 changed files with 10 additions and 2 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;