Added support for the trigger buttons on the Victrix Pro FS for PS5

(cherry picked from commit 8d7e61ea42364c256b76e7f6f2b6d6f90742bcb7)
(cherry picked from commit ab1670386f8716db0d3a9c5d4b69c0435b6db025)
This commit is contained in:
Sam Lantinga 2023-03-10 15:28:22 -08:00
parent 384144d632
commit d94b944f91
1 changed files with 10 additions and 2 deletions

View File

@ -1178,9 +1178,17 @@ HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL_hid_device
SDL_PrivateJoystickButton(joystick, 16, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED);
}
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);
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);