diff options
author | Billy Laws <blaws05@gmail.com> | 2020-09-19 16:10:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 17:10:53 +0200 |
commit | 4b1bed1b051439a95adcc03da4175741dbdf5bb4 (patch) | |
tree | b59ab96e09c486fec496e673eb1e6dd902d9e3fc /Ryujinx.HLE/HOS/Services | |
parent | 2ce59c44bcb2d789f4d6312b26cf41f36915d73c (diff) |
Correct the threshold for control stick buttons (#1483)
This was tested against HW with https://github.com/Xpl0itR/Input-Test/tree/master/Input-Test and a few changes to record the minimum value axis value when the stick buttons were marked as pressed.
Diffstat (limited to 'Ryujinx.HLE/HOS/Services')
-rw-r--r-- | Ryujinx.HLE/HOS/Services/Hid/Hid.cs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Hid/Hid.cs b/Ryujinx.HLE/HOS/Services/Hid/Hid.cs index 2db67619..18a7ba11 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/Hid.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/Hid.cs @@ -87,17 +87,18 @@ namespace Ryujinx.HLE.HOS.Services.Hid public ControllerKeys UpdateStickButtons(JoystickPosition leftStick, JoystickPosition rightStick) { + const int stickButtonThreshold = short.MaxValue / 2; ControllerKeys result = 0; - result |= (leftStick.Dx < 0) ? ControllerKeys.LStickLeft : result; - result |= (leftStick.Dx > 0) ? ControllerKeys.LStickRight : result; - result |= (leftStick.Dy < 0) ? ControllerKeys.LStickDown : result; - result |= (leftStick.Dy > 0) ? ControllerKeys.LStickUp : result; + result |= (leftStick.Dx < -stickButtonThreshold) ? ControllerKeys.LStickLeft : result; + result |= (leftStick.Dx > stickButtonThreshold) ? ControllerKeys.LStickRight : result; + result |= (leftStick.Dy < -stickButtonThreshold) ? ControllerKeys.LStickDown : result; + result |= (leftStick.Dy > stickButtonThreshold) ? ControllerKeys.LStickUp : result; - result |= (rightStick.Dx < 0) ? ControllerKeys.RStickLeft : result; - result |= (rightStick.Dx > 0) ? ControllerKeys.RStickRight : result; - result |= (rightStick.Dy < 0) ? ControllerKeys.RStickDown : result; - result |= (rightStick.Dy > 0) ? ControllerKeys.RStickUp : result; + result |= (rightStick.Dx < -stickButtonThreshold) ? ControllerKeys.RStickLeft : result; + result |= (rightStick.Dx > stickButtonThreshold) ? ControllerKeys.RStickRight : result; + result |= (rightStick.Dy < -stickButtonThreshold) ? ControllerKeys.RStickDown : result; + result |= (rightStick.Dy > stickButtonThreshold) ? ControllerKeys.RStickUp : result; return result; } |