Hopefully correct some behavior for axis to axis mappings

This commit is contained in:
Travis Nickles 2017-04-25 07:10:36 -07:00
parent 2b5ae4fd51
commit 05c94b677b

View File

@ -402,6 +402,8 @@ namespace DS4Windows
int x; int x;
int y; int y;
int curve; int curve;
/* TODO: Look into curve options and make sure maximum axes values are being respected */
int lsCurve = getLSCurve(device); int lsCurve = getLSCurve(device);
if (lsCurve > 0) if (lsCurve > 0)
{ {
@ -437,6 +439,7 @@ namespace DS4Windows
dState.LY = (byte)Math.Round(curvey, 0); dState.LY = (byte)Math.Round(curvey, 0);
} }
/* TODO: Look into curve options and make sure maximum axes values are being respected */
int rsCurve = getRSCurve(device); int rsCurve = getRSCurve(device);
if (rsCurve > 0) if (rsCurve > 0)
{ {
@ -1225,85 +1228,65 @@ namespace DS4Windows
{ {
case DS4Controls.LXNeg: case DS4Controls.LXNeg:
case DS4Controls.LXPos: case DS4Controls.LXPos:
{
if (Math.Abs(MappedState.LX - 127) < 10)
{ {
if (dc == DS4Controls.LXNeg) if (dc == DS4Controls.LXNeg)
{ {
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true); byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping);
if (Math.Abs(127 - axisMapping) > 5)
MappedState.LX = axisMapping; MappedState.LX = axisMapping;
} }
else else
{ {
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping); byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true);
if (Math.Abs(127 - axisMapping) > 5)
MappedState.LX = axisMapping; MappedState.LX = axisMapping;
} }
}
break; break;
} }
case DS4Controls.LYNeg: case DS4Controls.LYNeg:
case DS4Controls.LYPos: case DS4Controls.LYPos:
{
if (Math.Abs(MappedState.LY - 127) < 10)
{ {
if (dc == DS4Controls.LYNeg) if (dc == DS4Controls.LYNeg)
{ {
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping); byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping);
if (Math.Abs(127 - axisMapping) > 5)
MappedState.LY = axisMapping; MappedState.LY = axisMapping;
} }
else else
{ {
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true); byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true);
if (Math.Abs(127 - axisMapping) > 5)
MappedState.LY = axisMapping; MappedState.LY = axisMapping;
} }
}
break; break;
} }
case DS4Controls.RXNeg: case DS4Controls.RXNeg:
case DS4Controls.RXPos: case DS4Controls.RXPos:
{
if (Math.Abs(MappedState.RX - 127) < 10)
{ {
if (dc == DS4Controls.RXNeg) if (dc == DS4Controls.RXNeg)
{ {
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping); byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping);
if (Math.Abs(127 - axisMapping) > 5)
MappedState.RX = axisMapping; MappedState.RX = axisMapping;
} }
else else
{ {
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true); byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true);
if (Math.Abs(127 - axisMapping) > 5)
MappedState.RX = axisMapping; MappedState.RX = axisMapping;
} }
}
break; break;
} }
case DS4Controls.RYNeg: case DS4Controls.RYNeg:
case DS4Controls.RYPos: case DS4Controls.RYPos:
{
if (Math.Abs(MappedState.RY - 127) < 10)
{ {
if (dc == DS4Controls.RYNeg) if (dc == DS4Controls.RYNeg)
{ {
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping); byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping);
if (Math.Abs(127 - axisMapping) > 5)
MappedState.RY = axisMapping; MappedState.RY = axisMapping;
} }
else else
{ {
byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true); byte axisMapping = getXYAxisMapping2(device, key, cState, eState, tp, fieldMapping, true);
if (Math.Abs(127 - axisMapping) > 5)
MappedState.RY = axisMapping; MappedState.RY = axisMapping;
} }
}
break; break;
} }