Revert "Introduce HidHideCLI"

This reverts commit 9fb343430ba3eabf5daa74e2f7bbcc840e923dea.
This commit is contained in:
Kamil Trzciński 2022-11-25 20:27:57 +01:00
parent 6c436633fc
commit d0b6fb93b0
4 changed files with 0 additions and 141 deletions

View file

@ -25,7 +25,6 @@ namespace SteamController
public bool RequestDesktopMode { get; set; } = true;
public bool SteamRunning { get; set; } = false;
public bool SteamUsesController { get; set; } = false;
public bool ControllerHidden { get; set; } = false;
public bool Enabled
{

View file

@ -55,17 +55,6 @@ namespace SteamController
contextMenu.Opening += delegate { desktopModeItem.Checked = context.RequestDesktopMode; };
contextMenu.Items.Add(desktopModeItem);
var hidHideItem = new ToolStripMenuItem("Use &HidHide");
hidHideItem.Checked = Settings.Default.EnableHidHide;
hidHideItem.Enabled = HidHideCLI.IsAvailable;
hidHideItem.Click += delegate
{
Settings.Default.EnableHidHide = !Settings.Default.EnableHidHide;
Settings.Default.Save();
};
contextMenu.Opening += delegate { hidHideItem.Checked = Settings.Default.EnableHidHide; };
contextMenu.Items.Add(hidHideItem);
var steamDetectionItem = new ToolStripMenuItem("Auto-disable on &Steam");
steamDetectionItem.Checked = Settings.Default.EnableSteamDetection;
steamDetectionItem.Click += delegate

View file

@ -1,74 +0,0 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace SteamController.Helpers
{
internal static class HidHideCLI
{
public const String CLIPath = @"C:\Program Files\Nefarius Software Solutions\HidHide\x64\HidHideCLI.exe";
static HidHideCLI()
{
IsAvailable = File.Exists(CLIPath);
}
public static bool IsAvailable
{
get; private set;
}
public static bool Cloak(bool enable = true)
{
if (enable)
return StartCLI("--cloak-on");
else
return StartCLI("--cloak-off");
}
public static bool RegisterApplication(String path, bool seeHidden = true)
{
if (seeHidden)
return StartCLI("--app-reg", path);
else
return StartCLI("--app-unreg", path);
}
public static bool HideDevice(String path, bool hide = true)
{
if (hide)
return StartCLI("--dev-hide", path);
else
return StartCLI("--dev-unhide", path);
}
public static bool RegisterApplication(bool seeHidden)
{
var process = Process.GetCurrentProcess();
var fullPath = process?.MainModule?.FileName;
if (fullPath is not null)
return RegisterApplication(fullPath, seeHidden);
return true;
}
private static bool StartCLI(params string[] args)
{
var si = new ProcessStartInfo()
{
FileName = CLIPath,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
CreateNoWindow = true
};
foreach (var arg in args)
{
si.ArgumentList.Add(arg);
}
var process = Process.Start(si);
return process is not null;
}
}
}

View file

@ -1,55 +0,0 @@
using System.Diagnostics;
using SteamController.Helpers;
namespace SteamController.Managers
{
public sealed class HidHideManager : Manager
{
public const String NeptuneDevicePath = @"HID\VID_28DE&PID_1205&MI_02\8&a5f3a41&0&0000";
private bool? applicationRegistered;
private bool? deviceHidden;
private bool? clockDevices;
public override void Tick(Context context)
{
if (applicationRegistered != true)
{
HidHideCLI.RegisterApplication(true);
applicationRegistered = true;
}
if (clockDevices != true)
{
HidHideCLI.Cloak(true);
clockDevices = true;
}
if (!Settings.Default.EnableHidHide)
{
HideDevice(false);
return;
}
if (context.SteamUsesController)
{
HideDevice(false);
context.ControllerHidden = false;
}
else
{
HideDevice(true);
context.ControllerHidden = true;
}
}
private void HideDevice(bool hidden)
{
if (deviceHidden == hidden)
return;
HidHideCLI.HideDevice(NeptuneDevicePath, hidden);
deviceHidden = hidden;
}
}
}