Merge branch 'jay' into vigem-udpserver

This commit is contained in:
Travis Nickles 2019-03-12 18:55:35 -05:00
commit 489a36be00
8 changed files with 88 additions and 9 deletions

View File

@ -1592,7 +1592,7 @@ namespace DS4Windows
public int notifications = 2; public int notifications = 2;
public bool disconnectBTAtStop = false; public bool disconnectBTAtStop = false;
public bool swipeProfiles = true; public bool swipeProfiles = true;
public bool ds4Mapping = true; public bool ds4Mapping = false;
public bool quickCharge = false; public bool quickCharge = false;
public int firstXinputPort = 1; public int firstXinputPort = 1;
public bool closeMini = false; public bool closeMini = false;

View File

@ -81,8 +81,8 @@ namespace DS4Windows
public UdpServer(GetPadDetail getPadDetailDel) public UdpServer(GetPadDetail getPadDetailDel)
{ {
portInfoGet = getPadDetailDel; portInfoGet = getPadDetailDel;
argsList = new SocketAsyncEventArgs[20]; argsList = new SocketAsyncEventArgs[40];
for (int num = 0; num <= 19; num++) for (int num = 0; num < 40; num++)
{ {
SocketAsyncEventArgs args = new SocketAsyncEventArgs(); SocketAsyncEventArgs args = new SocketAsyncEventArgs();
args.SetBuffer(new byte[100], 0, 100); args.SetBuffer(new byte[100], 0, 100);
@ -188,7 +188,7 @@ namespace DS4Windows
int temp = 0; int temp = 0;
poolLock.EnterWriteLock(); poolLock.EnterWriteLock();
temp = listInd; temp = listInd;
listInd = ++listInd % 20; listInd = ++listInd % 40;
SocketAsyncEventArgs args = argsList[temp]; SocketAsyncEventArgs args = argsList[temp];
poolLock.ExitWriteLock(); poolLock.ExitWriteLock();
@ -654,7 +654,7 @@ namespace DS4Windows
int temp = 0; int temp = 0;
poolLock.EnterWriteLock(); poolLock.EnterWriteLock();
temp = listInd; temp = listInd;
listInd = ++listInd % 20; listInd = ++listInd % 40;
SocketAsyncEventArgs args = argsList[temp]; SocketAsyncEventArgs args = argsList[temp];
poolLock.ExitWriteLock(); poolLock.ExitWriteLock();

View File

@ -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);
}
}

View File

@ -1114,7 +1114,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
if (!inHotPlug) if (!inHotPlug)
{ {
inHotPlug = true; 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) while (loopHotplug == true)
{ {
Thread.Sleep(1500);
Program.rootHub.HotPlug(); Program.rootHub.HotPlug();
//TaskRunner.Run(() => { Program.rootHub.HotPlug(uiContext); }); //TaskRunner.Run(() => { Program.rootHub.HotPlug(uiContext); });
lock (hotplugCounterLock) lock (hotplugCounterLock)

View File

@ -107,7 +107,7 @@
<ErrorReport>none</ErrorReport> <ErrorReport>none</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<LangVersion>7.2</LangVersion> <LangVersion>7.3</LangVersion>
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningLevel>1</WarningLevel> <WarningLevel>1</WarningLevel>
@ -144,6 +144,7 @@
<Compile Include="DS4Control\ScpDevice.cs" /> <Compile Include="DS4Control\ScpDevice.cs" />
<Compile Include="DS4Control\ScpUtil.cs" /> <Compile Include="DS4Control\ScpUtil.cs" />
<Compile Include="DS4Control\UdpServer.cs" /> <Compile Include="DS4Control\UdpServer.cs" />
<Compile Include="DS4Control\Util.cs" />
<Compile Include="DS4Control\X360Device.cs" /> <Compile Include="DS4Control\X360Device.cs" />
<Compile Include="DS4Forms\LanguagePackComboBox.cs"> <Compile Include="DS4Forms\LanguagePackComboBox.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>

View File

@ -75,6 +75,16 @@ namespace DS4Windows
} }
catch { } // Ignore problems raising the priority. 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 try
{ {
// another instance is already running if OpenExsting succeeds. // another instance is already running if OpenExsting succeeds.

View File

@ -212,7 +212,7 @@ namespace DS4Windows.Properties {
} }
/// <summary> /// <summary>
/// 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).
/// </summary> /// </summary>
public static string BTPollRate { public static string BTPollRate {
get { get {

View File

@ -158,7 +158,7 @@
<value>..\Resources\BT.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\BT.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="BTPollRate" xml:space="preserve"> <data name="BTPollRate" xml:space="preserve">
<value>Determines the poll rate used for the DS4 hardware when connected via Bluetooth</value> <value>Determines the poll rate used for the DS4 hardware when connected via Bluetooth. (Applies on profile save)</value>
</data> </data>
<data name="CannotMoveFiles" xml:space="preserve"> <data name="CannotMoveFiles" xml:space="preserve">
<value>Cannot move files to new location, Please rename the DS4Tool folder to "DS4Windows"</value> <value>Cannot move files to new location, Please rename the DS4Tool folder to "DS4Windows"</value>