diff --git a/code/client/cl_keys.c b/code/client/cl_keys.c index c786f526df..ef134fc779 100644 --- a/code/client/cl_keys.c +++ b/code/client/cl_keys.c @@ -316,6 +316,13 @@ keyname_t keynames[] = {"PAD0_LEFTTRIGGER", K_PAD0_LEFTTRIGGER }, {"PAD0_RIGHTTRIGGER", K_PAD0_RIGHTTRIGGER }, + {"PAD0_MISC1", K_PAD0_MISC1 }, + {"PAD0_PADDLE1", K_PAD0_PADDLE1 }, + {"PAD0_PADDLE2", K_PAD0_PADDLE2 }, + {"PAD0_PADDLE3", K_PAD0_PADDLE3 }, + {"PAD0_PADDLE4", K_PAD0_PADDLE4 }, + {"PAD0_TOUCHPAD", K_PAD0_TOUCHPAD }, + {NULL,0} }; diff --git a/code/client/keycodes.h b/code/client/keycodes.h index e813368c13..c460ef50a0 100644 --- a/code/client/keycodes.h +++ b/code/client/keycodes.h @@ -290,6 +290,13 @@ typedef enum { K_PAD0_LEFTTRIGGER, K_PAD0_RIGHTTRIGGER, + K_PAD0_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button */ + K_PAD0_PADDLE1, /* Xbox Elite paddle P1 */ + K_PAD0_PADDLE2, /* Xbox Elite paddle P3 */ + K_PAD0_PADDLE3, /* Xbox Elite paddle P2 */ + K_PAD0_PADDLE4, /* Xbox Elite paddle P4 */ + K_PAD0_TOUCHPAD, /* PS4/PS5 touchpad button */ + // Pseudo-key that brings the console down K_CONSOLE, diff --git a/code/qcommon/vm_x86.c b/code/qcommon/vm_x86.c index 8d6321a69a..db7c22cabf 100644 --- a/code/qcommon/vm_x86.c +++ b/code/qcommon/vm_x86.c @@ -42,7 +42,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif #endif -#if defined (__i386__) || defined(__x86_64__) +#if defined (__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) static void VM_Destroy_Compiled(vm_t* self); /* diff --git a/code/sdl/sdl_input.c b/code/sdl/sdl_input.c index 63274c61d2..390f7b3b33 100644 --- a/code/sdl/sdl_input.c +++ b/code/sdl/sdl_input.c @@ -503,7 +503,10 @@ static void IN_InitJoystick( void ) Q_strcat(buf, sizeof(buf), "\n"); } - Cvar_Get( "in_availableJoysticks", buf, CVAR_ROM ); + Cvar_Get( "in_availableJoysticks", "", CVAR_ROM ); + + // Update cvar on in_restart or controller add/remove. + Cvar_Set( "in_availableJoysticks", buf ); if( !in_joystick->integer ) { Com_DPrintf( "Joystick is not active.\n" ); @@ -657,7 +660,14 @@ static void IN_GamepadMove( void ) qboolean pressed = SDL_GameControllerGetButton(gamepad, SDL_CONTROLLER_BUTTON_A + i); if (pressed != stick_state.buttons[i]) { - Com_QueueEvent(in_eventTime, SE_KEY, K_PAD0_A + i, pressed, 0, NULL); +#if SDL_VERSION_ATLEAST( 2, 0, 14 ) + if ( i >= SDL_CONTROLLER_BUTTON_MISC1 ) { + Com_QueueEvent(in_eventTime, SE_KEY, K_PAD0_MISC1 + i - SDL_CONTROLLER_BUTTON_MISC1, pressed, 0, NULL); + } else +#endif + { + Com_QueueEvent(in_eventTime, SE_KEY, K_PAD0_A + i, pressed, 0, NULL); + } stick_state.buttons[i] = pressed; } }