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)
{
case DS4Controls.LXNeg:
if (cState.LX < 127.5f - deadzoneL)
value = -(cState.LX - 127.5f - deadzoneL) / 2550d * speed;
if (cState.LX < 127 - deadzoneL)
value = -(cState.LX - 127 - deadzoneL) / 2550d * speed;
break;
case DS4Controls.LXPos:
if (cState.LX > 127.5f + deadzoneL)
value = (cState.LX - 127.5f + deadzoneL) / 2550d * speed;
if (cState.LX > 127 + deadzoneL)
value = (cState.LX - 127 + deadzoneL) / 2550d * speed;
break;
case DS4Controls.RXNeg:
if (cState.RX < 127.5f - deadzoneR)
value = -(cState.RX - 127.5f - deadzoneR) / 2550d * speed;
if (cState.RX < 127 - deadzoneR)
value = -(cState.RX - 127 - deadzoneR) / 2550d * speed;
break;
case DS4Controls.RXPos:
if (cState.RX > 127.5f + deadzoneR)
value = (cState.RX - 127.5f + deadzoneR) / 2550d * speed;
if (cState.RX > 127 + deadzoneR)
value = (cState.RX - 127 + deadzoneR) / 2550d * speed;
break;
case DS4Controls.LYNeg:
if (cState.LY < 127.5f - deadzoneL)
value = -(cState.LY - 127.5f - deadzoneL) / 2550d * speed;
if (cState.LY < 127 - deadzoneL)
value = -(cState.LY - 127 - deadzoneL) / 2550d * speed;
break;
case DS4Controls.LYPos:
if (cState.LY > 127.5f + deadzoneL)
value = (cState.LY - 127.5f + deadzoneL) / 2550d * speed;
if (cState.LY > 127 + deadzoneL)
value = (cState.LY - 127 + deadzoneL) / 2550d * speed;
break;
case DS4Controls.RYNeg:
if (cState.RY < 127 - deadzoneR)
value = -(cState.RY - 127.5f - deadzoneR) / 2550d * speed;
value = -(cState.RY - 127 - deadzoneR) / 2550d * speed;
break;
case DS4Controls.RYPos:
if (cState.RY > 127 + deadzoneR)
value = (cState.RY - 127.5f + deadzoneR) / 2550d * speed;
value = (cState.RY - 127 + deadzoneR) / 2550d * speed;
break;
default: break;
}