From 5ae1b8800f9c8357e2b2bb369d88a004ab296994 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sat, 7 Sep 2019 11:57:32 -0500 Subject: [PATCH] Use max displacement from center for Mouse Joystick and RS conflict Related to issue #807 --- DS4Windows/DS4Control/Mapping.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 5f2a619..9cbf6ca 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -1874,9 +1874,25 @@ namespace DS4Windows } ref byte gyroTempX = ref gyroStickX[device]; - if (gyroTempX != 128) MappedState.RX = gyroTempX; + if (gyroTempX != 128) + { + if (MappedState.RX != 128) + MappedState.RX = Math.Abs(gyroTempX - 128) > Math.Abs(MappedState.RX - 128) ? + gyroTempX : MappedState.RX; + else + MappedState.RX = gyroTempX; + } + ref byte gyroTempY = ref gyroStickY[device]; - if (gyroTempY != 128) MappedState.RY = gyroTempY; + if (gyroTempY != 128) + { + if (MappedState.RY != 128) + MappedState.RY = Math.Abs(gyroTempY - 128) > Math.Abs(MappedState.RY - 128) ? + gyroTempY : MappedState.RY; + else + MappedState.RY = gyroTempY; + } + gyroTempX = gyroTempY = 128; calculateFinalMouseMovement(ref tempMouseDeltaX, ref tempMouseDeltaY,