From 0b2ea9454a9fd8bfe2cfbf0dc3d6251005ac1645 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Wed, 29 Jan 2020 12:39:52 -0600 Subject: [PATCH] Fixed type cast problems with Gyro output curves. Fixed Easeout Cubic. Related to issue #1045. --- DS4Windows/DS4Control/Mapping.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 6cf6526..584a576 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -1307,7 +1307,7 @@ namespace DS4Windows output = abs - 0.18; else // if (abs > 0.75) output = (abs * 1.72) - 0.72; - dState.Motion.outputAccelX = (byte)(output * sign * 128.0); + dState.Motion.outputAccelX = (int)(output * sign * 128.0); } else if (sxOutCurveMode == 2) { @@ -1325,14 +1325,15 @@ namespace DS4Windows { double abs = Math.Abs(temp); double output = abs * (abs - 2.0); - dState.Motion.outputAccelX = (byte)(-1.0 * output * + dState.Motion.outputAccelX = (int)(-1.0 * output * sign * 128.0); } else if (sxOutCurveMode == 5) { double inner = Math.Abs(temp) - 1.0; double output = inner * inner * inner + 1.0; - dState.Motion.outputAccelX = (byte)(-1.0 * output * 255.0); + dState.Motion.outputAccelX = (int)(output * + sign * 128.0); } else if (sxOutCurveMode == 6) { @@ -1357,7 +1358,7 @@ namespace DS4Windows output = abs - 0.18; else // if (abs > 0.75) output = (abs * 1.72) - 0.72; - dState.Motion.outputAccelZ = (byte)(output * sign * 128.0); + dState.Motion.outputAccelZ = (int)(output * sign * 128.0); } else if (szOutCurveMode == 2) { @@ -1375,14 +1376,15 @@ namespace DS4Windows { double abs = Math.Abs(temp); double output = abs * (abs - 2.0); - dState.Motion.outputAccelZ = (byte)(-1.0 * output * + dState.Motion.outputAccelZ = (int)(-1.0 * output * sign * 128.0); } else if (szOutCurveMode == 5) { double inner = Math.Abs(temp) - 1.0; double output = inner * inner * inner + 1.0; - dState.Motion.outputAccelZ = (byte)(-1.0 * output * 255.0); + dState.Motion.outputAccelZ = (int)(output * + sign * 128.0); } else if (szOutCurveMode == 6) {