From 7641d11a365744cb3524cb09c48d598c8fbbfe79 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Mon, 9 Aug 2021 09:51:27 -0500 Subject: [PATCH] Added FrameCounter data to DS4 Extended report --- DS4Windows/DS4Control/ControlService.cs | 1 + DS4Windows/DS4Control/DS4OutDevices/DS4OutDeviceExt.cs | 3 ++- DS4Windows/DS4Library/DS4State.cs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index d9b1ea72d1..9903705710 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -2269,6 +2269,7 @@ protected virtual void On_Report(DS4Device device, EventArgs e, int ind) // Might change to use new DS4State.CopyExtrasTo method tempMapState.Motion = cState.Motion; tempMapState.ds4Timestamp = cState.ds4Timestamp; + tempMapState.FrameCounter = cState.FrameCounter; tempMapState.TouchPacketCounter = cState.TouchPacketCounter; tempMapState.TrackPadTouch0 = cState.TrackPadTouch0; tempMapState.TrackPadTouch1 = cState.TrackPadTouch1; diff --git a/DS4Windows/DS4Control/DS4OutDevices/DS4OutDeviceExt.cs b/DS4Windows/DS4Control/DS4OutDevices/DS4OutDeviceExt.cs index 7472379cff..bdd432064b 100644 --- a/DS4Windows/DS4Control/DS4OutDevices/DS4OutDeviceExt.cs +++ b/DS4Windows/DS4Control/DS4OutDevices/DS4OutDeviceExt.cs @@ -62,7 +62,8 @@ public override unsafe void ConvertandSendReport(DS4State state, int device) if (state.OutputTouchButton) tempSpecial |= DualShock4SpecialButton.Touchpad.Value; outDS4Report.wButtons = tempButtons; - outDS4Report.bSpecial = (byte)tempSpecial; + // Frame counter is high 6 bits. Low 2 bits is for extra buttons (PS, TP Click) + outDS4Report.bSpecial = (byte)(tempSpecial | (state.FrameCounter << 2)); outDS4Report.wButtons |= tempDPad.Value; } diff --git a/DS4Windows/DS4Library/DS4State.cs b/DS4Windows/DS4Library/DS4State.cs index 87c6ba711d..4b77b478bd 100644 --- a/DS4Windows/DS4Library/DS4State.cs +++ b/DS4Windows/DS4Library/DS4State.cs @@ -219,6 +219,7 @@ public void CopyExtrasTo(DS4State state) { state.Motion = Motion; state.ds4Timestamp = ds4Timestamp; + state.FrameCounter = FrameCounter; state.TouchPacketCounter = TouchPacketCounter; state.TrackPadTouch0 = TrackPadTouch0; state.TrackPadTouch1 = TrackPadTouch1;