# SDL: Added support for the trigger buttons on the Victrix Pro FS for PS5 (ab167)

**URL:** <https://discourse.libsdl.org/t/sdl-added-support-for-the-trigger-buttons-on-the-victrix-pro-fs-for-ps5-ab167/43052>\
**Category:** SDL Commits\
**Created:** [March 10, 2023, 11:48pm UTC](https://discourse.libsdl.org/t/sdl-added-support-for-the-trigger-buttons-on-the-victrix-pro-fs-for-ps5-ab167/43052 "2023-03-10T23:48:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [March 10, 2023, 11:48pm UTC](https://discourse.libsdl.org/t/sdl-added-support-for-the-trigger-buttons-on-the-victrix-pro-fs-for-ps5-ab167/43052/1 "2023-03-10T23:48:02Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/ab1670386f8716db0d3a9c5d4b69c0435b6db025>
>
> (cherry picked from commit 8d7e61ea42364c256b76e7f6f2b6d6f90742bcb7)

```diff
From ab1670386f8716db0d3a9c5d4b69c0435b6db025 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 10 Mar 2023 15:28:22 -0800
Subject: [PATCH] Added support for the trigger buttons on the Victrix Pro FS
 for PS5

(cherry picked from commit 8d7e61ea42364c256b76e7f6f2b6d6f90742bcb7)
---
 src/joystick/hidapi/SDL_hidapi_ps5.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index 7bf7d6258e86..1c1ca502d252 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -1186,9 +1186,17 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
         SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PS5_RIGHT_PADDLE, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
     }
 
- axis = ((int)packet->ucTriggerLeft * 257) - 32768;
+ if (packet->rgucButtonsAndHat[1] & 0x04) {
+ axis = SDL_JOYSTICK_AXIS_MAX;
+ } else {
+ axis = ((int)packet->ucTriggerLeft * 257) - 32768;
+ }
     SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
- axis = ((int)packet->ucTriggerRight * 257) - 32768;
+ if (packet->rgucButtonsAndHat[1] & 0x08) {
+ axis = SDL_JOYSTICK_AXIS_MAX;
+ } else {
+ axis = ((int)packet->ucTriggerRight * 257) - 32768;
+ }
     SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
     axis = ((int)packet->ucLeftJoystickX * 257) - 32768;
     SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);

```
