Fixed a couple of issue with gyro mappings

This commit is contained in:
Travis Nickles 2017-04-28 13:06:58 -07:00
parent ca2074d76f
commit 9e153fff97
2 changed files with 48 additions and 40 deletions

View File

@ -95,11 +95,13 @@ namespace DS4Windows
buttons[(int)DS4Controls.TouchUpper] = tp != null ? tp.upperDown : false;
buttons[(int)DS4Controls.TouchMulti] = tp != null ? tp.multiDown : false;
gryodirs[(int)DS4Controls.GyroXNeg] = exposeState.getGyroX();
gryodirs[(int)DS4Controls.GyroXPos] = exposeState.getGyroX();
int gyroX = exposeState.getGyroX();
gryodirs[(int)DS4Controls.GyroXPos] = gyroX;
gryodirs[(int)DS4Controls.GyroXNeg] = gyroX;
gryodirs[(int)DS4Controls.GyroZPos] = exposeState.getGyroZ();
gryodirs[(int)DS4Controls.GyroZPos] = exposeState.getGyroZ();
int gyroZ = exposeState.getGyroZ();
gryodirs[(int)DS4Controls.GyroZPos] = gyroZ;
gryodirs[(int)DS4Controls.GyroZNeg] = gyroZ;
swipedirs[(int)DS4Controls.SwipeLeft] = tp != null ? tp.swipeLeftB : (byte)0;
swipedirs[(int)DS4Controls.SwipeRight] = tp != null ? tp.swipeRightB : (byte)0;

View File

@ -2619,13 +2619,14 @@ namespace DS4Windows
{
bool sOff = isUsingSAforMouse(device);
bool safeTest = false;
if (control == DS4Controls.GyroXNeg || control == DS4Controls.GyroZNeg)
switch (control)
{
safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] > 67;
}
else
{
safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] < -67;
case DS4Controls.GyroXPos: safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] > 67; break;
case DS4Controls.GyroXNeg: safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] < -67; break;
case DS4Controls.GyroZPos: safeTest = SZSens[device] * fieldMap.gryodirs[controlNum] > 67; break;
case DS4Controls.GyroZNeg: safeTest = SZSens[device] * fieldMap.gryodirs[controlNum] < -67; break;
default: break;
}
result = !sOff ? safeTest : false;
@ -2780,13 +2781,14 @@ namespace DS4Windows
{
bool sOff = isUsingSAforMouse(device);
bool safeTest = false;
if (control == DS4Controls.GyroXNeg || control == DS4Controls.GyroZNeg)
switch (control)
{
safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] > 67;
}
else
{
safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] < -67;
case DS4Controls.GyroXPos: safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] > 67; break;
case DS4Controls.GyroXNeg: safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] < -67; break;
case DS4Controls.GyroZPos: safeTest = SZSens[device] * fieldMap.gryodirs[controlNum] > 67; break;
case DS4Controls.GyroZNeg: safeTest = SZSens[device] * fieldMap.gryodirs[controlNum] < -67; break;
default: break;
}
result = !sOff ? safeTest : false;
@ -3086,41 +3088,45 @@ namespace DS4Windows
double SZD = getSZDeadzone(device);
bool sOff = isUsingSAforMouse(device);
if (control == DS4Controls.GyroXNeg || control == DS4Controls.GyroZNeg)
switch (control)
{
if (!sOff && fieldMap.gryodirs[controlNum] < -SXD * 10)
{
if (alt)
{
result = (byte)Math.Min(255, 127 + SXSens[device] * -fieldMap.gryodirs[controlNum]);
}
else
{
result = (byte)Math.Max(0, 127 - SXSens[device] * -fieldMap.gryodirs[controlNum]);
}
}
else
{
result = falseVal;
}
}
else
case DS4Controls.GyroXPos:
{
if (!sOff && fieldMap.gryodirs[controlNum] > SXD * 10)
{
if (alt)
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - SXSens[device] * fieldMap.gryodirs[controlNum]);
}
else result = falseVal;
break;
}
case DS4Controls.GyroXNeg:
{
result = (byte)Math.Min(255, 127 + SXSens[device] * fieldMap.gryodirs[controlNum]);
}
else
if (!sOff && fieldMap.gryodirs[controlNum] < -SXD * 10)
{
result = (byte)Math.Max(0, 127 - SXSens[device] * fieldMap.gryodirs[controlNum]);
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * -fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - SXSens[device] * -fieldMap.gryodirs[controlNum]);
}
else result = falseVal;
break;
}
else
case DS4Controls.GyroZPos:
{
result = falseVal;
if (!sOff && fieldMap.gryodirs[controlNum] > SZD * 10)
{
if (alt) result = (byte)Math.Min(255, 127 + SZSens[device] * fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - SZSens[device] * fieldMap.gryodirs[controlNum]);
}
else return falseVal;
break;
}
case DS4Controls.GyroZNeg:
{
if (!sOff && fieldMap.gryodirs[controlNum] < -SZD * 10)
{
if (alt) result = (byte)Math.Min(255, 127 + SZSens[device] * -fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - SZSens[device] * -fieldMap.gryodirs[controlNum]);
}
else result = falseVal;
break;
}
default: break;
}
}