Default button for 'Esc' in gamepad is now Start

This commit is contained in:
Jaime Moreira 2024-08-27 13:10:25 -04:00
parent 68973b6ae7
commit 15f9d35d39
3 changed files with 15 additions and 16 deletions

View file

@ -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 `1`, which enables gamepad usage; `0` disables its detection at
startup. Can only be set from command line. startup. Can only be set from command line.
* **in_sdlbackbutton**: Defines which button is used in the gamepad or * **in_sdlbackbutton**: Defines which button is used in the gamepad as
joystick as the `Esc` key, to access the main menu and 'cancel' / the `Esc` key, to pull the main menu and 'cancel' / 'go back' on its
'go back' on its options. Default is `0`, which corresponds to the options. Valid values are `0` = Back / Select / Minus, `1` = Start /
Back/Select/Minus button. Set to `1` to use Start/Menu/Plus, and to Menu / Plus (default), or `2` = Guide / Home / PS. Requires a game
`2` to use the Guide/Home/PS button. Requires a game restart restart, or gamepad replug, when changed.
(or controller replug) when changed.
* **joy_layout**: Allows to select the stick layout of the gamepad. * **joy_layout**: Allows to select the stick layout of the gamepad.
- `0`: *Default*, left stick moves, right aims - `0`: *Default*, left stick moves, right aims

View file

@ -78,7 +78,7 @@ typedef enum
// IN_Update() called at the beginning of a frame to the // IN_Update() called at the beginning of a frame to the
// actual movement functions called at a later time. // actual movement functions called at a later time.
static float mouse_x, mouse_y; 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 int joystick_left_x, joystick_left_y, joystick_right_x, joystick_right_y;
static float gyro_yaw, gyro_pitch; static float gyro_yaw, gyro_pitch;
static qboolean mlooking; static qboolean mlooking;
@ -2067,19 +2067,19 @@ IN_Controller_Init(qboolean notify_user)
SDL_Joystick *joystick = NULL; SDL_Joystick *joystick = NULL;
SDL_bool is_controller = SDL_FALSE; SDL_bool is_controller = SDL_FALSE;
cvar = Cvar_Get("in_sdlbackbutton", "0", CVAR_ARCHIVE); cvar = Cvar_Get("in_sdlbackbutton", "1", CVAR_ARCHIVE);
if (cvar) if (cvar)
{ {
switch ((int)cvar->value) switch ((int)cvar->value)
{ {
case 1: case 0:
sdl_back_button = SDL_CONTROLLER_BUTTON_START; sdl_back_button = SDL_CONTROLLER_BUTTON_BACK;
break; break;
case 2: case 2:
sdl_back_button = SDL_CONTROLLER_BUTTON_GUIDE; sdl_back_button = SDL_CONTROLLER_BUTTON_GUIDE;
break; break;
default: default:
sdl_back_button = SDL_CONTROLLER_BUTTON_BACK; sdl_back_button = SDL_CONTROLLER_BUTTON_START;
} }
} }

View file

@ -81,7 +81,7 @@ typedef enum
// IN_Update() called at the beginning of a frame to the // IN_Update() called at the beginning of a frame to the
// actual movement functions called at a later time. // actual movement functions called at a later time.
static float mouse_x, mouse_y; 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 int joystick_left_x, joystick_left_y, joystick_right_x, joystick_right_y;
static float gyro_yaw, gyro_pitch; static float gyro_yaw, gyro_pitch;
static qboolean mlooking; static qboolean mlooking;
@ -2053,19 +2053,19 @@ IN_Controller_Init(qboolean notify_user)
SDL_Joystick *joystick = NULL; SDL_Joystick *joystick = NULL;
SDL_bool is_controller = SDL_FALSE; SDL_bool is_controller = SDL_FALSE;
cvar = Cvar_Get("in_sdlbackbutton", "0", CVAR_ARCHIVE); cvar = Cvar_Get("in_sdlbackbutton", "1", CVAR_ARCHIVE);
if (cvar) if (cvar)
{ {
switch ((int)cvar->value) switch ((int)cvar->value)
{ {
case 1: case 0:
sdl_back_button = SDL_GAMEPAD_BUTTON_START; sdl_back_button = SDL_GAMEPAD_BUTTON_BACK;
break; break;
case 2: case 2:
sdl_back_button = SDL_GAMEPAD_BUTTON_GUIDE; sdl_back_button = SDL_GAMEPAD_BUTTON_GUIDE;
break; break;
default: default:
sdl_back_button = SDL_GAMEPAD_BUTTON_BACK; sdl_back_button = SDL_GAMEPAD_BUTTON_START;
} }
} }