mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Fixed distinction between one finger touchpad touch and two finger touch
Touch 2 being active does not necessarily mean two fingers are currently on the touchpad
This commit is contained in:
parent
2d58034415
commit
44aef8b90d
@ -82,8 +82,8 @@ namespace DS4Windows
|
||||
case 11: return s.DpadRight;
|
||||
case 12: return s.L3;
|
||||
case 13: return s.R3;
|
||||
case 14: return s.Touch1;
|
||||
case 15: return s.Touch2;
|
||||
case 14: return s.Touch1Finger;
|
||||
case 15: return s.Touch2Fingers;
|
||||
case 16: return s.Options;
|
||||
case 17: return s.Share;
|
||||
case 18: return s.PS;
|
||||
|
@ -838,10 +838,12 @@ namespace DS4Windows
|
||||
//for (int touches = inputReport[-1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET - 1], touchOffset = 0; touches > 0; touches--, touchOffset += 9)
|
||||
{
|
||||
cState.TouchPacketCounter = inputReport[-1 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset];
|
||||
cState.Touch1 = (inputReport[0 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] >> 7) != 0 ? false : true; // >= 1 touch detected
|
||||
cState.Touch1 = (inputReport[0 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] >> 7) != 0 ? false : true; // finger 1 detected
|
||||
cState.Touch1Identifier = (byte)(inputReport[0 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] & 0x7f);
|
||||
cState.Touch2 = (inputReport[4 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] >> 7) != 0 ? false : true; // 2 touches detected
|
||||
cState.Touch2 = (inputReport[4 + DS4Touchpad.TOUCHPAD_DATA_OFFSET + touchOffset] >> 7) != 0 ? false : true; // finger 2 detected
|
||||
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;
|
||||
// Even when idling there is still a touch packet indicating no touch 1 or 2
|
||||
|
@ -8,7 +8,7 @@ namespace DS4Windows
|
||||
public bool Square, Triangle, Circle, Cross;
|
||||
public bool DpadUp, DpadDown, DpadLeft, DpadRight;
|
||||
public bool L1, L3, R1, R3;
|
||||
public bool Share, Options, PS, Touch1, Touch2, TouchButton, TouchRight, TouchLeft;
|
||||
public bool Share, Options, PS, Touch1, Touch2, TouchButton, TouchRight, TouchLeft, Touch1Finger, Touch2Fingers;
|
||||
public byte Touch1Identifier, Touch2Identifier;
|
||||
public byte LX, RX, LY, RY, L2, R2;
|
||||
public byte FrameCounter; // 0, 1, 2...62, 63, 0....
|
||||
@ -30,6 +30,7 @@ namespace DS4Windows
|
||||
DpadUp = DpadDown = DpadLeft = DpadRight = false;
|
||||
L1 = L3 = R1 = R3 = false;
|
||||
Share = Options = PS = Touch1 = Touch2 = TouchButton = TouchRight = TouchLeft = false;
|
||||
Touch1Finger = Touch2Fingers = false;
|
||||
LX = RX = LY = RY = 127;
|
||||
L2 = R2 = 0;
|
||||
FrameCounter = 255; // only actually has 6 bits, so this is a null indicator
|
||||
@ -73,6 +74,8 @@ namespace DS4Windows
|
||||
Touch2Identifier = state.Touch2Identifier;
|
||||
TouchButton = state.TouchButton;
|
||||
TouchPacketCounter = state.TouchPacketCounter;
|
||||
Touch1Finger = state.Touch1Finger;
|
||||
Touch2Fingers = state.Touch2Fingers;
|
||||
LX = state.LX;
|
||||
RX = state.RX;
|
||||
LY = state.LY;
|
||||
@ -122,6 +125,8 @@ namespace DS4Windows
|
||||
state.TouchRight = TouchRight;
|
||||
state.TouchButton = TouchButton;
|
||||
state.TouchPacketCounter = TouchPacketCounter;
|
||||
state.Touch1Finger = Touch1Finger;
|
||||
state.Touch2Fingers = Touch2Fingers;
|
||||
state.LX = LX;
|
||||
state.RX = RX;
|
||||
state.LY = LY;
|
||||
|
@ -34,6 +34,8 @@ namespace DS4Windows
|
||||
bool Touch1 { get { return _state.Touch1; } }
|
||||
bool Touch2 { get { return _state.Touch2; } }
|
||||
bool TouchButton { get { return _state.TouchButton; } }
|
||||
bool Touch1Finger { get { return _state.Touch1Finger; } }
|
||||
bool Touch2Fingers { get { return _state.Touch2Fingers; } }
|
||||
byte LX { get { return _state.LX; } }
|
||||
byte RX { get { return _state.RX; } }
|
||||
byte LY { get { return _state.LY; } }
|
||||
|
Loading…
Reference in New Issue
Block a user