Better logic to handle availability of tdp limiters

This commit is contained in:
IceStormNG
2024-03-02 13:29:56 +01:00
parent b104d852c7
commit f2ef77b866
4 changed files with 18 additions and 6 deletions

View File

@@ -82,13 +82,14 @@ namespace GHelper.AutoTDP
int availableFS = 0;
int availablePL = 0;
//Requires RTSS to be installed
if (RTSSFramerateSource.IsAvailable()) availableFS++;
//Intel MSR Limiter is available on Intel only
if (!RyzenControl.IsAMD()) availablePL++;
if (IntelMSRPowerLimiter.IsAvailable()) availablePL++;
//ASUS ACPI Power limiter is available
if (AppConfig.IsASUS()) availablePL++;
if (ASUSACPIPowerLimiter.IsAvailable()) availablePL++;
return availablePL > 0 && availableFS > 0;
}

View File

@@ -1,4 +1,5 @@
using GHelper.AutoTDP.FramerateSource;
using GHelper.AutoTDP.PowerLimiter;
using GHelper.UI;
using Ryzen;
@@ -123,7 +124,7 @@ namespace GHelper.AutoTDP
{
checkBoxEnabled.Checked = AppConfig.Get("auto_tdp_enabled", 0) == 1;
if (!RyzenControl.IsAMD())
if (IntelMSRPowerLimiter.IsAvailable())
comboBoxLimiter.Items.Add("Intel MSR Power Limiter");
@@ -134,14 +135,14 @@ namespace GHelper.AutoTDP
if (comboBoxLimiter.Items.Count > 0 && limiter is null)
comboBoxLimiter.SelectedIndex = 0;
if (!RyzenControl.IsAMD() && limiter is not null && limiter.Equals("intel_msr"))
if (IntelMSRPowerLimiter.IsAvailable() && limiter is not null && limiter.Equals("intel_msr"))
{
comboBoxLimiter.SelectedIndex = 0;
}
if (limiter is not null && limiter.Equals("asus_acpi"))
if (limiter is not null && limiter.Equals("asus_acpi") && ASUSACPIPowerLimiter.IsAvailable())
{
comboBoxLimiter.SelectedIndex = !RyzenControl.IsAMD() ? 1 : 0;
comboBoxLimiter.SelectedIndex = IntelMSRPowerLimiter.IsAvailable() ? 1 : 0;
}

View File

@@ -17,6 +17,11 @@ namespace GHelper.AutoTDP.PowerLimiter
}
public static bool IsAvailable()
{
return AppConfig.IsASUS();
}
public void SavePowerLimits()
{
DefaultA0 = Program.acpi.DeviceGet(AsusACPI.PPT_APUA0);

View File

@@ -27,6 +27,11 @@ namespace GHelper.AutoTDP.PowerLimiter
ReadPowerUnit();
}
public static bool IsAvailable()
{
return !RyzenControl.IsAMD();
}
public void SavePowerLimits()
{
DefaultEax = 0;