Skip to content

Commit

Permalink
SDL: ps4 controller trigger bits on other controllers just mean that …
Browse files Browse the repository at this point in the history
…there's some activity, not saturation - only force it on if the analog value is 0.
  • Loading branch information
slouken committed Apr 8, 2020
1 parent ba95fa6 commit 55515a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/joystick/hidapi/SDL_hidapi_ps4.c
Expand Up @@ -427,8 +427,8 @@ HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev, SDL_
*/
if ((packet->rgucButtonsHatAndCounter[1] & 0x0C) != 0) {
Uint8 data = packet->rgucButtonsHatAndCounter[1];
packet->ucTriggerLeft = (data & 0x04) ? 255 : packet->ucTriggerLeft;
packet->ucTriggerRight = (data & 0x08) ? 255 : packet->ucTriggerRight;
packet->ucTriggerLeft = (data & 0x04) && packet->ucTriggerLeft == 0 ? 255 : packet->ucTriggerLeft;
packet->ucTriggerRight = (data & 0x08) && packet->ucTriggerRight == 0 ? 255 : packet->ucTriggerRight;
}

if (ctx->last_state.rgucButtonsHatAndCounter[2] != packet->rgucButtonsHatAndCounter[2]) {
Expand Down

0 comments on commit 55515a8

Please sign in to comment.