mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 23:51: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.TouchUpper] = tp != null ? (!priorMouse ? tp.upperDown : tp.priorUpperDown) : false;
|
||||||
buttons[(int)DS4Controls.TouchMulti] = tp != null ? (!priorMouse ? tp.multiDown : tp.priorMultiDown) : 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.GyroXPos] = sixAxisX > 0 ? sixAxisX : 0;
|
||||||
gryodirs[(int)DS4Controls.GyroXNeg] = 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.GyroZPos] = sixAxisZ > 0 ? sixAxisZ : 0;
|
||||||
gryodirs[(int)DS4Controls.GyroZNeg] = sixAxisZ < 0 ? sixAxisZ : 0;
|
gryodirs[(int)DS4Controls.GyroZNeg] = sixAxisZ < 0 ? sixAxisZ : 0;
|
||||||
|
|
||||||
|
@ -914,17 +914,17 @@ namespace DS4Windows
|
|||||||
if (absx > SXD)
|
if (absx > SXD)
|
||||||
{
|
{
|
||||||
double ratioX = absx < maxValue ? (absx - SXD) / (double)(maxValue - SXD) : 1.0;
|
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));
|
(int)Math.Min(128d, sxsens * 128d * ((1.0 - sxAntiDead) * ratioX + sxAntiDead));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dState.Motion.accelX = 0;
|
dState.Motion.outputAccelX = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dState.Motion.accelX = Math.Sign(gyroX) *
|
dState.Motion.outputAccelX = Math.Sign(gyroX) *
|
||||||
(int)Math.Min(128d, sxsens * 128d * (absx / 128d));
|
(int)Math.Min(128d, sxsens * 128d * (absx / 128d));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,51 +934,51 @@ namespace DS4Windows
|
|||||||
if (absz > SZD)
|
if (absz > SZD)
|
||||||
{
|
{
|
||||||
double ratioZ = absz < maxValue ? (absz - SZD) / (double)(maxValue - SZD) : 1.0;
|
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));
|
(int)Math.Min(128d, szsens * 128d * ((1.0 - szAntiDead) * ratioZ + szAntiDead));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dState.Motion.accelZ = 0;
|
dState.Motion.outputAccelZ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dState.Motion.accelZ = Math.Sign(gyroZ) *
|
dState.Motion.outputAccelZ = Math.Sign(gyroZ) *
|
||||||
(int)Math.Min(128d, szsens * 128d * (absz / 128d));
|
(int)Math.Min(128d, szsens * 128d * (absz / 128d));
|
||||||
}
|
}
|
||||||
|
|
||||||
int sxOutCurveMode = tempIntArray[device] = getSXOutCurveMode(device);
|
int sxOutCurveMode = tempIntArray[device] = getSXOutCurveMode(device);
|
||||||
if (sxOutCurveMode > 0)
|
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);
|
double sign = Math.Sign(temp);
|
||||||
if (sxOutCurveMode == 1)
|
if (sxOutCurveMode == 1)
|
||||||
{
|
{
|
||||||
double output = temp * temp;
|
double output = temp * temp;
|
||||||
dState.Motion.accelX = (byte)(output * sign * 128.0);
|
dState.Motion.outputAccelX = (byte)(output * sign * 128.0);
|
||||||
}
|
}
|
||||||
else if (sxOutCurveMode == 2)
|
else if (sxOutCurveMode == 2)
|
||||||
{
|
{
|
||||||
double output = temp * temp * temp;
|
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);
|
int szOutCurveMode = tempIntArray[device] = getSZOutCurveMode(device);
|
||||||
if (szOutCurveMode > 0)
|
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);
|
double sign = Math.Sign(temp);
|
||||||
if (szOutCurveMode == 1)
|
if (szOutCurveMode == 1)
|
||||||
{
|
{
|
||||||
double output = temp * temp;
|
double output = temp * temp;
|
||||||
dState.Motion.accelZ = (byte)(output * sign * 128.0);
|
dState.Motion.outputAccelZ = (byte)(output * sign * 128.0);
|
||||||
}
|
}
|
||||||
else if (szOutCurveMode == 2)
|
else if (szOutCurveMode == 2)
|
||||||
{
|
{
|
||||||
double output = temp * temp * temp;
|
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 class SixAxis
|
||||||
{
|
{
|
||||||
public int gyroYaw, gyroPitch, gyroRoll, accelX, accelY, accelZ;
|
public int gyroYaw, gyroPitch, gyroRoll, accelX, accelY, accelZ;
|
||||||
|
public int outputAccelX, outputAccelY, outputAccelZ;
|
||||||
public readonly int gyroYawFull, gyroPitchFull, gyroRollFull;
|
public readonly int gyroYawFull, gyroPitchFull, gyroRollFull;
|
||||||
public int accelXFull, accelYFull, accelZFull;
|
public readonly int accelXFull, accelYFull, accelZFull;
|
||||||
public readonly byte touchID;
|
public readonly byte touchID;
|
||||||
public readonly double elapsed;
|
public readonly double elapsed;
|
||||||
public readonly SixAxis previousAxis = null;
|
public readonly SixAxis previousAxis = null;
|
||||||
|
|
||||||
public SixAxis(int X, int Y, int Z, int aX, int aY, int aZ,
|
public SixAxis(int X, int Y, int Z, int aX, int aY, int aZ,
|
||||||
double milliseconds, SixAxis prevAxis = null)
|
double milliseconds, SixAxis prevAxis = null)
|
||||||
{
|
{
|
||||||
@ -35,6 +37,9 @@ namespace DS4Windows
|
|||||||
accelX = -aX / 64;
|
accelX = -aX / 64;
|
||||||
accelY = -aY / 64;
|
accelY = -aY / 64;
|
||||||
accelZ = aZ / 64;
|
accelZ = aZ / 64;
|
||||||
|
outputAccelX = accelX;
|
||||||
|
outputAccelY = accelY;
|
||||||
|
outputAccelZ = accelZ;
|
||||||
|
|
||||||
accelXFull = -aX;
|
accelXFull = -aX;
|
||||||
accelYFull = -aY;
|
accelYFull = -aY;
|
||||||
|
@ -78,5 +78,23 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
return _state.Motion.accelZ;
|
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