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)
|
while (true)
|
||||||
{
|
{
|
||||||
|
var config = mainConfig.Data;
|
||||||
try
|
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)
|
if (config.DebugMode)
|
||||||
stopwatch.Restart();
|
stopwatch.Restart();
|
||||||
|
|
||||||
@@ -268,15 +269,19 @@ namespace Spectrum.Detection
|
|||||||
MovementPaths.ResetWindMouse();
|
MovementPaths.ResetWindMouse();
|
||||||
Thread.Sleep(5);
|
Thread.Sleep(5);
|
||||||
}
|
}
|
||||||
if (InputManager.IsKeyOrMouseDown(mainConfig.Data.MenuKey))
|
if (InputManager.IsKeyOrMouseDown(config.MenuKey))
|
||||||
{
|
{
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
if ((now - lastMenuToggle).TotalMilliseconds > 175)
|
if ((now - lastMenuToggle).TotalMilliseconds > 175)
|
||||||
{
|
{
|
||||||
mainConfig.Data.ShowMenu = !mainConfig.Data.ShowMenu;
|
config.ShowMenu = !config.ShowMenu;
|
||||||
lastMenuToggle = now;
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace Spectrum
|
|||||||
private const int SM_YVIRTUALSCREEN = 77;
|
private const int SM_YVIRTUALSCREEN = 77;
|
||||||
private const int SM_CXVIRTUALSCREEN = 78;
|
private const int SM_CXVIRTUALSCREEN = 78;
|
||||||
private const int SM_CYVIRTUALSCREEN = 79;
|
private const int SM_CYVIRTUALSCREEN = 79;
|
||||||
|
public static bool IsWindowHidden = false;
|
||||||
|
|
||||||
public static (int Width, int Height) GetPrimaryScreenSize()
|
public static (int Width, int Height) GetPrimaryScreenSize()
|
||||||
{
|
{
|
||||||
@@ -40,11 +41,13 @@ namespace Spectrum
|
|||||||
|
|
||||||
public static bool EnableAntiCapture(IntPtr windowHandle)
|
public static bool EnableAntiCapture(IntPtr windowHandle)
|
||||||
{
|
{
|
||||||
|
IsWindowHidden = true;
|
||||||
return SetWindowDisplayAffinity(windowHandle, WDA_EXCLUDEFROMCAPTURE);
|
return SetWindowDisplayAffinity(windowHandle, WDA_EXCLUDEFROMCAPTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool DisableAntiCapture(IntPtr windowHandle)
|
public static bool DisableAntiCapture(IntPtr windowHandle)
|
||||||
{
|
{
|
||||||
|
IsWindowHidden = false;
|
||||||
return SetWindowDisplayAffinity(windowHandle, WDA_NONE);
|
return SetWindowDisplayAffinity(windowHandle, WDA_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user