From c8632a96c61c8a2f3b507ac2b46cdc211687a110 Mon Sep 17 00:00:00 2001 From: jays2kings Date: Fri, 31 Oct 2014 15:00:15 -0400 Subject: [PATCH] Version 1.4.0.81 Fix crash when disconnecting by PS+Options --- DS4Control/Control.cs | 4 ++-- DS4Control/Mapping.cs | 8 ++++---- DS4Control/ScpUtil.cs | 2 +- DS4Tool/Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DS4Control/Control.cs b/DS4Control/Control.cs index 0c5679506a..91834c124a 100644 --- a/DS4Control/Control.cs +++ b/DS4Control/Control.cs @@ -484,8 +484,7 @@ protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State p { if (!d.Charging) { - d.DisconnectBT(); - InputMethods.performKeyRelease(Global.getCustomKey(0, DS4Controls.PS)); + d.DisconnectBT(); InputMethods.performKeyRelease(Global.getCustomKey(0, DS4Controls.PS)); string[] skeys = Global.getCustomMacro(0, DS4Controls.PS).Split('/'); ushort[] keys = new ushort[skeys.Length]; for (int i = 0; i < keys.Length; i++) @@ -493,6 +492,7 @@ protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State p keys[i] = ushort.Parse(skeys[i]); InputMethods.performKeyRelease(keys[i]); } + d = null; } } if (cState.Touch1 && pState.PS) diff --git a/DS4Control/Mapping.cs b/DS4Control/Mapping.cs index 985f2a08a8..fdbb8bf80b 100644 --- a/DS4Control/Mapping.cs +++ b/DS4Control/Mapping.cs @@ -1397,10 +1397,10 @@ public static bool getBoolMapping(DS4Controls control, DS4State cState, DS4State case DS4Controls.Square: return cState.Square; case DS4Controls.Triangle: return cState.Triangle; case DS4Controls.Circle: return cState.Circle; - case DS4Controls.TouchLeft: return tp.leftDown; - case DS4Controls.TouchRight: return tp.rightDown; - case DS4Controls.TouchMulti: return tp.multiDown; - case DS4Controls.TouchUpper: return tp.upperDown; + case DS4Controls.TouchLeft: return (tp != null ? tp.leftDown : false); + case DS4Controls.TouchRight: return (tp != null ? tp.rightDown : false); + case DS4Controls.TouchMulti: return (tp != null ? tp.multiDown : false); + case DS4Controls.TouchUpper: return (tp != null ? tp.upperDown : false); case DS4Controls.LXNeg: return cState.LX < 127 - 55; case DS4Controls.LYNeg: return cState.LY < 127 - 55; case DS4Controls.RXNeg: return cState.RX < 127 - 55; diff --git a/DS4Control/ScpUtil.cs b/DS4Control/ScpUtil.cs index fcad2ee0b6..0695242efc 100644 --- a/DS4Control/ScpUtil.cs +++ b/DS4Control/ScpUtil.cs @@ -1376,7 +1376,7 @@ public Boolean LoadProfile(int device, System.Windows.Forms.Control[] buttons, S if (device < 4) { if (dinputOnly[device] == true) control.x360Bus.Unplug(device); - else if (control.DS4Controllers[device].IsAlive()) control.x360Bus.Plugin(device); + else if (control.DS4Controllers[device] != null && control.DS4Controllers[device].IsAlive()) control.x360Bus.Plugin(device); } } catch { missingSetting = true; } diff --git a/DS4Tool/Properties/AssemblyInfo.cs b/DS4Tool/Properties/AssemblyInfo.cs index 5e437dd326..4e8b431902 100644 --- a/DS4Tool/Properties/AssemblyInfo.cs +++ b/DS4Tool/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.8")] -[assembly: AssemblyFileVersion("1.4.0.8")] +[assembly: AssemblyVersion("1.4.0.81")] +[assembly: AssemblyFileVersion("1.4.0.81")]