From 604d419cb9a6c7c85eeec2eb5fcbbbc2f5ca8878 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sun, 10 Mar 2019 09:44:34 -0500 Subject: [PATCH 1/6] Have x86 build target C# 7.3 Missed updating this before --- DS4Windows/DS4Windows.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DS4Windows/DS4Windows.csproj b/DS4Windows/DS4Windows.csproj index 7a1ae54..a573484 100644 --- a/DS4Windows/DS4Windows.csproj +++ b/DS4Windows/DS4Windows.csproj @@ -107,7 +107,7 @@ none MinimumRecommendedRules.ruleset true - 7.2 + 7.3 On true 1 From 76b31245f802fe9a1f670f4ab3ad0420861f98e3 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Mon, 11 Mar 2019 11:54:55 -0500 Subject: [PATCH 2/6] Default use controller for mapping option to false This has probably caused issues for other people --- DS4Windows/DS4Control/ScpUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 7cef8cf..e385b31 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -1592,7 +1592,7 @@ namespace DS4Windows public int notifications = 2; public bool disconnectBTAtStop = false; public bool swipeProfiles = true; - public bool ds4Mapping = true; + public bool ds4Mapping = false; public bool quickCharge = false; public int firstXinputPort = 1; public bool closeMini = false; From 695d9b3e31774ccefa4f05a8007d003943fe4647 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Mon, 11 Mar 2019 12:48:16 -0500 Subject: [PATCH 3/6] Raise SocketAsyncEventArgs buffer for UDP server Related to issue #602 --- DS4Windows/DS4Control/UdpServer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DS4Windows/DS4Control/UdpServer.cs b/DS4Windows/DS4Control/UdpServer.cs index 76ad2aa..4a8ef4c 100644 --- a/DS4Windows/DS4Control/UdpServer.cs +++ b/DS4Windows/DS4Control/UdpServer.cs @@ -81,8 +81,8 @@ namespace DS4Windows public UdpServer(GetPadDetail getPadDetailDel) { portInfoGet = getPadDetailDel; - argsList = new SocketAsyncEventArgs[20]; - for (int num = 0; num <= 19; num++) + argsList = new SocketAsyncEventArgs[40]; + for (int num = 0; num < 40; num++) { SocketAsyncEventArgs args = new SocketAsyncEventArgs(); args.SetBuffer(new byte[100], 0, 100); @@ -188,7 +188,7 @@ namespace DS4Windows int temp = 0; poolLock.EnterWriteLock(); temp = listInd; - listInd = ++listInd % 20; + listInd = ++listInd % 40; SocketAsyncEventArgs args = argsList[temp]; poolLock.ExitWriteLock(); @@ -654,7 +654,7 @@ namespace DS4Windows int temp = 0; poolLock.EnterWriteLock(); temp = listInd; - listInd = ++listInd % 20; + listInd = ++listInd % 40; SocketAsyncEventArgs args = argsList[temp]; poolLock.ExitWriteLock(); From 1c2690f0207f9646859c020649db7b836f013860 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Mon, 11 Mar 2019 14:57:34 -0500 Subject: [PATCH 4/6] Added extra note for BT Poll Rate message --- DS4Windows/Properties/Resources.Designer.cs | 2 +- DS4Windows/Properties/Resources.resx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DS4Windows/Properties/Resources.Designer.cs b/DS4Windows/Properties/Resources.Designer.cs index 2fd43bf..58a5158 100644 --- a/DS4Windows/Properties/Resources.Designer.cs +++ b/DS4Windows/Properties/Resources.Designer.cs @@ -212,7 +212,7 @@ namespace DS4Windows.Properties { } /// - /// Looks up a localized string similar to Determines the poll rate used for the DS4 hardware when connected via Bluetooth. + /// Looks up a localized string similar to Determines the poll rate used for the DS4 hardware when connected via Bluetooth. (Applies on profile save). /// public static string BTPollRate { get { diff --git a/DS4Windows/Properties/Resources.resx b/DS4Windows/Properties/Resources.resx index d6ae880..9860dce 100644 --- a/DS4Windows/Properties/Resources.resx +++ b/DS4Windows/Properties/Resources.resx @@ -158,7 +158,7 @@ ..\Resources\BT.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - Determines the poll rate used for the DS4 hardware when connected via Bluetooth + Determines the poll rate used for the DS4 hardware when connected via Bluetooth. (Applies on profile save) Cannot move files to new location, Please rename the DS4Tool folder to "DS4Windows" From 54b6b2754a056dae323a2b0a9c9ed81e6f16c5db Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Tue, 12 Mar 2019 16:03:08 -0500 Subject: [PATCH 5/6] Change when delay takes place for hotplug routine --- DS4Windows/DS4Forms/DS4Form.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index c9f2f97..257ff22 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -1114,7 +1114,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question if (!inHotPlug) { inHotPlug = true; - TaskRunner.Run(() => { Thread.Sleep(1500); InnerHotplug2(); }); + TaskRunner.Run(() => { InnerHotplug2(); }); } } } @@ -1145,6 +1145,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question while (loopHotplug == true) { + Thread.Sleep(1500); Program.rootHub.HotPlug(); //TaskRunner.Run(() => { Program.rootHub.HotPlug(uiContext); }); lock (hotplugCounterLock) From a7192d2fbf2db3db98ea743e665e7d9b1d6d9085 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Tue, 12 Mar 2019 16:34:24 -0500 Subject: [PATCH 6/6] Force Normal IO and Page Priority More useful when run as Task but it seems to help normal runs as well. Related to issue #487. --- DS4Windows/DS4Control/Util.cs | 67 +++++++++++++++++++++++++++++++++++ DS4Windows/DS4Windows.csproj | 1 + DS4Windows/Program.cs | 10 ++++++ 3 files changed, 78 insertions(+) create mode 100644 DS4Windows/DS4Control/Util.cs diff --git a/DS4Windows/DS4Control/Util.cs b/DS4Windows/DS4Control/Util.cs new file mode 100644 index 0000000..b749af1 --- /dev/null +++ b/DS4Windows/DS4Control/Util.cs @@ -0,0 +1,67 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.Text; + +namespace DS4Windows +{ + [SuppressUnmanagedCodeSecurity] + class Util + { + public enum PROCESS_INFORMATION_CLASS : int + { + ProcessBasicInformation = 0, + ProcessQuotaLimits, + ProcessIoCounters, + ProcessVmCounters, + ProcessTimes, + ProcessBasePriority, + ProcessRaisePriority, + ProcessDebugPort, + ProcessExceptionPort, + ProcessAccessToken, + ProcessLdtInformation, + ProcessLdtSize, + ProcessDefaultHardErrorMode, + ProcessIoPortHandlers, + ProcessPooledUsageAndLimits, + ProcessWorkingSetWatch, + ProcessUserModeIOPL, + ProcessEnableAlignmentFaultFixup, + ProcessPriorityClass, + ProcessWx86Information, + ProcessHandleCount, + ProcessAffinityMask, + ProcessPriorityBoost, + ProcessDeviceMap, + ProcessSessionInformation, + ProcessForegroundInformation, + ProcessWow64Information, + ProcessImageFileName, + ProcessLUIDDeviceMapsEnabled, + ProcessBreakOnTermination, + ProcessDebugObjectHandle, + ProcessDebugFlags, + ProcessHandleTracing, + ProcessIoPriority, + ProcessExecuteFlags, + ProcessResourceManagement, + ProcessCookie, + ProcessImageInformation, + ProcessCycleTime, + ProcessPagePriority, + ProcessInstrumentationCallback, + ProcessThreadStackAllocation, + ProcessWorkingSetWatchEx, + ProcessImageFileNameWin32, + ProcessImageFileMapping, + ProcessAffinityUpdateMode, + ProcessMemoryAllocationMode, + MaxProcessInfoClass + } + + [DllImport("ntdll.dll", SetLastError = true)] + public static extern int NtSetInformationProcess(IntPtr processHandle, + PROCESS_INFORMATION_CLASS processInformationClass, ref IntPtr processInformation, uint processInformationLength); + } +} diff --git a/DS4Windows/DS4Windows.csproj b/DS4Windows/DS4Windows.csproj index a573484..9dfc9ed 100644 --- a/DS4Windows/DS4Windows.csproj +++ b/DS4Windows/DS4Windows.csproj @@ -141,6 +141,7 @@ + UserControl diff --git a/DS4Windows/Program.cs b/DS4Windows/Program.cs index c5045d3..1adf387 100644 --- a/DS4Windows/Program.cs +++ b/DS4Windows/Program.cs @@ -75,6 +75,16 @@ namespace DS4Windows } catch { } // Ignore problems raising the priority. + // Force Normal IO Priority + IntPtr ioPrio = new IntPtr(2); + Util.NtSetInformationProcess(Process.GetCurrentProcess().Handle, + Util.PROCESS_INFORMATION_CLASS.ProcessIoPriority, ref ioPrio, 4); + + // Force Normal Page Priority + IntPtr pagePrio = new IntPtr(5); + Util.NtSetInformationProcess(Process.GetCurrentProcess().Handle, + Util.PROCESS_INFORMATION_CLASS.ProcessPagePriority, ref pagePrio, 4); + try { // another instance is already running if OpenExsting succeeds.