From 9c0a326d489eb5ff7f569136ef5ff07747b84cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Mon, 19 Dec 2022 12:33:45 +0100 Subject: [PATCH] Require to acknowledge `Anti-Cheat` impact on `PowerControl` --- PowerControl/MenuStack.cs | 21 +++++++++++++++++++++ PowerControl/Program.cs | 6 ++++++ PowerControl/Settings.cs | 34 +++++++++++++++++++++++++++++----- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/PowerControl/MenuStack.cs b/PowerControl/MenuStack.cs index f7616fe..0472ea3 100644 --- a/PowerControl/MenuStack.cs +++ b/PowerControl/MenuStack.cs @@ -252,6 +252,13 @@ namespace PowerControl ActiveOption = "?", ApplyValue = delegate(object selected) { + if (!Settings.Default.AckAntiCheat( + Controller.TitleWithVersion, + "TDP", + "Changing TDP requires kernel access for a short period. Leave the game if it uses anti-cheat protection.") + ) + return null; + uint mW = uint.Parse(selected.ToString().Replace("W", "")) * 1000; if (VangoghGPU.IsSupported) @@ -301,6 +308,13 @@ namespace PowerControl ResetValue = () => { return "Default"; }, ApplyValue = delegate(object selected) { + if (!Settings.Default.AckAntiCheat( + Controller.TitleWithVersion, + "GPU", + "Changing GPU frequency requires kernel access for a short period. Leave the game if it uses anti-cheat protection.") + ) + return null; + return Instance.WithGlobalMutex(200, () => { using (var sd = VangoghGPU.Open()) @@ -330,6 +344,13 @@ namespace PowerControl ResetValue = () => { return "Default"; }, ApplyValue = delegate(object selected) { + if (!Settings.Default.AckAntiCheat( + Controller.TitleWithVersion, + "CPU", + "Changing GPU frequency requires kernel access for a short period. Leave the game if it uses anti-cheat protection.") + ) + return null; + return Instance.WithGlobalMutex(200, () => { using (var sd = VangoghGPU.Open()) diff --git a/PowerControl/Program.cs b/PowerControl/Program.cs index 4e7afac..216d822 100644 --- a/PowerControl/Program.cs +++ b/PowerControl/Program.cs @@ -18,6 +18,12 @@ namespace PowerControl { if (Settings.Default.EnableExperimentalFeatures) { + if (!Settings.Default.AckAntiCheat( + Controller.TitleWithVersion, + "ExperimentalFeatures", + "You are running EXPERIMENTAL build.")) + return; + for (int i = 0; !VangoghGPU.IsSupported; i++) { Instance.WithGlobalMutex(1000, () => VangoghGPU.Detect()); diff --git a/PowerControl/Settings.cs b/PowerControl/Settings.cs index 5d49307..2ed438b 100644 --- a/PowerControl/Settings.cs +++ b/PowerControl/Settings.cs @@ -49,11 +49,35 @@ namespace PowerControl public bool EnableExperimentalFeatures { -#if DEBUG - get { return true; } -#else - get { return false; } -#endif + get { return Instance.IsDEBUG; } + } + + public bool AckAntiCheat(String title, String name, String message) + { + if (Get("AckAntiCheat" + name, false) && Settings.Default.EnableExperimentalFeatures) + return true; + + var result = MessageBox.Show( + String.Join("\n", + "WARNING!!!!", + "", + message, + "This might result in kicking from the application or even be banned.", + "", + "CLICK YES TO ACKNOWLEDGE?", + "CLICK NO TO LEARN MORE." + ), title, MessageBoxButtons.YesNo + ); + + if (result == DialogResult.Yes) + { + Set("AckAntiCheat" + name, true); + return true; + } + + try { System.Diagnostics.Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev/#anti-cheat-and-antivirus-software"); } + catch { } + return false; } } }