Attempt to smooth out mouse cursor for analog sticks

This commit is contained in:
Travis Nickles 2017-06-19 08:50:28 -07:00
parent 5678ee6cd5
commit 328b2dc14c
2 changed files with 15 additions and 3 deletions

View File

@ -2322,7 +2322,8 @@ namespace DS4Windows
int controlNum = (int)control;
DS4StateFieldMapping.ControlType controlType = DS4StateFieldMapping.mappedType[controlNum];
long timeElapsed = ctrl.DS4Controllers[device].getLastTimeElapsed();
//long timeElapsed = ctrl.DS4Controllers[device].getLastTimeElapsed();
double timeElapsed = ctrl.DS4Controllers[device].lastTimeElapsedDouble;
//double mouseOffset = 0.025;
double tempMouseOffsetX = 0.0, tempMouseOffsetY = 0.0;

View File

@ -264,6 +264,12 @@ namespace DS4Windows
return lastTimeElapsed;
}
public double lastTimeElapsedDouble = 0.0;
public double getLastTimeElapsedDouble()
{
return lastTimeElapsedDouble;
}
public byte RightLightFastRumble
{
get { return rightLightFastRumble; }
@ -630,10 +636,12 @@ namespace DS4Windows
return synced;
}
public double Latency = 0;
public double Latency = 0.0;
public string error;
public bool firstReport = false;
public bool oldCharging = false;
double curTimeDouble = 0.0;
double oldTimeDouble = 0.0;
private void performDs4Input()
{
@ -656,12 +664,15 @@ namespace DS4Windows
{
oldCharging = charging;
currerror = string.Empty;
curTimeDouble = sw.Elapsed.TotalMilliseconds;
curtime = sw.ElapsedMilliseconds;
this.lastTimeElapsed = curtime - oldtime;
lastTimeElapsed = curtime - oldtime;
lastTimeElapsedDouble = (curTimeDouble - oldTimeDouble);
//latencyList.Add(this.lastTimeElapsed);
latencyQueue.Enqueue(this.lastTimeElapsed);
tempLatencyCount++;
oldtime = curtime;
oldTimeDouble = curTimeDouble;
if (tempLatencyCount > 50)
{