From 082c7036f556c77fa70ee582f7e18b01e912bc31 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sat, 2 Mar 2024 13:16:08 +0100 Subject: [PATCH] Check whether autotdp is available at all. --- app/AutoTDP/AutoTDPService.cs | 26 +++++++++++++++++++++++++- app/Settings.cs | 2 ++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/AutoTDP/AutoTDPService.cs b/app/AutoTDP/AutoTDPService.cs index 0272b8d9..4dd76f03 100644 --- a/app/AutoTDP/AutoTDPService.cs +++ b/app/AutoTDP/AutoTDPService.cs @@ -1,6 +1,7 @@ using System.Text.Json; using GHelper.AutoTDP.FramerateSource; using GHelper.AutoTDP.PowerLimiter; +using Ryzen; namespace GHelper.AutoTDP { @@ -69,9 +70,32 @@ namespace GHelper.AutoTDP return currentGame is not null; } + public static bool IsAvailable() + { + + if (AppConfig.IsAlly()) + { + //Not yet supported + return false; + } + + int availableFS = 0; + int availablePL = 0; + + if (RTSSFramerateSource.IsAvailable()) availableFS++; + + //Intel MSR Limiter is available on Intel only + if (!RyzenControl.IsAMD()) availablePL++; + + //ASUS ACPI Power limiter is available + if (AppConfig.IsASUS()) availablePL++; + + return availablePL > 0 && availableFS > 0; + } + public void Start() { - if (!IsEnabled() || IsRunning()) + if (!IsEnabled() || IsRunning() || !IsAvailable()) { return; } diff --git a/app/Settings.cs b/app/Settings.cs index e93c66ed..add11280 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -453,6 +453,8 @@ namespace GHelper Task.Run((Action)RefreshPeripheralsBattery); updateControl.CheckForUpdates(); + + tableAdditionalGPUFeature.Visible = AutoTDPService.IsAvailable(); } }