Added CPU boost control

This commit is contained in:
seerge
2023-02-18 21:08:22 +01:00
parent e782467585
commit 023d7388bd
5 changed files with 203 additions and 54 deletions

View File

@@ -49,6 +49,8 @@ namespace GHelper
buttonQuit.Click += ButtonQuit_Click;
checkBoost.Click += CheckBoost_Click;
checkScreen.CheckedChanged += checkScreen_CheckedChanged;
SetTimer();
@@ -56,6 +58,15 @@ namespace GHelper
}
private void CheckBoost_Click(object? sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
if (chk.Checked)
NativeMethods.SetCPUBoost(3);
else
NativeMethods.SetCPUBoost(0);
}
private void Button120Hz_Click(object? sender, EventArgs e)
{
SetScreen(1000, 1);
@@ -91,6 +102,12 @@ namespace GHelper
}
public void InitBoost()
{
int boost = NativeMethods.GetCPUBoost();
checkBoost.Checked = (boost > 0);
}
public void InitScreen()
{
@@ -197,7 +214,7 @@ namespace GHelper
InitScreen();
this.Left = Screen.FromControl(this).Bounds.Width - 10 - this.Width;
this.Top = Screen.FromControl(this).Bounds.Height - 100 - this.Height;
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
this.Activate();
aTimer.Enabled = true;
}
@@ -401,7 +418,7 @@ namespace GHelper
break;
case ASUSWmi.GPUModeUltimate:
buttonUltimate.FlatAppearance.BorderSize = buttonActive;
labelGPU.Text = "GPU Mode: Ultimate (dGPU exclusive)";
labelGPU.Text = "GPU Mode: Ultimate (dGPU is main)";
Program.trayIcon.Icon = GHelper.Properties.Resources.ultimate;
break;
default:
@@ -413,8 +430,6 @@ namespace GHelper
}
private void ButtonSilent_Click(object? sender, EventArgs e)
{
SetPerformanceMode(ASUSWmi.PerformanceSilent);
@@ -480,13 +495,9 @@ namespace GHelper
{
CheckBox chk = (CheckBox)sender;
if (chk.Checked)
{
Program.config.setConfig("gpu_auto", 1);
}
else
{
Program.config.setConfig("gpu_auto", 0);
}
}
@@ -494,13 +505,9 @@ namespace GHelper
{
CheckBox chk = (CheckBox)sender;
if (chk.Checked)
{
Program.config.setConfig("screen_auto", 1);
}
else
{
Program.config.setConfig("screen_auto", 0);
}
}
}