mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Some renamings
This commit is contained in:
@@ -75,12 +75,16 @@ public class AppConfig
|
||||
|
||||
public int getConfig(string name, bool performance = false)
|
||||
{
|
||||
|
||||
if (config.ContainsKey(name))
|
||||
return int.Parse(config[name].ToString());
|
||||
else return -1;
|
||||
}
|
||||
|
||||
public bool isConfig(string name)
|
||||
{
|
||||
return getConfig(name) == 1;
|
||||
}
|
||||
|
||||
public string getConfigString(string name)
|
||||
{
|
||||
if (config.ContainsKey(name))
|
||||
@@ -115,22 +119,32 @@ public class AppConfig
|
||||
}
|
||||
}
|
||||
|
||||
public string getParamName(int device, string paramName = "fan_profile")
|
||||
public string getParamName(AsusFan device, string paramName = "fan_profile")
|
||||
{
|
||||
int mode = getConfig("performance_mode");
|
||||
string name;
|
||||
|
||||
if (device == 1)
|
||||
switch (device)
|
||||
{
|
||||
case AsusFan.GPU:
|
||||
name = "gpu";
|
||||
else if (device == 2)
|
||||
break;
|
||||
case AsusFan.Mid:
|
||||
name = "mid";
|
||||
else
|
||||
break;
|
||||
case AsusFan.XGM:
|
||||
name = "xgm";
|
||||
break;
|
||||
default:
|
||||
name = "cpu";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return paramName + "_" + name + "_" + mode;
|
||||
}
|
||||
|
||||
public byte[] getFanConfig(int device)
|
||||
public byte[] getFanConfig(AsusFan device)
|
||||
{
|
||||
string curveString = getConfigString(getParamName(device));
|
||||
byte[] curve = { };
|
||||
@@ -141,7 +155,7 @@ public class AppConfig
|
||||
return curve;
|
||||
}
|
||||
|
||||
public void setFanConfig(int device, byte[] curve)
|
||||
public void setFanConfig(AsusFan device, byte[] curve)
|
||||
{
|
||||
string bitCurve = BitConverter.ToString(curve);
|
||||
setConfig(getParamName(device), bitCurve);
|
||||
@@ -156,7 +170,7 @@ public class AppConfig
|
||||
return array;
|
||||
}
|
||||
|
||||
public byte[] getDefaultCurve(int device)
|
||||
public byte[] getDefaultCurve(AsusFan device)
|
||||
{
|
||||
int mode = getConfig("performance_mode");
|
||||
byte[] curve;
|
||||
@@ -164,19 +178,19 @@ public class AppConfig
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
if (device == 1)
|
||||
if (device == AsusFan.GPU)
|
||||
curve = StringToBytes("14-3F-44-48-4C-50-54-62-16-1F-26-2D-39-47-55-5F");
|
||||
else
|
||||
curve = StringToBytes("14-3F-44-48-4C-50-54-62-11-1A-22-29-34-43-51-5A");
|
||||
break;
|
||||
case 2:
|
||||
if (device == 1)
|
||||
if (device == AsusFan.GPU)
|
||||
curve = StringToBytes("3C-41-42-46-47-4B-4C-62-08-11-11-1D-1D-26-26-2D");
|
||||
else
|
||||
curve = StringToBytes("3C-41-42-46-47-4B-4C-62-03-0C-0C-16-16-22-22-29");
|
||||
break;
|
||||
default:
|
||||
if (device == 1)
|
||||
if (device == AsusFan.GPU)
|
||||
curve = StringToBytes("3A-3D-40-44-48-4D-51-62-0C-16-1D-1F-26-2D-34-4A");
|
||||
else
|
||||
curve = StringToBytes("3A-3D-40-44-48-4D-51-62-08-11-16-1A-22-29-30-45");
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO.Pipes;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class ASUSWmi
|
||||
public enum AsusFan
|
||||
{
|
||||
CPU = 0,
|
||||
GPU = 1,
|
||||
Mid = 2,
|
||||
XGM = 3
|
||||
}
|
||||
|
||||
public class AsusACPI
|
||||
{
|
||||
|
||||
const string FILE_NAME = @"\\.\\ATKACPI";
|
||||
@@ -163,7 +169,7 @@ public class ASUSWmi
|
||||
}
|
||||
|
||||
|
||||
public ASUSWmi()
|
||||
public AsusACPI()
|
||||
{
|
||||
handle = CreateFile(
|
||||
FILE_NAME,
|
||||
@@ -282,7 +288,7 @@ public class ASUSWmi
|
||||
}
|
||||
|
||||
|
||||
public int SetFanCurve(int device, byte[] curve)
|
||||
public int SetFanCurve(AsusFan device, byte[] curve)
|
||||
{
|
||||
|
||||
if (curve.Length != 16) return -1;
|
||||
@@ -295,10 +301,10 @@ public class ASUSWmi
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case 1:
|
||||
case AsusFan.GPU:
|
||||
result = DeviceSet(DevsGPUFanCurve, curve, "FanGPU");
|
||||
break;
|
||||
case 2:
|
||||
case AsusFan.Mid:
|
||||
result = DeviceSet(DevsMidFanCurve, curve, "FanMid");
|
||||
break;
|
||||
default:
|
||||
@@ -309,7 +315,7 @@ public class ASUSWmi
|
||||
return result;
|
||||
}
|
||||
|
||||
public byte[] GetFanCurve(int device, int mode = 0)
|
||||
public byte[] GetFanCurve(AsusFan device, int mode = 0)
|
||||
{
|
||||
uint fan_mode;
|
||||
|
||||
@@ -323,9 +329,9 @@ public class ASUSWmi
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case 1:
|
||||
case AsusFan.GPU:
|
||||
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
||||
case 2:
|
||||
case AsusFan.Mid:
|
||||
return DeviceGetBuffer(DevsMidFanCurve, fan_mode);
|
||||
default:
|
||||
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
||||
@@ -334,7 +340,8 @@ public class ASUSWmi
|
||||
}
|
||||
|
||||
|
||||
public static bool IsEmptyCurve(byte[] curve) {
|
||||
public static bool IsEmptyCurve(byte[] curve)
|
||||
{
|
||||
return curve.Length != 16 || curve.All(singleByte => singleByte == 0);
|
||||
}
|
||||
|
||||
@@ -374,6 +381,11 @@ public class ASUSWmi
|
||||
|
||||
}
|
||||
|
||||
public bool IsXGConnected()
|
||||
{
|
||||
return DeviceGet(GPUXGConnected) == 1;
|
||||
}
|
||||
|
||||
public void TUFKeyboardBrightness(int brightness)
|
||||
{
|
||||
int param = 0x80 | (brightness & 0x7F);
|
||||
@@ -49,7 +49,7 @@ namespace GHelper
|
||||
}
|
||||
}
|
||||
|
||||
public static class Aura
|
||||
public static class AsusUSB
|
||||
{
|
||||
|
||||
static byte[] MESSAGE_SET = { 0x5d, 0xb5, 0, 0, 0 };
|
||||
@@ -208,7 +208,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardBrightness(brightness);
|
||||
Program.acpi.TUFKeyboardBrightness(brightness);
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardPower(
|
||||
Program.acpi.TUFKeyboardPower(
|
||||
flags.Contains(AuraDev19b6.AwakeKeyb),
|
||||
flags.Contains(AuraDev19b6.BootKeyb),
|
||||
flags.Contains(AuraDev19b6.SleepKeyb),
|
||||
@@ -238,20 +238,44 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
public static void ApplyXGMLight(bool status)
|
||||
public static int SetXGM(byte[] msg)
|
||||
{
|
||||
byte value = status ? (byte)0x50 : (byte)0;
|
||||
var msg = new byte[] { 0x5e, 0xc5, value };
|
||||
|
||||
Debug.WriteLine("XGM Payload :" + BitConverter.ToString(msg));
|
||||
|
||||
foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }))
|
||||
{
|
||||
device.OpenDevice();
|
||||
var message = new byte[300];
|
||||
Array.Copy(msg, message, msg.Length);
|
||||
Debug.WriteLine(BitConverter.ToString(message));
|
||||
device.WriteFeatureData(message);
|
||||
Debug.WriteLine("XGM " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg));
|
||||
device.WriteFeatureData(msg);
|
||||
device.CloseDevice();
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void ApplyXGMLight(bool status)
|
||||
{
|
||||
SetXGM(new byte[] { 0x5e, 0xc5, status ? (byte)0x50 : (byte)0 });
|
||||
}
|
||||
|
||||
|
||||
public static int ResetXGM()
|
||||
{
|
||||
return SetXGM(new byte[] { 0x5e, 0xd1, 0x02 });
|
||||
}
|
||||
|
||||
public static int SetXGMFan(byte[] curve)
|
||||
{
|
||||
|
||||
if (AsusACPI.IsEmptyCurve(curve)) return -1;
|
||||
|
||||
byte[] msg = new byte[19];
|
||||
Array.Copy(new byte[] { 0x5e, 0xd1, 0x01 }, msg, 3);
|
||||
Array.Copy(curve, 0, msg, 3, curve.Length);
|
||||
|
||||
return SetXGM(msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +317,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardRGB(Mode, Color1, _speed);
|
||||
Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed);
|
||||
|
||||
}
|
||||
|
||||
14
app/Extra.cs
14
app/Extra.cs
@@ -92,10 +92,10 @@ namespace GHelper
|
||||
Shown += Keyboard_Shown;
|
||||
|
||||
comboKeyboardSpeed.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboKeyboardSpeed.DataSource = new BindingSource(Aura.GetSpeeds(), null);
|
||||
comboKeyboardSpeed.DataSource = new BindingSource(AsusUSB.GetSpeeds(), null);
|
||||
comboKeyboardSpeed.DisplayMember = "Value";
|
||||
comboKeyboardSpeed.ValueMember = "Key";
|
||||
comboKeyboardSpeed.SelectedValue = Aura.Speed;
|
||||
comboKeyboardSpeed.SelectedValue = AsusUSB.Speed;
|
||||
comboKeyboardSpeed.SelectedValueChanged += ComboKeyboardSpeed_SelectedValueChanged;
|
||||
|
||||
// Keyboard
|
||||
@@ -187,7 +187,7 @@ namespace GHelper
|
||||
pictureHelp.Click += PictureHelp_Click;
|
||||
trackBrightness.Scroll += TrackBrightness_Scroll;
|
||||
|
||||
panelXMG.Visible = (Program.wmi.DeviceGet(ASUSWmi.GPUXGConnected) == 1);
|
||||
panelXMG.Visible = (Program.acpi.DeviceGet(AsusACPI.GPUXGConnected) == 1);
|
||||
checkXMG.Checked = !(Program.config.getConfig("xmg_light") == 0);
|
||||
checkXMG.CheckedChanged += CheckXMG_CheckedChanged;
|
||||
|
||||
@@ -202,13 +202,13 @@ namespace GHelper
|
||||
{
|
||||
Program.RunAsAdmin("extra");
|
||||
Program.config.setConfig("keyboard_light_tiomeout", (int)numericBacklightTime.Value);
|
||||
Aura.SetBacklightOffDelay((int)numericBacklightTime.Value);
|
||||
AsusUSB.SetBacklightOffDelay((int)numericBacklightTime.Value);
|
||||
}
|
||||
|
||||
private void CheckXMG_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("xmg_light", (checkXMG.Checked ? 1 : 0));
|
||||
Aura.ApplyXGMLight(checkXMG.Checked);
|
||||
AsusUSB.ApplyXGMLight(checkXMG.Checked);
|
||||
}
|
||||
|
||||
private void CheckUSBC_CheckedChanged(object? sender, EventArgs e)
|
||||
@@ -219,7 +219,7 @@ namespace GHelper
|
||||
private void TrackBrightness_Scroll(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("keyboard_brightness", trackBrightness.Value);
|
||||
Aura.ApplyBrightness(trackBrightness.Value);
|
||||
AsusUSB.ApplyBrightness(trackBrightness.Value);
|
||||
}
|
||||
|
||||
private void PictureHelp_Click(object? sender, EventArgs e)
|
||||
@@ -288,7 +288,7 @@ namespace GHelper
|
||||
if (checkSleepLogo.Checked) flags.Add(AuraDev19b6.SleepLogo);
|
||||
if (checkShutdownLogo.Checked) flags.Add(AuraDev19b6.ShutdownLogo);
|
||||
|
||||
Aura.ApplyAuraPower(flags);
|
||||
AsusUSB.ApplyAuraPower(flags);
|
||||
|
||||
}
|
||||
|
||||
|
||||
33
app/Fans.Designer.cs
generated
33
app/Fans.Designer.cs
generated
@@ -37,12 +37,15 @@ namespace GHelper
|
||||
Title title2 = new Title();
|
||||
ChartArea chartArea3 = new ChartArea();
|
||||
Title title3 = new Title();
|
||||
ChartArea chartArea4 = new ChartArea();
|
||||
Title title4 = new Title();
|
||||
panelFans = new Panel();
|
||||
labelTip = new Label();
|
||||
tableFanCharts = new TableLayoutPanel();
|
||||
chartGPU = new Chart();
|
||||
chartCPU = new Chart();
|
||||
chartMid = new Chart();
|
||||
chartXGM = new Chart();
|
||||
panelTitleFans = new Panel();
|
||||
labelBoost = new Label();
|
||||
comboBoost = new RComboBox();
|
||||
@@ -93,6 +96,7 @@ namespace GHelper
|
||||
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)chartMid).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)chartXGM).BeginInit();
|
||||
panelTitleFans.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
|
||||
panelApplyFans.SuspendLayout();
|
||||
@@ -121,6 +125,7 @@ namespace GHelper
|
||||
// panelFans
|
||||
//
|
||||
panelFans.AutoSize = true;
|
||||
panelFans.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelFans.Controls.Add(labelTip);
|
||||
panelFans.Controls.Add(tableFanCharts);
|
||||
panelFans.Controls.Add(panelTitleFans);
|
||||
@@ -154,16 +159,20 @@ namespace GHelper
|
||||
tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||
tableFanCharts.Controls.Add(chartGPU, 0, 1);
|
||||
tableFanCharts.Controls.Add(chartCPU, 0, 0);
|
||||
|
||||
tableFanCharts.Controls.Add(chartXGM, 0, 2);
|
||||
tableFanCharts.Controls.Add(chartMid, 0, 2);
|
||||
|
||||
tableFanCharts.Dock = DockStyle.Fill;
|
||||
tableFanCharts.Location = new Point(0, 66);
|
||||
tableFanCharts.Margin = new Padding(4);
|
||||
tableFanCharts.Name = "tableFanCharts";
|
||||
tableFanCharts.Padding = new Padding(10, 0, 10, 10);
|
||||
tableFanCharts.RowCount = 2;
|
||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 33F));
|
||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 33F));
|
||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 33F));
|
||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
||||
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
|
||||
tableFanCharts.Size = new Size(805, 1007);
|
||||
tableFanCharts.TabIndex = 36;
|
||||
//
|
||||
@@ -210,6 +219,20 @@ namespace GHelper
|
||||
chartMid.Titles.Add(title3);
|
||||
chartMid.Visible = false;
|
||||
//
|
||||
// chartXGM
|
||||
//
|
||||
chartArea4.Name = "ChartAreaXGM";
|
||||
chartXGM.ChartAreas.Add(chartArea4);
|
||||
chartXGM.Dock = DockStyle.Fill;
|
||||
chartXGM.Location = new Point(12, 674);
|
||||
chartXGM.Margin = new Padding(2, 10, 2, 10);
|
||||
chartXGM.Name = "chartXGM";
|
||||
chartXGM.Size = new Size(781, 313);
|
||||
chartXGM.TabIndex = 14;
|
||||
chartXGM.Text = "chartXGM";
|
||||
title4.Name = "Title4";
|
||||
chartXGM.Titles.Add(title4);
|
||||
chartXGM.Visible = false; //
|
||||
// panelTitleFans
|
||||
//
|
||||
panelTitleFans.Controls.Add(labelBoost);
|
||||
@@ -763,7 +786,7 @@ namespace GHelper
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(1356, 1189);
|
||||
ClientSize = new Size(1340, 1189);
|
||||
Controls.Add(panelFans);
|
||||
Controls.Add(panelSliders);
|
||||
Margin = new Padding(4, 2, 4, 2);
|
||||
@@ -782,6 +805,7 @@ namespace GHelper
|
||||
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)chartCPU).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)chartMid).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)chartXGM).EndInit();
|
||||
panelTitleFans.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)picturePerf).EndInit();
|
||||
panelApplyFans.ResumeLayout(false);
|
||||
@@ -829,6 +853,7 @@ namespace GHelper
|
||||
private Chart chartGPU;
|
||||
private Chart chartCPU;
|
||||
private Chart chartMid;
|
||||
private Chart chartXGM;
|
||||
private Label labelTip;
|
||||
private Panel panelPower;
|
||||
private Label labelInfo;
|
||||
|
||||
160
app/Fans.cs
160
app/Fans.cs
@@ -12,6 +12,7 @@ namespace GHelper
|
||||
Series seriesCPU;
|
||||
Series seriesGPU;
|
||||
Series seriesMid;
|
||||
Series seriesXGM;
|
||||
|
||||
static int MinRPM, MaxRPM;
|
||||
|
||||
@@ -53,10 +54,12 @@ namespace GHelper
|
||||
seriesCPU = chartCPU.Series.Add("CPU");
|
||||
seriesGPU = chartGPU.Series.Add("GPU");
|
||||
seriesMid = chartMid.Series.Add("Mid");
|
||||
seriesXGM = chartXGM.Series.Add("XGM");
|
||||
|
||||
seriesCPU.Color = colorStandard;
|
||||
seriesGPU.Color = colorTurbo;
|
||||
seriesMid.Color = colorEco;
|
||||
seriesXGM.Color = Color.Orange;
|
||||
|
||||
chartCPU.MouseMove += ChartCPU_MouseMove;
|
||||
chartCPU.MouseUp += ChartCPU_MouseUp;
|
||||
@@ -67,13 +70,16 @@ namespace GHelper
|
||||
chartMid.MouseMove += ChartCPU_MouseMove;
|
||||
chartMid.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
chartXGM.MouseMove += ChartCPU_MouseMove;
|
||||
chartXGM.MouseUp += ChartCPU_MouseUp;
|
||||
|
||||
buttonReset.Click += ButtonReset_Click;
|
||||
|
||||
trackTotal.Maximum = ASUSWmi.MaxTotal;
|
||||
trackTotal.Minimum = ASUSWmi.MinTotal;
|
||||
trackTotal.Maximum = AsusACPI.MaxTotal;
|
||||
trackTotal.Minimum = AsusACPI.MinTotal;
|
||||
|
||||
trackCPU.Maximum = ASUSWmi.MaxCPU;
|
||||
trackCPU.Minimum = ASUSWmi.MinCPU;
|
||||
trackCPU.Maximum = AsusACPI.MaxCPU;
|
||||
trackCPU.Minimum = AsusACPI.MinCPU;
|
||||
|
||||
trackCPU.Scroll += TrackPower_Scroll;
|
||||
trackTotal.Scroll += TrackPower_Scroll;
|
||||
@@ -90,11 +96,11 @@ namespace GHelper
|
||||
trackGPUMemory.Minimum = NvidiaGpuControl.MinMemoryOffset;
|
||||
trackGPUMemory.Maximum = NvidiaGpuControl.MaxMemoryOffset;
|
||||
|
||||
trackGPUBoost.Minimum = ASUSWmi.MinGPUBoost;
|
||||
trackGPUBoost.Maximum = ASUSWmi.MaxGPUBoost;
|
||||
trackGPUBoost.Minimum = AsusACPI.MinGPUBoost;
|
||||
trackGPUBoost.Maximum = AsusACPI.MaxGPUBoost;
|
||||
|
||||
trackGPUTemp.Minimum = ASUSWmi.MinGPUTemp;
|
||||
trackGPUTemp.Maximum = ASUSWmi.MaxGPUTemp;
|
||||
trackGPUTemp.Minimum = AsusACPI.MinGPUTemp;
|
||||
trackGPUTemp.Maximum = AsusACPI.MaxGPUTemp;
|
||||
|
||||
trackGPUCore.Scroll += trackGPU_Scroll;
|
||||
trackGPUMemory.Scroll += trackGPU_Scroll;
|
||||
@@ -151,8 +157,8 @@ namespace GHelper
|
||||
int core = Program.config.getConfigPerf("gpu_core");
|
||||
int memory = Program.config.getConfigPerf("gpu_memory");
|
||||
|
||||
if (gpu_boost < 0) gpu_boost = ASUSWmi.MaxGPUBoost;
|
||||
if (gpu_temp < 0) gpu_temp = ASUSWmi.MaxGPUTemp;
|
||||
if (gpu_boost < 0) gpu_boost = AsusACPI.MaxGPUBoost;
|
||||
if (gpu_temp < 0) gpu_temp = AsusACPI.MaxGPUTemp;
|
||||
|
||||
if (core == -1) core = 0;
|
||||
if (memory == -1) memory = 0;
|
||||
@@ -180,11 +186,11 @@ namespace GHelper
|
||||
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
|
||||
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
|
||||
|
||||
trackGPUBoost.Value = Math.Max(Math.Min(gpu_boost, ASUSWmi.MaxGPUBoost), ASUSWmi.MinGPUBoost);
|
||||
trackGPUTemp.Value = Math.Max(Math.Min(gpu_temp, ASUSWmi.MaxGPUTemp), ASUSWmi.MinGPUTemp);
|
||||
trackGPUBoost.Value = Math.Max(Math.Min(gpu_boost, AsusACPI.MaxGPUBoost), AsusACPI.MinGPUBoost);
|
||||
trackGPUTemp.Value = Math.Max(Math.Min(gpu_temp, AsusACPI.MaxGPUTemp), AsusACPI.MinGPUTemp);
|
||||
|
||||
panelGPUBoost.Visible = (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC0) >= 0);
|
||||
panelGPUTemp.Visible = (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC2) >= 0);
|
||||
panelGPUBoost.Visible = (Program.acpi.DeviceGet(AsusACPI.PPT_GPUC0) >= 0);
|
||||
panelGPUTemp.Visible = (Program.acpi.DeviceGet(AsusACPI.PPT_GPUC2) >= 0);
|
||||
|
||||
VisualiseGPUSettings();
|
||||
|
||||
@@ -233,17 +239,26 @@ namespace GHelper
|
||||
return (200 * Math.Round((float)(MinRPM * 100 + (MaxRPM - MinRPM) * percentage) / 200)).ToString() + unit;
|
||||
}
|
||||
|
||||
void SetChart(Chart chart, int device)
|
||||
void SetChart(Chart chart, AsusFan device)
|
||||
{
|
||||
|
||||
string title;
|
||||
string title = "";
|
||||
|
||||
if (device == 1)
|
||||
title = Properties.Strings.FanProfileGPU;
|
||||
else if (device == 2)
|
||||
title = Properties.Strings.FanProfileMid;
|
||||
else
|
||||
switch (device)
|
||||
{
|
||||
case AsusFan.CPU:
|
||||
title = Properties.Strings.FanProfileCPU;
|
||||
break;
|
||||
case AsusFan.GPU:
|
||||
title = Properties.Strings.FanProfileGPU;
|
||||
break;
|
||||
case AsusFan.Mid:
|
||||
title = Properties.Strings.FanProfileMid;
|
||||
break;
|
||||
case AsusFan.XGM:
|
||||
title = "XG Mobile";
|
||||
break;
|
||||
}
|
||||
|
||||
if (Program.settingsForm.perfName.Length > 0)
|
||||
labelFans.Text = Properties.Strings.FanProfiles + ": " + Program.settingsForm.perfName;
|
||||
@@ -330,7 +345,7 @@ namespace GHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
Program.settingsForm.AutoFans();
|
||||
}
|
||||
|
||||
@@ -349,7 +364,7 @@ namespace GHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
Program.settingsForm.AutoPower();
|
||||
}
|
||||
}
|
||||
@@ -376,8 +391,8 @@ namespace GHelper
|
||||
public void InitPower(bool changed = false)
|
||||
{
|
||||
|
||||
bool cpuBmode = (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0); // 2022 model +
|
||||
bool cpuAmode = (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0); // 2021 model +
|
||||
bool cpuBmode = (Program.acpi.DeviceGet(AsusACPI.PPT_CPUB0) >= 0); // 2022 model +
|
||||
bool cpuAmode = (Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0); // 2021 model +
|
||||
|
||||
panelPower.Visible = cpuAmode;
|
||||
panelCPU.Visible = cpuBmode;
|
||||
@@ -403,13 +418,13 @@ namespace GHelper
|
||||
limit_cpu = Program.config.getConfigPerf("limit_cpu");
|
||||
}
|
||||
|
||||
if (limit_total < 0) limit_total = ASUSWmi.DefaultTotal;
|
||||
if (limit_total > ASUSWmi.MaxTotal) limit_total = ASUSWmi.MaxTotal;
|
||||
if (limit_total < ASUSWmi.MinTotal) limit_total = ASUSWmi.MinTotal;
|
||||
if (limit_total < 0) limit_total = AsusACPI.DefaultTotal;
|
||||
if (limit_total > AsusACPI.MaxTotal) limit_total = AsusACPI.MaxTotal;
|
||||
if (limit_total < AsusACPI.MinTotal) limit_total = AsusACPI.MinTotal;
|
||||
|
||||
if (limit_cpu < 0) limit_cpu = ASUSWmi.DefaultCPU;
|
||||
if (limit_cpu > ASUSWmi.MaxCPU) limit_cpu = ASUSWmi.MaxCPU;
|
||||
if (limit_cpu < ASUSWmi.MinCPU) limit_cpu = ASUSWmi.MinCPU;
|
||||
if (limit_cpu < 0) limit_cpu = AsusACPI.DefaultCPU;
|
||||
if (limit_cpu > AsusACPI.MaxCPU) limit_cpu = AsusACPI.MaxCPU;
|
||||
if (limit_cpu < AsusACPI.MinCPU) limit_cpu = AsusACPI.MinCPU;
|
||||
if (limit_cpu > limit_total) limit_cpu = limit_total;
|
||||
|
||||
trackTotal.Value = limit_total;
|
||||
@@ -435,27 +450,43 @@ namespace GHelper
|
||||
public void InitFans()
|
||||
{
|
||||
|
||||
byte[] curve = Program.wmi.GetFanCurve(2);
|
||||
int chartCount = 2;
|
||||
|
||||
if (curve.All(singleByte => singleByte == 0))
|
||||
// Middle / system fan check
|
||||
if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid)))
|
||||
{
|
||||
Program.config.setConfig("mid_fan", 0);
|
||||
|
||||
Program.config.setConfig("mid_fan", 1);
|
||||
chartCount++;
|
||||
chartMid.Visible = true;
|
||||
SetChart(chartMid, AsusFan.Mid);
|
||||
LoadProfile(seriesMid, AsusFan.Mid);
|
||||
MinimumSize = new Size(0, chartCount * 400 + 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.config.setConfig("mid_fan", 1);
|
||||
chartMid.Visible = true;
|
||||
SetChart(chartMid, 2);
|
||||
LoadProfile(seriesMid, 2);
|
||||
Program.config.setConfig("mid_fan", 0);
|
||||
}
|
||||
|
||||
// XG Mobile Fan check
|
||||
if (Program.acpi.IsXGConnected())
|
||||
{
|
||||
Program.config.setConfig("xgm_fan", 1);
|
||||
chartCount++;
|
||||
chartXGM.Visible = true;
|
||||
SetChart(chartXGM, AsusFan.XGM);
|
||||
LoadProfile(seriesXGM, AsusFan.XGM);
|
||||
MinimumSize = new Size(0, chartCount * 400 + 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.config.setConfig("xgm_fan", 0);
|
||||
}
|
||||
|
||||
SetChart(chartCPU, 0);
|
||||
SetChart(chartGPU, 1);
|
||||
SetChart(chartCPU, AsusFan.CPU);
|
||||
SetChart(chartGPU, AsusFan.GPU);
|
||||
|
||||
LoadProfile(seriesCPU, 0);
|
||||
LoadProfile(seriesGPU, 1);
|
||||
LoadProfile(seriesCPU, AsusFan.CPU);
|
||||
LoadProfile(seriesGPU, AsusFan.GPU);
|
||||
|
||||
int auto_apply = Program.config.getConfigPerf("auto_apply");
|
||||
|
||||
@@ -464,7 +495,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
void LoadProfile(Series series, int device, int def = 0)
|
||||
void LoadProfile(Series series, AsusFan device, bool reset = false)
|
||||
{
|
||||
|
||||
series.ChartType = SeriesChartType.Line;
|
||||
@@ -476,14 +507,14 @@ namespace GHelper
|
||||
int mode = Program.config.getConfig("performance_mode");
|
||||
byte[] curve = Program.config.getFanConfig(device);
|
||||
|
||||
if (def == 1 || ASUSWmi.IsEmptyCurve(curve))
|
||||
if (reset || AsusACPI.IsEmptyCurve(curve))
|
||||
{
|
||||
curve = Program.wmi.GetFanCurve(device, mode);
|
||||
curve = Program.acpi.GetFanCurve(device, mode);
|
||||
|
||||
if (ASUSWmi.IsEmptyCurve(curve))
|
||||
if (AsusACPI.IsEmptyCurve(curve))
|
||||
curve = Program.config.getDefaultCurve(device);
|
||||
|
||||
curve = ASUSWmi.FixFanCurve(curve);
|
||||
curve = AsusACPI.FixFanCurve(curve);
|
||||
|
||||
}
|
||||
|
||||
@@ -501,7 +532,7 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
void SaveProfile(Series series, int device)
|
||||
void SaveProfile(Series series, AsusFan device)
|
||||
{
|
||||
byte[] curve = new byte[16];
|
||||
int i = 0;
|
||||
@@ -521,10 +552,14 @@ namespace GHelper
|
||||
private void ButtonReset_Click(object? sender, EventArgs e)
|
||||
{
|
||||
|
||||
LoadProfile(seriesCPU, 0, 1);
|
||||
LoadProfile(seriesGPU, 1, 1);
|
||||
if (Program.config.getConfig("mid_fan") == 1)
|
||||
LoadProfile(seriesMid, 2, 1);
|
||||
LoadProfile(seriesCPU, AsusFan.CPU, true);
|
||||
LoadProfile(seriesGPU, AsusFan.GPU, true);
|
||||
|
||||
if (Program.config.isConfig("mid_fan"))
|
||||
LoadProfile(seriesMid, AsusFan.Mid, true);
|
||||
|
||||
if (Program.config.isConfig("xgm_fan"))
|
||||
LoadProfile(seriesXGM, AsusFan.XGM, true);
|
||||
|
||||
checkApplyFans.Checked = false;
|
||||
checkApplyPower.Checked = false;
|
||||
@@ -532,12 +567,13 @@ namespace GHelper
|
||||
Program.config.setConfigPerf("auto_apply", 0);
|
||||
Program.config.setConfigPerf("auto_apply_power", 0);
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
if (Program.acpi.IsXGConnected()) AsusUSB.ResetXGM();
|
||||
|
||||
trackGPUCore.Value = 0;
|
||||
trackGPUMemory.Value = 0;
|
||||
trackGPUBoost.Value = ASUSWmi.MaxGPUBoost;
|
||||
trackGPUTemp.Value = ASUSWmi.MaxGPUTemp;
|
||||
trackGPUBoost.Value = AsusACPI.MaxGPUBoost;
|
||||
trackGPUTemp.Value = AsusACPI.MaxGPUTemp;
|
||||
|
||||
Program.config.setConfigPerf("gpu_boost", trackGPUBoost.Value);
|
||||
Program.config.setConfigPerf("gpu_temp", trackGPUTemp.Value);
|
||||
@@ -554,10 +590,14 @@ namespace GHelper
|
||||
curPoint = null;
|
||||
labelTip.Visible = false;
|
||||
|
||||
SaveProfile(seriesCPU, 0);
|
||||
SaveProfile(seriesGPU, 1);
|
||||
if (Program.config.getConfig("mid_fan") == 1)
|
||||
SaveProfile(seriesMid, 2);
|
||||
SaveProfile(seriesCPU, AsusFan.CPU);
|
||||
SaveProfile(seriesGPU, AsusFan.GPU);
|
||||
|
||||
if (Program.config.isConfig("mid_fan"))
|
||||
SaveProfile(seriesMid, AsusFan.Mid);
|
||||
|
||||
if (Program.config.isConfig("xgm_fan"))
|
||||
SaveProfile(seriesXGM, AsusFan.XGM);
|
||||
|
||||
Program.settingsForm.AutoFans();
|
||||
|
||||
|
||||
@@ -69,11 +69,11 @@ public static class HardwareControl
|
||||
gpuTemp = -1;
|
||||
gpuUse = -1;
|
||||
|
||||
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
||||
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
|
||||
midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
|
||||
cpuFan = FormatFan(Program.acpi.DeviceGet(AsusACPI.CPU_Fan));
|
||||
gpuFan = FormatFan(Program.acpi.DeviceGet(AsusACPI.GPU_Fan));
|
||||
midFan = FormatFan(Program.acpi.DeviceGet(AsusACPI.Mid_Fan));
|
||||
|
||||
cpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_CPU);
|
||||
cpuTemp = Program.acpi.DeviceGet(AsusACPI.Temp_CPU);
|
||||
|
||||
if (cpuTemp < 0) try
|
||||
{
|
||||
@@ -99,7 +99,7 @@ public static class HardwareControl
|
||||
}
|
||||
|
||||
if (gpuTemp is null || gpuTemp < 0)
|
||||
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
||||
gpuTemp = Program.acpi.DeviceGet(AsusACPI.Temp_GPU);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace GHelper
|
||||
Visible = true
|
||||
};
|
||||
|
||||
public static ASUSWmi? wmi;
|
||||
public static AsusACPI? acpi;
|
||||
public static AppConfig config = new AppConfig();
|
||||
|
||||
public static SettingsForm settingsForm = new SettingsForm();
|
||||
@@ -48,7 +48,7 @@ namespace GHelper
|
||||
|
||||
try
|
||||
{
|
||||
wmi = new ASUSWmi();
|
||||
acpi = new AsusACPI();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace GHelper
|
||||
|
||||
trayIcon.MouseClick += TrayIcon_MouseClick;
|
||||
|
||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||
acpi.SubscribeToEvents(WatcherEventArrived);
|
||||
|
||||
settingsForm.InitAura();
|
||||
settingsForm.InitMatrix();
|
||||
@@ -268,12 +268,12 @@ namespace GHelper
|
||||
touchpadState = (key?.GetValue("Enabled")?.ToString() == "1");
|
||||
}
|
||||
|
||||
tabletState = wmi.DeviceGet(ASUSWmi.TabletState) > 0;
|
||||
tabletState = acpi.DeviceGet(AsusACPI.TabletState) > 0;
|
||||
|
||||
Logger.WriteLine("Tablet: " + tabletState + " Touchpad: " + touchpadState);
|
||||
|
||||
if ((tabletState && touchpadState) || (!tabletState && !touchpadState))
|
||||
wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.Touchpad_Toggle, "Touchpad");
|
||||
acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Touchpad_Toggle, "Touchpad");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<value>套用功率限制</value>
|
||||
</data>
|
||||
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
|
||||
<value>Auto Adjust Windows Power Mode</value>
|
||||
<value>自動調整Windows電源模式</value>
|
||||
</data>
|
||||
<data name="AuraBreathe" xml:space="preserve">
|
||||
<value>呼吸</value>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="Awake" xml:space="preserve">
|
||||
<value>喚醒時</value>
|
||||
</data>
|
||||
<data name="BacklightTimeout" xml:space="preserve">
|
||||
<value>電池模式下自動關閉背光的秒數</value>
|
||||
</data>
|
||||
<data name="Balanced" xml:space="preserve">
|
||||
<value>平衡模式</value>
|
||||
</data>
|
||||
@@ -255,12 +258,24 @@
|
||||
<data name="FansAndPower" xml:space="preserve">
|
||||
<value>風扇和電源</value>
|
||||
</data>
|
||||
<data name="FanSpeed" xml:space="preserve">
|
||||
<value> 風扇: </value>
|
||||
</data>
|
||||
<data name="FansPower" xml:space="preserve">
|
||||
<value>自定義設置</value>
|
||||
</data>
|
||||
<data name="GPUBoost" xml:space="preserve">
|
||||
<value>Dynamic Boost</value>
|
||||
</data>
|
||||
<data name="GPUChanging" xml:space="preserve">
|
||||
<value>切換中...</value>
|
||||
</data>
|
||||
<data name="GPUCoreClockOffset" xml:space="preserve">
|
||||
<value>核心時脈偏移量(Offset)</value>
|
||||
</data>
|
||||
<data name="GPUMemoryClockOffset" xml:space="preserve">
|
||||
<value>顯示卡記憶體偏移量(Offset)</value>
|
||||
</data>
|
||||
<data name="GPUMode" xml:space="preserve">
|
||||
<value>GPU 模式</value>
|
||||
</data>
|
||||
@@ -273,6 +288,12 @@
|
||||
<data name="GPUModeUltimate" xml:space="preserve">
|
||||
<value>獨立顯卡</value>
|
||||
</data>
|
||||
<data name="GPUSettings" xml:space="preserve">
|
||||
<value>顯卡設定</value>
|
||||
</data>
|
||||
<data name="GPUTempTarget" xml:space="preserve">
|
||||
<value>GPU溫度上限</value>
|
||||
</data>
|
||||
<data name="KeyBindings" xml:space="preserve">
|
||||
<value>按鍵綁定</value>
|
||||
</data>
|
||||
@@ -291,6 +312,18 @@
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>螢幕顯示</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>螢幕背蓋</value>
|
||||
</data>
|
||||
<data name="Lightbar" xml:space="preserve">
|
||||
<value>燈條</value>
|
||||
</data>
|
||||
<data name="Logo" xml:space="preserve">
|
||||
<value>Logo</value>
|
||||
</data>
|
||||
<data name="MatrixAudio" xml:space="preserve">
|
||||
<value>Audio Visualizer</value>
|
||||
</data>
|
||||
<data name="MatrixBanner" xml:space="preserve">
|
||||
<value>横幅</value>
|
||||
</data>
|
||||
@@ -333,6 +366,9 @@
|
||||
<data name="OptimizedGPUTooltip" xml:space="preserve">
|
||||
<value>使用電池切換到節能模式,插入電源時切換到標準模式</value>
|
||||
</data>
|
||||
<data name="OptimizedUSBC" xml:space="preserve">
|
||||
<value>自動模式下,使用USB-C充電時持續關閉獨顯</value>
|
||||
</data>
|
||||
<data name="Other" xml:space="preserve">
|
||||
<value>其他</value>
|
||||
</data>
|
||||
@@ -360,6 +396,9 @@
|
||||
<data name="Quit" xml:space="preserve">
|
||||
<value>退出</value>
|
||||
</data>
|
||||
<data name="RestartGPU" xml:space="preserve">
|
||||
<value>有其他程式正在使用獨顯導致無法切換至節能模式. 是否在裝置管理員中重啟獨顯? * 請自行評估風險</value>
|
||||
</data>
|
||||
<data name="RPM" xml:space="preserve">
|
||||
<value>每分鐘轉數</value>
|
||||
</data>
|
||||
@@ -387,6 +426,12 @@
|
||||
<data name="ToggleAura" xml:space="preserve">
|
||||
<value>切換Aura</value>
|
||||
</data>
|
||||
<data name="ToggleMiniled" xml:space="preserve">
|
||||
<value>切換Miniled(若有支援)</value>
|
||||
</data>
|
||||
<data name="ToggleScreen" xml:space="preserve">
|
||||
<value>切換螢幕</value>
|
||||
</data>
|
||||
<data name="Turbo" xml:space="preserve">
|
||||
<value>極速模式</value>
|
||||
</data>
|
||||
|
||||
170
app/Settings.cs
170
app/Settings.cs
@@ -265,13 +265,13 @@ namespace GHelper
|
||||
|
||||
private void ButtonXGM_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.GPUXG) == 1)
|
||||
if (Program.acpi.DeviceGet(AsusACPI.GPUXG) == 1)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUXG, 0, "GPU XGM");
|
||||
Program.acpi.DeviceSet(AsusACPI.GPUXG, 0, "GPU XGM");
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUXG, 1, "GPU XGM");
|
||||
Program.acpi.DeviceSet(AsusACPI.GPUXG, 1, "GPU XGM");
|
||||
}
|
||||
InitXGM();
|
||||
}
|
||||
@@ -637,21 +637,21 @@ namespace GHelper
|
||||
|
||||
public void InitAura()
|
||||
{
|
||||
Aura.Mode = Program.config.getConfig("aura_mode");
|
||||
Aura.Speed = Program.config.getConfig("aura_speed");
|
||||
Aura.SetColor(Program.config.getConfig("aura_color"));
|
||||
Aura.SetColor2(Program.config.getConfig("aura_color2"));
|
||||
AsusUSB.Mode = Program.config.getConfig("aura_mode");
|
||||
AsusUSB.Speed = Program.config.getConfig("aura_speed");
|
||||
AsusUSB.SetColor(Program.config.getConfig("aura_color"));
|
||||
AsusUSB.SetColor2(Program.config.getConfig("aura_color2"));
|
||||
|
||||
comboKeyboard.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboKeyboard.DataSource = new BindingSource(Aura.GetModes(), null);
|
||||
comboKeyboard.DataSource = new BindingSource(AsusUSB.GetModes(), null);
|
||||
comboKeyboard.DisplayMember = "Value";
|
||||
comboKeyboard.ValueMember = "Key";
|
||||
comboKeyboard.SelectedValue = Aura.Mode;
|
||||
comboKeyboard.SelectedValue = AsusUSB.Mode;
|
||||
comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged;
|
||||
|
||||
pictureColor.BackColor = Aura.Color1;
|
||||
pictureColor2.BackColor = Aura.Color2;
|
||||
pictureColor2.Visible = Aura.HasSecondColor();
|
||||
pictureColor.BackColor = AsusUSB.Color1;
|
||||
pictureColor2.BackColor = AsusUSB.Color2;
|
||||
pictureColor2.Visible = AsusUSB.HasSecondColor();
|
||||
}
|
||||
|
||||
public void InitMatrix()
|
||||
@@ -679,16 +679,16 @@ namespace GHelper
|
||||
|
||||
public void SetAura()
|
||||
{
|
||||
Aura.Mode = Program.config.getConfig("aura_mode");
|
||||
Aura.Speed = Program.config.getConfig("aura_speed");
|
||||
Aura.SetColor(Program.config.getConfig("aura_color"));
|
||||
Aura.SetColor2(Program.config.getConfig("aura_color2"));
|
||||
AsusUSB.Mode = Program.config.getConfig("aura_mode");
|
||||
AsusUSB.Speed = Program.config.getConfig("aura_speed");
|
||||
AsusUSB.SetColor(Program.config.getConfig("aura_color"));
|
||||
AsusUSB.SetColor2(Program.config.getConfig("aura_color2"));
|
||||
|
||||
pictureColor.BackColor = Aura.Color1;
|
||||
pictureColor2.BackColor = Aura.Color2;
|
||||
pictureColor2.Visible = Aura.HasSecondColor();
|
||||
pictureColor.BackColor = AsusUSB.Color1;
|
||||
pictureColor2.BackColor = AsusUSB.Color2;
|
||||
pictureColor2.Visible = AsusUSB.HasSecondColor();
|
||||
|
||||
Aura.ApplyAura();
|
||||
AsusUSB.ApplyAura();
|
||||
|
||||
}
|
||||
|
||||
@@ -753,13 +753,13 @@ namespace GHelper
|
||||
if (overdrive >= 0)
|
||||
{
|
||||
if (Program.config.getConfig("no_overdrive") == 1) overdrive = 0;
|
||||
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive, "ScreenOverdrive");
|
||||
Program.acpi.DeviceSet(AsusACPI.ScreenOverdrive, overdrive, "ScreenOverdrive");
|
||||
|
||||
}
|
||||
|
||||
if (miniled >= 0)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.ScreenMiniled, miniled, "Miniled");
|
||||
Program.acpi.DeviceSet(AsusACPI.ScreenMiniled, miniled, "Miniled");
|
||||
Debug.WriteLine("Miniled " + miniled);
|
||||
}
|
||||
|
||||
@@ -775,8 +775,8 @@ namespace GHelper
|
||||
bool screenAuto = (Program.config.getConfig("screen_auto") == 1);
|
||||
bool overdriveSetting = (Program.config.getConfig("no_overdrive") != 1);
|
||||
|
||||
int overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
|
||||
int miniled = Program.wmi.DeviceGet(ASUSWmi.ScreenMiniled);
|
||||
int overdrive = Program.acpi.DeviceGet(AsusACPI.ScreenOverdrive);
|
||||
int miniled = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled);
|
||||
|
||||
bool screenEnabled = (frequency >= 0);
|
||||
|
||||
@@ -848,17 +848,17 @@ namespace GHelper
|
||||
|
||||
private void ButtonUltimate_Click(object? sender, EventArgs e)
|
||||
{
|
||||
SetGPUMode(ASUSWmi.GPUModeUltimate);
|
||||
SetGPUMode(AsusACPI.GPUModeUltimate);
|
||||
}
|
||||
|
||||
private void ButtonStandard_Click(object? sender, EventArgs e)
|
||||
{
|
||||
SetGPUMode(ASUSWmi.GPUModeStandard);
|
||||
SetGPUMode(AsusACPI.GPUModeStandard);
|
||||
}
|
||||
|
||||
private void ButtonEco_Click(object? sender, EventArgs e)
|
||||
{
|
||||
SetGPUMode(ASUSWmi.GPUModeEco);
|
||||
SetGPUMode(AsusACPI.GPUModeEco);
|
||||
}
|
||||
|
||||
public async void RefreshSensors(bool force = false)
|
||||
@@ -935,22 +935,22 @@ namespace GHelper
|
||||
int limit_total = Program.config.getConfigPerf("limit_total");
|
||||
int limit_cpu = Program.config.getConfigPerf("limit_cpu");
|
||||
|
||||
if (limit_total > ASUSWmi.MaxTotal) return;
|
||||
if (limit_total < ASUSWmi.MinTotal) return;
|
||||
if (limit_total > AsusACPI.MaxTotal) return;
|
||||
if (limit_total < AsusACPI.MinTotal) return;
|
||||
|
||||
if (limit_cpu > ASUSWmi.MaxCPU) return;
|
||||
if (limit_cpu < ASUSWmi.MinCPU) return;
|
||||
if (limit_cpu > AsusACPI.MaxCPU) return;
|
||||
if (limit_cpu < AsusACPI.MinCPU) return;
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0)
|
||||
if (Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total, "PowerLimit A0");
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_APUA3, limit_total, "PowerLimit A3");
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_TotalA0, limit_total, "PowerLimit A0");
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, limit_total, "PowerLimit A3");
|
||||
customPower = limit_total;
|
||||
}
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0)
|
||||
if (Program.acpi.DeviceGet(AsusACPI.PPT_CPUB0) >= 0)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu, "PowerLimit B0");
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_CPUB0, limit_cpu, "PowerLimit B0");
|
||||
customPower = limit_cpu;
|
||||
}
|
||||
|
||||
@@ -969,7 +969,7 @@ namespace GHelper
|
||||
|
||||
//if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false;
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.GPUEco) == 1) return;
|
||||
if (Program.acpi.DeviceGet(AsusACPI.GPUEco) == 1) return;
|
||||
if (HardwareControl.GpuControl is null) return;
|
||||
if (!HardwareControl.GpuControl!.IsNvidia) return;
|
||||
|
||||
@@ -999,17 +999,17 @@ namespace GHelper
|
||||
int gpu_temp = Program.config.getConfigPerf("gpu_temp");
|
||||
|
||||
|
||||
if (gpu_boost < ASUSWmi.MinGPUBoost || gpu_boost > ASUSWmi.MaxGPUBoost) return;
|
||||
if (gpu_temp < ASUSWmi.MinGPUTemp || gpu_temp > ASUSWmi.MaxGPUTemp) return;
|
||||
if (gpu_boost < AsusACPI.MinGPUBoost || gpu_boost > AsusACPI.MaxGPUBoost) return;
|
||||
if (gpu_temp < AsusACPI.MinGPUTemp || gpu_temp > AsusACPI.MaxGPUTemp) return;
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC0) >= 0)
|
||||
if (Program.acpi.DeviceGet(AsusACPI.PPT_GPUC0) >= 0)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_GPUC0, gpu_boost, "PowerLimit C0");
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_GPUC0, gpu_boost, "PowerLimit C0");
|
||||
}
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC2) >= 0)
|
||||
if (Program.acpi.DeviceGet(AsusACPI.PPT_GPUC2) >= 0)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_GPUC2, gpu_temp, "PowerLimit C2");
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_GPUC2, gpu_temp, "PowerLimit C2");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1027,18 +1027,21 @@ namespace GHelper
|
||||
|
||||
if (Program.config.getConfigPerf("auto_apply") == 1 || force)
|
||||
{
|
||||
int cpuResult = Program.wmi.SetFanCurve(0, Program.config.getFanConfig(0));
|
||||
int gpuResult = Program.wmi.SetFanCurve(1, Program.config.getFanConfig(1));
|
||||
int cpuResult = Program.acpi.SetFanCurve(AsusFan.CPU, Program.config.getFanConfig(AsusFan.CPU));
|
||||
int gpuResult = Program.acpi.SetFanCurve(AsusFan.GPU, Program.config.getFanConfig(AsusFan.GPU));
|
||||
|
||||
if (Program.config.getConfig("mid_fan") == 1)
|
||||
Program.wmi.SetFanCurve(2, Program.config.getFanConfig(2));
|
||||
if (Program.config.isConfig("mid_fan"))
|
||||
Program.acpi.SetFanCurve(AsusFan.Mid, Program.config.getFanConfig(AsusFan.Mid));
|
||||
|
||||
if (Program.config.isConfig("xgm_fan") && Program.acpi.IsXGConnected())
|
||||
AsusUSB.SetXGMFan(Program.config.getFanConfig(AsusFan.XGM));
|
||||
|
||||
// something went wrong, resetting to default profile
|
||||
if (cpuResult != 1 || gpuResult != 1)
|
||||
{
|
||||
int mode = Program.config.getConfig("performance_mode");
|
||||
Logger.WriteLine("ASUS BIOS rejected fan curve, resetting mode to " + mode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, mode, "PerformanceMode");
|
||||
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, mode, "PerformanceMode");
|
||||
LabelFansResult("ASUS BIOS rejected fan curve");
|
||||
}
|
||||
else
|
||||
@@ -1053,8 +1056,8 @@ namespace GHelper
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, 80, "PowerLimit Fix A0");
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_APUA3, 80, "PowerLimit Fix A3");
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_TotalA0, 80, "PowerLimit Fix A0");
|
||||
Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, 80, "PowerLimit Fix A3");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1112,17 +1115,17 @@ namespace GHelper
|
||||
|
||||
switch (PerformanceMode)
|
||||
{
|
||||
case ASUSWmi.PerformanceSilent:
|
||||
case AsusACPI.PerformanceSilent:
|
||||
buttonSilent.Activated = true;
|
||||
perfName = Properties.Strings.Silent;
|
||||
break;
|
||||
case ASUSWmi.PerformanceTurbo:
|
||||
case AsusACPI.PerformanceTurbo:
|
||||
buttonTurbo.Activated = true;
|
||||
perfName = Properties.Strings.Turbo;
|
||||
break;
|
||||
default:
|
||||
buttonBalanced.Activated = true;
|
||||
PerformanceMode = ASUSWmi.PerformanceBalanced;
|
||||
PerformanceMode = AsusACPI.PerformanceBalanced;
|
||||
perfName = Properties.Strings.Balanced;
|
||||
break;
|
||||
}
|
||||
@@ -1135,7 +1138,8 @@ namespace GHelper
|
||||
Program.config.setConfig("performance_" + (int)SystemInformation.PowerStatus.PowerLineStatus, PerformanceMode);
|
||||
Program.config.setConfig("performance_mode", PerformanceMode);
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode, "PerformanceMode");
|
||||
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, PerformanceMode, "PerformanceMode");
|
||||
if (Program.config.isConfig("xgm_fan") && Program.acpi.IsXGConnected()) AsusUSB.ResetXGM();
|
||||
|
||||
if (notify && (oldMode != PerformanceMode))
|
||||
{
|
||||
@@ -1200,9 +1204,9 @@ namespace GHelper
|
||||
if (Program.config.getConfig("keyboard_auto") != 1) return;
|
||||
|
||||
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online)
|
||||
Aura.ApplyBrightness(3);
|
||||
AsusUSB.ApplyBrightness(3);
|
||||
else
|
||||
Aura.ApplyBrightness(0);
|
||||
AsusUSB.ApplyBrightness(0);
|
||||
|
||||
|
||||
}
|
||||
@@ -1242,7 +1246,7 @@ namespace GHelper
|
||||
bool optimizedUSBC = Program.config.getConfig("optimized_usbc") != 1;
|
||||
|
||||
return SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online &&
|
||||
(optimizedUSBC || Program.wmi.DeviceGet(ASUSWmi.ChargerMode) != ASUSWmi.ChargerUSB);
|
||||
(optimizedUSBC || Program.acpi.DeviceGet(AsusACPI.ChargerMode) != AsusACPI.ChargerUSB);
|
||||
|
||||
}
|
||||
|
||||
@@ -1256,8 +1260,8 @@ namespace GHelper
|
||||
|
||||
if (!GpuAuto && !ForceGPU) return false;
|
||||
|
||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
int eco = Program.acpi.DeviceGet(AsusACPI.GPUEco);
|
||||
int mux = Program.acpi.DeviceGet(AsusACPI.GPUMux);
|
||||
|
||||
if (mux == 0) // GPU in Ultimate, ignore
|
||||
return false;
|
||||
@@ -1267,13 +1271,13 @@ namespace GHelper
|
||||
if (ReEnableGPU()) return true;
|
||||
|
||||
if (eco == 1)
|
||||
if ((GpuAuto && IsPlugged()) || (ForceGPU && GpuMode == ASUSWmi.GPUModeStandard))
|
||||
if ((GpuAuto && IsPlugged()) || (ForceGPU && GpuMode == AsusACPI.GPUModeStandard))
|
||||
{
|
||||
SetGPUEco(0);
|
||||
return true;
|
||||
}
|
||||
if (eco == 0)
|
||||
if ((GpuAuto && !IsPlugged()) || (ForceGPU && GpuMode == ASUSWmi.GPUModeEco))
|
||||
if ((GpuAuto && !IsPlugged()) || (ForceGPU && GpuMode == AsusACPI.GPUModeEco))
|
||||
{
|
||||
|
||||
if (HardwareControl.IsUsedGPU())
|
||||
@@ -1322,20 +1326,16 @@ namespace GHelper
|
||||
|
||||
public void InitXGM()
|
||||
{
|
||||
int connected = Program.wmi.DeviceGet(ASUSWmi.GPUXGConnected);
|
||||
int enabled = Program.wmi.DeviceGet(ASUSWmi.GPUXG);
|
||||
|
||||
buttonXGM.Enabled = buttonXGM.Visible = (connected == 1);
|
||||
buttonXGM.Activated = (enabled == 1);
|
||||
|
||||
buttonXGM.Enabled = buttonXGM.Visible = Program.acpi.IsXGConnected();
|
||||
buttonXGM.Activated = (Program.acpi.DeviceGet(AsusACPI.GPUXG) == 1);
|
||||
}
|
||||
|
||||
|
||||
public int InitGPUMode()
|
||||
{
|
||||
|
||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
int eco = Program.acpi.DeviceGet(AsusACPI.GPUEco);
|
||||
int mux = Program.acpi.DeviceGet(AsusACPI.GPUMux);
|
||||
|
||||
Logger.WriteLine("Eco flag : " + eco);
|
||||
Logger.WriteLine("Mux flag : " + mux);
|
||||
@@ -1343,13 +1343,13 @@ namespace GHelper
|
||||
int GpuMode;
|
||||
|
||||
if (mux == 0)
|
||||
GpuMode = ASUSWmi.GPUModeUltimate;
|
||||
GpuMode = AsusACPI.GPUModeUltimate;
|
||||
else
|
||||
{
|
||||
if (eco == 1)
|
||||
GpuMode = ASUSWmi.GPUModeEco;
|
||||
GpuMode = AsusACPI.GPUModeEco;
|
||||
else
|
||||
GpuMode = ASUSWmi.GPUModeStandard;
|
||||
GpuMode = AsusACPI.GPUModeStandard;
|
||||
|
||||
UltimateUI(mux == 1);
|
||||
|
||||
@@ -1433,7 +1433,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
//if (eco == 1) status = 0; else
|
||||
status = Program.wmi.SetGPUEco(eco);
|
||||
status = Program.acpi.SetGPUEco(eco);
|
||||
|
||||
if (status == 0 && eco == 1 && hardWay)
|
||||
{
|
||||
@@ -1474,34 +1474,34 @@ namespace GHelper
|
||||
var restart = false;
|
||||
var changed = false;
|
||||
|
||||
if (CurrentGPU == ASUSWmi.GPUModeUltimate)
|
||||
if (CurrentGPU == AsusACPI.GPUModeUltimate)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show(Properties.Strings.AlertUltimateOff, Properties.Strings.AlertUltimateTitle, MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUMux, 1, "GPUMux");
|
||||
Program.acpi.DeviceSet(AsusACPI.GPUMux, 1, "GPUMux");
|
||||
restart = true;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else if (GPUMode == ASUSWmi.GPUModeUltimate)
|
||||
else if (GPUMode == AsusACPI.GPUModeUltimate)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show(Properties.Strings.AlertUltimateOn, Properties.Strings.AlertUltimateTitle, MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUMux, 0, "GPUMux");
|
||||
Program.acpi.DeviceSet(AsusACPI.GPUMux, 0, "GPUMux");
|
||||
restart = true;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
}
|
||||
else if (GPUMode == ASUSWmi.GPUModeEco)
|
||||
else if (GPUMode == AsusACPI.GPUModeEco)
|
||||
{
|
||||
VisualiseGPUMode(GPUMode);
|
||||
SetGPUEco(1, true);
|
||||
changed = true;
|
||||
}
|
||||
else if (GPUMode == ASUSWmi.GPUModeStandard)
|
||||
else if (GPUMode == AsusACPI.GPUModeStandard)
|
||||
{
|
||||
VisualiseGPUMode(GPUMode);
|
||||
SetGPUEco(0);
|
||||
@@ -1537,14 +1537,14 @@ namespace GHelper
|
||||
|
||||
switch (GPUMode)
|
||||
{
|
||||
case ASUSWmi.GPUModeEco:
|
||||
case AsusACPI.GPUModeEco:
|
||||
buttonOptimized.BorderColor = colorEco;
|
||||
buttonEco.Activated = !GPUAuto;
|
||||
buttonOptimized.Activated = GPUAuto;
|
||||
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeEco;
|
||||
Program.trayIcon.Icon = Properties.Resources.eco;
|
||||
break;
|
||||
case ASUSWmi.GPUModeUltimate:
|
||||
case AsusACPI.GPUModeUltimate:
|
||||
buttonUltimate.Activated = true;
|
||||
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeUltimate;
|
||||
Program.trayIcon.Icon = Properties.Resources.ultimate;
|
||||
@@ -1568,17 +1568,17 @@ namespace GHelper
|
||||
|
||||
private void ButtonSilent_Click(object? sender, EventArgs e)
|
||||
{
|
||||
SetPerformanceMode(ASUSWmi.PerformanceSilent);
|
||||
SetPerformanceMode(AsusACPI.PerformanceSilent);
|
||||
}
|
||||
|
||||
private void ButtonBalanced_Click(object? sender, EventArgs e)
|
||||
{
|
||||
SetPerformanceMode(ASUSWmi.PerformanceBalanced);
|
||||
SetPerformanceMode(AsusACPI.PerformanceBalanced);
|
||||
}
|
||||
|
||||
private void ButtonTurbo_Click(object? sender, EventArgs e)
|
||||
{
|
||||
SetPerformanceMode(ASUSWmi.PerformanceTurbo);
|
||||
SetPerformanceMode(AsusACPI.PerformanceTurbo);
|
||||
}
|
||||
|
||||
private void Settings_Load(object sender, EventArgs e)
|
||||
@@ -1609,7 +1609,7 @@ namespace GHelper
|
||||
labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit + ": " + limit.ToString() + "%";
|
||||
sliderBattery.Value = limit;
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit, "BatteryLimit");
|
||||
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit");
|
||||
try
|
||||
{
|
||||
OptimizationService.SetChargeLimit(limit);
|
||||
|
||||
Reference in New Issue
Block a user