Compare commits

..

15 Commits

Author SHA1 Message Date
Serge
7f6bdda39a Stop GPU apps button 2023-06-24 13:08:06 +02:00
Serge
96dc22072a UI tweaks 2023-06-24 11:32:59 +02:00
Serge
3c02d5cd95 Optimus check 2023-06-23 19:37:51 +02:00
Serge
e58a396cbd CPU power limits for old devices 2023-06-22 15:53:35 +02:00
Serge
40ecdf0d35 Max GPU core/memory config settings 2023-06-20 16:20:14 +02:00
Serge
f31b05dcd1 Aura cleanup 2023-06-20 13:48:32 +02:00
Serge
d778838ad4 Release script 2023-06-19 16:15:33 +02:00
Serge
b177dacf8b Merge branch 'main' of https://github.com/seerge/g-helper 2023-06-19 13:53:09 +02:00
Serge
6e9cc51a5f G15 Advantage Edition TDP 2023-06-19 13:53:07 +02:00
Serge
e2a6b770a0 Update README.md 2023-06-18 17:32:16 +02:00
Serge
055e83e976 Default temp fix 2023-06-18 15:28:52 +02:00
Serge
40be93b60d UV/Temp reset fix 2023-06-18 15:23:29 +02:00
Serge
2c2eed4fe2 Temp limit and update checker 2023-06-18 14:59:37 +02:00
Serge
8d6b277fda Merge branch 'main' of https://github.com/seerge/g-helper 2023-06-17 13:24:16 +02:00
Serge
8e6f54e833 Update README.md 2023-06-17 10:39:06 +02:00
25 changed files with 708 additions and 196 deletions

View File

@@ -20,9 +20,9 @@ jobs:
- name: Publish - name: Publish
run: | run: |
dotnet publish app/GHelper.sln --configuration Release --runtime win-x64 -p:PublishSingleFile=true --no-self-contained dotnet publish app/GHelper.sln --configuration Release --runtime win-x64 -p:PublishSingleFile=true --no-self-contained
powershell Compress-Archive app/bin/x64/Release/net7.0-windows8.0/win-x64/publish/GHelper.exe GHelper.zip powershell Compress-Archive app/bin/x64/Release/net7.0-windows8.0/win-x64/publish/* GHelper.zip
- name: Upload - name: Upload
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
run: | run: |
gh release upload ${{ github.ref_name }} app/bin/x64/Release/net7.0-windows8.0/win-x64/publish/GHelper.exe GHelper.zip gh release upload ${{ github.ref_name }} GHelper.zip

View File

@@ -106,8 +106,7 @@ public class AsusACPI
public const int GPUModeStandard = 1; public const int GPUModeStandard = 1;
public const int GPUModeUltimate = 2; public const int GPUModeUltimate = 2;
public static int MaxTotal => AppConfig.ContainsModel("G513QY") ? 250 : 150;
public const int MaxTotal = 150;
public const int MinTotal = 5; public const int MinTotal = 5;
public const int DefaultTotal = 125; public const int DefaultTotal = 125;
@@ -428,6 +427,7 @@ public class AsusACPI
return DeviceGet(PPT_CPUB0) >= 0 && DeviceGet(PPT_GPUC0) < 0; return DeviceGet(PPT_CPUB0) >= 0 && DeviceGet(PPT_GPUC0) < 0;
} }
public void ScanRange() public void ScanRange()
{ {
int value; int value;

View File

@@ -179,13 +179,11 @@ namespace GHelper
} }
private static IEnumerable<HidDevice> GetHidDevices(int[] deviceIds, int minInput = 18, int minFeatures = 1) private static IEnumerable<HidDevice> GetHidDevices(int[] deviceIds, int minFeatures = 1)
{ {
HidDevice[] HidDeviceList = HidDevices.Enumerate(ASUS_ID, deviceIds).ToArray(); HidDevice[] HidDeviceList = HidDevices.Enumerate(ASUS_ID, deviceIds).ToArray();
foreach (HidDevice device in HidDeviceList) foreach (HidDevice device in HidDeviceList)
if (device.IsConnected if (device.IsConnected && device.Capabilities.FeatureReportByteLength >= minFeatures)
&& device.Capabilities.FeatureReportByteLength >= minFeatures
&& device.Capabilities.InputReportByteLength >= minInput)
yield return device; yield return device;
} }
@@ -235,7 +233,7 @@ namespace GHelper
{ {
Task.Run(async () => Task.Run(async () =>
{ {
var devices = GetHidDevices(deviceIds, 0); var devices = GetHidDevices(deviceIds);
foreach (HidDevice device in devices) foreach (HidDevice device in devices)
{ {
device.OpenDevice(); device.OpenDevice();
@@ -263,7 +261,7 @@ namespace GHelper
byte[] msg = { AURA_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness }; byte[] msg = { AURA_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness }; byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
var devices = GetHidDevices(deviceIds, 0); var devices = GetHidDevices(deviceIds);
foreach (HidDevice device in devices) foreach (HidDevice device in devices)
{ {
device.OpenDevice(); device.OpenDevice();
@@ -289,7 +287,7 @@ namespace GHelper
{ {
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness }; byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
var devicesBackup = GetHidDevices(deviceIds, 0); var devicesBackup = GetHidDevices(deviceIds);
foreach (HidDevice device in devicesBackup) foreach (HidDevice device in devicesBackup)
{ {
device.OpenDevice(); device.OpenDevice();
@@ -312,13 +310,15 @@ namespace GHelper
var devices = GetHidDevices(deviceIds); var devices = GetHidDevices(deviceIds);
//Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
foreach (HidDevice device in devices) foreach (HidDevice device in devices)
{ {
device.OpenDevice(); device.OpenDevice();
device.WriteFeatureData(msg); if (device.ReadFeatureData(out byte[] data, AURA_HID_ID))
Logger.WriteLine("USB-KB " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg)); {
device.WriteFeatureData(msg);
Logger.WriteLine("USB-KB " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg));
}
device.CloseDevice(); device.CloseDevice();
} }
@@ -351,23 +351,19 @@ namespace GHelper
} }
byte[] msg = AuraMessage(Mode, Color1, Color2, _speed); byte[] msg = AuraMessage(Mode, Color1, Color2, _speed);
var devices = GetHidDevices(deviceIds); var devices = GetHidDevices(deviceIds);
if (devices.Count() == 0)
{
Logger.WriteLine("USB-KB : not found");
devices = GetHidDevices(deviceIds, 1);
}
foreach (HidDevice device in devices) foreach (HidDevice device in devices)
{ {
device.OpenDevice(); device.OpenDevice();
device.WriteFeatureData(msg); if (device.ReadFeatureData(out byte[] data, AURA_HID_ID))
device.WriteFeatureData(MESSAGE_SET); {
device.WriteFeatureData(MESSAGE_APPLY); device.WriteFeatureData(msg);
device.WriteFeatureData(MESSAGE_SET);
device.WriteFeatureData(MESSAGE_APPLY);
Logger.WriteLine("USB-KB " + device.Capabilities.FeatureReportByteLength + "|" + device.Capabilities.InputReportByteLength + device.Description + device.DevicePath + ":" + BitConverter.ToString(msg));
}
device.CloseDevice(); device.CloseDevice();
Logger.WriteLine("USB-KB " + device.Capabilities.FeatureReportByteLength + "|" + device.Capabilities.InputReportByteLength + device.Description + device.DevicePath + ":" + BitConverter.ToString(msg));
} }
if (AppConfig.ContainsModel("TUF")) if (AppConfig.ContainsModel("TUF"))
@@ -385,7 +381,7 @@ namespace GHelper
var payload = new byte[300]; var payload = new byte[300];
Array.Copy(msg, payload, msg.Length); Array.Copy(msg, payload, msg.Length);
foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }, 0, 300)) foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }, 300))
{ {
device.OpenDevice(); device.OpenDevice();
Logger.WriteLine("XGM " + device.Attributes.ProductHexId + "|" + device.Capabilities.FeatureReportByteLength + ":" + BitConverter.ToString(msg)); Logger.WriteLine("XGM " + device.Attributes.ProductHexId + "|" + device.Capabilities.FeatureReportByteLength + ":" + BitConverter.ToString(msg));

180
app/Fans.Designer.cs generated
View File

@@ -74,8 +74,15 @@ namespace GHelper
labelLeftUV = new Label(); labelLeftUV = new Label();
trackUV = new TrackBar(); trackUV = new TrackBar();
panelTitleAdvanced = new Panel(); panelTitleAdvanced = new Panel();
pictureAdvanced = new PictureBox(); pictureUV = new PictureBox();
labelAdvanced = new Label(); labelTitleUV = new Label();
panelTemperature = new Panel();
labelTemp = new Label();
labelLeftTemp = new Label();
trackTemp = new TrackBar();
panelTitleTemp = new Panel();
pictureTemp = new PictureBox();
labelTempLimit = new Label();
panelPower = new Panel(); panelPower = new Panel();
panelApplyPower = new Panel(); panelApplyPower = new Panel();
checkApplyPower = new RCheckBox(); checkApplyPower = new RCheckBox();
@@ -140,7 +147,11 @@ namespace GHelper
panelUV.SuspendLayout(); panelUV.SuspendLayout();
((System.ComponentModel.ISupportInitialize)trackUV).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackUV).BeginInit();
panelTitleAdvanced.SuspendLayout(); panelTitleAdvanced.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureAdvanced).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureUV).BeginInit();
panelTemperature.SuspendLayout();
((System.ComponentModel.ISupportInitialize)trackTemp).BeginInit();
panelTitleTemp.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureTemp).BeginInit();
panelPower.SuspendLayout(); panelPower.SuspendLayout();
panelApplyPower.SuspendLayout(); panelApplyPower.SuspendLayout();
panelB0.SuspendLayout(); panelB0.SuspendLayout();
@@ -474,10 +485,12 @@ namespace GHelper
panelAdvanced.Controls.Add(panelUViGPU); panelAdvanced.Controls.Add(panelUViGPU);
panelAdvanced.Controls.Add(panelUV); panelAdvanced.Controls.Add(panelUV);
panelAdvanced.Controls.Add(panelTitleAdvanced); panelAdvanced.Controls.Add(panelTitleAdvanced);
panelAdvanced.Controls.Add(panelTemperature);
panelAdvanced.Controls.Add(panelTitleTemp);
panelAdvanced.Dock = DockStyle.Top; panelAdvanced.Dock = DockStyle.Top;
panelAdvanced.Location = new Point(10, 1284); panelAdvanced.Location = new Point(10, 1284);
panelAdvanced.Name = "panelAdvanced"; panelAdvanced.Name = "panelAdvanced";
panelAdvanced.Size = new Size(520, 588); panelAdvanced.Size = new Size(520, 778);
panelAdvanced.TabIndex = 14; panelAdvanced.TabIndex = 14;
panelAdvanced.Visible = false; panelAdvanced.Visible = false;
// //
@@ -486,7 +499,7 @@ namespace GHelper
panelAdvancedApply.Controls.Add(checkApplyUV); panelAdvancedApply.Controls.Add(checkApplyUV);
panelAdvancedApply.Controls.Add(buttonApplyAdvanced); panelAdvancedApply.Controls.Add(buttonApplyAdvanced);
panelAdvancedApply.Dock = DockStyle.Top; panelAdvancedApply.Dock = DockStyle.Top;
panelAdvancedApply.Location = new Point(0, 512); panelAdvancedApply.Location = new Point(0, 702);
panelAdvancedApply.Name = "panelAdvancedApply"; panelAdvancedApply.Name = "panelAdvancedApply";
panelAdvancedApply.Size = new Size(520, 76); panelAdvancedApply.Size = new Size(520, 76);
panelAdvancedApply.TabIndex = 47; panelAdvancedApply.TabIndex = 47;
@@ -524,11 +537,14 @@ namespace GHelper
// //
// labelRisky // labelRisky
// //
labelRisky.BackColor = Color.IndianRed;
labelRisky.Dock = DockStyle.Top; labelRisky.Dock = DockStyle.Top;
labelRisky.Location = new Point(0, 314); labelRisky.ForeColor = SystemColors.ControlLightLight;
labelRisky.Location = new Point(0, 504);
labelRisky.Margin = new Padding(0, 0, 0, 0);
labelRisky.Name = "labelRisky"; labelRisky.Name = "labelRisky";
labelRisky.Padding = new Padding(10, 10, 10, 5); labelRisky.Padding = new Padding(10, 10, 10, 5);
labelRisky.Size = new Size(520, 198); labelRisky.Size = new Size(520, 220);
labelRisky.TabIndex = 46; labelRisky.TabIndex = 46;
labelRisky.Text = resources.GetString("labelRisky.Text"); labelRisky.Text = resources.GetString("labelRisky.Text");
// //
@@ -540,7 +556,7 @@ namespace GHelper
panelUViGPU.Controls.Add(labelLeftUViGPU); panelUViGPU.Controls.Add(labelLeftUViGPU);
panelUViGPU.Controls.Add(trackUViGPU); panelUViGPU.Controls.Add(trackUViGPU);
panelUViGPU.Dock = DockStyle.Top; panelUViGPU.Dock = DockStyle.Top;
panelUViGPU.Location = new Point(0, 190); panelUViGPU.Location = new Point(0, 380);
panelUViGPU.Margin = new Padding(4); panelUViGPU.Margin = new Padding(4);
panelUViGPU.MaximumSize = new Size(0, 124); panelUViGPU.MaximumSize = new Size(0, 124);
panelUViGPU.Name = "panelUViGPU"; panelUViGPU.Name = "panelUViGPU";
@@ -588,7 +604,7 @@ namespace GHelper
panelUV.Controls.Add(labelLeftUV); panelUV.Controls.Add(labelLeftUV);
panelUV.Controls.Add(trackUV); panelUV.Controls.Add(trackUV);
panelUV.Dock = DockStyle.Top; panelUV.Dock = DockStyle.Top;
panelUV.Location = new Point(0, 66); panelUV.Location = new Point(0, 256);
panelUV.Margin = new Padding(4); panelUV.Margin = new Padding(4);
panelUV.MaximumSize = new Size(0, 124); panelUV.MaximumSize = new Size(0, 124);
panelUV.Name = "panelUV"; panelUV.Name = "panelUV";
@@ -630,36 +646,117 @@ namespace GHelper
// //
// panelTitleAdvanced // panelTitleAdvanced
// //
panelTitleAdvanced.Controls.Add(pictureAdvanced); panelTitleAdvanced.Controls.Add(pictureUV);
panelTitleAdvanced.Controls.Add(labelAdvanced); panelTitleAdvanced.Controls.Add(labelTitleUV);
panelTitleAdvanced.Dock = DockStyle.Top; panelTitleAdvanced.Dock = DockStyle.Top;
panelTitleAdvanced.Location = new Point(0, 0); panelTitleAdvanced.Location = new Point(0, 190);
panelTitleAdvanced.Name = "panelTitleAdvanced"; panelTitleAdvanced.Name = "panelTitleAdvanced";
panelTitleAdvanced.Size = new Size(520, 66); panelTitleAdvanced.Size = new Size(520, 66);
panelTitleAdvanced.TabIndex = 48; panelTitleAdvanced.TabIndex = 48;
// //
// pictureAdvanced // pictureUV
// //
pictureAdvanced.BackgroundImage = Properties.Resources.icons8_voltage_60; pictureUV.BackgroundImage = Properties.Resources.icons8_voltage_60;
pictureAdvanced.BackgroundImageLayout = ImageLayout.Zoom; pictureUV.BackgroundImageLayout = ImageLayout.Zoom;
pictureAdvanced.InitialImage = null; pictureUV.InitialImage = null;
pictureAdvanced.Location = new Point(10, 18); pictureUV.Location = new Point(10, 18);
pictureAdvanced.Margin = new Padding(4, 2, 4, 10); pictureUV.Margin = new Padding(4, 2, 4, 10);
pictureAdvanced.Name = "pictureAdvanced"; pictureUV.Name = "pictureUV";
pictureAdvanced.Size = new Size(36, 38); pictureUV.Size = new Size(36, 38);
pictureAdvanced.TabIndex = 48; pictureUV.TabIndex = 48;
pictureAdvanced.TabStop = false; pictureUV.TabStop = false;
// //
// labelAdvanced // labelTitleUV
// //
labelAdvanced.AutoSize = true; labelTitleUV.AutoSize = true;
labelAdvanced.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelTitleUV.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelAdvanced.Location = new Point(51, 20); labelTitleUV.Location = new Point(51, 20);
labelAdvanced.Margin = new Padding(4, 0, 4, 0); labelTitleUV.Margin = new Padding(4, 0, 4, 0);
labelAdvanced.Name = "labelAdvanced"; labelTitleUV.Name = "labelTitleUV";
labelAdvanced.Size = new Size(166, 32); labelTitleUV.Size = new Size(166, 32);
labelAdvanced.TabIndex = 47; labelTitleUV.TabIndex = 47;
labelAdvanced.Text = "Undervolting"; labelTitleUV.Text = "Undervolting";
//
// panelTemperature
//
panelTemperature.AutoSize = true;
panelTemperature.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelTemperature.Controls.Add(labelTemp);
panelTemperature.Controls.Add(labelLeftTemp);
panelTemperature.Controls.Add(trackTemp);
panelTemperature.Dock = DockStyle.Top;
panelTemperature.Location = new Point(0, 66);
panelTemperature.Margin = new Padding(4);
panelTemperature.MaximumSize = new Size(0, 124);
panelTemperature.Name = "panelTemperature";
panelTemperature.Size = new Size(520, 124);
panelTemperature.TabIndex = 51;
//
// labelTemp
//
labelTemp.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelTemp.Location = new Point(347, 13);
labelTemp.Margin = new Padding(4, 0, 4, 0);
labelTemp.Name = "labelTemp";
labelTemp.Size = new Size(148, 32);
labelTemp.TabIndex = 13;
labelTemp.Text = "T";
labelTemp.TextAlign = ContentAlignment.TopRight;
//
// labelLeftTemp
//
labelLeftTemp.AutoSize = true;
labelLeftTemp.Location = new Point(10, 10);
labelLeftTemp.Margin = new Padding(4, 0, 4, 0);
labelLeftTemp.Name = "labelLeftTemp";
labelLeftTemp.Size = new Size(183, 32);
labelLeftTemp.TabIndex = 12;
labelLeftTemp.Text = "CPU Temp Limit";
//
// trackTemp
//
trackTemp.Location = new Point(6, 48);
trackTemp.Margin = new Padding(4, 2, 4, 2);
trackTemp.Maximum = 0;
trackTemp.Minimum = -40;
trackTemp.Name = "trackTemp";
trackTemp.Size = new Size(508, 90);
trackTemp.TabIndex = 11;
trackTemp.TickFrequency = 5;
trackTemp.TickStyle = TickStyle.TopLeft;
//
// panelTitleTemp
//
panelTitleTemp.Controls.Add(pictureTemp);
panelTitleTemp.Controls.Add(labelTempLimit);
panelTitleTemp.Dock = DockStyle.Top;
panelTitleTemp.Location = new Point(0, 0);
panelTitleTemp.Name = "panelTitleTemp";
panelTitleTemp.Size = new Size(520, 66);
panelTitleTemp.TabIndex = 50;
//
// pictureTemp
//
pictureTemp.BackgroundImage = Properties.Resources.icons8_temperature_48;
pictureTemp.BackgroundImageLayout = ImageLayout.Zoom;
pictureTemp.InitialImage = null;
pictureTemp.Location = new Point(10, 18);
pictureTemp.Margin = new Padding(4, 2, 4, 10);
pictureTemp.Name = "pictureTemp";
pictureTemp.Size = new Size(36, 38);
pictureTemp.TabIndex = 48;
pictureTemp.TabStop = false;
//
// labelTempLimit
//
labelTempLimit.AutoSize = true;
labelTempLimit.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelTempLimit.Location = new Point(51, 20);
labelTempLimit.Margin = new Padding(4, 0, 4, 0);
labelTempLimit.Name = "labelTempLimit";
labelTempLimit.Size = new Size(140, 32);
labelTempLimit.TabIndex = 47;
labelTempLimit.Text = "Temp Limit";
// //
// panelPower // panelPower
// //
@@ -695,7 +792,7 @@ namespace GHelper
checkApplyPower.Margin = new Padding(0); checkApplyPower.Margin = new Padding(0);
checkApplyPower.Name = "checkApplyPower"; checkApplyPower.Name = "checkApplyPower";
checkApplyPower.Padding = new Padding(16, 6, 16, 6); checkApplyPower.Padding = new Padding(16, 6, 16, 6);
checkApplyPower.Size = new Size(329, 46); checkApplyPower.Size = new Size(489, 46);
checkApplyPower.TabIndex = 45; checkApplyPower.TabIndex = 45;
checkApplyPower.Text = "Apply Power Limits"; checkApplyPower.Text = "Apply Power Limits";
checkApplyPower.UseVisualStyleBackColor = false; checkApplyPower.UseVisualStyleBackColor = false;
@@ -1308,7 +1405,13 @@ namespace GHelper
((System.ComponentModel.ISupportInitialize)trackUV).EndInit(); ((System.ComponentModel.ISupportInitialize)trackUV).EndInit();
panelTitleAdvanced.ResumeLayout(false); panelTitleAdvanced.ResumeLayout(false);
panelTitleAdvanced.PerformLayout(); panelTitleAdvanced.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureAdvanced).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureUV).EndInit();
panelTemperature.ResumeLayout(false);
panelTemperature.PerformLayout();
((System.ComponentModel.ISupportInitialize)trackTemp).EndInit();
panelTitleTemp.ResumeLayout(false);
panelTitleTemp.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureTemp).EndInit();
panelPower.ResumeLayout(false); panelPower.ResumeLayout(false);
panelPower.PerformLayout(); panelPower.PerformLayout();
panelApplyPower.ResumeLayout(false); panelApplyPower.ResumeLayout(false);
@@ -1416,8 +1519,8 @@ namespace GHelper
private Label labelUV; private Label labelUV;
private Label labelLeftUV; private Label labelLeftUV;
private TrackBar trackUV; private TrackBar trackUV;
private PictureBox pictureAdvanced; private PictureBox pictureUV;
private Label labelAdvanced; private Label labelTitleUV;
private RButton buttonApplyAdvanced; private RButton buttonApplyAdvanced;
private Panel panelApplyPower; private Panel panelApplyPower;
private Panel panelAdvanced; private Panel panelAdvanced;
@@ -1436,5 +1539,12 @@ namespace GHelper
private PictureBox pictureBoost; private PictureBox pictureBoost;
private Label labelBoostTitle; private Label labelBoostTitle;
private Label labelRisky; private Label labelRisky;
private Panel panelTitleTemp;
private PictureBox pictureTemp;
private Label labelTempLimit;
private Panel panelTemperature;
private Label labelTemp;
private Label labelLeftTemp;
private TrackBar trackTemp;
} }
} }

View File

@@ -1,10 +1,7 @@
using CustomControls; using CustomControls;
using GHelper.Gpu; using GHelper.Gpu;
using Ryzen; using Ryzen;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Net.Sockets;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting;
namespace GHelper namespace GHelper
@@ -53,6 +50,8 @@ namespace GHelper
labelGPUBoostTitle.Text = Properties.Strings.GPUBoost; labelGPUBoostTitle.Text = Properties.Strings.GPUBoost;
labelGPUTempTitle.Text = Properties.Strings.GPUTempTarget; labelGPUTempTitle.Text = Properties.Strings.GPUTempTarget;
labelRisky.Text = Properties.Strings.UndervoltingRisky;
InitTheme(true); InitTheme(true);
MinRPM = 18; MinRPM = 18;
@@ -132,6 +131,17 @@ namespace GHelper
//labelInfo.MaximumSize = new Size(280, 0); //labelInfo.MaximumSize = new Size(280, 0);
labelFansResult.Visible = false; labelFansResult.Visible = false;
trackUV.Minimum = RyzenControl.MinCPUUV;
trackUV.Maximum = RyzenControl.MaxCPUUV;
trackUViGPU.Minimum = RyzenControl.MinIGPUUV;
trackUViGPU.Maximum = RyzenControl.MaxIGPUUV;
trackTemp.Minimum = RyzenControl.MinTemp;
trackTemp.Maximum = RyzenControl.MaxTemp;
FillModes(); FillModes();
InitAll(); InitAll();
@@ -147,14 +157,10 @@ namespace GHelper
buttonRemove.Click += ButtonRemove_Click; buttonRemove.Click += ButtonRemove_Click;
buttonRename.Click += ButtonRename_Click; buttonRename.Click += ButtonRename_Click;
trackUV.Minimum = -30;
trackUV.Maximum = 0;
trackUViGPU.Minimum = -20;
trackUViGPU.Maximum = 0;
trackUV.Scroll += TrackUV_Scroll; trackUV.Scroll += TrackUV_Scroll;
trackUViGPU.Scroll += TrackUV_Scroll; trackUViGPU.Scroll += TrackUV_Scroll;
trackTemp.Scroll += TrackUV_Scroll;
buttonApplyAdvanced.Click += ButtonApplyAdvanced_Click; buttonApplyAdvanced.Click += ButtonApplyAdvanced_Click;
@@ -249,6 +255,9 @@ namespace GHelper
int cpuUV = Math.Max(trackUV.Minimum, Math.Min(trackUV.Maximum, AppConfig.GetMode("cpu_uv", 0))); int cpuUV = Math.Max(trackUV.Minimum, Math.Min(trackUV.Maximum, AppConfig.GetMode("cpu_uv", 0)));
int igpuUV = Math.Max(trackUViGPU.Minimum, Math.Min(trackUViGPU.Maximum, AppConfig.GetMode("igpu_uv", 0))); int igpuUV = Math.Max(trackUViGPU.Minimum, Math.Min(trackUViGPU.Maximum, AppConfig.GetMode("igpu_uv", 0)));
int temp = AppConfig.GetMode("cpu_temp");
if (temp < trackTemp.Minimum || temp > trackTemp.Maximum) temp = 96;
checkApplyUV.Enabled = checkApplyUV.Checked = AppConfig.IsMode("auto_uv"); checkApplyUV.Enabled = checkApplyUV.Checked = AppConfig.IsMode("auto_uv");
trackUV.Value = cpuUV; trackUV.Value = cpuUV;
@@ -257,22 +266,32 @@ namespace GHelper
trackUViGPU.Value = igpuUV; trackUViGPU.Value = igpuUV;
labelUViGPU.Text = trackUViGPU.Value.ToString(); labelUViGPU.Text = trackUViGPU.Value.ToString();
buttonAdvanced.Visible = Undervolter.IsAMD(); trackTemp.Value = temp;
labelTemp.Text = trackTemp.Value.ToString() + "°C";
buttonAdvanced.Visible = RyzenControl.IsAMD();
} }
private void AdvancedScroll()
private void TrackUV_Scroll(object? sender, EventArgs e)
{ {
AppConfig.SetMode("auto_uv", 0); AppConfig.SetMode("auto_uv", 0);
checkApplyUV.Enabled = checkApplyUV.Checked = false; checkApplyUV.Enabled = checkApplyUV.Checked = false;
labelUV.Text = trackUV.Value.ToString(); labelUV.Text = trackUV.Value.ToString();
labelUViGPU.Text = trackUViGPU.Value.ToString(); labelUViGPU.Text = trackUViGPU.Value.ToString();
labelTemp.Text = trackTemp.Value.ToString() + "°C";
AppConfig.SetMode("cpu_temp", trackTemp.Value);
AppConfig.SetMode("cpu_uv", trackUV.Value); AppConfig.SetMode("cpu_uv", trackUV.Value);
AppConfig.SetMode("igpu_uv", trackUViGPU.Value); AppConfig.SetMode("igpu_uv", trackUViGPU.Value);
}
private void TrackUV_Scroll(object? sender, EventArgs e)
{
AdvancedScroll();
} }
private void ComboModes_KeyPress(object? sender, KeyPressEventArgs e) private void ComboModes_KeyPress(object? sender, KeyPressEventArgs e)
@@ -603,13 +622,15 @@ namespace GHelper
public void InitPower(bool changed = false) public void InitPower(bool changed = false)
{ {
bool modeA0 = Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0; bool modeA0 = (Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0 || RyzenControl.IsAMD());
bool modeB0 = Program.acpi.IsAllAmdPPT(); bool modeB0 = Program.acpi.IsAllAmdPPT();
bool modeC1 = Program.acpi.DeviceGet(AsusACPI.PPT_APUC1) >= 0; bool modeC1 = Program.acpi.DeviceGet(AsusACPI.PPT_APUC1) >= 0;
panelA0.Visible = modeA0; panelA0.Visible = modeA0;
panelB0.Visible = modeB0; panelB0.Visible = modeB0;
panelApplyPower.Visible = panelTitleCPU.Visible = modeA0 || modeB0 || modeC1;
// All AMD version has B0 but doesn't have C0 (Nvidia GPU) settings // All AMD version has B0 but doesn't have C0 (Nvidia GPU) settings
if (modeB0) if (modeB0)
@@ -814,8 +835,10 @@ namespace GHelper
trackUV.Value = 0; trackUV.Value = 0;
trackUViGPU.Value = 0; trackUViGPU.Value = 0;
AppConfig.SetMode("cpu_uv", 0); trackTemp.Value = 96;
AppConfig.SetMode("igpu_uv", 0);
AdvancedScroll();
AppConfig.SetMode("cpu_temp", -1);
if (gpuVisible) if (gpuVisible)
{ {

View File

@@ -16,7 +16,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.87</AssemblyVersion> <AssemblyVersion>0.91</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -11,8 +11,8 @@ namespace GHelper.Gpu;
public class NvidiaGpuControl : IGpuControl public class NvidiaGpuControl : IGpuControl
{ {
public const int MaxCoreOffset = 250; public static int MaxCoreOffset => AppConfig.Get("max_gpu_core", 250);
public const int MaxMemoryOffset = 250; public static int MaxMemoryOffset => AppConfig.Get("max_gpu_memory", 250);
public const int MinCoreOffset = -250; public const int MinCoreOffset = -250;
public const int MinMemoryOffset = -250; public const int MinMemoryOffset = -250;
@@ -79,6 +79,12 @@ public class NvidiaGpuControl : IGpuControl
core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000; core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000;
memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000; memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000;
Logger.WriteLine($"GET GPU CLOCKS: {core}, {memory}"); Logger.WriteLine($"GET GPU CLOCKS: {core}, {memory}");
foreach (var delta in states.Voltages[PerformanceStateId.P0_3DPerformance])
{
Logger.WriteLine("GPU VOLT:" + delta.IsEditable + " - " + delta.ValueDeltaInMicroVolt.DeltaValue);
}
return 0; return 0;
} }
@@ -117,7 +123,7 @@ public class NvidiaGpuControl : IGpuControl
return status; return status;
} }
public int SetClocks(int core, int memory) public int SetClocks(int core, int memory, int voltage = 0)
{ {
if (core < MinCoreOffset || core > MaxCoreOffset) return 0; if (core < MinCoreOffset || core > MaxCoreOffset) return 0;
@@ -127,9 +133,10 @@ public class NvidiaGpuControl : IGpuControl
var coreClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Graphics, new PerformanceStates20ParameterDelta(core * 1000)); var coreClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Graphics, new PerformanceStates20ParameterDelta(core * 1000));
var memoryClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Memory, new PerformanceStates20ParameterDelta(memory * 1000)); var memoryClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Memory, new PerformanceStates20ParameterDelta(memory * 1000));
var voltageEntry = new PerformanceStates20BaseVoltageEntryV1(PerformanceVoltageDomain.Core, new PerformanceStates20ParameterDelta(voltage));
PerformanceStates20ClockEntryV1[] clocks = { coreClock, memoryClock }; PerformanceStates20ClockEntryV1[] clocks = { coreClock, memoryClock };
PerformanceStates20BaseVoltageEntryV1[] voltages = { }; PerformanceStates20BaseVoltageEntryV1[] voltages = { };
PerformanceState20[] performanceStates = { new PerformanceState20(PerformanceStateId.P0_3DPerformance, clocks, voltages) }; PerformanceState20[] performanceStates = { new PerformanceState20(PerformanceStateId.P0_3DPerformance, clocks, voltages) };

61
app/Gpu/NvidiaSmi.cs Normal file
View File

@@ -0,0 +1,61 @@
using System.Diagnostics;
using System.Text.RegularExpressions;
public static class NvidiaSmi
{
public static bool GetDisplayActiveStatus()
{
string commandOutput = RunNvidiaSmiCommand();
Logger.WriteLine(commandOutput);
if (commandOutput.Length == 0) return false;
if (!commandOutput.Contains("RTX 40")) return false;
// Extract the "Display Active" status using regular expressions
string displayActivePattern = @"Display Active\s+:\s+(\w+)";
Match match = Regex.Match(commandOutput, displayActivePattern, RegexOptions.IgnoreCase);
if (match.Success)
{
string status = match.Groups[1].Value.ToLower().Trim(' ');
return status == "enabled";
}
return false; // Return false if the "Display Active" status is not found
}
private static string RunNvidiaSmiCommand(string arguments = "-i 0 -q")
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "nvidia-smi",
Arguments = arguments,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};
Process process = new Process
{
StartInfo = startInfo
};
try
{
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return output;
}
catch (Exception ex)
{
//return File.ReadAllText(@"smi.txt");
Debug.WriteLine(ex.Message);
}
return "";
}
}

View File

@@ -24,6 +24,14 @@ namespace GHelper
{ {
while (!cancellationTokenSource.Token.IsCancellationRequested) while (!cancellationTokenSource.Token.IsCancellationRequested)
{ {
// Emergency break
if (input == null || !input.IsConnected )
{
Logger.WriteLine("Listener terminated");
break;
}
var data = input.Read().Data; var data = input.Read().Data;
if (data.Length > 1 && data[0] == AsusUSB.INPUT_HID_ID && data[1] > 0 && data[1] != 236) if (data.Length > 1 && data[0] == AsusUSB.INPUT_HID_ID && data[1] > 0 && data[1] != 236)
{ {
@@ -31,6 +39,7 @@ namespace GHelper
KeyHandler(data[1]); KeyHandler(data[1]);
} }
} }
Logger.WriteLine("Listener stopped"); Logger.WriteLine("Listener stopped");
} }

View File

@@ -74,7 +74,7 @@ namespace GHelper
Application.EnableVisualStyles(); Application.EnableVisualStyles();
HardwareControl.RecreateGpuControl(); HardwareControl.RecreateGpuControl();
Undervolter.Init(); RyzenControl.Init();
var ds = settingsForm.Handle; var ds = settingsForm.Handle;
@@ -193,6 +193,10 @@ namespace GHelper
switch (action) switch (action)
{ {
case "cpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle();
break;
case "gpu": case "gpu":
Startup.ReScheduleAdmin(); Startup.ReScheduleAdmin();
settingsForm.FansToggle(1); settingsForm.FansToggle(1);

View File

@@ -390,6 +390,16 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_refresh_32 {
get {
object obj = ResourceManager.GetObject("icons8-refresh-32", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
@@ -480,6 +490,16 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_temperature_48 {
get {
object obj = ResourceManager.GetObject("icons8-temperature-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View File

@@ -157,9 +157,6 @@
<data name="icons8-processor-96" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-processor-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-processor-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-processor-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-fan-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_add_64" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8_add_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-add-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-add-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@@ -184,15 +181,15 @@
<data name="icons8-voltage-60" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-voltage-60" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-voltage-60.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-voltage-60.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="backlight_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-keyboard-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-keyboard-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-keyboard-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-keyboard-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="brightness_down" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="brightness_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\brightness-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\brightness-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-save-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-save-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-fan-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-fan-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@@ -208,8 +205,8 @@
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-rocket-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -220,8 +217,8 @@
<data name="icons8-spa-flower-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-spa-flower-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-spa-flower-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-spa-flower-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-speed-96" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-save-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-save-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8_function" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8_function" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -229,8 +226,8 @@
<data name="icons8-balance-symbol-96" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-balance-symbol-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-balance-symbol-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-balance-symbol-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-organic-food-961" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-fan-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-organic-food-961.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-matrix-desktop-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-matrix-desktop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-matrix-desktop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-matrix-desktop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -238,23 +235,29 @@
<data name="icons8_remove_64" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8_remove_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-speed-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-xbox-controller-96" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-xbox-controller-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-xbox-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-xbox-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-organic-food-961" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-organic-food-961.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-project-management-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-project-management-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-project-management-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-project-management-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-leaf-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-leaf-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-leaf-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-leaf-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="backlight_down" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-rocket-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-boost-30" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-boost-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -262,7 +265,10 @@
<data name="icons8_video_48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8_video_48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-video-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-boost-30" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-temperature-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-boost-30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-temperature-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-refresh-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-refresh-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </root>

View File

@@ -160,7 +160,7 @@ namespace GHelper.Properties {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Apply. /// Looks up a localized string similar to Apply Power Limits.
/// </summary> /// </summary>
internal static string ApplyPowerLimits { internal static string ApplyPowerLimits {
get { get {
@@ -456,6 +456,26 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Disabling the dGPU by going to Eco mode while Display Mode in NVIDIA Control Panel is not set to Optimus might cause problems with brightness controls until after the next reboot.
///
///Do you still want to continue?.
/// </summary>
internal static string EnableOptimusText {
get {
return ResourceManager.GetString("EnableOptimusText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to NVIDIA Display Mode is not set to Optimus.
/// </summary>
internal static string EnableOptimusTitle {
get {
return ResourceManager.GetString("EnableOptimusTitle", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Extra. /// Looks up a localized string similar to Extra.
/// </summary> /// </summary>
@@ -861,6 +881,24 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to New updates.
/// </summary>
internal static string NewUpdates {
get {
return ResourceManager.GetString("NewUpdates", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No new updates.
/// </summary>
internal static string NoNewUpdates {
get {
return ResourceManager.GetString("NoNewUpdates", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Open G-Helper window. /// Looks up a localized string similar to Open G-Helper window.
/// </summary> /// </summary>
@@ -1086,6 +1124,15 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Stop GPU Applications.
/// </summary>
internal static string StopGPUApps {
get {
return ResourceManager.GetString("StopGPUApps", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Stopping Services. /// Looks up a localized string similar to Stopping Services.
/// </summary> /// </summary>
@@ -1176,6 +1223,15 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Undervolting is experimental and risky feature. If applied values are too low for your hardware, it can become unstable, shut down or cause data corruption. If you want to try - start from small values first, click Apply and test what works for you..
/// </summary>
internal static string UndervoltingRisky {
get {
return ResourceManager.GetString("UndervoltingRisky", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Updates. /// Looks up a localized string similar to Updates.
/// </summary> /// </summary>

View File

@@ -403,7 +403,7 @@
<value>Overdrive</value> <value>Overdrive</value>
</data> </data>
<data name="PerformanceMode" xml:space="preserve"> <data name="PerformanceMode" xml:space="preserve">
<value>Modo de rendimiento</value> <value>Modo</value>
</data> </data>
<data name="PictureGif" xml:space="preserve"> <data name="PictureGif" xml:space="preserve">
<value>Imagen / Gif</value> <value>Imagen / Gif</value>

View File

@@ -249,6 +249,14 @@
<data name="EcoMode" xml:space="preserve"> <data name="EcoMode" xml:space="preserve">
<value>Eco</value> <value>Eco</value>
</data> </data>
<data name="EnableOptimusText" xml:space="preserve">
<value>Disabling the dGPU by going to Eco mode while Display Mode in NVIDIA Control Panel is not set to Optimus might cause problems with brightness controls until after the next reboot.
Do you still want to continue?</value>
</data>
<data name="EnableOptimusTitle" xml:space="preserve">
<value>NVIDIA Display Mode is not set to Optimus</value>
</data>
<data name="Extra" xml:space="preserve"> <data name="Extra" xml:space="preserve">
<value>Extra</value> <value>Extra</value>
</data> </data>
@@ -384,6 +392,12 @@
<data name="MuteMic" xml:space="preserve"> <data name="MuteMic" xml:space="preserve">
<value>Mute Mic</value> <value>Mute Mic</value>
</data> </data>
<data name="NewUpdates" xml:space="preserve">
<value>New updates</value>
</data>
<data name="NoNewUpdates" xml:space="preserve">
<value>No new updates</value>
</data>
<data name="OpenGHelper" xml:space="preserve"> <data name="OpenGHelper" xml:space="preserve">
<value>Open G-Helper window</value> <value>Open G-Helper window</value>
</data> </data>
@@ -459,6 +473,9 @@
<data name="Stop" xml:space="preserve"> <data name="Stop" xml:space="preserve">
<value>Stop</value> <value>Stop</value>
</data> </data>
<data name="StopGPUApps" xml:space="preserve">
<value>Stop GPU Applications</value>
</data>
<data name="StoppingServices" xml:space="preserve"> <data name="StoppingServices" xml:space="preserve">
<value>Stopping Services</value> <value>Stopping Services</value>
</data> </data>
@@ -489,6 +506,9 @@
<data name="UltimateMode" xml:space="preserve"> <data name="UltimateMode" xml:space="preserve">
<value>Ultimate</value> <value>Ultimate</value>
</data> </data>
<data name="UndervoltingRisky" xml:space="preserve">
<value>Undervolting is experimental and risky feature. If applied values are too low for your hardware, it can become unstable, shut down or cause data corruption. If you want to try - start from small values first, click Apply and test what works for you.</value>
</data>
<data name="Updates" xml:space="preserve"> <data name="Updates" xml:space="preserve">
<value>Updates</value> <value>Updates</value>
</data> </data>

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

View File

@@ -8,8 +8,18 @@ using System.Management;
namespace Ryzen namespace Ryzen
{ {
internal class Undervolter internal class RyzenControl
{ {
public const int MinCPUUV = -30;
public const int MaxCPUUV = 0;
public const int MinIGPUUV = -20;
public const int MaxIGPUUV = 0;
public const int MinTemp = 75;
public const int MaxTemp = 98;
public static string[] FAM = { "RAVEN", "PICASSO", "DALI", "RENOIR/LUCIENNE", "MATISSE", "VANGOGH", "VERMEER", "CEZANNE/BARCELO", "REMBRANDT", "PHOENIX", "RAPHAEL/DRAGON RANGE" }; public static string[] FAM = { "RAVEN", "PICASSO", "DALI", "RENOIR/LUCIENNE", "MATISSE", "VANGOGH", "VERMEER", "CEZANNE/BARCELO", "REMBRANDT", "PHOENIX", "RAPHAEL/DRAGON RANGE" };
public static int FAMID { get; protected set; } public static int FAMID { get; protected set; }
@@ -116,11 +126,14 @@ namespace Ryzen
public static bool IsAMD() public static bool IsAMD()
{ {
if (CPUName.Length == 0) Init(); if (CPUName.Length == 0) Init();
return CPUName.Contains("AMD") || CPUName.Contains("Ryzen") || CPUName.Contains("Athlon") || CPUName.Contains("Radeon") || CPUName.Contains("AMD Custom APU 0405"); return CPUName.Contains("AMD") || CPUName.Contains("Ryzen") || CPUName.Contains("Athlon") || CPUName.Contains("Radeon") || CPUName.Contains("AMD Custom APU 0405");
}
public static bool IsRyzen9()
{
if (CPUName.Length == 0) Init();
return CPUName.Contains("Ryzen 9");
} }
public static void SetAddresses() public static void SetAddresses()

View File

@@ -135,12 +135,16 @@ namespace Ryzen
public Status SendMp1(uint message, ref uint[] arguments) public Status SendMp1(uint message, ref uint[] arguments)
{ {
return SendMsg(MP1_ADDR_MSG, MP1_ADDR_RSP, MP1_ADDR_ARG, message, ref arguments); var result = SendMsg(MP1_ADDR_MSG, MP1_ADDR_RSP, MP1_ADDR_ARG, message, ref arguments);
//Logger.WriteLine($"RyzenMP1:{message} {arguments[0]} {result}");
return result;
} }
public Status SendPsmu(uint message, ref uint[] arguments) public Status SendPsmu(uint message, ref uint[] arguments)
{ {
return SendMsg(PSMU_ADDR_MSG, PSMU_ADDR_RSP, PSMU_ADDR_ARG, message, ref arguments); var result = SendMsg(PSMU_ADDR_MSG, PSMU_ADDR_RSP, PSMU_ADDR_ARG, message, ref arguments);
//Logger.WriteLine($"RyzenPSMU:{message} {arguments[0]} {result}");
return result;
} }

View File

@@ -22,7 +22,7 @@ namespace Ryzen
//RAPHAEL/DRAGON RANGE - 10 //RAPHAEL/DRAGON RANGE - 10
public static Smu RyzenAccess = new Smu(false); public static Smu RyzenAccess = new Smu(false);
public static int FAMID = Undervolter.FAMID; public static int FAMID = RyzenControl.FAMID;
//STAMP Limit //STAMP Limit
@@ -195,15 +195,17 @@ namespace Ryzen
uint[] Args = new uint[6]; uint[] Args = new uint[6];
Args[0] = value; Args[0] = value;
Smu.Status? result = null;
switch (FAMID) switch (FAMID)
{ {
case -1: case -1:
RyzenAccess.SendPsmu(0x68, ref Args); result = RyzenAccess.SendPsmu(0x68, ref Args);
break; break;
case 0: case 0:
case 1: case 1:
case 2: case 2:
RyzenAccess.SendMp1(0x1f, ref Args); result = RyzenAccess.SendMp1(0x1f, ref Args);
break; break;
case 3: case 3:
case 5: case 5:
@@ -211,19 +213,22 @@ namespace Ryzen
case 8: case 8:
case 9: case 9:
case 11: case 11:
RyzenAccess.SendMp1(0x19, ref Args); result = RyzenAccess.SendMp1(0x19, ref Args);
break; break;
case 4: case 4:
case 6: case 6:
RyzenAccess.SendMp1(0x23, ref Args); RyzenAccess.SendMp1(0x23, ref Args);
RyzenAccess.SendPsmu(0x56, ref Args); result = RyzenAccess.SendPsmu(0x56, ref Args);
break; break;
case 10: case 10:
RyzenAccess.SendPsmu(0x59, ref Args); result = RyzenAccess.SendPsmu(0x59, ref Args);
break; break;
default: default:
break; break;
} }
Logger.WriteLine($"CPU Temp: {value} {result}");
RyzenAccess.Deinitialize(); RyzenAccess.Deinitialize();
} }
@@ -262,21 +267,26 @@ namespace Ryzen
uint[] Args = new uint[6]; uint[] Args = new uint[6];
Args[0] = value; Args[0] = value;
Smu.Status? result = null;
switch (FAMID) switch (FAMID)
{ {
case 5: case 5:
case 8: case 8:
case 9: case 9:
case 11: case 11:
RyzenAccess.SendMp1(0x33, ref Args); result = RyzenAccess.SendMp1(0x33, ref Args);
break; break;
case 3: case 3:
case 7: case 7:
RyzenAccess.SendMp1(0x38, ref Args); result = RyzenAccess.SendMp1(0x38, ref Args);
break; break;
default: default:
break; break;
} }
Logger.WriteLine($"APU Temp: {value} {result}");
RyzenAccess.Deinitialize(); RyzenAccess.Deinitialize();
} }

View File

@@ -97,6 +97,7 @@ namespace GHelper
labelVersion = new Label(); labelVersion = new Label();
labelModel = new Label(); labelModel = new Label();
panelVersion = new Panel(); panelVersion = new Panel();
buttonStopGPU = new RButton();
panelMatrix.SuspendLayout(); panelMatrix.SuspendLayout();
tableLayoutMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout();
panelMatrixTitle.SuspendLayout(); panelMatrixTitle.SuspendLayout();
@@ -592,6 +593,7 @@ namespace GHelper
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableGPU.Controls.Add(buttonStopGPU, 0, 0);
tableGPU.Controls.Add(buttonEco, 0, 0); tableGPU.Controls.Add(buttonEco, 0, 0);
tableGPU.Controls.Add(buttonStandard, 1, 0); tableGPU.Controls.Add(buttonStandard, 1, 0);
tableGPU.Controls.Add(buttonXGM, 2, 0); tableGPU.Controls.Add(buttonXGM, 2, 0);
@@ -664,11 +666,11 @@ namespace GHelper
buttonXGM.ForeColor = SystemColors.ControlText; buttonXGM.ForeColor = SystemColors.ControlText;
buttonXGM.Image = Properties.Resources.icons8_video_48; buttonXGM.Image = Properties.Resources.icons8_video_48;
buttonXGM.ImageAlign = ContentAlignment.BottomCenter; buttonXGM.ImageAlign = ContentAlignment.BottomCenter;
buttonXGM.Location = new Point(4, 132); buttonXGM.Location = new Point(580, 4);
buttonXGM.Margin = new Padding(4); buttonXGM.Margin = new Padding(4);
buttonXGM.Name = "buttonXGM"; buttonXGM.Name = "buttonXGM";
buttonXGM.Secondary = false; buttonXGM.Secondary = false;
buttonXGM.Size = new Size(184, 120); buttonXGM.Size = new Size(186, 120);
buttonXGM.TabIndex = 2; buttonXGM.TabIndex = 2;
buttonXGM.Text = "XG Mobile"; buttonXGM.Text = "XG Mobile";
buttonXGM.TextImageRelation = TextImageRelation.ImageAboveText; buttonXGM.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -687,11 +689,11 @@ namespace GHelper
buttonOptimized.ForeColor = SystemColors.ControlText; buttonOptimized.ForeColor = SystemColors.ControlText;
buttonOptimized.Image = Properties.Resources.icons8_project_management_48__1_; buttonOptimized.Image = Properties.Resources.icons8_project_management_48__1_;
buttonOptimized.ImageAlign = ContentAlignment.BottomCenter; buttonOptimized.ImageAlign = ContentAlignment.BottomCenter;
buttonOptimized.Location = new Point(580, 4); buttonOptimized.Location = new Point(388, 4);
buttonOptimized.Margin = new Padding(4); buttonOptimized.Margin = new Padding(4);
buttonOptimized.Name = "buttonOptimized"; buttonOptimized.Name = "buttonOptimized";
buttonOptimized.Secondary = false; buttonOptimized.Secondary = false;
buttonOptimized.Size = new Size(186, 120); buttonOptimized.Size = new Size(184, 120);
buttonOptimized.TabIndex = 3; buttonOptimized.TabIndex = 3;
buttonOptimized.Text = Properties.Strings.Optimized; buttonOptimized.Text = Properties.Strings.Optimized;
buttonOptimized.TextImageRelation = TextImageRelation.ImageAboveText; buttonOptimized.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -709,7 +711,7 @@ namespace GHelper
buttonUltimate.ForeColor = SystemColors.ControlText; buttonUltimate.ForeColor = SystemColors.ControlText;
buttonUltimate.Image = Properties.Resources.icons8_game_controller_48; buttonUltimate.Image = Properties.Resources.icons8_game_controller_48;
buttonUltimate.ImageAlign = ContentAlignment.BottomCenter; buttonUltimate.ImageAlign = ContentAlignment.BottomCenter;
buttonUltimate.Location = new Point(388, 4); buttonUltimate.Location = new Point(4, 132);
buttonUltimate.Margin = new Padding(4); buttonUltimate.Margin = new Padding(4);
buttonUltimate.Name = "buttonUltimate"; buttonUltimate.Name = "buttonUltimate";
buttonUltimate.Secondary = false; buttonUltimate.Secondary = false;
@@ -1118,6 +1120,30 @@ namespace GHelper
panelVersion.Size = new Size(810, 57); panelVersion.Size = new Size(810, 57);
panelVersion.TabIndex = 41; panelVersion.TabIndex = 41;
// //
// buttonStopGPU
//
buttonStopGPU.Activated = false;
buttonStopGPU.BackColor = SystemColors.ControlLightLight;
buttonStopGPU.BorderColor = Color.Transparent;
buttonStopGPU.BorderRadius = 5;
buttonStopGPU.CausesValidation = false;
buttonStopGPU.Dock = DockStyle.Top;
buttonStopGPU.FlatAppearance.BorderSize = 0;
buttonStopGPU.FlatStyle = FlatStyle.Flat;
buttonStopGPU.ForeColor = SystemColors.ControlText;
buttonStopGPU.Image = Properties.Resources.icons8_leaf_48;
buttonStopGPU.ImageAlign = ContentAlignment.BottomCenter;
buttonStopGPU.Location = new Point(196, 132);
buttonStopGPU.Margin = new Padding(4);
buttonStopGPU.Name = "buttonStopGPU";
buttonStopGPU.Secondary = false;
buttonStopGPU.Size = new Size(184, 120);
buttonStopGPU.TabIndex = 4;
buttonStopGPU.Text = "Stop GPU applications";
buttonStopGPU.TextImageRelation = TextImageRelation.ImageAboveText;
buttonStopGPU.UseVisualStyleBackColor = false;
buttonStopGPU.Visible = false;
//
// SettingsForm // SettingsForm
// //
AutoScaleDimensions = new SizeF(192F, 192F); AutoScaleDimensions = new SizeF(192F, 192F);
@@ -1255,5 +1281,6 @@ namespace GHelper
private Panel panelVersion; private Panel panelVersion;
private Label labelVersion; private Label labelVersion;
private Label labelModel; private Label labelModel;
private RButton buttonStopGPU;
} }
} }

View File

@@ -31,6 +31,7 @@ namespace GHelper
public Extra keyb; public Extra keyb;
public Updates updates; public Updates updates;
static long lastUpdate;
static long lastRefresh; static long lastRefresh;
private bool customFans = false; private bool customFans = false;
@@ -53,7 +54,7 @@ namespace GHelper
buttonUltimate.Text = Properties.Strings.UltimateMode; buttonUltimate.Text = Properties.Strings.UltimateMode;
buttonStandard.Text = Properties.Strings.StandardMode; buttonStandard.Text = Properties.Strings.StandardMode;
buttonOptimized.Text = Properties.Strings.Optimized; buttonOptimized.Text = Properties.Strings.Optimized;
buttonStopGPU.Text = Properties.Strings.StopGPUApps;
buttonScreenAuto.Text = Properties.Strings.AutoMode; buttonScreenAuto.Text = Properties.Strings.AutoMode;
buttonMiniled.Text = Properties.Strings.Multizone; buttonMiniled.Text = Properties.Strings.Multizone;
@@ -101,6 +102,7 @@ namespace GHelper
buttonStandard.Click += ButtonStandard_Click; buttonStandard.Click += ButtonStandard_Click;
buttonUltimate.Click += ButtonUltimate_Click; buttonUltimate.Click += ButtonUltimate_Click;
buttonOptimized.Click += ButtonOptimized_Click; buttonOptimized.Click += ButtonOptimized_Click;
buttonStopGPU.Click += ButtonStopGPU_Click;
VisibleChanged += SettingsForm_VisibleChanged; VisibleChanged += SettingsForm_VisibleChanged;
@@ -182,14 +184,10 @@ namespace GHelper
SetContextMenu(); SetContextMenu();
Task.Run(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(1));
CheckForUpdatesAsync();
});
} }
private void SettingsForm_VisibleChanged(object? sender, EventArgs e) private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
{ {
aTimer.Enabled = this.Visible; aTimer.Enabled = this.Visible;
@@ -197,6 +195,17 @@ namespace GHelper
{ {
InitScreen(); InitScreen();
InitXGM(); InitXGM();
// Run update once per 12 hours
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeSeconds() - lastUpdate) < 43200) return;
lastUpdate = DateTimeOffset.Now.ToUnixTimeSeconds();
Task.Run(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(1));
CheckForUpdatesAsync();
});
} }
} }
@@ -981,6 +990,12 @@ namespace GHelper
SetGPUMode(AsusACPI.GPUModeEco); SetGPUMode(AsusACPI.GPUModeEco);
} }
private void ButtonStopGPU_Click(object? sender, EventArgs e)
{
HardwareControl.KillGPUApps();
}
public async void RefreshSensors(bool force = false) public async void RefreshSensors(bool force = false)
{ {
@@ -1029,7 +1044,7 @@ namespace GHelper
labelPerf.Text = Properties.Strings.PerformanceMode + ": " + Modes.GetCurrentName() + (customFans ? "+" : "") + ((customPower > 0) ? " " + customPower + "W" : ""); labelPerf.Text = Properties.Strings.PerformanceMode + ": " + Modes.GetCurrentName() + (customFans ? "+" : "") + ((customPower > 0) ? " " + customPower + "W" : "");
} }
public void SetPower() public void SetPower(bool launchAsAdmin = false)
{ {
int limit_total = AppConfig.GetMode("limit_total"); int limit_total = AppConfig.GetMode("limit_total");
@@ -1052,6 +1067,23 @@ namespace GHelper
Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, limit_total, "PowerLimit A3"); Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, limit_total, "PowerLimit A3");
customPower = limit_total; customPower = limit_total;
} }
else if (RyzenControl.IsAMD())
{
if (ProcessHelper.IsUserAdministrator())
{
SendCommand.set_stapm_limit((uint)limit_total * 1000);
SendCommand.set_stapm2_limit((uint)limit_total * 1000);
SendCommand.set_slow_limit((uint)limit_total * 1000);
SendCommand.set_fast_limit((uint)limit_total * 1000);
customPower = limit_total;
}
else if (launchAsAdmin)
{
ProcessHelper.RunAsAdmin("cpu");
return;
}
}
if (Program.acpi.IsAllAmdPPT()) // CPU limit all amd models if (Program.acpi.IsAllAmdPPT()) // CPU limit all amd models
{ {
@@ -1141,23 +1173,32 @@ namespace GHelper
return; return;
} }
if (!Undervolter.IsAMD()) return; if (!RyzenControl.IsAMD()) return;
int cpuUV = AppConfig.GetMode("cpu_uv", 0); int cpuUV = AppConfig.GetMode("cpu_uv", 0);
int igpuUV = AppConfig.GetMode("igpu_uv", 0); int igpuUV = AppConfig.GetMode("igpu_uv", 0);
int cpuTemp = AppConfig.GetMode("cpu_temp");
try try
{ {
if (cpuUV >= -40 && cpuUV <= 0) if (cpuUV >= RyzenControl.MinCPUUV && cpuUV <= RyzenControl.MaxCPUUV)
{ {
SendCommand.set_coall(cpuUV); SendCommand.set_coall(cpuUV);
} }
if (igpuUV >= -40 && igpuUV <= 0) if (igpuUV >= RyzenControl.MinIGPUUV && igpuUV <= RyzenControl.MaxIGPUUV)
{ {
SendCommand.set_cogfx(igpuUV); SendCommand.set_cogfx(igpuUV);
} }
} catch (Exception ex)
if (cpuTemp >= RyzenControl.MinTemp && cpuTemp <= RyzenControl.MaxTemp)
{
SendCommand.set_tctl_temp((uint)cpuTemp);
SendCommand.set_apu_skin_temp_limit((uint)cpuTemp);
}
}
catch (Exception ex)
{ {
Logger.WriteLine("UV Error: " + ex.ToString()); Logger.WriteLine("UV Error: " + ex.ToString());
} }
@@ -1224,13 +1265,14 @@ namespace GHelper
} }
private static bool isManualModeRequired() private static bool IsManualModeRequired()
{ {
if (!AppConfig.IsMode("auto_apply_power")) if (!AppConfig.IsMode("auto_apply_power"))
return false; return false;
return return
AppConfig.Is("manual_mode") || AppConfig.Is("manual_mode") ||
AppConfig.ContainsModel("GU603") ||
AppConfig.ContainsModel("GU604") || AppConfig.ContainsModel("GU604") ||
AppConfig.ContainsModel("FX517") || AppConfig.ContainsModel("FX517") ||
AppConfig.ContainsModel("G733"); AppConfig.ContainsModel("G733");
@@ -1255,7 +1297,7 @@ namespace GHelper
} }
// Fix for models that don't support PPT settings in all modes, setting a "manual" mode for them // Fix for models that don't support PPT settings in all modes, setting a "manual" mode for them
if (isManualModeRequired() && !applyFans) if (IsManualModeRequired() && !applyFans)
{ {
AutoFans(true); AutoFans(true);
} }
@@ -1277,7 +1319,7 @@ namespace GHelper
} }
else else
{ {
if (applyPower) SetPower(); if (applyPower) SetPower(true);
SetGPUPower(); SetGPUPower();
AutoUV(); AutoUV();
} }
@@ -1345,7 +1387,7 @@ namespace GHelper
SetPerformanceLabel(); SetPerformanceLabel();
if (isManualModeRequired()) if (IsManualModeRequired())
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, AsusACPI.PerformanceManual, "Manual Mode"); Program.acpi.DeviceSet(AsusACPI.PerformanceMode, AsusACPI.PerformanceManual, "Manual Mode");
else else
Program.acpi.DeviceSet(AsusACPI.PerformanceMode, Modes.GetBase(mode), "Mode"); Program.acpi.DeviceSet(AsusACPI.PerformanceMode, Modes.GetBase(mode), "Mode");
@@ -1510,20 +1552,6 @@ namespace GHelper
return true; return true;
} }
private void UltimateUI(bool ultimate)
{
if (!ultimate)
{
tableGPU.Controls.Remove(buttonUltimate);
tablePerf.ColumnCount = 0;
tableGPU.ColumnCount = 0;
tableScreen.ColumnCount = 0;
menuUltimate.Visible = false;
}
//tableLayoutMatrix.ColumnCount = 0;
}
public void InitXGM() public void InitXGM()
{ {
bool connected = Program.acpi.IsXGConnected(); bool connected = Program.acpi.IsXGConnected();
@@ -1574,12 +1602,28 @@ namespace GHelper
else else
GpuMode = AsusACPI.GPUModeStandard; GpuMode = AsusACPI.GPUModeStandard;
UltimateUI(mux == 1); // Ultimate mode not suported
if (mux != 1)
{
tableGPU.Controls.Remove(buttonUltimate);
tablePerf.ColumnCount = 0;
tableGPU.ColumnCount = 0;
tableScreen.ColumnCount = 0;
menuUltimate.Visible = false;
}
if (eco < 0 && mux < 0) if (eco < 0 && mux < 0)
{ {
isGpuSection = tableGPU.Visible = false; isGpuSection = false;
buttonEco.Visible = false;
buttonStandard.Visible = false;
buttonUltimate.Visible = false;
buttonOptimized.Visible = false;
buttonStopGPU.Visible = true;
SetContextMenu(); SetContextMenu();
if (HardwareControl.FormatFan(Program.acpi.DeviceGet(AsusACPI.GPU_Fan)) is null) panelGPU.Visible = false; if (HardwareControl.FormatFan(Program.acpi.DeviceGet(AsusACPI.GPU_Fan)) is null) panelGPU.Visible = false;
} }
@@ -1657,7 +1701,20 @@ namespace GHelper
int status = 1; int status = 1;
if (eco == 1) HardwareControl.KillGPUApps(); if (eco == 1)
{
if (NvidiaSmi.GetDisplayActiveStatus())
{
DialogResult dialogResult = MessageBox.Show(Properties.Strings.EnableOptimusText, Properties.Strings.EnableOptimusTitle, MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.No)
{
InitGPUMode();
return;
}
}
HardwareControl.KillGPUApps();
}
Logger.WriteLine($"Running eco command {eco}"); Logger.WriteLine($"Running eco command {eco}");

105
app/Updates.Designer.cs generated
View File

@@ -33,6 +33,8 @@
labelBIOS = new Label(); labelBIOS = new Label();
pictureBios = new PictureBox(); pictureBios = new PictureBox();
panelBiosTitle = new Panel(); panelBiosTitle = new Panel();
labelUpdates = new Label();
buttonRefresh = new CustomControls.RButton();
panelBios = new Panel(); panelBios = new Panel();
panelDrivers = new Panel(); panelDrivers = new Panel();
tableDrivers = new TableLayoutPanel(); tableDrivers = new TableLayoutPanel();
@@ -56,21 +58,21 @@
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableBios.Dock = DockStyle.Top; tableBios.Dock = DockStyle.Top;
tableBios.Location = new Point(10, 10); tableBios.Location = new Point(20, 20);
tableBios.Margin = new Padding(2); tableBios.Margin = new Padding(4);
tableBios.MinimumSize = new Size(550, 0); tableBios.MinimumSize = new Size(1100, 0);
tableBios.Name = "tableBios"; tableBios.Name = "tableBios";
tableBios.Size = new Size(608, 0); tableBios.Size = new Size(1216, 0);
tableBios.TabIndex = 0; tableBios.TabIndex = 0;
// //
// labelBIOS // labelBIOS
// //
labelBIOS.AutoSize = true; labelBIOS.AutoSize = true;
labelBIOS.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelBIOS.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelBIOS.Location = new Point(34, 14); labelBIOS.Location = new Point(68, 23);
labelBIOS.Margin = new Padding(2, 0, 2, 0); labelBIOS.Margin = new Padding(4, 0, 4, 0);
labelBIOS.Name = "labelBIOS"; labelBIOS.Name = "labelBIOS";
labelBIOS.Size = new Size(35, 15); labelBIOS.Size = new Size(68, 32);
labelBIOS.TabIndex = 1; labelBIOS.TabIndex = 1;
labelBIOS.Text = "BIOS"; labelBIOS.Text = "BIOS";
// //
@@ -78,34 +80,63 @@
// //
pictureBios.BackgroundImage = (Image)resources.GetObject("pictureBios.BackgroundImage"); pictureBios.BackgroundImage = (Image)resources.GetObject("pictureBios.BackgroundImage");
pictureBios.BackgroundImageLayout = ImageLayout.Zoom; pictureBios.BackgroundImageLayout = ImageLayout.Zoom;
pictureBios.Location = new Point(14, 14); pictureBios.Location = new Point(28, 23);
pictureBios.Margin = new Padding(2); pictureBios.Margin = new Padding(4);
pictureBios.Name = "pictureBios"; pictureBios.Name = "pictureBios";
pictureBios.Size = new Size(16, 16); pictureBios.Size = new Size(32, 32);
pictureBios.TabIndex = 2; pictureBios.TabIndex = 2;
pictureBios.TabStop = false; pictureBios.TabStop = false;
// //
// panelBiosTitle // panelBiosTitle
// //
panelBiosTitle.Controls.Add(labelUpdates);
panelBiosTitle.Controls.Add(buttonRefresh);
panelBiosTitle.Controls.Add(labelBIOS); panelBiosTitle.Controls.Add(labelBIOS);
panelBiosTitle.Controls.Add(pictureBios); panelBiosTitle.Controls.Add(pictureBios);
panelBiosTitle.Dock = DockStyle.Top; panelBiosTitle.Dock = DockStyle.Top;
panelBiosTitle.Location = new Point(0, 0); panelBiosTitle.Location = new Point(0, 0);
panelBiosTitle.Margin = new Padding(2); panelBiosTitle.Margin = new Padding(4);
panelBiosTitle.Name = "panelBiosTitle"; panelBiosTitle.Name = "panelBiosTitle";
panelBiosTitle.Size = new Size(628, 31); panelBiosTitle.Size = new Size(1256, 62);
panelBiosTitle.TabIndex = 3; panelBiosTitle.TabIndex = 3;
// //
// labelUpdates
//
labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelUpdates.Location = new Point(941, 23);
labelUpdates.Name = "labelUpdates";
labelUpdates.Size = new Size(245, 32);
labelUpdates.TabIndex = 4;
labelUpdates.Text = "Updates Available";
//
// buttonRefresh
//
buttonRefresh.Activated = false;
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonRefresh.BackColor = SystemColors.ControlLight;
buttonRefresh.BorderColor = Color.Transparent;
buttonRefresh.BorderRadius = 5;
buttonRefresh.FlatAppearance.BorderSize = 0;
buttonRefresh.FlatStyle = FlatStyle.Flat;
buttonRefresh.Image = Properties.Resources.icons8_refresh_32;
buttonRefresh.Location = new Point(1183, 14);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Secondary = true;
buttonRefresh.Size = new Size(52, 46);
buttonRefresh.TabIndex = 3;
buttonRefresh.UseVisualStyleBackColor = false;
//
// panelBios // panelBios
// //
panelBios.AutoSize = true; panelBios.AutoSize = true;
panelBios.Controls.Add(tableBios); panelBios.Controls.Add(tableBios);
panelBios.Dock = DockStyle.Top; panelBios.Dock = DockStyle.Top;
panelBios.Location = new Point(0, 31); panelBios.Location = new Point(0, 62);
panelBios.Margin = new Padding(2); panelBios.Margin = new Padding(4);
panelBios.Name = "panelBios"; panelBios.Name = "panelBios";
panelBios.Padding = new Padding(10); panelBios.Padding = new Padding(20);
panelBios.Size = new Size(628, 20); panelBios.Size = new Size(1256, 40);
panelBios.TabIndex = 4; panelBios.TabIndex = 4;
// //
// panelDrivers // panelDrivers
@@ -113,11 +144,11 @@
panelDrivers.AutoSize = true; panelDrivers.AutoSize = true;
panelDrivers.Controls.Add(tableDrivers); panelDrivers.Controls.Add(tableDrivers);
panelDrivers.Dock = DockStyle.Top; panelDrivers.Dock = DockStyle.Top;
panelDrivers.Location = new Point(0, 73); panelDrivers.Location = new Point(0, 146);
panelDrivers.Margin = new Padding(2); panelDrivers.Margin = new Padding(4);
panelDrivers.Name = "panelDrivers"; panelDrivers.Name = "panelDrivers";
panelDrivers.Padding = new Padding(10); panelDrivers.Padding = new Padding(20);
panelDrivers.Size = new Size(628, 20); panelDrivers.Size = new Size(1256, 40);
panelDrivers.TabIndex = 6; panelDrivers.TabIndex = 6;
// //
// tableDrivers // tableDrivers
@@ -129,11 +160,11 @@
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableDrivers.Dock = DockStyle.Top; tableDrivers.Dock = DockStyle.Top;
tableDrivers.Location = new Point(10, 10); tableDrivers.Location = new Point(20, 20);
tableDrivers.Margin = new Padding(2); tableDrivers.Margin = new Padding(4);
tableDrivers.MinimumSize = new Size(550, 0); tableDrivers.MinimumSize = new Size(1100, 0);
tableDrivers.Name = "tableDrivers"; tableDrivers.Name = "tableDrivers";
tableDrivers.Size = new Size(608, 0); tableDrivers.Size = new Size(1216, 0);
tableDrivers.TabIndex = 0; tableDrivers.TabIndex = 0;
// //
// panelDriversTitle // panelDriversTitle
@@ -141,20 +172,20 @@
panelDriversTitle.Controls.Add(labelDrivers); panelDriversTitle.Controls.Add(labelDrivers);
panelDriversTitle.Controls.Add(pictureDrivers); panelDriversTitle.Controls.Add(pictureDrivers);
panelDriversTitle.Dock = DockStyle.Top; panelDriversTitle.Dock = DockStyle.Top;
panelDriversTitle.Location = new Point(0, 51); panelDriversTitle.Location = new Point(0, 102);
panelDriversTitle.Margin = new Padding(2); panelDriversTitle.Margin = new Padding(4);
panelDriversTitle.Name = "panelDriversTitle"; panelDriversTitle.Name = "panelDriversTitle";
panelDriversTitle.Size = new Size(628, 22); panelDriversTitle.Size = new Size(1256, 44);
panelDriversTitle.TabIndex = 5; panelDriversTitle.TabIndex = 5;
// //
// labelDrivers // labelDrivers
// //
labelDrivers.AutoSize = true; labelDrivers.AutoSize = true;
labelDrivers.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); labelDrivers.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelDrivers.Location = new Point(34, 4); labelDrivers.Location = new Point(68, 6);
labelDrivers.Margin = new Padding(2, 0, 2, 0); labelDrivers.Margin = new Padding(4, 0, 4, 0);
labelDrivers.Name = "labelDrivers"; labelDrivers.Name = "labelDrivers";
labelDrivers.Size = new Size(126, 15); labelDrivers.Size = new Size(254, 32);
labelDrivers.TabIndex = 1; labelDrivers.TabIndex = 1;
labelDrivers.Text = "Drivers and Software"; labelDrivers.Text = "Drivers and Software";
// //
@@ -162,24 +193,24 @@
// //
pictureDrivers.BackgroundImage = (Image)resources.GetObject("pictureDrivers.BackgroundImage"); pictureDrivers.BackgroundImage = (Image)resources.GetObject("pictureDrivers.BackgroundImage");
pictureDrivers.BackgroundImageLayout = ImageLayout.Zoom; pictureDrivers.BackgroundImageLayout = ImageLayout.Zoom;
pictureDrivers.Location = new Point(14, 4); pictureDrivers.Location = new Point(28, 6);
pictureDrivers.Margin = new Padding(2); pictureDrivers.Margin = new Padding(4);
pictureDrivers.Name = "pictureDrivers"; pictureDrivers.Name = "pictureDrivers";
pictureDrivers.Size = new Size(16, 16); pictureDrivers.Size = new Size(32, 32);
pictureDrivers.TabIndex = 2; pictureDrivers.TabIndex = 2;
pictureDrivers.TabStop = false; pictureDrivers.TabStop = false;
// //
// Updates // Updates
// //
AutoScaleDimensions = new SizeF(96F, 96F); AutoScaleDimensions = new SizeF(192F, 192F);
AutoScaleMode = AutoScaleMode.Dpi; AutoScaleMode = AutoScaleMode.Dpi;
AutoScroll = true; AutoScroll = true;
ClientSize = new Size(628, 345); ClientSize = new Size(1256, 690);
Controls.Add(panelDrivers); Controls.Add(panelDrivers);
Controls.Add(panelDriversTitle); Controls.Add(panelDriversTitle);
Controls.Add(panelBios); Controls.Add(panelBios);
Controls.Add(panelBiosTitle); Controls.Add(panelBiosTitle);
Margin = new Padding(2); Margin = new Padding(4);
MinimizeBox = false; MinimizeBox = false;
Name = "Updates"; Name = "Updates";
ShowIcon = false; ShowIcon = false;
@@ -211,5 +242,7 @@
private Panel panelDriversTitle; private Panel panelDriversTitle;
private Label labelDrivers; private Label labelDrivers;
private PictureBox pictureDrivers; private PictureBox pictureDrivers;
private CustomControls.RButton buttonRefresh;
private Label labelUpdates;
} }
} }

View File

@@ -1,5 +1,4 @@
using CustomControls; using CustomControls;
using HidSharp;
using System.Diagnostics; using System.Diagnostics;
using System.Management; using System.Management;
using System.Net; using System.Net;
@@ -23,21 +22,34 @@ namespace GHelper
static string model; static string model;
static string bios; static string bios;
public Updates() static int updatesCount = 0;
private static long lastUpdate;
private void LoadUpdates()
{ {
InitializeComponent();
InitTheme(); if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastUpdate) < 5000) return;
lastUpdate = DateTimeOffset.Now.ToUnixTimeMilliseconds();
InitBiosAndModel(); InitBiosAndModel();
updatesCount = 0;
labelUpdates.ForeColor = colorEco;
labelUpdates.Text = Properties.Strings.NoNewUpdates;
Text = Properties.Strings.BiosAndDriverUpdates + ": " + model + " " + bios; Text = Properties.Strings.BiosAndDriverUpdates + ": " + model + " " + bios;
labelBIOS.Text = "BIOS"; labelBIOS.Text = "BIOS";
labelDrivers.Text = Properties.Strings.DriverAndSoftware; labelDrivers.Text = Properties.Strings.DriverAndSoftware;
SuspendLayout(); SuspendLayout();
tableBios.Visible = false; tableBios.Visible = false;
tableDrivers.Visible = false; tableDrivers.Visible = false;
ClearTable(tableBios);
ClearTable(tableDrivers);
Task.Run(async () => Task.Run(async () =>
{ {
DriversAsync($"https://rog.asus.com/support/webapi/product/GetPDBIOS?website=global&model={model}&cpu=", 1, tableBios); DriversAsync($"https://rog.asus.com/support/webapi/product/GetPDBIOS?website=global&model={model}&cpu=", 1, tableBios);
@@ -47,10 +59,36 @@ namespace GHelper
{ {
DriversAsync($"https://rog.asus.com/support/webapi/product/GetPDDrivers?website=global&model={model}&cpu={model}&osid=52", 0, tableDrivers); DriversAsync($"https://rog.asus.com/support/webapi/product/GetPDDrivers?website=global&model={model}&cpu={model}&osid=52", 0, tableDrivers);
}); });
}
private void ClearTable(TableLayoutPanel tableLayoutPanel)
{
while (tableLayoutPanel.Controls.Count > 0)
{
tableLayoutPanel.Controls[0].Dispose();
}
tableLayoutPanel.RowCount = 0;
}
public Updates()
{
InitializeComponent();
InitTheme(true);
LoadUpdates();
//buttonRefresh.Visible = false;
buttonRefresh.Click += ButtonRefresh_Click;
Shown += Updates_Shown; Shown += Updates_Shown;
} }
private void ButtonRefresh_Click(object? sender, EventArgs e)
{
LoadUpdates();
}
private void Updates_Shown(object? sender, EventArgs e) private void Updates_Shown(object? sender, EventArgs e)
{ {
Height = Program.settingsForm.Height; Height = Program.settingsForm.Height;
@@ -90,7 +128,8 @@ namespace GHelper
{ {
model = results[0]; model = results[0];
bios = results[1]; bios = results[1];
} else }
else
{ {
model = obj["SMBIOSBIOSVersion"].ToString(); model = obj["SMBIOSBIOSVersion"].ToString();
} }
@@ -114,11 +153,12 @@ namespace GHelper
httpClient.DefaultRequestHeaders.AcceptEncoding.ParseAdd("gzip, deflate, br"); httpClient.DefaultRequestHeaders.AcceptEncoding.ParseAdd("gzip, deflate, br");
httpClient.DefaultRequestHeaders.Add("User-Agent", "C# App"); httpClient.DefaultRequestHeaders.Add("User-Agent", "C# App");
var json = await httpClient.GetStringAsync(url); var json = await httpClient.GetStringAsync(url);
var data = JsonSerializer.Deserialize<JsonElement>(json); var data = JsonSerializer.Deserialize<JsonElement>(json);
var groups = data.GetProperty("Result").GetProperty("Obj"); var groups = data.GetProperty("Result").GetProperty("Obj");
List<string> skipList = new() { "Armoury Crate & Aura Creator Installer", "MyASUS", "ASUS Smart Display Control", "Aura Wallpaper", "Virtual Pet","ROG Font V1.5" }; List<string> skipList = new() { "Armoury Crate & Aura Creator Installer", "MyASUS", "ASUS Smart Display Control", "Aura Wallpaper", "Virtual Pet", "ROG Font V1.5" };
List<DriverDownload> drivers = new(); List<DriverDownload> drivers = new();
for (int i = 0; i < groups.GetArrayLength(); i++) for (int i = 0; i < groups.GetArrayLength(); i++)
@@ -145,6 +185,7 @@ namespace GHelper
driver.hardwares = file.GetProperty("HardwareInfoList"); driver.hardwares = file.GetProperty("HardwareInfoList");
drivers.Add(driver); drivers.Add(driver);
Invoke(delegate Invoke(delegate
{ {
string versionText = driver.version.Replace("latest version at the ", ""); string versionText = driver.version.Replace("latest version at the ", "");
@@ -170,6 +211,7 @@ namespace GHelper
} }
} }
Invoke(delegate Invoke(delegate
{ {
table.Visible = true; table.Visible = true;
@@ -177,6 +219,7 @@ namespace GHelper
PerformLayout(); PerformLayout();
}); });
Dictionary<string, string> devices = new(); Dictionary<string, string> devices = new();
if (type == 0) devices = GetDeviceVersions(); if (type == 0) devices = GetDeviceVersions();
@@ -208,8 +251,13 @@ namespace GHelper
{ {
Invoke(delegate Invoke(delegate
{ {
updatesCount++;
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold); label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
label.ForeColor = colorTurbo; label.ForeColor = colorTurbo;
labelUpdates.Text = $"{Properties.Strings.NewUpdates}: {updatesCount}";
labelUpdates.ForeColor = colorTurbo;
labelUpdates.Font = new Font(label.Font, FontStyle.Bold);
}); });
} }
} }
@@ -217,6 +265,8 @@ namespace GHelper
count++; count++;
} }
GC.Collect();
GC.WaitForPendingFinalizers();
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -73,7 +73,7 @@ _PPTs are shown for G14 2022, for other models PPTs will be different as they ar
## :question: FAQ ## :question: FAQ
#### How do I stop the Armory Crate install popup appearing every time I press the M4 / Rog key? #### How do I stop the Armory Crate install popup appearing every time I press the M4 / Rog key?
Delete or move somewhere following file ``C:\Windows\System32\ASUSACCI\ArmouryCrateKeyControl.exe``. Stop ``ArmouryCrateControlInterface`` service under windows Services app.
If it still appears - Go to BIOS (F2 on boot), open Advanced Settings and disable "Armory Control Interface". If it still appears - Go to BIOS (F2 on boot), open Advanced Settings and disable "Armory Control Interface".
#### Why is Ultimate GPU mode not available on my laptop? #### Why is Ultimate GPU mode not available on my laptop?
@@ -222,6 +222,12 @@ Ctrl + Shift + F12
------------ ------------
**Libraries / projects used**
- [Linux Kernel](https://github.com/torvalds/linux/blob/master/drivers/platform/x86/asus-wmi.c) for some basic endpoints in ASUS ACPI/WMI interface
- [NvAPIWrapper](https://github.com/falahati/NvAPIWrapper) for accessing Nvidia API
- [Starlight](https://github.com/vddCore/Starlight) for anime matrix communication protocol
- [UXTU](https://github.com/JamesCJ60/Universal-x86-Tuning-Utility) for undervolting using Ryzen System Management Unit
**Disclaimers** **Disclaimers**
"ROG", "TUF", and "Armoury Crate" are trademarked by and belong to AsusTek Computer, Inc. I make no claims to these or any assets belonging to AsusTek Computer and use them purely for informational purposes only. "ROG", "TUF", and "Armoury Crate" are trademarked by and belong to AsusTek Computer, Inc. I make no claims to these or any assets belonging to AsusTek Computer and use them purely for informational purposes only.