feat: ensure anti capture visibility

This commit is contained in:
2025-10-22 03:30:05 -04:00
parent 153c719eb5
commit 529576d972
2 changed files with 12 additions and 4 deletions
+9 -4
View File
@@ -37,11 +37,12 @@ namespace Spectrum.Detection
{
while (true)
{
var config = mainConfig.Data;
try
{
if (InputManager.IsKeyOrMouseDown(mainConfig.Data.Keybind) || InputManager.IsKeyOrMouseDown(mainConfig.Data.TriggerKeybind))
if (InputManager.IsKeyOrMouseDown(config.Keybind) || InputManager.IsKeyOrMouseDown(config.TriggerKeybind))
{
var config = mainConfig.Data;
if (config.DebugMode)
stopwatch.Restart();
@@ -268,15 +269,19 @@ namespace Spectrum.Detection
MovementPaths.ResetWindMouse();
Thread.Sleep(5);
}
if (InputManager.IsKeyOrMouseDown(mainConfig.Data.MenuKey))
if (InputManager.IsKeyOrMouseDown(config.MenuKey))
{
var now = DateTime.Now;
if ((now - lastMenuToggle).TotalMilliseconds > 175)
{
mainConfig.Data.ShowMenu = !mainConfig.Data.ShowMenu;
config.ShowMenu = !config.ShowMenu;
lastMenuToggle = now;
}
}
if (config.AntiCapture && !Win32.IsWindowHidden)
Win32.EnableAntiCapture(renderer!.window.Handle);
else if (!config.AntiCapture && Win32.IsWindowHidden)
Win32.DisableAntiCapture(renderer!.window.Handle);
}
catch (Exception ex)
{
+3
View File
@@ -16,6 +16,7 @@ namespace Spectrum
private const int SM_YVIRTUALSCREEN = 77;
private const int SM_CXVIRTUALSCREEN = 78;
private const int SM_CYVIRTUALSCREEN = 79;
public static bool IsWindowHidden = false;
public static (int Width, int Height) GetPrimaryScreenSize()
{
@@ -40,11 +41,13 @@ namespace Spectrum
public static bool EnableAntiCapture(IntPtr windowHandle)
{
IsWindowHidden = true;
return SetWindowDisplayAffinity(windowHandle, WDA_EXCLUDEFROMCAPTURE);
}
public static bool DisableAntiCapture(IntPtr windowHandle)
{
IsWindowHidden = false;
return SetWindowDisplayAffinity(windowHandle, WDA_NONE);
}
}