mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 13:41:15 +01:00
Minor changes to exclusive mode routine
This commit is contained in:
parent
22babe9ded
commit
315797fe53
@ -13,6 +13,7 @@ namespace DS4Windows
|
||||
private static HashSet<string> DevicePaths = new HashSet<string>();
|
||||
// Keep instance of opened exclusive mode devices not in use (Charging while using BT connection)
|
||||
private static List<HidDevice> DisabledDevices = new List<HidDevice>();
|
||||
private static Stopwatch sw = new Stopwatch();
|
||||
public static bool isExclusiveMode = false;
|
||||
|
||||
private static string devicePathToInstanceId(string devicePath)
|
||||
@ -249,7 +250,6 @@ namespace DS4Windows
|
||||
|
||||
public static void reEnableDevice(string deviceInstanceId)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
bool success;
|
||||
Guid hidGuid = new Guid();
|
||||
NativeMethods.HidD_GetHidGuid(ref hidGuid);
|
||||
@ -285,7 +285,7 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
//System.Threading.Thread.Sleep(50);
|
||||
sw.Start();
|
||||
sw.Restart();
|
||||
while (sw.ElapsedMilliseconds < 50)
|
||||
{
|
||||
// Use SpinWait to keep control of current thread. Using Sleep could potentially
|
||||
@ -306,15 +306,6 @@ namespace DS4Windows
|
||||
throw new Exception("Error enabling device, error code = " + Marshal.GetLastWin32Error());
|
||||
}
|
||||
|
||||
//System.Threading.Thread.Sleep(10);
|
||||
sw.Restart();
|
||||
while (sw.ElapsedMilliseconds < 10)
|
||||
{
|
||||
// Use SpinWait to keep control of current thread. Using Sleep could potentially
|
||||
// cause other events to get run out of order
|
||||
System.Threading.Thread.SpinWait(20);
|
||||
}
|
||||
sw.Stop();
|
||||
NativeMethods.SetupDiDestroyDeviceInfoList(deviceInfoSet);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user