@@ -1084,9 +1084,17 @@ static void HIDAPI_DriverPS5_HandleSimpleStatePacket(SDL_Joystick *joystick, SDL
1084
1084
SDL_SendJoystickButton (timestamp , joystick , SDL_GAMEPAD_BUTTON_MISC1 , (data & 0x02 ) ? SDL_PRESSED : SDL_RELEASED );
1085
1085
}
1086
1086
1087
- axis = ((int )packet -> ucTriggerLeft * 257 ) - 32768 ;
1087
+ if (packet -> ucTriggerLeft == 0 && (packet -> rgucButtonsHatAndCounter [1 ] & 0x04 )) {
1088
+ axis = SDL_JOYSTICK_AXIS_MAX ;
1089
+ } else {
1090
+ axis = ((int )packet -> ucTriggerLeft * 257 ) - 32768 ;
1091
+ }
1088
1092
SDL_SendJoystickAxis (timestamp , joystick , SDL_GAMEPAD_AXIS_LEFT_TRIGGER , axis );
1089
- axis = ((int )packet -> ucTriggerRight * 257 ) - 32768 ;
1093
+ if (packet -> ucTriggerRight == 0 && (packet -> rgucButtonsHatAndCounter [1 ] & 0x08 )) {
1094
+ axis = SDL_JOYSTICK_AXIS_MAX ;
1095
+ } else {
1096
+ axis = ((int )packet -> ucTriggerRight * 257 ) - 32768 ;
1097
+ }
1090
1098
SDL_SendJoystickAxis (timestamp , joystick , SDL_GAMEPAD_AXIS_RIGHT_TRIGGER , axis );
1091
1099
axis = ((int )packet -> ucLeftJoystickX * 257 ) - 32768 ;
1092
1100
SDL_SendJoystickAxis (timestamp , joystick , SDL_GAMEPAD_AXIS_LEFTX , axis );
@@ -1183,13 +1191,13 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
1183
1191
SDL_SendJoystickButton (timestamp , joystick , SDL_CONTROLLER_BUTTON_PS5_RIGHT_PADDLE , (data & 0x80 ) ? SDL_PRESSED : SDL_RELEASED );
1184
1192
}
1185
1193
1186
- if (packet -> rgucButtonsAndHat [1 ] & 0x04 ) {
1194
+ if (packet -> ucTriggerLeft == 0 && ( packet -> rgucButtonsAndHat [1 ] & 0x04 ) ) {
1187
1195
axis = SDL_JOYSTICK_AXIS_MAX ;
1188
1196
} else {
1189
1197
axis = ((int )packet -> ucTriggerLeft * 257 ) - 32768 ;
1190
1198
}
1191
1199
SDL_SendJoystickAxis (timestamp , joystick , SDL_GAMEPAD_AXIS_LEFT_TRIGGER , axis );
1192
- if (packet -> rgucButtonsAndHat [1 ] & 0x08 ) {
1200
+ if (packet -> ucTriggerRight == 0 && ( packet -> rgucButtonsAndHat [1 ] & 0x08 ) ) {
1193
1201
axis = SDL_JOYSTICK_AXIS_MAX ;
1194
1202
} else {
1195
1203
axis = ((int )packet -> ucTriggerRight * 257 ) - 32768 ;
0 commit comments