Remove some unneeded checks

This commit is contained in:
Travis Nickles 2017-03-27 06:02:04 -07:00
parent 9cfae83569
commit 51dfa8b91b
2 changed files with 107 additions and 101 deletions

View File

@ -474,9 +474,10 @@ namespace DS4Windows
if (eastertime)
EasterTime(ind);
GetInputkeys(ind);
if (LSCurve[ind] != 0 || RSCurve[ind] != 0 || LSDeadzone[ind] != 0 || RSDeadzone[ind] != 0 ||
/*if (LSCurve[ind] != 0 || RSCurve[ind] != 0 || LSDeadzone[ind] != 0 || RSDeadzone[ind] != 0 ||
L2Deadzone[ind] != 0 || R2Deadzone[ind] != 0 || LSSens[ind] != 0 || RSSens[ind] != 0 ||
L2Sens[ind] != 0 || R2Sens[ind] != 0) //if a curve or deadzone is in place
*/
cState = Mapping.SetCurveAndDeadzone(ind, cState);
if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) ||
HasCustomAction(ind) || HasCustomExtras(ind) || ProfileActions[ind].Count > 0))

View File

@ -448,10 +448,11 @@ namespace DS4Windows
dState.RY = (byte)Math.Round(curvey, 0);
}
double lsSquared = Math.Pow(cState.LX - 127.5f, 2) + Math.Pow(cState.LY - 127.5f, 2);
//deadzones
int lsDeadzone = LSDeadzone[device];
int lsAntiDead = LSAntiDeadzone[device];
if (lsDeadzone > 0 || lsAntiDead > 0)
{
double lsSquared = Math.Pow(cState.LX - 127.5f, 2) + Math.Pow(cState.LY - 127.5f, 2);
double lsDeadzoneSquared = Math.Pow(lsDeadzone, 2);
if (lsDeadzone > 0 && lsSquared <= lsDeadzoneSquared)
{
@ -506,10 +507,13 @@ namespace DS4Windows
//dState.LX = (byte)(Math.Cos(r) * (127.5f + LSDeadzone[device]) + 127.5f);
//dState.LY = (byte)(Math.Sin(r) * (127.5f + LSDeadzone[device]) + 127.5f);
}
//Console.WriteLine
double rsSquared = Math.Pow(cState.RX - 127.5f, 2) + Math.Pow(cState.RY - 127.5f, 2);
}
int rsDeadzone = RSDeadzone[device];
int rsAntiDead = RSAntiDeadzone[device];
if (rsDeadzone > 0 || rsAntiDead > 0)
{
double rsSquared = Math.Pow(cState.RX - 127.5f, 2) + Math.Pow(cState.RY - 127.5f, 2);
double rsDeadzoneSquared = Math.Pow(rsDeadzone, 2);
if (rsDeadzone > 0 && rsSquared <= rsDeadzoneSquared)
{
@ -566,6 +570,7 @@ namespace DS4Windows
//dState.RX = (byte)(Math.Cos(r) * (127.5f + RSDeadzone[device]) + 127.5f);
//dState.RY = (byte)(Math.Sin(r) * (127.5f + RSDeadzone[device]) + 127.5f);
}
}
byte l2Deadzone = L2Deadzone[device];
if (l2Deadzone > 0)