From 56d21aa3c0da9fcf7053abee0a797a828a32cbd2 Mon Sep 17 00:00:00 2001 From: jays2kings Date: Fri, 21 Nov 2014 14:56:31 -0500 Subject: [PATCH] Version 1.4.158 Fixed random mouse dancing in some games When adding trigger actions to the left or right stick, fixed L2/R2 not working 100% of the time Fixed profile for controllers not being changeable if usb was plugged in at start --- DS4Control/Mapping.cs | 48 ++++++++++++++++-------------- DS4Tool/DS4Form.Designer.cs | 4 --- DS4Tool/DS4Form.cs | 11 ------- DS4Tool/Properties/AssemblyInfo.cs | 4 +-- 4 files changed, 28 insertions(+), 39 deletions(-) diff --git a/DS4Control/Mapping.cs b/DS4Control/Mapping.cs index d1cbab8..66f18b7 100644 --- a/DS4Control/Mapping.cs +++ b/DS4Control/Mapping.cs @@ -759,7 +759,7 @@ namespace DS4Control if (getBoolMapping(dc, cState, eState, tp)) MappedState.L1 = true; foreach (DS4Controls dc in L2) - if (getByteMapping(device, dc, cState, eState, tp) != 0) + if (getByteMapping(device, dc, cState, eState, tp) > 5) MappedState.L2 = getByteMapping(device, dc, cState, eState, tp); foreach (DS4Controls dc in L3) if (getBoolMapping(dc, cState, eState, tp)) @@ -768,7 +768,7 @@ namespace DS4Control if (getBoolMapping(dc, cState, eState, tp)) MappedState.R1 = true; foreach (DS4Controls dc in R2) - if (getByteMapping(device, dc, cState, eState, tp) != 0) + if (getByteMapping(device, dc, cState, eState, tp) > 5) MappedState.R2 = getByteMapping(device, dc, cState, eState, tp); foreach (DS4Controls dc in R3) if (getBoolMapping(dc, cState, eState, tp)) @@ -1138,7 +1138,7 @@ namespace DS4Control case X360Controls.LYPos: LYP.Add(customButton.Key); break; case X360Controls.RXPos: RXP.Add(customButton.Key); break; case X360Controls.RYPos: RYP.Add(customButton.Key); break; - case X360Controls.LT: L2.Add(customButton.Key); break; + case X360Controls.LT: L2.Add(customButton.Key); Console.WriteLine("yes"); break; case X360Controls.RT: R2.Add(customButton.Key); break; case X360Controls.LeftMouse: if (getBoolMapping(customButton.Key, cState, eState, tp)) @@ -1354,41 +1354,39 @@ namespace DS4Control double root = 1.002; double divide = 10000d; DateTime now = mousenow[mnum]; - bool leftsitcklive = ((cState.LX < 127 - deadzoneL || 127 + deadzoneL < cState.LX) || (cState.LY < 127 - deadzoneL || 127 + deadzoneL < cState.LY)); - bool rightsitcklive = ((cState.RX < 127 - deadzoneR || 127 + deadzoneR < cState.RX) || (cState.RY < 127 - deadzoneR || 127 + deadzoneR < cState.RY)); switch (control) { case DS4Controls.LXNeg: - if (leftsitcklive) - value = -(cState.LX - 127) / 2550d * speed; + if (cState.LX - 127.5f < -deadzoneL) + value = -(cState.LX - 127.5f) / 2550d * speed; break; case DS4Controls.LXPos: - if (leftsitcklive) - value = (cState.LX - 127) / 2550d * speed; + if (cState.LX - 127.5f > deadzoneL) + value = (cState.LX - 127.5f) / 2550d * speed; break; case DS4Controls.RXNeg: - if (rightsitcklive) - value = -(cState.RX - 127) / 2550d * speed; + if (cState.RX - 127.5f < -deadzoneR) + value = -(cState.RX - 127.5f) / 2550d * speed; break; case DS4Controls.RXPos: - if (rightsitcklive) - value = (cState.RX - 127) / 2550d * speed; + if (cState.RX - 127.5f > deadzoneR) + value = (cState.RX - 127.5f) / 2550d * speed; break; case DS4Controls.LYNeg: - if (leftsitcklive) - value = -(cState.LY - 127) / 2550d * speed; + if (cState.LY - 127.5f < -deadzoneL) + value = -(cState.LY - 127.5f) / 2550d * speed; break; case DS4Controls.LYPos: - if (leftsitcklive) - value = (cState.LY - 127) / 2550d * speed; + if (cState.LY - 127.5f > deadzoneL) + value = (cState.LY - 127.5f) / 2550d * speed; break; case DS4Controls.RYNeg: - if (rightsitcklive) - value = -(cState.RY - 127) / 2550d * speed; + if (cState.RY - 127.5f < -deadzoneR) + value = -(cState.RY - 127.5f) / 2550d * speed; break; case DS4Controls.RYPos: - if (rightsitcklive) - value = (cState.RY - 127) / 2550d * speed; + if (cState.RY - 127.5f > deadzoneR) + value = (cState.RY - 127.5f) / 2550d * speed; break; case DS4Controls.Share: value = (cState.Share ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; case DS4Controls.Options: value = (cState.Options ? Math.Pow(root + speed / divide, 100) - 1 : 0); break; @@ -1424,6 +1422,10 @@ namespace DS4Control bool LYChanged = (Math.Abs(127 - cState.LY) < deadzoneL); bool RXChanged = (Math.Abs(127 - cState.RX) < deadzoneR); bool RYChanged = (Math.Abs(127 - cState.RY) < deadzoneR); + bool contains = (control.ToString().Contains("LX") || + control.ToString().Contains("LY") || + control.ToString().Contains("RX") || + control.ToString().Contains("RY")); if (LXChanged || LYChanged || RXChanged || RYChanged) now = DateTime.UtcNow; if (Global.getMouseAccel(device)) @@ -1436,7 +1438,8 @@ namespace DS4Control if (mouseaccel[controlnum] > 1000) value *= (double)Math.Min(2000, (mouseaccel[controlnum])) / 1000d; } - if (value <= 1) + if (value != 0) + if (contains && value <= 1 && value != 0) { if (now >= mousenow[mnum] + TimeSpan.FromMilliseconds((1 - value) * 500)) { @@ -1448,6 +1451,7 @@ namespace DS4Control } else return (int)value; + return 0; } public static bool compare(byte b1, byte b2) diff --git a/DS4Tool/DS4Form.Designer.cs b/DS4Tool/DS4Form.Designer.cs index 9f4b48d..652aeb3 100644 --- a/DS4Tool/DS4Form.Designer.cs +++ b/DS4Tool/DS4Form.Designer.cs @@ -363,13 +363,11 @@ // resources.ApplyResources(this.lbPad1, "lbPad1"); this.lbPad1.Name = "lbPad1"; - this.lbPad1.TextChanged += new System.EventHandler(this.lbPad1_TextChanged); // // lbPad2 // resources.ApplyResources(this.lbPad2, "lbPad2"); this.lbPad2.Name = "lbPad2"; - this.lbPad2.TextChanged += new System.EventHandler(this.lbPad1_TextChanged); // // bnEditC3 // @@ -391,13 +389,11 @@ // resources.ApplyResources(this.lbPad3, "lbPad3"); this.lbPad3.Name = "lbPad3"; - this.lbPad3.TextChanged += new System.EventHandler(this.lbPad1_TextChanged); // // lbPad4 // resources.ApplyResources(this.lbPad4, "lbPad4"); this.lbPad4.Name = "lbPad4"; - this.lbPad4.TextChanged += new System.EventHandler(this.lbPad1_TextChanged); // // cBController1 // diff --git a/DS4Tool/DS4Form.cs b/DS4Tool/DS4Form.cs index 0fde713..b486666 100644 --- a/DS4Tool/DS4Form.cs +++ b/DS4Tool/DS4Form.cs @@ -710,17 +710,6 @@ namespace DS4Windows rootHub.DS4Controllers[i].DisconnectBT(); } - private async void lbPad1_TextChanged(object sender, EventArgs e) - { - Label lb = ((Label)sender); - int i = int.Parse(lb.Name.Substring(lb.Name.Length-1)) - 1; - if (lb.Text == Properties.Resources.Disconnected && Pads[i].Enabled) - { - await Task.Delay(10); - Enable_Controls(i, false); - } - } - private void Enable_Controls(int device, bool on) { Pads[device].Enabled = on; diff --git a/DS4Tool/Properties/AssemblyInfo.cs b/DS4Tool/Properties/AssemblyInfo.cs index 392d27b..7643050 100644 --- a/DS4Tool/Properties/AssemblyInfo.cs +++ b/DS4Tool/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 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.157")] -[assembly: AssemblyFileVersion("1.4.157")] +[assembly: AssemblyVersion("1.4.158")] +[assembly: AssemblyFileVersion("1.4.158")]