mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-30 04:54:20 +01:00
Change when sleep is run for device removal
This commit is contained in:
parent
6d4527a4c6
commit
31f1382245
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
|
|
||||||
using System.Media;
|
using System.Media;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Diagnostics;
|
||||||
using static DS4Windows.Global;
|
using static DS4Windows.Global;
|
||||||
|
|
||||||
namespace DS4Windows
|
namespace DS4Windows
|
||||||
@ -614,7 +615,17 @@ namespace DS4Windows
|
|||||||
|
|
||||||
LogDebug(removed);
|
LogDebug(removed);
|
||||||
Log.LogToTray(removed);
|
Log.LogToTray(removed);
|
||||||
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
|
/*Stopwatch sw = new Stopwatch();
|
||||||
|
sw.Start();
|
||||||
|
while (sw.ElapsedMilliseconds < XINPUT_UNPLUG_SETTLE_TIME)
|
||||||
|
{
|
||||||
|
// 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(500);
|
||||||
|
}
|
||||||
|
sw.Stop();
|
||||||
|
*/
|
||||||
|
|
||||||
device.IsRemoved = true;
|
device.IsRemoved = true;
|
||||||
device.Synced = false;
|
device.Synced = false;
|
||||||
DS4Controllers[ind] = null;
|
DS4Controllers[ind] = null;
|
||||||
@ -622,6 +633,7 @@ namespace DS4Windows
|
|||||||
lag[ind] = false;
|
lag[ind] = false;
|
||||||
inWarnMonitor[ind] = false;
|
inWarnMonitor[ind] = false;
|
||||||
useDInputOnly[ind] = false;
|
useDInputOnly[ind] = false;
|
||||||
|
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
|
||||||
OnControllerRemoved(this, ind);
|
OnControllerRemoved(this, ind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user