From 15f9d35d3996e80669fc8d5bcb8f3eb508b1f7aa Mon Sep 17 00:00:00 2001 From: Jaime Moreira Date: Tue, 27 Aug 2024 13:10:25 -0400 Subject: [PATCH] Default button for 'Esc' in gamepad is now Start --- doc/040_cvarlist.md | 11 +++++------ src/client/input/sdl2.c | 10 +++++----- src/client/input/sdl3.c | 10 +++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index 595ad2c5..1eebcdc1 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -570,12 +570,11 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` `1`, which enables gamepad usage; `0` disables its detection at startup. Can only be set from command line. -* **in_sdlbackbutton**: Defines which button is used in the gamepad or - joystick as the `Esc` key, to access the main menu and 'cancel' / - 'go back' on its options. Default is `0`, which corresponds to the - Back/Select/Minus button. Set to `1` to use Start/Menu/Plus, and to - `2` to use the Guide/Home/PS button. Requires a game restart - (or controller replug) when changed. +* **in_sdlbackbutton**: Defines which button is used in the gamepad as + the `Esc` key, to pull the main menu and 'cancel' / 'go back' on its + options. Valid values are `0` = Back / Select / Minus, `1` = Start / + Menu / Plus (default), or `2` = Guide / Home / PS. Requires a game + restart, or gamepad replug, when changed. * **joy_layout**: Allows to select the stick layout of the gamepad. - `0`: *Default*, left stick moves, right aims diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c index 10be4ae4..3caf22d2 100644 --- a/src/client/input/sdl2.c +++ b/src/client/input/sdl2.c @@ -78,7 +78,7 @@ typedef enum // IN_Update() called at the beginning of a frame to the // actual movement functions called at a later time. static float mouse_x, mouse_y; -static unsigned char sdl_back_button = SDL_CONTROLLER_BUTTON_BACK; +static unsigned char sdl_back_button = SDL_CONTROLLER_BUTTON_START; static int joystick_left_x, joystick_left_y, joystick_right_x, joystick_right_y; static float gyro_yaw, gyro_pitch; static qboolean mlooking; @@ -2067,19 +2067,19 @@ IN_Controller_Init(qboolean notify_user) SDL_Joystick *joystick = NULL; SDL_bool is_controller = SDL_FALSE; - cvar = Cvar_Get("in_sdlbackbutton", "0", CVAR_ARCHIVE); + cvar = Cvar_Get("in_sdlbackbutton", "1", CVAR_ARCHIVE); if (cvar) { switch ((int)cvar->value) { - case 1: - sdl_back_button = SDL_CONTROLLER_BUTTON_START; + case 0: + sdl_back_button = SDL_CONTROLLER_BUTTON_BACK; break; case 2: sdl_back_button = SDL_CONTROLLER_BUTTON_GUIDE; break; default: - sdl_back_button = SDL_CONTROLLER_BUTTON_BACK; + sdl_back_button = SDL_CONTROLLER_BUTTON_START; } } diff --git a/src/client/input/sdl3.c b/src/client/input/sdl3.c index 1c72ab0e..49c259d2 100644 --- a/src/client/input/sdl3.c +++ b/src/client/input/sdl3.c @@ -81,7 +81,7 @@ typedef enum // IN_Update() called at the beginning of a frame to the // actual movement functions called at a later time. static float mouse_x, mouse_y; -static unsigned char sdl_back_button = SDL_GAMEPAD_BUTTON_BACK; +static unsigned char sdl_back_button = SDL_GAMEPAD_BUTTON_START; static int joystick_left_x, joystick_left_y, joystick_right_x, joystick_right_y; static float gyro_yaw, gyro_pitch; static qboolean mlooking; @@ -2053,19 +2053,19 @@ IN_Controller_Init(qboolean notify_user) SDL_Joystick *joystick = NULL; SDL_bool is_controller = SDL_FALSE; - cvar = Cvar_Get("in_sdlbackbutton", "0", CVAR_ARCHIVE); + cvar = Cvar_Get("in_sdlbackbutton", "1", CVAR_ARCHIVE); if (cvar) { switch ((int)cvar->value) { - case 1: - sdl_back_button = SDL_GAMEPAD_BUTTON_START; + case 0: + sdl_back_button = SDL_GAMEPAD_BUTTON_BACK; break; case 2: sdl_back_button = SDL_GAMEPAD_BUTTON_GUIDE; break; default: - sdl_back_button = SDL_GAMEPAD_BUTTON_BACK; + sdl_back_button = SDL_GAMEPAD_BUTTON_START; } }