mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Remove some property usage and minor improvements
This commit is contained in:
parent
0fc12c1038
commit
7d6e33ba2f
@ -441,17 +441,16 @@ namespace DS4Windows
|
||||
//Called every time the new input report has arrived
|
||||
protected virtual void On_Report(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
DS4Device device = (DS4Device)sender;
|
||||
|
||||
int ind = -1;
|
||||
for (int i = 0; i < DS4Controllers.Length; i++)
|
||||
for (int i = 0, arlength = DS4Controllers.Length; ind == -1 && i < arlength; i++)
|
||||
if (device == DS4Controllers[i])
|
||||
ind = i;
|
||||
|
||||
if (ind != -1)
|
||||
{
|
||||
if (FlushHIDQueue[ind])
|
||||
if (getFlushHIDQueue(ind))
|
||||
device.FlushHID();
|
||||
if (!string.IsNullOrEmpty(device.error))
|
||||
{
|
||||
@ -459,9 +458,10 @@ namespace DS4Windows
|
||||
}
|
||||
if (DateTime.UtcNow - device.firstActive > TimeSpan.FromSeconds(5))
|
||||
{
|
||||
if (device.Latency >= FlashWhenLateAt && !lag[ind])
|
||||
int flashWhenLateAt = getFlashWhenLateAt();
|
||||
if (device.Latency >= flashWhenLateAt && !lag[ind])
|
||||
LagFlashWarning(ind, true);
|
||||
else if (device.Latency < FlashWhenLateAt && lag[ind])
|
||||
else if (device.Latency < flashWhenLateAt && lag[ind])
|
||||
LagFlashWarning(ind, false);
|
||||
}
|
||||
device.getExposedState(ExposedState[ind], CurrentState[ind]);
|
||||
@ -508,7 +508,7 @@ namespace DS4Windows
|
||||
// Output any synthetic events.
|
||||
Mapping.Commit(ind);
|
||||
// Pull settings updates.
|
||||
device.IdleTimeout = IdleDisconnectTimeout[ind];
|
||||
device.IdleTimeout = getIdleDisconnectTimeout(ind);
|
||||
}
|
||||
}
|
||||
|
||||
@ -751,22 +751,22 @@ namespace DS4Windows
|
||||
public int[] oldscrollvalue = { 0, 0, 0, 0 };
|
||||
protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State pState)
|
||||
{
|
||||
if (!UseTPforControls[deviceID] && cState.Touch1 && pState.PS)
|
||||
if (!getUseTPforControls(deviceID) && cState.Touch1 && pState.PS)
|
||||
{
|
||||
if (TouchSensitivity[deviceID] > 0 && touchreleased[deviceID])
|
||||
if (getTouchSensitivity(deviceID) > 0 && touchreleased[deviceID])
|
||||
{
|
||||
oldtouchvalue[deviceID] = TouchSensitivity[deviceID];
|
||||
oldscrollvalue[deviceID] = ScrollSensitivity[deviceID];
|
||||
TouchSensitivity[deviceID] = 0;
|
||||
ScrollSensitivity[deviceID] = 0;
|
||||
oldtouchvalue[deviceID] = getTouchSensitivity(deviceID);
|
||||
oldscrollvalue[deviceID] = getScrollSensitivity(deviceID);
|
||||
getTouchSensitivity()[deviceID] = 0;
|
||||
getScrollSensitivity()[deviceID] = 0;
|
||||
LogDebug(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
Log.LogToTray(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
touchreleased[deviceID] = false;
|
||||
}
|
||||
else if (touchreleased[deviceID])
|
||||
{
|
||||
TouchSensitivity[deviceID] = oldtouchvalue[deviceID];
|
||||
ScrollSensitivity[deviceID] = oldscrollvalue[deviceID];
|
||||
getTouchSensitivity()[deviceID] = oldtouchvalue[deviceID];
|
||||
getScrollSensitivity()[deviceID] = oldscrollvalue[deviceID];
|
||||
LogDebug(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
Log.LogToTray(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
touchreleased[deviceID] = false;
|
||||
|
@ -266,6 +266,10 @@ namespace DS4Windows
|
||||
set { m_Config.flashWhenLateAt = value; }
|
||||
get { return m_Config.flashWhenLateAt; }
|
||||
}
|
||||
public static int getFlashWhenLateAt()
|
||||
{
|
||||
return m_Config.flashWhenLateAt;
|
||||
}
|
||||
public static bool UseWhiteIcon
|
||||
{
|
||||
set { m_Config.useWhiteIcon = value; }
|
||||
@ -277,8 +281,24 @@ namespace DS4Windows
|
||||
public static byte[] RumbleBoost => m_Config.rumble;
|
||||
public static double[] Rainbow => m_Config.rainbow;
|
||||
public static bool[] FlushHIDQueue => m_Config.flushHIDQueue;
|
||||
public static int[] IdleDisconnectTimeout => m_Config.idleDisconnectTimeout;
|
||||
public static bool getFlushHIDQueue(int index)
|
||||
{
|
||||
return m_Config.flushHIDQueue[index];
|
||||
}
|
||||
public static int[] IdleDisconnectTimeout => m_Config.idleDisconnectTimeout;
|
||||
public static int getIdleDisconnectTimeout(int index)
|
||||
{
|
||||
return m_Config.idleDisconnectTimeout[index];
|
||||
}
|
||||
public static byte[] TouchSensitivity => m_Config.touchSensitivity;
|
||||
public static byte[] getTouchSensitivity()
|
||||
{
|
||||
return m_Config.touchSensitivity;
|
||||
}
|
||||
public static byte getTouchSensitivity(int index)
|
||||
{
|
||||
return m_Config.touchSensitivity[index];
|
||||
}
|
||||
public static byte[] FlashType => m_Config.flashType;
|
||||
public static byte getFlashType(int index)
|
||||
{
|
||||
@ -296,6 +316,10 @@ namespace DS4Windows
|
||||
public static bool[] DinputOnly => m_Config.dinputOnly;
|
||||
public static bool[] StartTouchpadOff => m_Config.startTouchpadOff;
|
||||
public static bool[] UseTPforControls => m_Config.useTPforControls;
|
||||
public static bool getUseTPforControls(int index)
|
||||
{
|
||||
return m_Config.useTPforControls[index];
|
||||
}
|
||||
public static bool[] UseSAforMouse => m_Config.useSAforMouse;
|
||||
public static string[] SATriggers => m_Config.sATriggers;
|
||||
public static int[] GyroSensitivity => m_Config.gyroSensitivity;
|
||||
@ -310,6 +334,15 @@ namespace DS4Windows
|
||||
public static byte[] TapSensitivity => m_Config.tapSensitivity;
|
||||
public static bool[] DoubleTap => m_Config.doubleTap;
|
||||
public static int[] ScrollSensitivity => m_Config.scrollSensitivity;
|
||||
public static int[] getScrollSensitivity()
|
||||
{
|
||||
return m_Config.scrollSensitivity;
|
||||
}
|
||||
public static int getScrollSensitivity(int index)
|
||||
{
|
||||
return m_Config.scrollSensitivity[index];
|
||||
}
|
||||
|
||||
public static bool[] LowerRCOn => m_Config.lowerRCOn;
|
||||
public static bool[] TouchpadJitterCompensation => m_Config.touchpadJitterCompensation;
|
||||
|
||||
|
@ -474,7 +474,7 @@ namespace DS4Windows
|
||||
else
|
||||
{
|
||||
//HidDevice.ReadStatus res = hDevice.ReadFile(inputReport);
|
||||
HidDevice.ReadStatus res = hDevice.ReadAsyncWithFileStream(inputReport2, READ_STREAM_TIMEOUT);
|
||||
HidDevice.ReadStatus res = hDevice.ReadAsyncWithFileStream(inputReport, READ_STREAM_TIMEOUT);
|
||||
readTimeout.Enabled = false;
|
||||
if (res != HidDevice.ReadStatus.Success)
|
||||
{
|
||||
@ -487,7 +487,7 @@ namespace DS4Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
Array.Copy(inputReport2, 0, inputReport, 0, inputReport.Length);
|
||||
//Array.Copy(inputReport2, 0, inputReport, 0, inputReport.Length);
|
||||
}
|
||||
}
|
||||
if (ConnectionType == ConnectionType.BT && btInputReport[0] != 0x11)
|
||||
@ -759,8 +759,8 @@ namespace DS4Windows
|
||||
public void getExposedState(DS4StateExposed expState, DS4State state)
|
||||
{
|
||||
cState.CopyTo(state);
|
||||
expState.Accel = accel;
|
||||
expState.Gyro = gyro;
|
||||
expState.setAccel(accel);
|
||||
expState.setGyro(gyro);
|
||||
}
|
||||
|
||||
public void getCurrentState(DS4State state)
|
||||
|
@ -48,8 +48,17 @@ namespace DS4Windows
|
||||
|
||||
/// <summary> Holds raw DS4 input data from 14 to 19 </summary>
|
||||
public byte[] Accel { set { accel = value; } }
|
||||
public void setAccel(byte[] value)
|
||||
{
|
||||
accel = value;
|
||||
}
|
||||
|
||||
/// <summary> Holds raw DS4 input data from 20 to 25 </summary>
|
||||
public byte[] Gyro { set { gyro = value; } }
|
||||
public void setGyro(byte[] value)
|
||||
{
|
||||
gyro = value;
|
||||
}
|
||||
|
||||
/// <summary> Yaw leftward/counter-clockwise/turn to port or larboard side </summary>
|
||||
/// <remarks> Add double the previous result to this delta and divide by three.</remarks>
|
||||
|
Loading…
Reference in New Issue
Block a user