Fix drifting mouse around dead zone

This commit is contained in:
Travis Nickles 2017-04-15 00:07:56 -07:00
parent babed4eaf1
commit 269ca4782f

View File

@ -2101,36 +2101,36 @@ namespace DS4Windows
switch (control) switch (control)
{ {
case DS4Controls.LXNeg: case DS4Controls.LXNeg:
if (cState.LX < 127.5f - deadzoneL) if (cState.LX < 127 - deadzoneL)
value = -(cState.LX - 127.5f - deadzoneL) / 2550d * speed; value = -(cState.LX - 127 - deadzoneL) / 2550d * speed;
break; break;
case DS4Controls.LXPos: case DS4Controls.LXPos:
if (cState.LX > 127.5f + deadzoneL) if (cState.LX > 127 + deadzoneL)
value = (cState.LX - 127.5f + deadzoneL) / 2550d * speed; value = (cState.LX - 127 + deadzoneL) / 2550d * speed;
break; break;
case DS4Controls.RXNeg: case DS4Controls.RXNeg:
if (cState.RX < 127.5f - deadzoneR) if (cState.RX < 127 - deadzoneR)
value = -(cState.RX - 127.5f - deadzoneR) / 2550d * speed; value = -(cState.RX - 127 - deadzoneR) / 2550d * speed;
break; break;
case DS4Controls.RXPos: case DS4Controls.RXPos:
if (cState.RX > 127.5f + deadzoneR) if (cState.RX > 127 + deadzoneR)
value = (cState.RX - 127.5f + deadzoneR) / 2550d * speed; value = (cState.RX - 127 + deadzoneR) / 2550d * speed;
break; break;
case DS4Controls.LYNeg: case DS4Controls.LYNeg:
if (cState.LY < 127.5f - deadzoneL) if (cState.LY < 127 - deadzoneL)
value = -(cState.LY - 127.5f - deadzoneL) / 2550d * speed; value = -(cState.LY - 127 - deadzoneL) / 2550d * speed;
break; break;
case DS4Controls.LYPos: case DS4Controls.LYPos:
if (cState.LY > 127.5f + deadzoneL) if (cState.LY > 127 + deadzoneL)
value = (cState.LY - 127.5f + deadzoneL) / 2550d * speed; value = (cState.LY - 127 + deadzoneL) / 2550d * speed;
break; break;
case DS4Controls.RYNeg: case DS4Controls.RYNeg:
if (cState.RY < 127 - deadzoneR) if (cState.RY < 127 - deadzoneR)
value = -(cState.RY - 127.5f - deadzoneR) / 2550d * speed; value = -(cState.RY - 127 - deadzoneR) / 2550d * speed;
break; break;
case DS4Controls.RYPos: case DS4Controls.RYPos:
if (cState.RY > 127 + deadzoneR) if (cState.RY > 127 + deadzoneR)
value = (cState.RY - 127.5f + deadzoneR) / 2550d * speed; value = (cState.RY - 127 + deadzoneR) / 2550d * speed;
break; break;
default: break; default: break;
} }