Skip to content

Commit

Permalink
Overdrive UI Tweaks #2497
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Apr 28, 2024
1 parent d26d9c4 commit 123fbc4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public static bool IsOLED()

public static bool IsNoOverdrive()
{
return Is("no_overdrive") || IsOLED();
return Is("no_overdrive");
}

public static bool IsNoSleepEvent()
Expand Down
13 changes: 11 additions & 2 deletions app/AsusACPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -636,8 +639,14 @@ public bool IsXGConnected()

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()
Expand Down
6 changes: 3 additions & 3 deletions app/Display/ScreenControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
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");
}
Expand Down Expand Up @@ -119,7 +119,7 @@ public void InitScreen()
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);

Expand Down
6 changes: 1 addition & 5 deletions app/Extra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,7 @@ public Extra()
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.
Expand Down Expand Up @@ -256,7 +253,6 @@ public Extra()
checkGpuApps.Visible = false;
checkUSBC.Visible = false;
checkAutoToggleClamshellMode.Visible = false;
checkNoOverdrive.Visible = false;

int apuMem = Program.acpi.GetAPUMem();
if (apuMem >= 0)
Expand Down

0 comments on commit 123fbc4

Please sign in to comment.