mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Under the hood changes
This commit is contained in:
@@ -192,9 +192,8 @@ namespace GHelper
|
|||||||
Debug.WriteLine(isPlugged.ToString());
|
Debug.WriteLine(isPlugged.ToString());
|
||||||
|
|
||||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||||
settingsForm.AutoPerformance(isPlugged);
|
|
||||||
settingsForm.AutoScreen(isPlugged);
|
|
||||||
|
|
||||||
|
settingsForm.AutoPerformance(isPlugged);
|
||||||
settingsForm.AutoGPUMode(isPlugged);
|
settingsForm.AutoGPUMode(isPlugged);
|
||||||
|
|
||||||
settingsForm.SetMatrix(isPlugged);
|
settingsForm.SetMatrix(isPlugged);
|
||||||
|
|||||||
49
Settings.cs
49
Settings.cs
@@ -518,21 +518,15 @@ namespace GHelper
|
|||||||
frequency = 120;
|
frequency = 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frequency > 0)
|
if (frequency <= 0) return;
|
||||||
NativeMethods.SetRefreshRate(frequency);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (overdrive > 0)
|
|
||||||
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Debug.WriteLine("Screen Overdrive not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
NativeMethods.SetRefreshRate(frequency);
|
||||||
|
if (overdrive > 0)
|
||||||
|
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
||||||
|
|
||||||
InitScreen();
|
InitScreen();
|
||||||
|
Debug.WriteLine(frequency);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitScreen()
|
public void InitScreen()
|
||||||
@@ -728,8 +722,9 @@ namespace GHelper
|
|||||||
var timer = new System.Timers.Timer(500);
|
var timer = new System.Timers.Timer(500);
|
||||||
timer.Elapsed += delegate
|
timer.Elapsed += delegate
|
||||||
{
|
{
|
||||||
SetPower();
|
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
|
timer.Dispose();
|
||||||
|
SetPower();
|
||||||
};
|
};
|
||||||
timer.Start();
|
timer.Start();
|
||||||
}
|
}
|
||||||
@@ -817,7 +812,6 @@ namespace GHelper
|
|||||||
else
|
else
|
||||||
SetScreen(60, 0);
|
SetScreen(60, 0);
|
||||||
|
|
||||||
InitScreen();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,7 +824,6 @@ namespace GHelper
|
|||||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||||
|
|
||||||
|
|
||||||
if (mux == 0) // GPU in Ultimate, ignore
|
if (mux == 0) // GPU in Ultimate, ignore
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
@@ -864,10 +857,13 @@ namespace GHelper
|
|||||||
else
|
else
|
||||||
GpuMode = ASUSWmi.GPUModeStandard;
|
GpuMode = ASUSWmi.GPUModeStandard;
|
||||||
|
|
||||||
if (mux != 1)
|
buttonUltimate.Visible = (mux == 1);
|
||||||
Disable_Ultimate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ButtonEnabled(buttonEco, true);
|
||||||
|
ButtonEnabled(buttonStandard, true);
|
||||||
|
ButtonEnabled(buttonUltimate, true);
|
||||||
|
|
||||||
Program.config.setConfig("gpu_mode", GpuMode);
|
Program.config.setConfig("gpu_mode", GpuMode);
|
||||||
VisualiseGPUMode(GpuMode);
|
VisualiseGPUMode(GpuMode);
|
||||||
|
|
||||||
@@ -878,16 +874,24 @@ namespace GHelper
|
|||||||
|
|
||||||
public void SetEcoGPU(int eco)
|
public void SetEcoGPU(int eco)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ButtonEnabled(buttonEco, false);
|
||||||
|
ButtonEnabled(buttonStandard, false);
|
||||||
|
ButtonEnabled(buttonUltimate, false);
|
||||||
|
|
||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.IsBackground = true;
|
Thread.CurrentThread.IsBackground = true;
|
||||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco);
|
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco);
|
||||||
BeginInvoke(delegate { InitGPUMode(); });
|
Program.settingsForm.BeginInvoke(delegate {
|
||||||
|
InitGPUMode();
|
||||||
|
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
|
||||||
|
});
|
||||||
}).Start();
|
}).Start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGPUMode(int GPUMode = ASUSWmi.GPUModeStandard)
|
public void SetGPUMode(int GPUMode)
|
||||||
{
|
{
|
||||||
|
|
||||||
int CurrentGPU = Program.config.getConfig("gpu_mode");
|
int CurrentGPU = Program.config.getConfig("gpu_mode");
|
||||||
@@ -984,6 +988,7 @@ namespace GHelper
|
|||||||
Program.trayIcon.Icon = GHelper.Properties.Resources.standard;
|
Program.trayIcon.Icon = GHelper.Properties.Resources.standard;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1007,10 +1012,10 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disable_Ultimate()
|
public void ButtonEnabled(Button but, bool enabled)
|
||||||
{
|
{
|
||||||
buttonUltimate.Enabled = false;
|
but.Enabled = enabled;
|
||||||
buttonUltimate.BackColor = SystemColors.ControlLight;
|
but.BackColor = enabled ? SystemColors.ControlLightLight : SystemColors.ControlLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetStartupCheck(bool status)
|
public void SetStartupCheck(bool status)
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
ps2exe .\ghelper.ps1 g14-helper.exe -title 'G14 Helper' -DPIAware -winFormsDPIAware -requireAdmin -iconFile 'standard.ico' -noConsole -copyright 'G14 Helper Tool' -noOutput
|
|
||||||
File diff suppressed because one or more lines are too long
BIN
old-ps1-script/ghelper.zip
Normal file
BIN
old-ps1-script/ghelper.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user