mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 05:31:12 +01:00
Correct touchpad X coordinate. Change DS4State.
This commit is contained in:
parent
60a21a9fe3
commit
473958ba1a
@ -847,8 +847,9 @@ namespace DS4Windows
|
||||
cState.Touch2Identifier = (byte)(inputReport[4 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0x7f);
|
||||
cState.Touch1Finger = cState.Touch1 || cState.Touch2; // >= 1 touch detected
|
||||
cState.Touch2Fingers = cState.Touch1 && cState.Touch2; // 2 touches detected
|
||||
cState.TouchLeft = (inputReport[1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] + ((inputReport[2 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0xF) * 255) >= 1920 * 2 / 5) ? false : true;
|
||||
cState.TouchRight = (inputReport[1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] + ((inputReport[2 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0xF) * 255) < 1920 * 2 / 5) ? false : true;
|
||||
int touchX = (((inputReport[2 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0xF) << 8) | inputReport[1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset]);
|
||||
cState.TouchLeft = touchX >= 1920 * 2 / 5 ? false : true;
|
||||
cState.TouchRight = touchX < 1920 * 2 / 5 ? false : true;
|
||||
// Even when idling there is still a touch packet indicating no touch 1 or 2
|
||||
touchpad.handleTouchpad(inputReport, cState, touchOffset);
|
||||
}
|
||||
@ -872,9 +873,9 @@ namespace DS4Windows
|
||||
deltaTimeCurrent = tempDelta * 16u / 3u;
|
||||
}
|
||||
|
||||
cState.elapsedNanoSec = deltaTimeCurrent;
|
||||
cState.elapsedMicroSec = deltaTimeCurrent;
|
||||
timeStampPrevious = tempStamp;
|
||||
elapsedDeltaTime = 0.000001 * deltaTimeCurrent; // Convert from nanoseconds to seconds
|
||||
elapsedDeltaTime = 0.000001 * deltaTimeCurrent; // Convert from microseconds to seconds
|
||||
|
||||
// Store Gyro and Accel values
|
||||
Array.Copy(inputReport, 13, gyro, 0, 6);
|
||||
|
@ -23,7 +23,7 @@ namespace DS4Windows
|
||||
public double LYUnit;
|
||||
public double RXUnit;
|
||||
public double RYUnit;
|
||||
public uint elapsedNanoSec = 0;
|
||||
public uint elapsedMicroSec = 0;
|
||||
public SixAxis Motion = null;
|
||||
public static readonly int DEFAULT_AXISDIR_VALUE = 127;
|
||||
|
||||
@ -47,7 +47,7 @@ namespace DS4Windows
|
||||
LYUnit = 0.0;
|
||||
RXUnit = 0.0;
|
||||
RYUnit = 0.0;
|
||||
elapsedNanoSec = 0;
|
||||
elapsedMicroSec = 0;
|
||||
Motion = new SixAxis(0, 0, 0, 0, 0, 0, 0.0);
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ namespace DS4Windows
|
||||
LYUnit = state.LYUnit;
|
||||
RXUnit = state.RXUnit;
|
||||
RYUnit = state.RYUnit;
|
||||
elapsedNanoSec = state.elapsedNanoSec;
|
||||
elapsedMicroSec = state.elapsedMicroSec;
|
||||
Motion = state.Motion;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ namespace DS4Windows
|
||||
state.LYUnit = LYUnit;
|
||||
state.RXUnit = RXUnit;
|
||||
state.RYUnit = RYUnit;
|
||||
state.elapsedNanoSec = elapsedNanoSec;
|
||||
state.elapsedMicroSec = elapsedMicroSec;
|
||||
state.Motion = Motion;
|
||||
}
|
||||
|
||||
|
@ -92,10 +92,10 @@ namespace DS4Windows
|
||||
|
||||
byte touchID1 = (byte)(data[0 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x7F);
|
||||
byte touchID2 = (byte)(data[4 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x7F);
|
||||
int currentX1 = data[1 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] + ((data[2 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF) * 255);
|
||||
int currentY1 = ((data[2 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF0) >> 4) + (data[3 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] * 16);
|
||||
int currentX2 = data[5 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] + ((data[6 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF) * 255);
|
||||
int currentY2 = ((data[6 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF0) >> 4) + (data[7 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] * 16);
|
||||
int currentX1 = ((data[2 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x0F) << 8) | data[1 + TOUCHPAD_DATA_OFFSET + touchPacketOffset];
|
||||
int currentY1 = (data[3 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] << 4) | ((data[2 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF0) >> 4);
|
||||
int currentX2 = ((data[6 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x0F) << 8) | data[5 + TOUCHPAD_DATA_OFFSET + touchPacketOffset];
|
||||
int currentY2 = (data[7 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] << 4) | ((data[6 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF0) >> 4);
|
||||
|
||||
TouchpadEventArgs args;
|
||||
if (sensors.Touch1 || sensors.Touch2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user