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 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;

View File

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

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)
{
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)

View File

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

View File

@ -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.

View File

@ -212,7 +212,7 @@ namespace DS4Windows.Properties {
}
/// <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>
public static string BTPollRate {
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>
</data>
<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 name="CannotMoveFiles" xml:space="preserve">
<value>Cannot move files to new location, Please rename the DS4Tool folder to "DS4Windows"</value>