From 55515a8c25006eca9e7c993bd915e837608cef61 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 8 Apr 2020 08:42:15 -0700 Subject: [PATCH] SDL: ps4 controller trigger bits on other controllers just mean that there's some activity, not saturation - only force it on if the analog value is 0. --- src/joystick/hidapi/SDL_hidapi_ps4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index a95c6e9a9..722e04b7a 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -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]) {