Skip to content

Commit

Permalink
Added FrameCounter data to DS4 Extended report
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryochan7 committed Aug 9, 2021
1 parent 062bf39 commit 7641d11
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions DS4Windows/DS4Control/ControlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion DS4Windows/DS4Control/DS4OutDevices/DS4OutDeviceExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions DS4Windows/DS4Library/DS4State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7641d11

Please sign in to comment.