Remove new DS4State object creation per poll

This commit is contained in:
Travis Nickles 2017-12-02 01:45:51 -06:00
parent dd6e2edadf
commit d66c98c139
2 changed files with 6 additions and 3 deletions

View File

@ -21,6 +21,7 @@ namespace DS4Windows
private DS4State[] MappedState = new DS4State[DS4_CONTROLLER_COUNT];
private DS4State[] CurrentState = new DS4State[DS4_CONTROLLER_COUNT];
private DS4State[] PreviousState = new DS4State[DS4_CONTROLLER_COUNT];
private DS4State[] TempState = new DS4State[DS4_CONTROLLER_COUNT];
public DS4StateExposed[] ExposedState = new DS4StateExposed[DS4_CONTROLLER_COUNT];
public bool recordingMacro = false;
public event EventHandler<DebugEventArgs> Debug = null;
@ -61,6 +62,7 @@ namespace DS4Windows
processingData[i] = new X360Data();
MappedState[i] = new DS4State();
CurrentState[i] = new DS4State();
TempState[i] = new DS4State();
PreviousState[i] = new DS4State();
ExposedState[i] = new DS4StateExposed(CurrentState[i]);
}
@ -789,7 +791,7 @@ namespace DS4Windows
if (getEnableTouchToggle(ind))
CheckForTouchToggle(ind, cState, pState);
cState = Mapping.SetCurveAndDeadzone(ind, cState);
cState = Mapping.SetCurveAndDeadzone(ind, cState, TempState[ind]);
if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) ||
containsCustomAction(ind) || containsCustomExtras(ind) ||

View File

@ -424,7 +424,7 @@ namespace DS4Windows
return (value < min) ? min : (value > max) ? max : value;
}
public static DS4State SetCurveAndDeadzone(int device, DS4State cState)
public static DS4State SetCurveAndDeadzone(int device, DS4State cState, DS4State dState)
{
double rotation = tempDoubleArray[device] = getLSRotation(device);
if (rotation > 0.0 || rotation < 0.0)
@ -434,7 +434,8 @@ namespace DS4Windows
if (rotationRS > 0.0 || rotationRS < 0.0)
cState.rotateRSCoordinates(rotationRS);
DS4State dState = new DS4State(cState);
cState.CopyTo(dState);
//DS4State dState = new DS4State(cState);
int x;
int y;
int curve;