From 3dd88e481c678e2ea4a1acca141e6a7ae3b5075a Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Thu, 7 Feb 2019 16:40:24 -0600 Subject: [PATCH] Fixed issue with xinput unplug routine on device removal Related to issue #554 --- DS4Windows/DS4Control/ScpUtil.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 3716c4a..a5a4073 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -2602,7 +2602,6 @@ namespace DS4Windows catch { dinputOnly[device] = false; missingSetting = true; } bool oldUseDInputOnly = Global.useDInputOnly[device]; - Global.useDInputOnly[device] = dinputOnly[device]; // Only change xinput devices under certain conditions. Avoid // performing this upon program startup before loading devices. @@ -2618,20 +2617,14 @@ namespace DS4Windows { if (dinputOnly[device] == true) { - Global.useDInputOnly[device] = true; xinputPlug = false; xinputStatus = true; } else if (synced && isAlive) { - Global.useDInputOnly[device] = false; xinputPlug = true; xinputStatus = true; } - else if (!synced) - { - Global.useDInputOnly[device] = true; - } } } } @@ -2995,12 +2988,12 @@ namespace DS4Windows int xinputIndex = control.x360Bus.FirstController + device; if (xinputResult) { - dinputOnly[device] = false; + Global.useDInputOnly[device] = false; AppLogger.LogToGui("X360 Controller # " + xinputIndex + " connected", false); } else { - dinputOnly[device] = true; + Global.useDInputOnly[device] = true; AppLogger.LogToGui("X360 Controller # " + xinputIndex + " failed. Using DInput only mode", true); } } @@ -3010,11 +3003,12 @@ namespace DS4Windows int xinputIndex = control.x360Bus.FirstController + device; if (xinputResult) { - dinputOnly[device] = true; + Global.useDInputOnly[device] = true; AppLogger.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false); } else { + Global.useDInputOnly[device] = false; AppLogger.LogToGui("X360 Controller # " + xinputIndex + " failed to unplug", true); } }