Late launch HidGuardHelper

This commit is contained in:
Travis Nickles 2020-01-25 21:22:18 -06:00
parent c02e6c89dc
commit b1872cee6a
2 changed files with 19 additions and 17 deletions

View File

@ -160,6 +160,7 @@ namespace DS4WinWPF
SetUICulture(DS4Windows.Global.UseLang);
DS4Windows.Global.LoadLinkedProfiles();
rootHub.LaunchHidGuardHelper();
DS4Forms.MainWindow window = new DS4Forms.MainWindow(parser);
MainWindow = window;
window.Show();

View File

@ -137,7 +137,8 @@ namespace DS4Windows
//sp.Stream = DS4WinWPF.Properties.Resources.EE;
// Cause thread affinity to not be tied to main GUI thread
tempBusThread = new Thread(() => {
tempBusThread = new Thread(() =>
{
//_udpServer = new UdpServer(GetPadDetailForIdx);
busThrRunning = true;
@ -165,18 +166,6 @@ namespace DS4Windows
// Thread.SpinWait(500);
//}
if (Global.hidguardInstalled)
{
ProcessStartInfo startInfo =
new ProcessStartInfo(Global.exedirpath + "\\HidGuardHelper.exe");
startInfo.Verb = "runas";
startInfo.Arguments = Process.GetCurrentProcess().Id.ToString();
startInfo.WorkingDirectory = Global.exedirpath;
try
{ Process tempProc = Process.Start(startInfo); tempProc.Dispose(); }
catch { }
}
for (int i = 0, arlength = DS4Controllers.Length; i < arlength; i++)
{
MappedState[i] = new DS4State();
@ -189,6 +178,22 @@ namespace DS4Windows
outputslotMan = new OutputSlotManager();
}
public void LaunchHidGuardHelper()
{
if (Global.hidguardInstalled)
{
LogDebug("HidGuardian in use. Launching HidGuardHelper.");
ProcessStartInfo startInfo =
new ProcessStartInfo(Global.exedirpath + "\\HidGuardHelper.exe");
startInfo.Verb = "runas";
startInfo.Arguments = Process.GetCurrentProcess().Id.ToString();
startInfo.WorkingDirectory = Global.exedirpath;
try
{ Process tempProc = Process.Start(startInfo); tempProc.Dispose(); }
catch { }
}
}
private void TestQueueBus(Action temp)
{
lock (busEvtQueueLock)
@ -422,10 +427,6 @@ namespace DS4Windows
LogDebug(DS4WinWPF.Properties.Resources.Starting);
LogDebug($"Connection to ViGEmBus {Global.vigembusVersion} established");
if (Global.hidguardInstalled)
{
LogDebug($"HidGuardian In Use");
}
DS4Devices.isExclusiveMode = getUseExclusiveMode();
//uiContext = tempui as SynchronizationContext;