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

main
Sam Lantinga 2023-03-10 15:28:22 -08:00
parent 06183989e1
commit fc1af1dfde
1 changed files with 10 additions and 2 deletions

View File

@ -1183,9 +1183,17 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
SDL_SendJoystickButton(timestamp, 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_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, 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_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, axis);
axis = ((int)packet->ucLeftJoystickX * 257) - 32768;
SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);