diff --git a/app/AppConfig.cs b/app/AppConfig.cs index f785ceed..3759dea3 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -416,7 +416,7 @@ public static class AppConfig public static bool IsNoOverdrive() { - return Is("no_overdrive") || IsOLED(); + return Is("no_overdrive"); } public static bool IsNoSleepEvent() diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index 18cafb84..5c237931 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -167,6 +167,9 @@ public class AsusACPI public const int PCoreMax = 16; public const int ECoreMax = 16; + private bool? _allAMD = null; + private bool? _overdrive = null; + [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] private static extern IntPtr CreateFile( @@ -636,8 +639,14 @@ public class AsusACPI public bool IsAllAmdPPT() { - //return false; - return DeviceGet(PPT_CPUB0) >= 0 && DeviceGet(PPT_GPUC0) < 0; + if (_allAMD is null) _allAMD = DeviceGet(PPT_CPUB0) >= 0 && DeviceGet(PPT_GPUC0) < 0; + return (bool)_allAMD; + } + + public bool IsOverdriveSupported() + { + if (_overdrive is null) _overdrive = DeviceGet(ScreenOverdrive) >= 0; + return (bool)_overdrive; } public bool IsNVidiaGPU() diff --git a/app/Display/ScreenControl.cs b/app/Display/ScreenControl.cs index b48552f6..07b463c4 100644 --- a/app/Display/ScreenControl.cs +++ b/app/Display/ScreenControl.cs @@ -51,10 +51,10 @@ namespace GHelper.Display ScreenNative.SetRefreshRate(laptopScreen, frequency); } - if (overdrive >= 0) + if (Program.acpi.IsOverdriveSupported() && overdrive >= 0) { if (AppConfig.IsNoOverdrive()) overdrive = 0; - if (!AppConfig.IsOLED() && overdrive != Program.acpi.DeviceGet(AsusACPI.ScreenOverdrive)) + if (overdrive != Program.acpi.DeviceGet(AsusACPI.ScreenOverdrive)) { Program.acpi.DeviceSet(AsusACPI.ScreenOverdrive, overdrive, "ScreenOverdrive"); } @@ -119,7 +119,7 @@ namespace GHelper.Display int maxFrequency = ScreenNative.GetMaxRefreshRate(laptopScreen); bool screenAuto = AppConfig.Is("screen_auto"); - bool overdriveSetting = !AppConfig.IsNoOverdrive(); + bool overdriveSetting = Program.acpi.IsOverdriveSupported() && !AppConfig.IsNoOverdrive(); int overdrive = AppConfig.IsNoOverdrive() ? 0 : Program.acpi.DeviceGet(AsusACPI.ScreenOverdrive); diff --git a/app/Extra.cs b/app/Extra.cs index 63f38115..4c5a874b 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -223,10 +223,7 @@ namespace GHelper checkUSBC.Visible = false; } - if (AppConfig.IsOLED()) - { - checkNoOverdrive.Visible = false; - } + checkNoOverdrive.Visible = Program.acpi.IsOverdriveSupported(); // Change text and hide irrelevant options on the ROG Ally, // which is a bit of a special case piece of hardware. @@ -256,7 +253,6 @@ namespace GHelper checkGpuApps.Visible = false; checkUSBC.Visible = false; checkAutoToggleClamshellMode.Visible = false; - checkNoOverdrive.Visible = false; int apuMem = Program.acpi.GetAPUMem(); if (apuMem >= 0)