mirror of
https://github.com/whoswhip/Spectrum.git
synced 2026-12-06 01:28:42 +00:00
feat: ensure anti capture visibility
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user