Require to acknowledge Anti-Cheat impact on FanControl

This commit is contained in:
Kamil Trzciński 2022-12-19 11:58:48 +01:00
parent 939894be41
commit 1da838227d
3 changed files with 82 additions and 9 deletions

View file

@ -55,18 +55,21 @@ namespace FanControl
fanModeSelectMenu.Items.Add(item);
}
setFanMode(Settings.Default.FanMode);
propertyGrid1.SelectedObject = fanControl;
propertyGrid1.ExpandAllGridItems();
notifyIcon.ShowBalloonTip(3000, Text, "Fan Control Started", ToolTipIcon.Info);
Microsoft.Win32.SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
Opacity = 0;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
setFanMode(Settings.Default.FanMode, !Settings.Default.AckAntiCheat);
notifyIcon.ShowBalloonTip(3000, Text, "Fan Control Started", ToolTipIcon.Info);
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
@ -74,6 +77,36 @@ namespace FanControl
Opacity = 100;
}
private bool AckAntiCheat()
{
if (Settings.Default.AckAntiCheat && Settings.Default.EnableExperimentalFeatures)
return true;
var result = MessageBox.Show(
String.Join("\n",
"WARNING!!!!",
"",
"Usage of SteamOS or Max Fan Curve might trigger anti-cheat protection in some games.",
"This might result in kicking from the application or even be banned.",
"",
"Ensure that you USE DEFAULT FAN when playing games with ANTI-CHEAT PROTECTION.",
"",
"CLICK YES TO ACKNOWLEDGE?",
"CLICK NO TO LEARN MORE."
), Text, MessageBoxButtons.YesNo
);
if (result == DialogResult.Yes)
{
Settings.Default.AckAntiCheat = true;
return true;
}
try { System.Diagnostics.Process.Start("explorer.exe", "https://steam-deck-tools.ayufan.dev/#anti-cheat-and-antivirus-software"); }
catch { }
return false;
}
private void SystemEvents_PowerModeChanged(object sender, Microsoft.Win32.PowerModeChangedEventArgs e)
{
// Restore fan mode on resume
@ -84,8 +117,14 @@ namespace FanControl
}
}
private void setFanMode(FanMode mode)
private void setFanMode(FanMode mode, bool requireAck = true)
{
if (mode != FanMode.Default && mode != fanControl.Mode)
{
if (requireAck && !AckAntiCheat())
return;
}
fanControl.SetMode(mode);
Settings.Default.FanMode = mode;
@ -157,8 +196,20 @@ namespace FanControl
if (fanControl is null)
return;
SharedData_Update();
try
{
fanLoopTimer.Enabled = false;
SharedData_Update();
}
finally
{
fanLoopTimer.Enabled = true;
}
#if DEBUG
fanControl.Update(Visible);
#else
fanControl.Update();
#endif
}
private void propertyGridUpdateTimer_Tick(object sender, EventArgs e)

View file

@ -17,7 +17,13 @@ namespace FanControl
internal partial class FanController : IDisposable
{
[CategoryAttribute("Fan")]
public FanMode Mode { get; private set; }
public FanMode Mode { get; private set; } = FanMode.Default;
[CategoryAttribute("Fan")]
public bool KernelDriversLoaded
{
get => Instance.UseKernelDrivers;
}
[CategoryAttribute("Fan")]
[NotifyParentProperty(true)]
@ -71,12 +77,13 @@ namespace FanControl
return rpm;
}
[Browsable(false)]
public bool IsActive
{
get { return Vlv0100.IsOpen; }
}
public void Update(bool visible)
public void Update(bool showForDefault = false)
{
var mutex = Instance.WaitGlobalMutex(200);
if (mutex is null)
@ -88,9 +95,13 @@ namespace FanControl
try
{
if (Mode == FanMode.Default && !visible)
if (!Settings.Default.AckAntiCheat || Mode == FanMode.Default && !showForDefault)
{
Instance.UseKernelDrivers = false;
CurrentRPM = null;
DesiredRPM = 0;
foreach (var sensor in allSensors.Values)
sensor.Reset();
return;
}
else if (!Vlv0100.IsOpen)

View file

@ -22,5 +22,16 @@ namespace FanControl
get { return Get<bool>("AlwaysOnTop", true); }
set { Set("AlwaysOnTop", value); }
}
public bool EnableExperimentalFeatures
{
get { return Instance.IsDEBUG; }
}
public bool AckAntiCheat
{
get { return Get<bool>("AckAntiCheat", false); }
set { Set("AckAntiCheat", value); }
}
}
}