diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 5a978c5..cdcfb5f 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -130,6 +130,7 @@ namespace DS4Windows // It is enough to feel a difference during gameplay. private static int[] rsOutCurveModeArray = { 0, 0, 0, 0 }; private static int[] lsOutCurveModeArray = { 0, 0, 0, 0 }; + static bool tempBool = false; // Special macros static bool altTabDone = true; @@ -1746,13 +1747,19 @@ namespace DS4Windows actionFound = true; DS4Device d = ctrl.DS4Controllers[device]; - if (!d.isCharging()) + bool synced = tempBool = d.isSynced(); + if (synced && !d.isCharging()) { ConnectionType deviceConn = d.getConnectionType(); + bool exclusive = tempBool = d.isExclusive(); if (deviceConn == ConnectionType.BT) { d.DisconnectBT(); } + else if (deviceConn == ConnectionType.SONYWA && exclusive) + { + d.DisconnectDongle(); + } //foreach (DS4Controls dc in action.trigger) for (int i = 0, arlen = action.trigger.Count; i < arlen; i++) diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 62a7ed1..aff4d60 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -1268,6 +1268,8 @@ namespace DS4Windows public bool[] gyroSmoothing = { false, false, false, false, false }; public double[] gyroSmoothWeight = { 0.5, 0.5, 0.5, 0.5, 0.5 }; + bool tempBool = false; + public BackingStore() { for (int i = 0; i < 5; i++) @@ -2352,7 +2354,9 @@ namespace DS4Windows { //bool changed = false; DS4Device tempDevice = control.DS4Controllers[device]; - + bool exists = tempBool = (tempDevice != null); + bool synced = tempBool = exists ? tempDevice.isSynced() : false; + bool isAlive = tempBool = exists ? tempDevice.IsAlive() : false; if (dinputOnly[device] != oldUseDInputOnly) { if (dinputOnly[device] == true) @@ -2367,7 +2371,7 @@ namespace DS4Windows //changed = true; } - else if (tempDevice != null && tempDevice.IsAlive()) + else if (synced && isAlive) { bool xinputResult = control.x360Bus.Plugin(device); if (xinputResult)