Skip to content

Commit

Permalink
Added extra state data copy method
Browse files Browse the repository at this point in the history
Might replace current copy routine in the future
  • Loading branch information
Ryochan7 committed Aug 8, 2021
1 parent d2961e9 commit 0e08503
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions DS4Windows/DS4Control/ControlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2266,6 +2266,7 @@ protected virtual void On_Report(DS4Device device, EventArgs e, int ind)
Mapping.MapCustom(ind, cState, tempMapState, ExposedState[ind], touchPad[ind], this);

// Copy current Touchpad and Gyro data
// Might change to use new DS4State.CopyExtrasTo method
tempMapState.Motion = cState.Motion;
tempMapState.ds4Timestamp = cState.ds4Timestamp;
tempMapState.TrackPadTouch0 = cState.TrackPadTouch0;
Expand Down
14 changes: 14 additions & 0 deletions DS4Windows/DS4Library/DS4State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,20 @@ public void CopyTo(DS4State state)
state.OutputRSOuter = OutputRSOuter;
}

/// <summary>
/// Only copy extra DS4State data that is not output directly tied
/// to the mapper routine. Gyro motion data, Touchpad touch data,
/// and timestamp data are copied
/// </summary>
/// <param name="state">State object to copy data to</param>
public void CopyExtrasTo(DS4State state)
{
state.Motion = Motion;
state.ds4Timestamp = ds4Timestamp;
state.TrackPadTouch0 = TrackPadTouch0;
state.TrackPadTouch1 = TrackPadTouch1;
}

public void calculateStickAngles()
{
double lsangle = Math.Atan2(-(LY - 128), (LX - 128));
Expand Down

0 comments on commit 0e08503

Please sign in to comment.