From cac819526ea90b3071b6b8ce566c07435d6da05f Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Mon, 13 Aug 2018 02:30:05 -0500 Subject: [PATCH 1/8] Updated url of alt build --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 55de55d..d69283d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ website at [ds4windows.com](http://ds4windows.com). - **[Main builds of DS4Windows](https://github.com/Ryochan7/DS4Windows/releases)** - Alternative builds: - - [UdpServer ViGEm build](http://ryochan7.xyz/ds4windows/test/DS4Windows_1.5.4_ViGEm_UdpServer_x64.zip) + - [UdpServer ViGEm build](http://ryochan7.xyz/ds4windows/test/DS4Windows_1.5.5_ViGEm_UdpServer_x64.zip) ## Requirements From b5c205f184db6a23b6ff20012cd841e909cc07ff Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Thu, 16 Aug 2018 15:58:02 -0500 Subject: [PATCH 2/8] Minor TODO update --- TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 42660e0..eb8eec2 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,6 @@ # TODO -* Perform some final cleanup and release version 1.5 +* ~~Perform some final cleanup and release version 1.5~~ * Attempt to remove reliance on the main thread when disconnecting a device. Currently used to delay hotplug routine * Look into distributing profile properties around various objects From 0358002e72d1cfba22183773111856a7a5c32a5f Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Thu, 16 Aug 2018 17:42:03 -0500 Subject: [PATCH 3/8] Remove some older unnecessary variables --- DS4Windows/DS4Control/ScpUtil.cs | 16 ---------------- DS4Windows/DS4Forms/DS4Form.cs | 7 ------- 2 files changed, 23 deletions(-) diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 0bd2a07..a7e0a9c 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -231,9 +231,7 @@ namespace DS4Windows public static string appdatapath; public static bool firstRun = false; public static bool multisavespots = false; - public static bool oldappdatafail = false; public static string appDataPpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Windows"; - public static string oldappdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool"; public static bool runHotPlug = false; public const int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance. public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; @@ -342,20 +340,6 @@ namespace DS4Windows SaveWhere(exepath); else if (File.Exists(appDataPpath + "\\Auto Profiles.xml")) SaveWhere(appDataPpath); - else if (File.Exists(oldappdatapath + "\\Auto Profiles.xml")) - { - try - { - if (Directory.Exists(appDataPpath)) - Directory.Move(appDataPpath, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Windows Old"); - Directory.Move(oldappdatapath, appDataPpath); - SaveWhere(appDataPpath); - } - catch - { - Global.oldappdatafail = true; - } - } else if (!File.Exists(exepath + "\\Auto Profiles.xml") && !File.Exists(appDataPpath + "\\Auto Profiles.xml")) { diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 2363e52..6f9f5e3 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -88,13 +88,6 @@ namespace DS4Windows { new SaveWhere(Global.multisavespots).ShowDialog(); } - else if (Global.oldappdatafail) - { - MessageBox.Show(Properties.Resources.CannotMoveFiles, "DS4Windows"); - Process.Start("explorer.exe", @"/select, " + appDataPpath); - Close(); - return; - } Global.Load(); Global.SetCulture(UseLang); From 3df7f24a7bdf0d01ecfd3c68722ceb9701f7a4b7 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Fri, 17 Aug 2018 02:20:53 -0500 Subject: [PATCH 4/8] Move code out of main form ctor --- DS4Windows/DS4Control/ScpUtil.cs | 36 ++++++++++++++++++++++++++++++++ DS4Windows/DS4Forms/DS4Form.cs | 35 +------------------------------ 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index a7e0a9c..604c8c2 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -358,7 +358,43 @@ namespace DS4Windows catch { /* Skip setting culture that we cannot set */ } } + public static void CreateStdActions() + { + XmlDocument xDoc = new XmlDocument(); + try + { + string[] profiles = Directory.GetFiles(appdatapath + @"\Profiles\"); + string s = string.Empty; + //foreach (string s in profiles) + for (int i = 0, proflen = profiles.Length; i < proflen; i++) + { + s = profiles[i]; + if (Path.GetExtension(s) == ".xml") + { + xDoc.Load(s); + XmlNode el = xDoc.SelectSingleNode("DS4Windows/ProfileActions"); + if (el != null) + { + if (string.IsNullOrEmpty(el.InnerText)) + el.InnerText = "Disconnect Controller"; + else + el.InnerText += "/Disconnect Controller"; + } + else + { + XmlNode Node = xDoc.SelectSingleNode("DS4Windows"); + el = xDoc.CreateElement("ProfileActions"); + el.InnerText = "Disconnect Controller"; + Node.AppendChild(el); + } + xDoc.Save(s); + LoadActions(); + } + } + } + catch { } + } public static event EventHandler ControllerStatusChange; // called when a controller is added/removed/battery or touchpad mode changes/etc. public static void ControllerStatusChanged(object sender) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 6f9f5e3..a40f99a 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -216,40 +216,7 @@ namespace DS4Windows if (!LoadActions()) //if first no actions have been made yet, create PS+Option to D/C and save it to every profile { - XmlDocument xDoc = new XmlDocument(); - try - { - string[] profiles = Directory.GetFiles(appdatapath + @"\Profiles\"); - string s = string.Empty; - //foreach (string s in profiles) - for (int i = 0, proflen = profiles.Length; i < proflen; i++) - { - s = profiles[i]; - if (Path.GetExtension(s) == ".xml") - { - xDoc.Load(s); - XmlNode el = xDoc.SelectSingleNode("DS4Windows/ProfileActions"); - if (el != null) - { - if (string.IsNullOrEmpty(el.InnerText)) - el.InnerText = "Disconnect Controller"; - else - el.InnerText += "/Disconnect Controller"; - } - else - { - XmlNode Node = xDoc.SelectSingleNode("DS4Windows"); - el = xDoc.CreateElement("ProfileActions"); - el.InnerText = "Disconnect Controller"; - Node.AppendChild(el); - } - - xDoc.Save(s); - LoadActions(); - } - } - } - catch { } + Global.CreateStdActions(); } bool start = true; From b5b45a8983e19fb1fa4b8178298ff31936baf1be Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Fri, 17 Aug 2018 02:40:04 -0500 Subject: [PATCH 5/8] Condense code paths for a section --- DS4Windows/DS4Forms/DS4Form.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index a40f99a..ed02469 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -171,17 +171,15 @@ namespace DS4Windows } catch { } MessageBox.Show("Copy complete, please relaunch DS4Windows and remove settings from Program Directory", "DS4Windows"); - appdatapath = null; - Close(); - return; } else { MessageBox.Show("DS4Windows cannot edit settings here, This will now close", "DS4Windows"); - appdatapath = null; - Close(); - return; } + + appdatapath = null; + Close(); + return; } cBUseWhiteIcon.Checked = UseWhiteIcon; From 41ebb0d7161f25951625593e3d57e3d33e5489d3 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Fri, 17 Aug 2018 14:36:35 -0500 Subject: [PATCH 6/8] Use BeginInvoke in timer method --- DS4Windows/DS4Forms/DS4Form.cs | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index ed02469..0cb547b 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -535,22 +535,32 @@ namespace DS4Windows string slide = Program.rootHub.TouchpadSlide(i); if (slide == "left") { - if (cbs[i].SelectedIndex <= 0) - cbs[i].SelectedIndex = cbs[i].Items.Count - 2; - else - cbs[i].SelectedIndex--; - + this.BeginInvoke((System.Action)(() => + { + if (cbs[i].SelectedIndex <= 0) + cbs[i].SelectedIndex = cbs[i].Items.Count - 2; + else + cbs[i].SelectedIndex--; + })); } else if (slide == "right") { - if (cbs[i].SelectedIndex == cbs[i].Items.Count - 2) - cbs[i].SelectedIndex = 0; - else - cbs[i].SelectedIndex++; + this.BeginInvoke((System.Action)(() => + { + if (cbs[i].SelectedIndex == cbs[i].Items.Count - 2) + cbs[i].SelectedIndex = 0; + else + cbs[i].SelectedIndex++; + })); } if (slide.Contains("t")) - ShowNotification(this, Properties.Resources.UsingProfile.Replace("*number*", (i + 1).ToString()).Replace("*Profile name*", cbs[i].Text)); + { + this.BeginInvoke((System.Action)(() => + { + ShowNotification(this, Properties.Resources.UsingProfile.Replace("*number*", (i + 1).ToString()).Replace("*Profile name*", cbs[i].Text)); + })); + } } } From 39762a361a9e4436da9290f925f563e5ce45dd00 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Fri, 17 Aug 2018 15:11:46 -0500 Subject: [PATCH 7/8] Delay execution of service start --- DS4Windows/DS4Forms/DS4Form.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 0cb547b..8edb4cf 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -275,9 +275,6 @@ namespace DS4Windows hotkeysTimer.Start(); } - if (btnStartStop.Enabled && start) - BtnStartStop_Clicked(); - startToolStripMenuItem.Text = btnStartStop.Text; cBoxNotifications.SelectedIndex = Notifications; cBSwipeProfiles.Checked = SwipeProfiles; @@ -398,6 +395,9 @@ namespace DS4Windows control.MouseHover += ClearLastMessage; } } + + if (btnStartStop.Enabled && start) + TaskRunner.Delay(10).ContinueWith((t) => this.BeginInvoke((System.Action)(() => BtnStartStop_Clicked()))); } private void populateHoverTextDict() From 1eecdfa8365e6819b418efa5532c08473aa03a1a Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sat, 18 Aug 2018 02:13:45 -0500 Subject: [PATCH 8/8] Version 1.5.6 --- DS4Windows/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DS4Windows/Properties/AssemblyInfo.cs b/DS4Windows/Properties/AssemblyInfo.cs index 6460f97..c360ca1 100644 --- a/DS4Windows/Properties/AssemblyInfo.cs +++ b/DS4Windows/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ 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.5.5")] -[assembly: AssemblyFileVersion("1.5.5")] +[assembly: AssemblyVersion("1.5.6")] +[assembly: AssemblyFileVersion("1.5.6")] [assembly: NeutralResourcesLanguage("en")]