Tweak mouse mapping method

This commit is contained in:
Travis Nickles 2017-04-13 20:23:44 -07:00
parent d72c8539e9
commit c0152f58c9

View File

@ -2086,81 +2086,123 @@ namespace DS4Windows
deadzoneL = 0; deadzoneL = 0;
if (RSDeadzone[device] >= 3) if (RSDeadzone[device] >= 3)
deadzoneR = 0; deadzoneR = 0;
double value = 0;
double value = 0.0;
int speed = ButtonMouseSensitivity[device] + 15; int speed = ButtonMouseSensitivity[device] + 15;
double root = 1.002; double root = 1.002;
double divide = 10000d; double divide = 10000d;
//DateTime now = mousenow[mnum]; //DateTime now = mousenow[mnum];
switch (control)
if (control >= DS4Controls.LXNeg && control <= DS4Controls.RYPos)
{ {
case DS4Controls.LXNeg: switch (control)
if (cState.LX - 127.5f < -deadzoneL) {
value = -(cState.LX - 127.5f) / 2550d * speed; case DS4Controls.LXNeg:
break; if (cState.LX - 127.5f < -deadzoneL)
case DS4Controls.LXPos: value = -(cState.LX - 127.5f) / 2550d * speed;
if (cState.LX - 127.5f > deadzoneL) break;
value = (cState.LX - 127.5f) / 2550d * speed; case DS4Controls.LXPos:
break; if (cState.LX - 127.5f > deadzoneL)
case DS4Controls.RXNeg: value = (cState.LX - 127.5f) / 2550d * speed;
if (cState.RX - 127.5f < -deadzoneR) break;
value = -(cState.RX - 127.5f) / 2550d * speed; case DS4Controls.RXNeg:
break; if (cState.RX - 127.5f < -deadzoneR)
case DS4Controls.RXPos: value = -(cState.RX - 127.5f) / 2550d * speed;
if (cState.RX - 127.5f > deadzoneR) break;
value = (cState.RX - 127.5f) / 2550d * speed; case DS4Controls.RXPos:
break; if (cState.RX - 127.5f > deadzoneR)
case DS4Controls.LYNeg: value = (cState.RX - 127.5f) / 2550d * speed;
if (cState.LY - 127.5f < -deadzoneL) break;
value = -(cState.LY - 127.5f) / 2550d * speed; case DS4Controls.LYNeg:
break; if (cState.LY - 127.5f < -deadzoneL)
case DS4Controls.LYPos: value = -(cState.LY - 127.5f) / 2550d * speed;
if (cState.LY - 127.5f > deadzoneL) break;
value = (cState.LY - 127.5f) / 2550d * speed; case DS4Controls.LYPos:
break; if (cState.LY - 127.5f > deadzoneL)
case DS4Controls.RYNeg: value = (cState.LY - 127.5f) / 2550d * speed;
if (cState.RY - 127.5f < -deadzoneR) break;
value = -(cState.RY - 127.5f) / 2550d * speed; case DS4Controls.RYNeg:
break; if (cState.RY - 127.5f < -deadzoneR)
case DS4Controls.RYPos: value = -(cState.RY - 127.5f) / 2550d * speed;
if (cState.RY - 127.5f > deadzoneR) break;
value = (cState.RY - 127.5f) / 2550d * speed; case DS4Controls.RYPos:
break; if (cState.RY - 127.5f > deadzoneR)
case DS4Controls.Share: value = (cState.Share ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; value = (cState.RY - 127.5f) / 2550d * speed;
case DS4Controls.Options: value = (cState.Options ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; break;
case DS4Controls.L1: value = (cState.L1 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; default: break;
case DS4Controls.R1: value = (cState.R1 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; }
case DS4Controls.L3: value = (cState.L3 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; }
case DS4Controls.R3: value = (cState.R3 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; else if (control >= DS4Controls.GyroXPos && control <= DS4Controls.GyroZNeg)
case DS4Controls.DpadUp: value = (cState.DpadUp ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; {
case DS4Controls.DpadDown: value = (cState.DpadDown ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; switch (control)
case DS4Controls.DpadLeft: value = (cState.DpadLeft ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; {
case DS4Controls.DpadRight: value = (cState.DpadRight ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; case DS4Controls.GyroXPos:
case DS4Controls.PS: value = (cState.PS ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; value = (byte)(eState.GyroX > SXD * 10 ? Math.Pow(root + speed / divide, eState.GyroX) : 0);
case DS4Controls.Cross: value = (cState.Cross ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; break;
case DS4Controls.Square: value = (cState.Square ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; case DS4Controls.GyroXNeg:
case DS4Controls.Triangle: value = (cState.Triangle ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; value = (byte)(eState.GyroX < -SXD * 10 ? Math.Pow(root + speed / divide, -eState.GyroX) : 0);
case DS4Controls.Circle: value = (cState.Circle ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; break;
case DS4Controls.L2: value = Math.Pow(root + speed / divide, cState.L2 / 2d) - 1; break; case DS4Controls.GyroZPos:
case DS4Controls.R2: value = Math.Pow(root + speed / divide, cState.R2 / 2d) - 1; break; value = (byte)(eState.GyroZ > SZD * 10 ? Math.Pow(root + speed / divide, eState.GyroZ) : 0);
case DS4Controls.GyroXPos: return (byte)(eState.GyroX > SXD * 10 ? break;
Math.Pow(root + speed / divide, eState.GyroX) : 0); case DS4Controls.GyroZNeg:
case DS4Controls.GyroXNeg: return (byte)(eState.GyroX < -SXD * 10 ? value = (byte)(eState.GyroZ < -SZD * 10 ? Math.Pow(root + speed / divide, -eState.GyroZ) : 0);
Math.Pow(root + speed / divide, -eState.GyroX) : 0); break;
case DS4Controls.GyroZPos: return (byte)(eState.GyroZ > SZD * 10 ?
Math.Pow(root + speed / divide, eState.GyroZ) : 0); default: break;
case DS4Controls.GyroZNeg: return (byte)(eState.GyroZ < -SZD * 10 ? }
Math.Pow(root + speed / divide, -eState.GyroZ) : 0); }
else if (control >= DS4Controls.DpadUp && control <= DS4Controls.DpadLeft)
{
switch (control)
{
case DS4Controls.DpadUp: value = (cState.DpadUp ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.DpadDown: value = (cState.DpadDown ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.DpadLeft: value = (cState.DpadLeft ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.DpadRight: value = (cState.DpadRight ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
default: break;
}
}
else if (control >= DS4Controls.Square && control <= DS4Controls.Cross)
{
switch (control)
{
case DS4Controls.Cross: value = (cState.Cross ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.Square: value = (cState.Square ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.Triangle: value = (cState.Triangle ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.Circle: value = (cState.Circle ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
default: break;
}
}
else if (control >= DS4Controls.L1 && control <= DS4Controls.R3)
{
switch (control)
{
case DS4Controls.L1: value = (cState.L1 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.L2: value = Math.Pow(root + speed / divide, cState.L2 / 2d) - 1; break;
case DS4Controls.L3: value = (cState.L3 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.R1: value = (cState.R1 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.R2: value = Math.Pow(root + speed / divide, cState.R2 / 2d) - 1; break;
case DS4Controls.R3: value = (cState.R3 ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
default: break;
}
}
else
{
switch (control)
{
case DS4Controls.Share: value = (cState.Share ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.Options: value = (cState.Options ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
case DS4Controls.PS: value = (cState.PS ? Math.Pow(root + speed / divide, 100) - 1 : 0); break;
default: break;
}
} }
bool LXChanged = (Math.Abs(127 - cState.LX) < deadzoneL); bool LXChanged = (Math.Abs(127 - cState.LX) < deadzoneL);
bool LYChanged = (Math.Abs(127 - cState.LY) < deadzoneL); bool LYChanged = (Math.Abs(127 - cState.LY) < deadzoneL);
bool RXChanged = (Math.Abs(127 - cState.RX) < deadzoneR); bool RXChanged = (Math.Abs(127 - cState.RX) < deadzoneR);
bool RYChanged = (Math.Abs(127 - cState.RY) < deadzoneR); bool RYChanged = (Math.Abs(127 - cState.RY) < deadzoneR);
/*bool contains = (control.ToString().Contains("LX") ||
control.ToString().Contains("LY") ||
control.ToString().Contains("RX") ||
control.ToString().Contains("RY"));
*/
bool contains = control >= DS4Controls.LXNeg && control <= DS4Controls.RYPos; bool contains = control >= DS4Controls.LXNeg && control <= DS4Controls.RYPos;
if (MouseAccel[device]) if (MouseAccel[device])
{ {