diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index d020331..e79271b 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; 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(); 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/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 1856f53..9ce097c 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) diff --git a/DS4Windows/DS4Windows.csproj b/DS4Windows/DS4Windows.csproj index 226899e..a627f6f 100644 --- a/DS4Windows/DS4Windows.csproj +++ b/DS4Windows/DS4Windows.csproj @@ -107,7 +107,7 @@ none MinimumRecommendedRules.ruleset true - 7.2 + 7.3 On true 1 @@ -144,6 +144,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. 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"