mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 15:41:49 +01:00
Create separate output accel values
This commit is contained in:
parent
a32e80fe61
commit
8dca930400
@ -90,11 +90,11 @@ namespace DS4Windows
|
||||
buttons[(int)DS4Controls.TouchUpper] = tp != null ? (!priorMouse ? tp.upperDown : tp.priorUpperDown) : false;
|
||||
buttons[(int)DS4Controls.TouchMulti] = tp != null ? (!priorMouse ? tp.multiDown : tp.priorMultiDown) : false;
|
||||
|
||||
int sixAxisX = -exposeState.getAccelX();
|
||||
int sixAxisX = -exposeState.getOutputAccelX();
|
||||
gryodirs[(int)DS4Controls.GyroXPos] = sixAxisX > 0 ? sixAxisX : 0;
|
||||
gryodirs[(int)DS4Controls.GyroXNeg] = sixAxisX < 0 ? sixAxisX : 0;
|
||||
|
||||
int sixAxisZ = exposeState.getAccelZ();
|
||||
int sixAxisZ = exposeState.getOutputAccelZ();
|
||||
gryodirs[(int)DS4Controls.GyroZPos] = sixAxisZ > 0 ? sixAxisZ : 0;
|
||||
gryodirs[(int)DS4Controls.GyroZNeg] = sixAxisZ < 0 ? sixAxisZ : 0;
|
||||
|
||||
|
@ -914,17 +914,17 @@ namespace DS4Windows
|
||||
if (absx > SXD)
|
||||
{
|
||||
double ratioX = absx < maxValue ? (absx - SXD) / (double)(maxValue - SXD) : 1.0;
|
||||
dState.Motion.accelX = Math.Sign(gyroX) *
|
||||
dState.Motion.outputAccelX = Math.Sign(gyroX) *
|
||||
(int)Math.Min(128d, sxsens * 128d * ((1.0 - sxAntiDead) * ratioX + sxAntiDead));
|
||||
}
|
||||
else
|
||||
{
|
||||
dState.Motion.accelX = 0;
|
||||
dState.Motion.outputAccelX = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dState.Motion.accelX = Math.Sign(gyroX) *
|
||||
dState.Motion.outputAccelX = Math.Sign(gyroX) *
|
||||
(int)Math.Min(128d, sxsens * 128d * (absx / 128d));
|
||||
}
|
||||
|
||||
@ -934,51 +934,51 @@ namespace DS4Windows
|
||||
if (absz > SZD)
|
||||
{
|
||||
double ratioZ = absz < maxValue ? (absz - SZD) / (double)(maxValue - SZD) : 1.0;
|
||||
dState.Motion.accelZ = Math.Sign(gyroZ) *
|
||||
dState.Motion.outputAccelZ = Math.Sign(gyroZ) *
|
||||
(int)Math.Min(128d, szsens * 128d * ((1.0 - szAntiDead) * ratioZ + szAntiDead));
|
||||
}
|
||||
else
|
||||
{
|
||||
dState.Motion.accelZ = 0;
|
||||
dState.Motion.outputAccelZ = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dState.Motion.accelZ = Math.Sign(gyroZ) *
|
||||
dState.Motion.outputAccelZ = Math.Sign(gyroZ) *
|
||||
(int)Math.Min(128d, szsens * 128d * (absz / 128d));
|
||||
}
|
||||
|
||||
int sxOutCurveMode = tempIntArray[device] = getSXOutCurveMode(device);
|
||||
if (sxOutCurveMode > 0)
|
||||
{
|
||||
double temp = Math.Abs(dState.Motion.accelX) / 128.0;
|
||||
double temp = Math.Abs(dState.Motion.outputAccelX) / 128.0;
|
||||
double sign = Math.Sign(temp);
|
||||
if (sxOutCurveMode == 1)
|
||||
{
|
||||
double output = temp * temp;
|
||||
dState.Motion.accelX = (byte)(output * sign * 128.0);
|
||||
dState.Motion.outputAccelX = (byte)(output * sign * 128.0);
|
||||
}
|
||||
else if (sxOutCurveMode == 2)
|
||||
{
|
||||
double output = temp * temp * temp;
|
||||
dState.Motion.accelX = (byte)(output * 128.0);
|
||||
dState.Motion.outputAccelX = (byte)(output * 128.0);
|
||||
}
|
||||
}
|
||||
|
||||
int szOutCurveMode = tempIntArray[device] = getSZOutCurveMode(device);
|
||||
if (szOutCurveMode > 0)
|
||||
{
|
||||
double temp = Math.Abs(dState.Motion.accelZ) / 128.0;
|
||||
double temp = Math.Abs(dState.Motion.outputAccelZ) / 128.0;
|
||||
double sign = Math.Sign(temp);
|
||||
if (szOutCurveMode == 1)
|
||||
{
|
||||
double output = temp * temp;
|
||||
dState.Motion.accelZ = (byte)(output * sign * 128.0);
|
||||
dState.Motion.outputAccelZ = (byte)(output * sign * 128.0);
|
||||
}
|
||||
else if (szOutCurveMode == 2)
|
||||
{
|
||||
double output = temp * temp * temp;
|
||||
dState.Motion.accelZ = (byte)(output * 128.0);
|
||||
dState.Motion.outputAccelZ = (byte)(output * 128.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,13 @@ namespace DS4Windows
|
||||
public class SixAxis
|
||||
{
|
||||
public int gyroYaw, gyroPitch, gyroRoll, accelX, accelY, accelZ;
|
||||
public int outputAccelX, outputAccelY, outputAccelZ;
|
||||
public readonly int gyroYawFull, gyroPitchFull, gyroRollFull;
|
||||
public int accelXFull, accelYFull, accelZFull;
|
||||
public readonly int accelXFull, accelYFull, accelZFull;
|
||||
public readonly byte touchID;
|
||||
public readonly double elapsed;
|
||||
public readonly SixAxis previousAxis = null;
|
||||
|
||||
public SixAxis(int X, int Y, int Z, int aX, int aY, int aZ,
|
||||
double milliseconds, SixAxis prevAxis = null)
|
||||
{
|
||||
@ -35,6 +37,9 @@ namespace DS4Windows
|
||||
accelX = -aX / 64;
|
||||
accelY = -aY / 64;
|
||||
accelZ = aZ / 64;
|
||||
outputAccelX = accelX;
|
||||
outputAccelY = accelY;
|
||||
outputAccelZ = accelZ;
|
||||
|
||||
accelXFull = -aX;
|
||||
accelYFull = -aY;
|
||||
|
@ -78,5 +78,23 @@ namespace DS4Windows
|
||||
{
|
||||
return _state.Motion.accelZ;
|
||||
}
|
||||
|
||||
public int OutputAccelX { get { return _state.Motion.outputAccelX; } }
|
||||
public int getOutputAccelX()
|
||||
{
|
||||
return _state.Motion.outputAccelX;
|
||||
}
|
||||
|
||||
public int OutputAccelY { get { return _state.Motion.outputAccelY; } }
|
||||
public int getOutputAccelY()
|
||||
{
|
||||
return _state.Motion.outputAccelY;
|
||||
}
|
||||
|
||||
public int OutputAccelZ { get { return _state.Motion.outputAccelZ; } }
|
||||
public int getOutputAccelZ()
|
||||
{
|
||||
return _state.Motion.outputAccelZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user