From 71ceae1e0c6c41d8217700bf225f18f330cb3e64 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sun, 29 Mar 2020 22:11:42 -0500 Subject: [PATCH] Added extra delay for ViGEm stop --- DS4Windows/DS4Control/ControlService.cs | 7 +++++++ DS4Windows/DS4Control/OutputSlotManager.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 3e883d8..97253d7 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -718,6 +718,7 @@ namespace DS4Windows LogDebug("Closing connection to ViGEmBus"); + bool anyUnplugged = false; for (int i = 0, arlength = DS4Controllers.Length; i < arlength; i++) { DS4Device tempDevice = DS4Controllers[i]; @@ -757,6 +758,7 @@ namespace DS4Windows if (tempout != null) { UnplugOutDev(i, tempDevice, true); + anyUnplugged = true; } //outputDevices[i] = null; @@ -787,6 +789,11 @@ namespace DS4Windows Thread.SpinWait(500); } + if (anyUnplugged) + { + Thread.Sleep(OutputSlotManager.DELAY_TIME); + } + stopViGEm(); } diff --git a/DS4Windows/DS4Control/OutputSlotManager.cs b/DS4Windows/DS4Control/OutputSlotManager.cs index 55de585..429a143 100644 --- a/DS4Windows/DS4Control/OutputSlotManager.cs +++ b/DS4Windows/DS4Control/OutputSlotManager.cs @@ -9,7 +9,7 @@ namespace DS4Windows { public class OutputSlotManager { - private const int DELAY_TIME = 500; // measured in ms + public const int DELAY_TIME = 500; // measured in ms private Dictionary deviceDict = new Dictionary(); private Dictionary revDeviceDict = new Dictionary();