mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7e8ba3241 | ||
|
|
b46f0fb887 | ||
|
|
a39c084bdf | ||
|
|
f0c291bea4 | ||
|
|
d04a20367b | ||
|
|
888e49fe40 | ||
|
|
4875a22f38 | ||
|
|
ea2e8a7c24 | ||
|
|
6ec94e4ac3 | ||
|
|
5334d1e4ed | ||
|
|
9f339806d4 | ||
|
|
54a4668e2a | ||
|
|
71d2a6ce05 | ||
|
|
92d1b97b95 | ||
|
|
4b9a53cef8 | ||
|
|
068694d7d1 | ||
|
|
43c6def162 | ||
|
|
306697f026 | ||
|
|
c5a32cc9d5 | ||
|
|
51acd9a612 | ||
|
|
457a37049c | ||
|
|
6d2cece4f2 | ||
|
|
265611009c | ||
|
|
2714b6dca7 | ||
|
|
f6de5eba64 | ||
|
|
13f7c81689 | ||
|
|
8c0d84b65b |
12
ASUSWmi.cs
12
ASUSWmi.cs
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics;
|
using GHelper;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -42,6 +43,15 @@ public class ASUSWmi
|
|||||||
public const int GPUModeUltimate = 2;
|
public const int GPUModeUltimate = 2;
|
||||||
|
|
||||||
|
|
||||||
|
public const int MaxTotal = 150;
|
||||||
|
public const int MinTotal = 15;
|
||||||
|
public const int DefaultTotal = 125;
|
||||||
|
|
||||||
|
public const int MaxCPU = 90;
|
||||||
|
public const int MinCPU = 15;
|
||||||
|
public const int DefaultCPU = 80;
|
||||||
|
|
||||||
|
|
||||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||||
private static extern IntPtr CreateFile(
|
private static extern IntPtr CreateFile(
|
||||||
string lpFileName,
|
string lpFileName,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
using Starlight.Communication;
|
using Starlight.Communication;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Management;
|
||||||
|
|
||||||
namespace Starlight.AnimeMatrix
|
namespace Starlight.AnimeMatrix
|
||||||
{
|
{
|
||||||
@@ -70,16 +71,45 @@ namespace Starlight.AnimeMatrix
|
|||||||
private const int UpdatePageLength = 0x0278;
|
private const int UpdatePageLength = 0x0278;
|
||||||
|
|
||||||
public int LedCount => 1450;
|
public int LedCount => 1450;
|
||||||
public int Rows => 61;
|
|
||||||
|
|
||||||
private byte[] _displayBuffer = new byte[UpdatePageLength * 3];
|
private byte[] _displayBuffer = new byte[UpdatePageLength * 3];
|
||||||
private List<byte[]> frames = new List<byte[]>();
|
private List<byte[]> frames = new List<byte[]>();
|
||||||
|
|
||||||
|
private int pages = 3;
|
||||||
|
|
||||||
|
public int MaxColumns = 34;
|
||||||
|
public int MaxRows = 61;
|
||||||
|
|
||||||
|
public int FullRows = 11;
|
||||||
|
|
||||||
private int frameIndex = 0;
|
private int frameIndex = 0;
|
||||||
|
|
||||||
public AnimeMatrixDevice()
|
public AnimeMatrixDevice()
|
||||||
: base(0x0B05, 0x193B, 640)
|
: base(0x0B05, 0x193B, 640)
|
||||||
{
|
{
|
||||||
|
string model = GetModel();
|
||||||
|
Debug.WriteLine(model);
|
||||||
|
if (model is not null && model.Contains("401"))
|
||||||
|
{
|
||||||
|
pages = 2;
|
||||||
|
|
||||||
|
FullRows = 6;
|
||||||
|
MaxColumns = 33;
|
||||||
|
MaxRows = 55;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string GetModel()
|
||||||
|
{
|
||||||
|
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_ComputerSystem"))
|
||||||
|
{
|
||||||
|
foreach (var process in searcher.Get())
|
||||||
|
return process["Model"].ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetBuffer()
|
public byte[] GetBuffer()
|
||||||
@@ -115,12 +145,12 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
public int EmptyColumns(int row)
|
public int EmptyColumns(int row)
|
||||||
{
|
{
|
||||||
return (int)Math.Ceiling(Math.Max(0, row - 11) / 2.0);
|
return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0);
|
||||||
}
|
}
|
||||||
public int Columns(int row)
|
public int Columns(int row)
|
||||||
{
|
{
|
||||||
EnsureRowInRange(row);
|
EnsureRowInRange(row);
|
||||||
return 34 - EmptyColumns(row);
|
return MaxColumns - EmptyColumns(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int RowToLinearAddress(int row)
|
public int RowToLinearAddress(int row)
|
||||||
@@ -183,6 +213,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
public void Present()
|
public void Present()
|
||||||
{
|
{
|
||||||
|
|
||||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||||
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 0 + 1)))
|
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 0 + 1)))
|
||||||
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength))
|
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength))
|
||||||
@@ -195,12 +226,13 @@ namespace Starlight.AnimeMatrix
|
|||||||
.AppendData(_displayBuffer[(UpdatePageLength * 1)..(UpdatePageLength * 2)])
|
.AppendData(_displayBuffer[(UpdatePageLength * 1)..(UpdatePageLength * 2)])
|
||||||
);
|
);
|
||||||
|
|
||||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
if (pages > 2)
|
||||||
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 2 + 1)))
|
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||||
.AppendData(BitConverter.GetBytes((ushort)(LedCount - UpdatePageLength * 2)))
|
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 2 + 1)))
|
||||||
.AppendData(
|
.AppendData(BitConverter.GetBytes((ushort)(LedCount - UpdatePageLength * 2)))
|
||||||
_displayBuffer[(UpdatePageLength * 2)..(UpdatePageLength * 2 + (LedCount - UpdatePageLength * 2))])
|
.AppendData(
|
||||||
);
|
_displayBuffer[(UpdatePageLength * 2)..(UpdatePageLength * 2 + (LedCount - UpdatePageLength * 2))])
|
||||||
|
);
|
||||||
|
|
||||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
|
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
|
||||||
}
|
}
|
||||||
@@ -241,8 +273,8 @@ namespace Starlight.AnimeMatrix
|
|||||||
public void GenerateFrame(Image image)
|
public void GenerateFrame(Image image)
|
||||||
{
|
{
|
||||||
|
|
||||||
int width = 34 * 3;
|
int width = MaxColumns * 3;
|
||||||
int height = 61;
|
int height = MaxRows;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
Bitmap canvas = new Bitmap(width, height);
|
Bitmap canvas = new Bitmap(width, height);
|
||||||
@@ -259,7 +291,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
graph.DrawImage(image, ((int)width - scaleWidth), ((int)height - scaleHeight) / 2, scaleWidth, scaleHeight);
|
graph.DrawImage(image, ((int)width - scaleWidth), ((int)height - scaleHeight) / 2, scaleWidth, scaleHeight);
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(canvas, 34, 61);
|
Bitmap bmp = new Bitmap(canvas, MaxColumns, MaxRows);
|
||||||
|
|
||||||
for (int y = 0; y < bmp.Height; y++)
|
for (int y = 0; y < bmp.Height; y++)
|
||||||
{
|
{
|
||||||
@@ -275,9 +307,9 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
private void EnsureRowInRange(int row)
|
private void EnsureRowInRange(int row)
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= Rows)
|
if (row < 0 || row >= MaxRows)
|
||||||
{
|
{
|
||||||
throw new IndexOutOfRangeException($"Y-coordinate should fall in range of [0, {Rows - 1}].");
|
throw new IndexOutOfRangeException($"Y-coordinate should fall in range of [0, {MaxRows - 1}].");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,8 @@
|
|||||||
<System.Windows.Forms.ApplicationConfigurationSection>
|
<System.Windows.Forms.ApplicationConfigurationSection>
|
||||||
<add key="DpiAwareness" value="PerMonitorV2" />
|
<add key="DpiAwareness" value="PerMonitorV2" />
|
||||||
</System.Windows.Forms.ApplicationConfigurationSection>
|
</System.Windows.Forms.ApplicationConfigurationSection>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
<appSettings>
|
||||||
|
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
|
||||||
|
</appSettings>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
// Source thanks to https://github.com/vddCore/Starlight :)
|
// Source thanks to https://github.com/vddCore/Starlight :)
|
||||||
|
|
||||||
using Starlight.Communication.Platform;
|
using Starlight.Communication.Platform;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
namespace Starlight.Communication
|
namespace Starlight.Communication
|
||||||
{
|
{
|
||||||
@@ -8,9 +9,21 @@ namespace Starlight.Communication
|
|||||||
{
|
{
|
||||||
private static UsbProvider _usbProvider;
|
private static UsbProvider _usbProvider;
|
||||||
|
|
||||||
|
private static ushort _vendorId;
|
||||||
|
private static ushort _productId;
|
||||||
|
private static int _maxFeatureReportLength;
|
||||||
|
|
||||||
protected Device(ushort vendorId, ushort productId, int maxFeatureReportLength)
|
protected Device(ushort vendorId, ushort productId, int maxFeatureReportLength)
|
||||||
{
|
{
|
||||||
_usbProvider = new WindowsUsbProvider(vendorId, productId, maxFeatureReportLength);
|
_vendorId = vendorId;
|
||||||
|
_productId = productId;
|
||||||
|
_maxFeatureReportLength = maxFeatureReportLength;
|
||||||
|
SetProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetProvider()
|
||||||
|
{
|
||||||
|
_usbProvider = new WindowsUsbProvider(_vendorId, _productId, _maxFeatureReportLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected T Packet<T>(params byte[] command) where T : Packet
|
protected T Packet<T>(params byte[] command) where T : Packet
|
||||||
|
|||||||
216
Fans.Designer.cs
generated
216
Fans.Designer.cs
generated
@@ -28,15 +28,20 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea5 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||||
panelFans = new Panel();
|
panelFans = new Panel();
|
||||||
checkAuto = new CheckBox();
|
picturePerf = new PictureBox();
|
||||||
|
tableFanCharts = new TableLayoutPanel();
|
||||||
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||||
|
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||||
|
checkBoost = new CheckBox();
|
||||||
|
labelFans = new Label();
|
||||||
|
checkAuto = new CheckBox();
|
||||||
buttonReset = new Button();
|
buttonReset = new Button();
|
||||||
buttonApply = new Button();
|
buttonApply = new Button();
|
||||||
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
|
||||||
panelPower = new Panel();
|
panelPower = new Panel();
|
||||||
|
pictureBox1 = new PictureBox();
|
||||||
labelPowerLimits = new Label();
|
labelPowerLimits = new Label();
|
||||||
checkApplyPower = new CheckBox();
|
checkApplyPower = new CheckBox();
|
||||||
buttonApplyPower = new Button();
|
buttonApplyPower = new Button();
|
||||||
@@ -52,9 +57,12 @@
|
|||||||
pictureFine = new PictureBox();
|
pictureFine = new PictureBox();
|
||||||
labelInfo = new Label();
|
labelInfo = new Label();
|
||||||
panelFans.SuspendLayout();
|
panelFans.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
|
||||||
|
tableFanCharts.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
|
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
|
||||||
panelPower.SuspendLayout();
|
panelPower.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||||
panelCPU.SuspendLayout();
|
panelCPU.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackCPU).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackCPU).BeginInit();
|
||||||
panelTotal.SuspendLayout();
|
panelTotal.SuspendLayout();
|
||||||
@@ -64,25 +72,103 @@
|
|||||||
//
|
//
|
||||||
// panelFans
|
// panelFans
|
||||||
//
|
//
|
||||||
|
panelFans.Controls.Add(picturePerf);
|
||||||
|
panelFans.Controls.Add(tableFanCharts);
|
||||||
|
panelFans.Controls.Add(checkBoost);
|
||||||
|
panelFans.Controls.Add(labelFans);
|
||||||
panelFans.Controls.Add(checkAuto);
|
panelFans.Controls.Add(checkAuto);
|
||||||
panelFans.Controls.Add(chartGPU);
|
|
||||||
panelFans.Controls.Add(buttonReset);
|
panelFans.Controls.Add(buttonReset);
|
||||||
panelFans.Controls.Add(buttonApply);
|
panelFans.Controls.Add(buttonApply);
|
||||||
panelFans.Controls.Add(chartCPU);
|
|
||||||
panelFans.Dock = DockStyle.Left;
|
panelFans.Dock = DockStyle.Left;
|
||||||
panelFans.Location = new Point(363, 0);
|
panelFans.Location = new Point(364, 0);
|
||||||
panelFans.Margin = new Padding(10);
|
panelFans.Margin = new Padding(0);
|
||||||
panelFans.MinimumSize = new Size(868, 1089);
|
|
||||||
panelFans.Name = "panelFans";
|
panelFans.Name = "panelFans";
|
||||||
panelFans.Padding = new Padding(10);
|
panelFans.Padding = new Padding(20);
|
||||||
panelFans.Size = new Size(872, 1089);
|
panelFans.Size = new Size(824, 1159);
|
||||||
panelFans.TabIndex = 12;
|
panelFans.TabIndex = 12;
|
||||||
//
|
//
|
||||||
|
// picturePerf
|
||||||
|
//
|
||||||
|
picturePerf.BackgroundImage = Properties.Resources.icons8_fan_head_96;
|
||||||
|
picturePerf.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
picturePerf.InitialImage = null;
|
||||||
|
picturePerf.Location = new Point(30, 18);
|
||||||
|
picturePerf.Margin = new Padding(4, 2, 4, 2);
|
||||||
|
picturePerf.Name = "picturePerf";
|
||||||
|
picturePerf.Size = new Size(36, 38);
|
||||||
|
picturePerf.TabIndex = 37;
|
||||||
|
picturePerf.TabStop = false;
|
||||||
|
//
|
||||||
|
// tableFanCharts
|
||||||
|
//
|
||||||
|
tableFanCharts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tableFanCharts.ColumnCount = 1;
|
||||||
|
tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||||
|
tableFanCharts.Controls.Add(chartGPU, 0, 1);
|
||||||
|
tableFanCharts.Controls.Add(chartCPU, 0, 0);
|
||||||
|
tableFanCharts.Location = new Point(28, 68);
|
||||||
|
tableFanCharts.Margin = new Padding(6);
|
||||||
|
tableFanCharts.Name = "tableFanCharts";
|
||||||
|
tableFanCharts.RowCount = 2;
|
||||||
|
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||||
|
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||||
|
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
|
||||||
|
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
|
||||||
|
tableFanCharts.Size = new Size(764, 988);
|
||||||
|
tableFanCharts.TabIndex = 36;
|
||||||
|
//
|
||||||
|
// chartGPU
|
||||||
|
//
|
||||||
|
chartArea1.Name = "ChartArea1";
|
||||||
|
chartGPU.ChartAreas.Add(chartArea1);
|
||||||
|
chartGPU.Dock = DockStyle.Fill;
|
||||||
|
chartGPU.Location = new Point(2, 504);
|
||||||
|
chartGPU.Margin = new Padding(2, 10, 2, 10);
|
||||||
|
chartGPU.Name = "chartGPU";
|
||||||
|
chartGPU.Size = new Size(760, 474);
|
||||||
|
chartGPU.TabIndex = 17;
|
||||||
|
chartGPU.Text = "chart1";
|
||||||
|
//
|
||||||
|
// chartCPU
|
||||||
|
//
|
||||||
|
chartArea2.Name = "ChartArea1";
|
||||||
|
chartCPU.ChartAreas.Add(chartArea2);
|
||||||
|
chartCPU.Dock = DockStyle.Fill;
|
||||||
|
chartCPU.Location = new Point(2, 10);
|
||||||
|
chartCPU.Margin = new Padding(2, 10, 2, 10);
|
||||||
|
chartCPU.Name = "chartCPU";
|
||||||
|
chartCPU.Size = new Size(760, 474);
|
||||||
|
chartCPU.TabIndex = 14;
|
||||||
|
chartCPU.Text = "chartCPU";
|
||||||
|
//
|
||||||
|
// checkBoost
|
||||||
|
//
|
||||||
|
checkBoost.AutoSize = true;
|
||||||
|
checkBoost.ForeColor = SystemColors.ControlText;
|
||||||
|
checkBoost.Location = new Point(475, 18);
|
||||||
|
checkBoost.Margin = new Padding(4, 2, 4, 2);
|
||||||
|
checkBoost.Name = "checkBoost";
|
||||||
|
checkBoost.Size = new Size(320, 36);
|
||||||
|
checkBoost.TabIndex = 35;
|
||||||
|
checkBoost.Text = "CPU Turbo Boost enabled";
|
||||||
|
checkBoost.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// labelFans
|
||||||
|
//
|
||||||
|
labelFans.AutoSize = true;
|
||||||
|
labelFans.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelFans.Location = new Point(66, 20);
|
||||||
|
labelFans.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
labelFans.Name = "labelFans";
|
||||||
|
labelFans.Size = new Size(138, 32);
|
||||||
|
labelFans.TabIndex = 28;
|
||||||
|
labelFans.Text = "Fan Curves";
|
||||||
|
//
|
||||||
// checkAuto
|
// checkAuto
|
||||||
//
|
//
|
||||||
checkAuto.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
checkAuto.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
checkAuto.AutoSize = true;
|
checkAuto.AutoSize = true;
|
||||||
checkAuto.Location = new Point(584, 981);
|
checkAuto.Location = new Point(377, 1086);
|
||||||
checkAuto.Margin = new Padding(4, 2, 4, 2);
|
checkAuto.Margin = new Padding(4, 2, 4, 2);
|
||||||
checkAuto.Name = "checkAuto";
|
checkAuto.Name = "checkAuto";
|
||||||
checkAuto.Size = new Size(165, 36);
|
checkAuto.Size = new Size(165, 36);
|
||||||
@@ -90,25 +176,13 @@
|
|||||||
checkAuto.Text = "Auto Apply";
|
checkAuto.Text = "Auto Apply";
|
||||||
checkAuto.UseVisualStyleBackColor = true;
|
checkAuto.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// chartGPU
|
|
||||||
//
|
|
||||||
chartGPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
chartArea5.Name = "ChartArea1";
|
|
||||||
chartGPU.ChartAreas.Add(chartArea5);
|
|
||||||
chartGPU.Location = new Point(22, 502);
|
|
||||||
chartGPU.Margin = new Padding(4, 2, 4, 2);
|
|
||||||
chartGPU.Name = "chartGPU";
|
|
||||||
chartGPU.Size = new Size(810, 460);
|
|
||||||
chartGPU.TabIndex = 16;
|
|
||||||
chartGPU.Text = "chart1";
|
|
||||||
//
|
|
||||||
// buttonReset
|
// buttonReset
|
||||||
//
|
//
|
||||||
buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonReset.Location = new Point(22, 1025);
|
buttonReset.Location = new Point(30, 1081);
|
||||||
buttonReset.Margin = new Padding(4, 2, 4, 2);
|
buttonReset.Margin = new Padding(4, 2, 4, 2);
|
||||||
buttonReset.Name = "buttonReset";
|
buttonReset.Name = "buttonReset";
|
||||||
buttonReset.Size = new Size(231, 44);
|
buttonReset.Size = new Size(232, 44);
|
||||||
buttonReset.TabIndex = 15;
|
buttonReset.TabIndex = 15;
|
||||||
buttonReset.Text = "Factory Defaults";
|
buttonReset.Text = "Factory Defaults";
|
||||||
buttonReset.UseVisualStyleBackColor = true;
|
buttonReset.UseVisualStyleBackColor = true;
|
||||||
@@ -116,7 +190,7 @@
|
|||||||
// buttonApply
|
// buttonApply
|
||||||
//
|
//
|
||||||
buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
buttonApply.Location = new Point(584, 1025);
|
buttonApply.Location = new Point(542, 1081);
|
||||||
buttonApply.Margin = new Padding(4, 2, 4, 2);
|
buttonApply.Margin = new Padding(4, 2, 4, 2);
|
||||||
buttonApply.Name = "buttonApply";
|
buttonApply.Name = "buttonApply";
|
||||||
buttonApply.Size = new Size(248, 44);
|
buttonApply.Size = new Size(248, 44);
|
||||||
@@ -124,20 +198,9 @@
|
|||||||
buttonApply.Text = "Apply Fan Curve";
|
buttonApply.Text = "Apply Fan Curve";
|
||||||
buttonApply.UseVisualStyleBackColor = true;
|
buttonApply.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// chartCPU
|
|
||||||
//
|
|
||||||
chartCPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
chartArea6.Name = "ChartArea1";
|
|
||||||
chartCPU.ChartAreas.Add(chartArea6);
|
|
||||||
chartCPU.Location = new Point(22, 21);
|
|
||||||
chartCPU.Margin = new Padding(10);
|
|
||||||
chartCPU.Name = "chartCPU";
|
|
||||||
chartCPU.Size = new Size(810, 460);
|
|
||||||
chartCPU.TabIndex = 13;
|
|
||||||
chartCPU.Text = "chartCPU";
|
|
||||||
//
|
|
||||||
// panelPower
|
// panelPower
|
||||||
//
|
//
|
||||||
|
panelPower.Controls.Add(pictureBox1);
|
||||||
panelPower.Controls.Add(labelPowerLimits);
|
panelPower.Controls.Add(labelPowerLimits);
|
||||||
panelPower.Controls.Add(checkApplyPower);
|
panelPower.Controls.Add(checkApplyPower);
|
||||||
panelPower.Controls.Add(buttonApplyPower);
|
panelPower.Controls.Add(buttonApplyPower);
|
||||||
@@ -148,15 +211,30 @@
|
|||||||
panelPower.Controls.Add(labelInfo);
|
panelPower.Controls.Add(labelInfo);
|
||||||
panelPower.Dock = DockStyle.Left;
|
panelPower.Dock = DockStyle.Left;
|
||||||
panelPower.Location = new Point(0, 0);
|
panelPower.Location = new Point(0, 0);
|
||||||
|
panelPower.Margin = new Padding(10);
|
||||||
panelPower.Name = "panelPower";
|
panelPower.Name = "panelPower";
|
||||||
panelPower.Size = new Size(363, 1089);
|
panelPower.Padding = new Padding(10);
|
||||||
|
panelPower.Size = new Size(364, 1159);
|
||||||
panelPower.TabIndex = 13;
|
panelPower.TabIndex = 13;
|
||||||
//
|
//
|
||||||
|
// pictureBox1
|
||||||
|
//
|
||||||
|
pictureBox1.BackgroundImage = Properties.Resources.icons8_processor_96;
|
||||||
|
pictureBox1.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
pictureBox1.InitialImage = null;
|
||||||
|
pictureBox1.Location = new Point(20, 18);
|
||||||
|
pictureBox1.Margin = new Padding(4, 2, 4, 2);
|
||||||
|
pictureBox1.Name = "pictureBox1";
|
||||||
|
pictureBox1.Size = new Size(36, 38);
|
||||||
|
pictureBox1.TabIndex = 38;
|
||||||
|
pictureBox1.TabStop = false;
|
||||||
|
//
|
||||||
// labelPowerLimits
|
// labelPowerLimits
|
||||||
//
|
//
|
||||||
labelPowerLimits.AutoSize = true;
|
labelPowerLimits.AutoSize = true;
|
||||||
labelPowerLimits.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelPowerLimits.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelPowerLimits.Location = new Point(23, 15);
|
labelPowerLimits.Location = new Point(54, 20);
|
||||||
|
labelPowerLimits.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelPowerLimits.Name = "labelPowerLimits";
|
labelPowerLimits.Name = "labelPowerLimits";
|
||||||
labelPowerLimits.Size = new Size(229, 32);
|
labelPowerLimits.Size = new Size(229, 32);
|
||||||
labelPowerLimits.TabIndex = 26;
|
labelPowerLimits.TabIndex = 26;
|
||||||
@@ -164,9 +242,9 @@
|
|||||||
//
|
//
|
||||||
// checkApplyPower
|
// checkApplyPower
|
||||||
//
|
//
|
||||||
checkApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
checkApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
checkApplyPower.AutoSize = true;
|
checkApplyPower.AutoSize = true;
|
||||||
checkApplyPower.Location = new Point(17, 981);
|
checkApplyPower.Location = new Point(27, 1039);
|
||||||
checkApplyPower.Margin = new Padding(4, 2, 4, 2);
|
checkApplyPower.Margin = new Padding(4, 2, 4, 2);
|
||||||
checkApplyPower.Name = "checkApplyPower";
|
checkApplyPower.Name = "checkApplyPower";
|
||||||
checkApplyPower.Size = new Size(165, 36);
|
checkApplyPower.Size = new Size(165, 36);
|
||||||
@@ -177,10 +255,10 @@
|
|||||||
// buttonApplyPower
|
// buttonApplyPower
|
||||||
//
|
//
|
||||||
buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonApplyPower.Location = new Point(17, 1025);
|
buttonApplyPower.Location = new Point(20, 1081);
|
||||||
buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
|
buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
|
||||||
buttonApplyPower.Name = "buttonApplyPower";
|
buttonApplyPower.Name = "buttonApplyPower";
|
||||||
buttonApplyPower.Size = new Size(321, 44);
|
buttonApplyPower.Size = new Size(324, 44);
|
||||||
buttonApplyPower.TabIndex = 24;
|
buttonApplyPower.TabIndex = 24;
|
||||||
buttonApplyPower.Text = "Apply Power Limits";
|
buttonApplyPower.Text = "Apply Power Limits";
|
||||||
buttonApplyPower.UseVisualStyleBackColor = true;
|
buttonApplyPower.UseVisualStyleBackColor = true;
|
||||||
@@ -190,7 +268,8 @@
|
|||||||
panelCPU.Controls.Add(labelCPU);
|
panelCPU.Controls.Add(labelCPU);
|
||||||
panelCPU.Controls.Add(label2);
|
panelCPU.Controls.Add(label2);
|
||||||
panelCPU.Controls.Add(trackCPU);
|
panelCPU.Controls.Add(trackCPU);
|
||||||
panelCPU.Location = new Point(184, 89);
|
panelCPU.Location = new Point(184, 90);
|
||||||
|
panelCPU.Margin = new Padding(4);
|
||||||
panelCPU.Name = "panelCPU";
|
panelCPU.Name = "panelCPU";
|
||||||
panelCPU.Size = new Size(160, 510);
|
panelCPU.Size = new Size(160, 510);
|
||||||
panelCPU.TabIndex = 23;
|
panelCPU.TabIndex = 23;
|
||||||
@@ -199,7 +278,7 @@
|
|||||||
//
|
//
|
||||||
labelCPU.AutoSize = true;
|
labelCPU.AutoSize = true;
|
||||||
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelCPU.Location = new Point(43, 41);
|
labelCPU.Location = new Point(44, 40);
|
||||||
labelCPU.Margin = new Padding(4, 0, 4, 0);
|
labelCPU.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelCPU.Name = "labelCPU";
|
labelCPU.Name = "labelCPU";
|
||||||
labelCPU.Size = new Size(61, 32);
|
labelCPU.Size = new Size(61, 32);
|
||||||
@@ -210,7 +289,7 @@
|
|||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
label2.AutoSize = true;
|
label2.AutoSize = true;
|
||||||
label2.Location = new Point(45, 7);
|
label2.Location = new Point(44, 8);
|
||||||
label2.Margin = new Padding(4, 0, 4, 0);
|
label2.Margin = new Padding(4, 0, 4, 0);
|
||||||
label2.Name = "label2";
|
label2.Name = "label2";
|
||||||
label2.Size = new Size(58, 32);
|
label2.Size = new Size(58, 32);
|
||||||
@@ -220,7 +299,7 @@
|
|||||||
//
|
//
|
||||||
// trackCPU
|
// trackCPU
|
||||||
//
|
//
|
||||||
trackCPU.Location = new Point(47, 89);
|
trackCPU.Location = new Point(48, 88);
|
||||||
trackCPU.Margin = new Padding(4, 2, 4, 2);
|
trackCPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
trackCPU.Maximum = 85;
|
trackCPU.Maximum = 85;
|
||||||
trackCPU.Minimum = 15;
|
trackCPU.Minimum = 15;
|
||||||
@@ -236,16 +315,17 @@
|
|||||||
panelTotal.Controls.Add(labelTotal);
|
panelTotal.Controls.Add(labelTotal);
|
||||||
panelTotal.Controls.Add(label1);
|
panelTotal.Controls.Add(label1);
|
||||||
panelTotal.Controls.Add(trackTotal);
|
panelTotal.Controls.Add(trackTotal);
|
||||||
panelTotal.Location = new Point(17, 89);
|
panelTotal.Location = new Point(16, 90);
|
||||||
|
panelTotal.Margin = new Padding(4);
|
||||||
panelTotal.Name = "panelTotal";
|
panelTotal.Name = "panelTotal";
|
||||||
panelTotal.Size = new Size(160, 511);
|
panelTotal.Size = new Size(160, 512);
|
||||||
panelTotal.TabIndex = 22;
|
panelTotal.TabIndex = 22;
|
||||||
//
|
//
|
||||||
// labelTotal
|
// labelTotal
|
||||||
//
|
//
|
||||||
labelTotal.AutoSize = true;
|
labelTotal.AutoSize = true;
|
||||||
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelTotal.Location = new Point(46, 41);
|
labelTotal.Location = new Point(46, 40);
|
||||||
labelTotal.Margin = new Padding(4, 0, 4, 0);
|
labelTotal.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelTotal.Name = "labelTotal";
|
labelTotal.Name = "labelTotal";
|
||||||
labelTotal.Size = new Size(70, 32);
|
labelTotal.Size = new Size(70, 32);
|
||||||
@@ -256,7 +336,7 @@
|
|||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
label1.Location = new Point(48, 7);
|
label1.Location = new Point(48, 8);
|
||||||
label1.Margin = new Padding(4, 0, 4, 0);
|
label1.Margin = new Padding(4, 0, 4, 0);
|
||||||
label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
label1.Size = new Size(65, 32);
|
label1.Size = new Size(65, 32);
|
||||||
@@ -266,7 +346,7 @@
|
|||||||
//
|
//
|
||||||
// trackTotal
|
// trackTotal
|
||||||
//
|
//
|
||||||
trackTotal.Location = new Point(44, 89);
|
trackTotal.Location = new Point(44, 88);
|
||||||
trackTotal.Margin = new Padding(4, 2, 4, 2);
|
trackTotal.Margin = new Padding(4, 2, 4, 2);
|
||||||
trackTotal.Maximum = 150;
|
trackTotal.Maximum = 150;
|
||||||
trackTotal.Minimum = 15;
|
trackTotal.Minimum = 15;
|
||||||
@@ -282,7 +362,7 @@
|
|||||||
//
|
//
|
||||||
labelApplied.AutoSize = true;
|
labelApplied.AutoSize = true;
|
||||||
labelApplied.ForeColor = Color.Tomato;
|
labelApplied.ForeColor = Color.Tomato;
|
||||||
labelApplied.Location = new Point(23, 51);
|
labelApplied.Location = new Point(56, 48);
|
||||||
labelApplied.Margin = new Padding(4, 0, 4, 0);
|
labelApplied.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelApplied.Name = "labelApplied";
|
labelApplied.Name = "labelApplied";
|
||||||
labelApplied.Size = new Size(143, 32);
|
labelApplied.Size = new Size(143, 32);
|
||||||
@@ -291,13 +371,13 @@
|
|||||||
//
|
//
|
||||||
// pictureFine
|
// pictureFine
|
||||||
//
|
//
|
||||||
pictureFine.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
pictureFine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
pictureFine.BackgroundImageLayout = ImageLayout.Zoom;
|
pictureFine.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
pictureFine.Image = Properties.Resources.everything_is_fine_itsfine;
|
pictureFine.Image = Properties.Resources.everything_is_fine_itsfine;
|
||||||
pictureFine.Location = new Point(17, 694);
|
pictureFine.Location = new Point(20, 682);
|
||||||
pictureFine.Margin = new Padding(4, 2, 4, 2);
|
pictureFine.Margin = new Padding(4, 2, 4, 2);
|
||||||
pictureFine.Name = "pictureFine";
|
pictureFine.Name = "pictureFine";
|
||||||
pictureFine.Size = new Size(327, 254);
|
pictureFine.Size = new Size(324, 268);
|
||||||
pictureFine.SizeMode = PictureBoxSizeMode.Zoom;
|
pictureFine.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
pictureFine.TabIndex = 20;
|
pictureFine.TabIndex = 20;
|
||||||
pictureFine.TabStop = false;
|
pictureFine.TabStop = false;
|
||||||
@@ -305,10 +385,10 @@
|
|||||||
//
|
//
|
||||||
// labelInfo
|
// labelInfo
|
||||||
//
|
//
|
||||||
labelInfo.Location = new Point(17, 603);
|
labelInfo.Location = new Point(24, 618);
|
||||||
labelInfo.Margin = new Padding(4, 0, 4, 0);
|
labelInfo.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelInfo.Name = "labelInfo";
|
labelInfo.Name = "labelInfo";
|
||||||
labelInfo.Size = new Size(327, 371);
|
labelInfo.Size = new Size(320, 330);
|
||||||
labelInfo.TabIndex = 19;
|
labelInfo.TabIndex = 19;
|
||||||
labelInfo.Text = "label";
|
labelInfo.Text = "label";
|
||||||
//
|
//
|
||||||
@@ -318,14 +398,14 @@
|
|||||||
AutoScaleMode = AutoScaleMode.Dpi;
|
AutoScaleMode = AutoScaleMode.Dpi;
|
||||||
AutoSize = true;
|
AutoSize = true;
|
||||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
ClientSize = new Size(1220, 1089);
|
ClientSize = new Size(1178, 1159);
|
||||||
Controls.Add(panelFans);
|
Controls.Add(panelFans);
|
||||||
Controls.Add(panelPower);
|
Controls.Add(panelPower);
|
||||||
Margin = new Padding(4, 2, 4, 2);
|
Margin = new Padding(4, 2, 4, 2);
|
||||||
MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
MdiChildrenMinimizedAnchorBottom = false;
|
MdiChildrenMinimizedAnchorBottom = false;
|
||||||
MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
MinimumSize = new Size(0, 1160);
|
MinimumSize = new Size(26, 1230);
|
||||||
Name = "Fans";
|
Name = "Fans";
|
||||||
ShowIcon = false;
|
ShowIcon = false;
|
||||||
ShowInTaskbar = false;
|
ShowInTaskbar = false;
|
||||||
@@ -333,10 +413,13 @@
|
|||||||
Text = "Fans and Power";
|
Text = "Fans and Power";
|
||||||
panelFans.ResumeLayout(false);
|
panelFans.ResumeLayout(false);
|
||||||
panelFans.PerformLayout();
|
panelFans.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)picturePerf).EndInit();
|
||||||
|
tableFanCharts.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
|
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)chartCPU).EndInit();
|
((System.ComponentModel.ISupportInitialize)chartCPU).EndInit();
|
||||||
panelPower.ResumeLayout(false);
|
panelPower.ResumeLayout(false);
|
||||||
panelPower.PerformLayout();
|
panelPower.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||||
panelCPU.ResumeLayout(false);
|
panelCPU.ResumeLayout(false);
|
||||||
panelCPU.PerformLayout();
|
panelCPU.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackCPU).EndInit();
|
((System.ComponentModel.ISupportInitialize)trackCPU).EndInit();
|
||||||
@@ -350,10 +433,8 @@
|
|||||||
#endregion
|
#endregion
|
||||||
private Panel panelFans;
|
private Panel panelFans;
|
||||||
private CheckBox checkAuto;
|
private CheckBox checkAuto;
|
||||||
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
|
|
||||||
private Button buttonReset;
|
private Button buttonReset;
|
||||||
private Button buttonApply;
|
private Button buttonApply;
|
||||||
private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU;
|
|
||||||
private Panel panelPower;
|
private Panel panelPower;
|
||||||
private CheckBox checkApplyPower;
|
private CheckBox checkApplyPower;
|
||||||
private Button buttonApplyPower;
|
private Button buttonApplyPower;
|
||||||
@@ -369,5 +450,12 @@
|
|||||||
private PictureBox pictureFine;
|
private PictureBox pictureFine;
|
||||||
private Label labelInfo;
|
private Label labelInfo;
|
||||||
private Label labelPowerLimits;
|
private Label labelPowerLimits;
|
||||||
|
private TableLayoutPanel tableFanCharts;
|
||||||
|
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
|
||||||
|
private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU;
|
||||||
|
private CheckBox checkBoost;
|
||||||
|
private Label labelFans;
|
||||||
|
private PictureBox picturePerf;
|
||||||
|
private PictureBox pictureBox1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
65
Fans.cs
65
Fans.cs
@@ -11,14 +11,6 @@ namespace GHelper
|
|||||||
Series seriesCPU;
|
Series seriesCPU;
|
||||||
Series seriesGPU;
|
Series seriesGPU;
|
||||||
|
|
||||||
const int MaxTotal = 150;
|
|
||||||
const int MinTotal = 15;
|
|
||||||
const int DefaultTotal = 125;
|
|
||||||
|
|
||||||
const int MaxCPU = 90;
|
|
||||||
const int MinCPU = 15;
|
|
||||||
const int DefaultCPU = 80;
|
|
||||||
|
|
||||||
void SetChart(Chart chart, int device)
|
void SetChart(Chart chart, int device)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -30,7 +22,7 @@ namespace GHelper
|
|||||||
title = "CPU Fan Profile";
|
title = "CPU Fan Profile";
|
||||||
|
|
||||||
if (Program.settingsForm.perfName.Length > 0)
|
if (Program.settingsForm.perfName.Length > 0)
|
||||||
title += ": " + Program.settingsForm.perfName;
|
labelFans.Text = "Fan Profiles: " + Program.settingsForm.perfName;
|
||||||
|
|
||||||
if (chart.Titles.Count > 0)
|
if (chart.Titles.Count > 0)
|
||||||
chart.Titles[0].Text = title;
|
chart.Titles[0].Text = title;
|
||||||
@@ -65,7 +57,18 @@ namespace GHelper
|
|||||||
|
|
||||||
private void Fans_Shown(object? sender, EventArgs e)
|
private void Fans_Shown(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Top = Program.settingsForm.Top;
|
if (Height > Program.settingsForm.Height)
|
||||||
|
{
|
||||||
|
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MinimumSize = new Size(0, Program.settingsForm.Height);
|
||||||
|
Height = Program.settingsForm.Height;
|
||||||
|
Top = Program.settingsForm.Top;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Left = Program.settingsForm.Left - Width - 5;
|
Left = Program.settingsForm.Left - Width - 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,11 +94,11 @@ namespace GHelper
|
|||||||
buttonReset.Click += ButtonReset_Click;
|
buttonReset.Click += ButtonReset_Click;
|
||||||
buttonApply.Click += ButtonApply_Click;
|
buttonApply.Click += ButtonApply_Click;
|
||||||
|
|
||||||
trackTotal.Maximum = MaxTotal;
|
trackTotal.Maximum = ASUSWmi.MaxTotal;
|
||||||
trackTotal.Minimum = MinTotal;
|
trackTotal.Minimum = ASUSWmi.MinTotal;
|
||||||
|
|
||||||
trackCPU.Maximum = MaxCPU;
|
trackCPU.Maximum = ASUSWmi.MaxCPU;
|
||||||
trackCPU.Minimum = MinCPU;
|
trackCPU.Minimum = ASUSWmi.MinCPU;
|
||||||
|
|
||||||
trackCPU.Scroll += TrackCPU_Scroll;
|
trackCPU.Scroll += TrackCPU_Scroll;
|
||||||
trackTotal.Scroll += TrackTotal_Scroll;
|
trackTotal.Scroll += TrackTotal_Scroll;
|
||||||
@@ -110,11 +113,33 @@ namespace GHelper
|
|||||||
|
|
||||||
InitFans();
|
InitFans();
|
||||||
InitPower();
|
InitPower();
|
||||||
|
InitBoost();
|
||||||
|
|
||||||
|
checkBoost.Click += CheckBoost_Click;
|
||||||
|
|
||||||
Shown += Fans_Shown;
|
Shown += Fans_Shown;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void InitBoost()
|
||||||
|
{
|
||||||
|
int boost = NativeMethods.GetCPUBoost();
|
||||||
|
checkBoost.Checked = (boost > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckBoost_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CheckBox chk = (CheckBox)sender;
|
||||||
|
if (chk.Checked)
|
||||||
|
NativeMethods.SetCPUBoost(2);
|
||||||
|
else
|
||||||
|
NativeMethods.SetCPUBoost(0);
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckApplyPower_Click(object? sender, EventArgs e)
|
private void CheckApplyPower_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is null) return;
|
if (sender is null) return;
|
||||||
@@ -167,13 +192,13 @@ namespace GHelper
|
|||||||
ApplyLabel(apply);
|
ApplyLabel(apply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit_total < 0) limit_total = DefaultTotal;
|
if (limit_total < 0) limit_total = ASUSWmi.DefaultTotal;
|
||||||
if (limit_total > MaxTotal) limit_total = MaxTotal;
|
if (limit_total > ASUSWmi.MaxTotal) limit_total = ASUSWmi.MaxTotal;
|
||||||
if (limit_total < MinTotal) limit_total = MinTotal;
|
if (limit_total < ASUSWmi.MinTotal) limit_total = ASUSWmi.MinTotal;
|
||||||
|
|
||||||
if (limit_cpu < 0) limit_cpu = DefaultCPU;
|
if (limit_cpu < 0) limit_cpu = ASUSWmi.DefaultCPU;
|
||||||
if (limit_cpu > MaxCPU) limit_cpu = MaxCPU;
|
if (limit_cpu > ASUSWmi.MaxCPU) limit_cpu = ASUSWmi.MaxCPU;
|
||||||
if (limit_cpu < MinCPU) limit_cpu = MinCPU;
|
if (limit_cpu < ASUSWmi.MinCPU) limit_cpu = ASUSWmi.MinCPU;
|
||||||
if (limit_cpu > limit_total) limit_cpu = limit_total;
|
if (limit_cpu > limit_total) limit_cpu = limit_total;
|
||||||
|
|
||||||
trackTotal.Value = limit_total;
|
trackTotal.Value = limit_total;
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
<AssemblyName>GHelper</AssemblyName>
|
<AssemblyName>GHelper</AssemblyName>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AssemblyVersion>0.18</AssemblyVersion>
|
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
|
<AssemblyVersion>0.25</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
418
NativeMethods.cs
418
NativeMethods.cs
@@ -1,11 +1,316 @@
|
|||||||
using System.Diagnostics;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Tools;
|
||||||
|
using static Tools.ScreenInterrogatory;
|
||||||
|
|
||||||
|
namespace Tools
|
||||||
|
{
|
||||||
|
public static class ScreenInterrogatory
|
||||||
|
{
|
||||||
|
public const int ERROR_SUCCESS = 0;
|
||||||
|
|
||||||
|
#region enums
|
||||||
|
|
||||||
|
public enum QUERY_DEVICE_CONFIG_FLAGS : uint
|
||||||
|
{
|
||||||
|
QDC_ALL_PATHS = 0x00000001,
|
||||||
|
QDC_ONLY_ACTIVE_PATHS = 0x00000002,
|
||||||
|
QDC_DATABASE_CURRENT = 0x00000004
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY : uint
|
||||||
|
{
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER = 0xFFFFFFFF,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HD15 = 0,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SVIDEO = 1,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPOSITE_VIDEO = 2,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPONENT_VIDEO = 3,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DVI = 4,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI = 5,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_LVDS = 6,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_D_JPN = 8,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDI = 9,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EXTERNAL = 10,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED = 11,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EXTERNAL = 12,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EMBEDDED = 13,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDTVDONGLE = 14,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_MIRACAST = 15,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL = 0x80000000,
|
||||||
|
DISPLAYCONFIG_OUTPUT_TECHNOLOGY_FORCE_UINT32 = 0xFFFFFFFF
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DISPLAYCONFIG_SCANLINE_ORDERING : uint
|
||||||
|
{
|
||||||
|
DISPLAYCONFIG_SCANLINE_ORDERING_UNSPECIFIED = 0,
|
||||||
|
DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE = 1,
|
||||||
|
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED = 2,
|
||||||
|
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_UPPERFIELDFIRST = DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED,
|
||||||
|
DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_LOWERFIELDFIRST = 3,
|
||||||
|
DISPLAYCONFIG_SCANLINE_ORDERING_FORCE_UINT32 = 0xFFFFFFFF
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DISPLAYCONFIG_ROTATION : uint
|
||||||
|
{
|
||||||
|
DISPLAYCONFIG_ROTATION_IDENTITY = 1,
|
||||||
|
DISPLAYCONFIG_ROTATION_ROTATE90 = 2,
|
||||||
|
DISPLAYCONFIG_ROTATION_ROTATE180 = 3,
|
||||||
|
DISPLAYCONFIG_ROTATION_ROTATE270 = 4,
|
||||||
|
DISPLAYCONFIG_ROTATION_FORCE_UINT32 = 0xFFFFFFFF
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DISPLAYCONFIG_SCALING : uint
|
||||||
|
{
|
||||||
|
DISPLAYCONFIG_SCALING_IDENTITY = 1,
|
||||||
|
DISPLAYCONFIG_SCALING_CENTERED = 2,
|
||||||
|
DISPLAYCONFIG_SCALING_STRETCHED = 3,
|
||||||
|
DISPLAYCONFIG_SCALING_ASPECTRATIOCENTEREDMAX = 4,
|
||||||
|
DISPLAYCONFIG_SCALING_CUSTOM = 5,
|
||||||
|
DISPLAYCONFIG_SCALING_PREFERRED = 128,
|
||||||
|
DISPLAYCONFIG_SCALING_FORCE_UINT32 = 0xFFFFFFFF
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DISPLAYCONFIG_PIXELFORMAT : uint
|
||||||
|
{
|
||||||
|
DISPLAYCONFIG_PIXELFORMAT_8BPP = 1,
|
||||||
|
DISPLAYCONFIG_PIXELFORMAT_16BPP = 2,
|
||||||
|
DISPLAYCONFIG_PIXELFORMAT_24BPP = 3,
|
||||||
|
DISPLAYCONFIG_PIXELFORMAT_32BPP = 4,
|
||||||
|
DISPLAYCONFIG_PIXELFORMAT_NONGDI = 5,
|
||||||
|
DISPLAYCONFIG_PIXELFORMAT_FORCE_UINT32 = 0xffffffff
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DISPLAYCONFIG_MODE_INFO_TYPE : uint
|
||||||
|
{
|
||||||
|
DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE = 1,
|
||||||
|
DISPLAYCONFIG_MODE_INFO_TYPE_TARGET = 2,
|
||||||
|
DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32 = 0xFFFFFFFF
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DISPLAYCONFIG_DEVICE_INFO_TYPE : uint
|
||||||
|
{
|
||||||
|
DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME = 1,
|
||||||
|
DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME = 2,
|
||||||
|
DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE = 3,
|
||||||
|
DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME = 4,
|
||||||
|
DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE = 5,
|
||||||
|
DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE = 6,
|
||||||
|
DISPLAYCONFIG_DEVICE_INFO_FORCE_UINT32 = 0xFFFFFFFF
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region structs
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct LUID
|
||||||
|
{
|
||||||
|
public uint LowPart;
|
||||||
|
public int HighPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_PATH_SOURCE_INFO
|
||||||
|
{
|
||||||
|
public LUID adapterId;
|
||||||
|
public uint id;
|
||||||
|
public uint modeInfoIdx;
|
||||||
|
public uint statusFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_PATH_TARGET_INFO
|
||||||
|
{
|
||||||
|
public LUID adapterId;
|
||||||
|
public uint id;
|
||||||
|
public uint modeInfoIdx;
|
||||||
|
private DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY outputTechnology;
|
||||||
|
private DISPLAYCONFIG_ROTATION rotation;
|
||||||
|
private DISPLAYCONFIG_SCALING scaling;
|
||||||
|
private DISPLAYCONFIG_RATIONAL refreshRate;
|
||||||
|
private DISPLAYCONFIG_SCANLINE_ORDERING scanLineOrdering;
|
||||||
|
public bool targetAvailable;
|
||||||
|
public uint statusFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_RATIONAL
|
||||||
|
{
|
||||||
|
public uint Numerator;
|
||||||
|
public uint Denominator;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_PATH_INFO
|
||||||
|
{
|
||||||
|
public DISPLAYCONFIG_PATH_SOURCE_INFO sourceInfo;
|
||||||
|
public DISPLAYCONFIG_PATH_TARGET_INFO targetInfo;
|
||||||
|
public uint flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_2DREGION
|
||||||
|
{
|
||||||
|
public uint cx;
|
||||||
|
public uint cy;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO
|
||||||
|
{
|
||||||
|
public ulong pixelRate;
|
||||||
|
public DISPLAYCONFIG_RATIONAL hSyncFreq;
|
||||||
|
public DISPLAYCONFIG_RATIONAL vSyncFreq;
|
||||||
|
public DISPLAYCONFIG_2DREGION activeSize;
|
||||||
|
public DISPLAYCONFIG_2DREGION totalSize;
|
||||||
|
public uint videoStandard;
|
||||||
|
public DISPLAYCONFIG_SCANLINE_ORDERING scanLineOrdering;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_TARGET_MODE
|
||||||
|
{
|
||||||
|
public DISPLAYCONFIG_VIDEO_SIGNAL_INFO targetVideoSignalInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct POINTL
|
||||||
|
{
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_SOURCE_MODE
|
||||||
|
{
|
||||||
|
public uint width;
|
||||||
|
public uint height;
|
||||||
|
public DISPLAYCONFIG_PIXELFORMAT pixelFormat;
|
||||||
|
public POINTL position;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
|
public struct DISPLAYCONFIG_MODE_INFO_UNION
|
||||||
|
{
|
||||||
|
[FieldOffset(0)]
|
||||||
|
public DISPLAYCONFIG_TARGET_MODE targetMode;
|
||||||
|
|
||||||
|
[FieldOffset(0)]
|
||||||
|
public DISPLAYCONFIG_SOURCE_MODE sourceMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_MODE_INFO
|
||||||
|
{
|
||||||
|
public DISPLAYCONFIG_MODE_INFO_TYPE infoType;
|
||||||
|
public uint id;
|
||||||
|
public LUID adapterId;
|
||||||
|
public DISPLAYCONFIG_MODE_INFO_UNION modeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS
|
||||||
|
{
|
||||||
|
public uint value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DISPLAYCONFIG_DEVICE_INFO_HEADER
|
||||||
|
{
|
||||||
|
public DISPLAYCONFIG_DEVICE_INFO_TYPE type;
|
||||||
|
public uint size;
|
||||||
|
public LUID adapterId;
|
||||||
|
public uint id;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
public struct DISPLAYCONFIG_TARGET_DEVICE_NAME
|
||||||
|
{
|
||||||
|
public DISPLAYCONFIG_DEVICE_INFO_HEADER header;
|
||||||
|
public DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS flags;
|
||||||
|
public DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY outputTechnology;
|
||||||
|
public ushort edidManufactureId;
|
||||||
|
public ushort edidProductCodeId;
|
||||||
|
public uint connectorInstance;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
|
||||||
|
public string monitorFriendlyDeviceName;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||||
|
public string monitorDevicePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DLL-Imports
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern int GetDisplayConfigBufferSizes(
|
||||||
|
QUERY_DEVICE_CONFIG_FLAGS flags, out uint numPathArrayElements, out uint numModeInfoArrayElements);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern int QueryDisplayConfig(
|
||||||
|
QUERY_DEVICE_CONFIG_FLAGS flags,
|
||||||
|
ref uint numPathArrayElements, [Out] DISPLAYCONFIG_PATH_INFO[] PathInfoArray,
|
||||||
|
ref uint numModeInfoArrayElements, [Out] DISPLAYCONFIG_MODE_INFO[] ModeInfoArray,
|
||||||
|
IntPtr currentTopologyId
|
||||||
|
);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern int DisplayConfigGetDeviceInfo(ref DISPLAYCONFIG_TARGET_DEVICE_NAME deviceName);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private static DISPLAYCONFIG_TARGET_DEVICE_NAME DeviceName(LUID adapterId, uint targetId)
|
||||||
|
{
|
||||||
|
var deviceName = new DISPLAYCONFIG_TARGET_DEVICE_NAME
|
||||||
|
{
|
||||||
|
header =
|
||||||
|
{
|
||||||
|
size = (uint)Marshal.SizeOf(typeof (DISPLAYCONFIG_TARGET_DEVICE_NAME)),
|
||||||
|
adapterId = adapterId,
|
||||||
|
id = targetId,
|
||||||
|
type = DISPLAYCONFIG_DEVICE_INFO_TYPE.DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var error = DisplayConfigGetDeviceInfo(ref deviceName);
|
||||||
|
if (error != ERROR_SUCCESS)
|
||||||
|
throw new Win32Exception(error);
|
||||||
|
|
||||||
|
return deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<DISPLAYCONFIG_TARGET_DEVICE_NAME> GetAllDevices()
|
||||||
|
{
|
||||||
|
uint pathCount, modeCount;
|
||||||
|
var error = GetDisplayConfigBufferSizes(QUERY_DEVICE_CONFIG_FLAGS.QDC_ONLY_ACTIVE_PATHS, out pathCount, out modeCount);
|
||||||
|
if (error != ERROR_SUCCESS)
|
||||||
|
throw new Win32Exception(error);
|
||||||
|
|
||||||
|
var displayPaths = new DISPLAYCONFIG_PATH_INFO[pathCount];
|
||||||
|
var displayModes = new DISPLAYCONFIG_MODE_INFO[modeCount];
|
||||||
|
error = QueryDisplayConfig(QUERY_DEVICE_CONFIG_FLAGS.QDC_ONLY_ACTIVE_PATHS,
|
||||||
|
ref pathCount, displayPaths, ref modeCount, displayModes, IntPtr.Zero);
|
||||||
|
if (error != ERROR_SUCCESS)
|
||||||
|
throw new Win32Exception(error);
|
||||||
|
|
||||||
|
for (var i = 0; i < modeCount; i++)
|
||||||
|
if (displayModes[i].infoType == DISPLAYCONFIG_MODE_INFO_TYPE.DISPLAYCONFIG_MODE_INFO_TYPE_TARGET)
|
||||||
|
yield return DeviceName(displayModes[i].adapterId, displayModes[i].id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public class NativeMethods
|
public class NativeMethods
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public const int KEYEVENTF_EXTENDEDKEY = 1;
|
public const int KEYEVENTF_EXTENDEDKEY = 1;
|
||||||
public const int KEYEVENTF_KEYUP = 2;
|
public const int KEYEVENTF_KEYUP = 2;
|
||||||
|
|
||||||
@@ -162,43 +467,6 @@ public class NativeMethods
|
|||||||
string lpszDeviceName, ref DEVMODE lpDevMode, IntPtr hwnd,
|
string lpszDeviceName, ref DEVMODE lpDevMode, IntPtr hwnd,
|
||||||
DisplaySettingsFlags dwflags, IntPtr lParam);
|
DisplaySettingsFlags dwflags, IntPtr lParam);
|
||||||
|
|
||||||
// ENUM DISPLAYS
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
static extern bool EnumDisplayDevicesA(string lpDevice, uint iDevNum, ref DISPLAY_DEVICE lpDisplayDevice, uint dwFlags);
|
|
||||||
|
|
||||||
[Flags()]
|
|
||||||
public enum DisplayDeviceStateFlags : int
|
|
||||||
{
|
|
||||||
AttachedToDesktop = 0x1,
|
|
||||||
MultiDriver = 0x2,
|
|
||||||
PrimaryDevice = 0x4,
|
|
||||||
MirroringDriver = 0x8,
|
|
||||||
VGACompatible = 0x10,
|
|
||||||
Removable = 0x20,
|
|
||||||
ModesPruned = 0x8000000,
|
|
||||||
Remote = 0x4000000,
|
|
||||||
Disconnect = 0x2000000
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
|
||||||
public struct DISPLAY_DEVICE
|
|
||||||
{
|
|
||||||
[MarshalAs(UnmanagedType.U4)]
|
|
||||||
public int cb;
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
|
||||||
public string DeviceName;
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
|
||||||
public string DeviceString;
|
|
||||||
[MarshalAs(UnmanagedType.U4)]
|
|
||||||
public DisplayDeviceStateFlags StateFlags;
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
|
||||||
public string DeviceID;
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
|
||||||
public string DeviceKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----
|
|
||||||
|
|
||||||
public static DEVMODE CreateDevmode()
|
public static DEVMODE CreateDevmode()
|
||||||
{
|
{
|
||||||
DEVMODE dm = new DEVMODE();
|
DEVMODE dm = new DEVMODE();
|
||||||
@@ -209,75 +477,49 @@ public class NativeMethods
|
|||||||
}
|
}
|
||||||
|
|
||||||
public const int ENUM_CURRENT_SETTINGS = -1;
|
public const int ENUM_CURRENT_SETTINGS = -1;
|
||||||
public const string laptopScreenName = "\\\\.\\DISPLAY1";
|
public const string defaultDevice = "\\\\.\\DISPLAY1";
|
||||||
|
|
||||||
public static string FindLaptopScreen()
|
public static string FindLaptopScreen()
|
||||||
{
|
{
|
||||||
string laptopScreen = null;
|
string laptopScreen = null;
|
||||||
|
|
||||||
DISPLAY_DEVICE d = new DISPLAY_DEVICE();
|
|
||||||
d.cb = Marshal.SizeOf(d);
|
|
||||||
|
|
||||||
List<string> activeScreens = new List<string>();
|
|
||||||
int counter = 0;
|
|
||||||
int deviceNum = -1;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var searcherActive = new ManagementObjectSearcher(@"\\.\root\wmi", "SELECT * FROM WmiMonitorBasicDisplayParams");
|
var devices = GetAllDevices().ToArray();
|
||||||
var resultsActive = searcherActive.Get();
|
int count = 0, displayNum = -1;
|
||||||
foreach (var result in resultsActive)
|
|
||||||
|
foreach (var device in devices)
|
||||||
{
|
{
|
||||||
activeScreens.Add(result["InstanceName"].ToString());
|
if (device.outputTechnology == DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY.DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL)
|
||||||
|
{
|
||||||
|
displayNum = count;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
//Debug.WriteLine(device.outputTechnology);
|
||||||
|
//Debug.WriteLine(device.monitorFriendlyDeviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
var searcher = new ManagementObjectSearcher(@"\\.\root\wmi", "SELECT * FROM WmiMonitorConnectionParams");
|
if (Screen.AllScreens.Length != count)
|
||||||
var results = searcher.Get();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var result in results)
|
|
||||||
{
|
{
|
||||||
long technology;
|
Debug.WriteLine("Mismatch between enumerated and available screens");
|
||||||
long.TryParse(result["VideoOutputTechnology"].ToString(), out technology);
|
return null;
|
||||||
string instanceName = result["InstanceName"].ToString();
|
}
|
||||||
|
|
||||||
if (technology == 0x80000000 && activeScreens.Contains(instanceName))
|
count = 0;
|
||||||
|
foreach (var screen in Screen.AllScreens)
|
||||||
|
{
|
||||||
|
if (count == displayNum)
|
||||||
{
|
{
|
||||||
deviceNum = counter;
|
laptopScreen = screen.DeviceName;
|
||||||
//Debug.WriteLine(result["InstanceName"]);
|
|
||||||
}
|
}
|
||||||
counter++;
|
//Debug.WriteLine(screen.DeviceName);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
} catch
|
} catch
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Failed to detect built in display");
|
Debug.WriteLine("Can't find internal screen");
|
||||||
deviceNum = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
counter = 0;
|
|
||||||
for (uint id = 0; EnumDisplayDevicesA(null, id, ref d, 0); id++)
|
|
||||||
{
|
|
||||||
if ((d.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) != 0)
|
|
||||||
{
|
|
||||||
//Debug.WriteLine(d.DeviceID);
|
|
||||||
//Debug.WriteLine(d.DeviceName);
|
|
||||||
if (counter == deviceNum)
|
|
||||||
{
|
|
||||||
laptopScreen = d.DeviceName;
|
|
||||||
}
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mismatch between active screens and enumerated screens, fallback to old method
|
|
||||||
if (counter != activeScreens.Count)
|
|
||||||
{
|
|
||||||
laptopScreen = null;
|
|
||||||
foreach (var screen in Screen.AllScreens)
|
|
||||||
if (screen.DeviceName == laptopScreenName)
|
|
||||||
laptopScreen = screen.DeviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return laptopScreen;
|
return laptopScreen;
|
||||||
}
|
}
|
||||||
|
|||||||
103
Program.cs
103
Program.cs
@@ -1,6 +1,10 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
public class HardwareMonitor
|
public class HardwareMonitor
|
||||||
{
|
{
|
||||||
@@ -36,6 +40,32 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Native methods for sleep detection
|
||||||
|
|
||||||
|
[DllImport("Powrprof.dll", SetLastError = true)]
|
||||||
|
static extern uint PowerRegisterSuspendResumeNotification(uint flags, ref DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS receipient, ref IntPtr registrationHandle);
|
||||||
|
|
||||||
|
|
||||||
|
private const int WM_POWERBROADCAST = 536; // (0x218)
|
||||||
|
private const int PBT_APMPOWERSTATUSCHANGE = 10; // (0xA) - Power status has changed.
|
||||||
|
private const int PBT_APMRESUMEAUTOMATIC = 18; // (0x12) - Operation is resuming automatically from a low-power state.This message is sent every time the system resumes.
|
||||||
|
private const int PBT_APMRESUMESUSPEND = 7; // (0x7) - Operation is resuming from a low-power state.This message is sent after PBT_APMRESUMEAUTOMATIC if the resume is triggered by user input, such as pressing a key.
|
||||||
|
private const int PBT_APMSUSPEND = 4; // (0x4) - System is suspending operation.
|
||||||
|
private const int PBT_POWERSETTINGCHANGE = 32787; // (0x8013) - A power setting change event has been received.
|
||||||
|
private const int DEVICE_NOTIFY_CALLBACK = 2;
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
struct DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS
|
||||||
|
{
|
||||||
|
public DeviceNotifyCallbackRoutine Callback;
|
||||||
|
public IntPtr Context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public delegate int DeviceNotifyCallbackRoutine(IntPtr context, int type, IntPtr setting);
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
public static NotifyIcon trayIcon = new NotifyIcon
|
public static NotifyIcon trayIcon = new NotifyIcon
|
||||||
{
|
{
|
||||||
Text = "G-Helper",
|
Text = "G-Helper",
|
||||||
@@ -69,13 +99,13 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
|
||||||
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
||||||
|
|
||||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||||
|
|
||||||
settingsForm.InitGPUMode();
|
settingsForm.InitGPUMode();
|
||||||
settingsForm.InitBoost();
|
|
||||||
settingsForm.InitAura();
|
settingsForm.InitAura();
|
||||||
settingsForm.InitMatrix();
|
settingsForm.InitMatrix();
|
||||||
|
|
||||||
@@ -85,14 +115,81 @@ namespace GHelper
|
|||||||
|
|
||||||
SetAutoModes();
|
SetAutoModes();
|
||||||
|
|
||||||
|
IntPtr registrationHandle = new IntPtr();
|
||||||
|
DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS recipient = new DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS();
|
||||||
|
recipient.Callback = new DeviceNotifyCallbackRoutine(DeviceNotifyCallback);
|
||||||
|
recipient.Context = IntPtr.Zero;
|
||||||
|
|
||||||
|
IntPtr pRecipient = Marshal.AllocHGlobal(Marshal.SizeOf(recipient));
|
||||||
|
Marshal.StructureToPtr(recipient, pRecipient, false);
|
||||||
|
|
||||||
|
uint result = PowerRegisterSuspendResumeNotification(DEVICE_NOTIFY_CALLBACK, ref recipient, ref registrationHandle);
|
||||||
|
|
||||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||||
|
|
||||||
IntPtr ds = settingsForm.Handle;
|
IntPtr ds = settingsForm.Handle;
|
||||||
|
|
||||||
|
CheckForUpdates();
|
||||||
|
|
||||||
Application.Run();
|
Application.Run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static int DeviceNotifyCallback(IntPtr context, int type, IntPtr setting)
|
||||||
|
{
|
||||||
|
//Debug.WriteLine($"Power callback type: {type}");
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case PBT_APMRESUMEAUTOMATIC:
|
||||||
|
settingsForm.BeginInvoke(delegate
|
||||||
|
{
|
||||||
|
// Fix for bugging buios on wake up
|
||||||
|
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, (config.getConfig("performance_mode")+1) % 3);
|
||||||
|
Thread.Sleep(500);
|
||||||
|
|
||||||
|
SetAutoModes();
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static async void CheckForUpdates()
|
||||||
|
{
|
||||||
|
|
||||||
|
var assembly = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||||
|
settingsForm.SetVersionLabel("Version: " + assembly);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var httpClient = new HttpClient())
|
||||||
|
{
|
||||||
|
httpClient.DefaultRequestHeaders.Add("User-Agent", "C# App");
|
||||||
|
var json = await httpClient.GetStringAsync("https://api.github.com/repos/seerge/g-helper/releases/latest");
|
||||||
|
var config = JsonSerializer.Deserialize<JsonElement>(json);
|
||||||
|
var tag = config.GetProperty("tag_name").ToString().Replace("v", "");
|
||||||
|
var url = config.GetProperty("assets")[0].GetProperty("browser_download_url").ToString();
|
||||||
|
|
||||||
|
var gitVersion = new Version(tag);
|
||||||
|
var appVersion = new Version(assembly);
|
||||||
|
|
||||||
|
var result = gitVersion.CompareTo(appVersion);
|
||||||
|
if (result > 0)
|
||||||
|
{
|
||||||
|
settingsForm.SetVersionLabel("Download Update: " + tag, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Debug.WriteLine("Failed to get update");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void SetAutoModes()
|
private static void SetAutoModes()
|
||||||
{
|
{
|
||||||
PowerLineStatus isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
|
PowerLineStatus isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
|
||||||
@@ -100,10 +197,10 @@ namespace GHelper
|
|||||||
Debug.WriteLine(isPlugged.ToString());
|
Debug.WriteLine(isPlugged.ToString());
|
||||||
|
|
||||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||||
settingsForm.AutoPerformance(isPlugged);
|
|
||||||
settingsForm.AutoScreen(isPlugged);
|
|
||||||
|
|
||||||
|
settingsForm.AutoPerformance(isPlugged);
|
||||||
settingsForm.AutoGPUMode(isPlugged);
|
settingsForm.AutoGPUMode(isPlugged);
|
||||||
|
|
||||||
settingsForm.SetMatrix(isPlugged);
|
settingsForm.SetMatrix(isPlugged);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
Properties/Resources.Designer.cs
generated
10
Properties/Resources.Designer.cs
generated
@@ -130,6 +130,16 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap icons8_processor_96 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("icons8-processor-96", 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>
|
||||||
|
|||||||
@@ -121,6 +121,9 @@
|
|||||||
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\eco.ico;System.Drawing.Icon, 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">
|
||||||
|
<value>..\Resources\icons8-matrix-desktop-48.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>
|
||||||
@@ -151,7 +154,7 @@
|
|||||||
<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-matrix-desktop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8-processor-96" 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-processor-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
27
README.md
27
README.md
@@ -1,11 +1,15 @@
|
|||||||
# G-Helper (For Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and others)
|
# G-Helper / GHelper for Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
|
||||||
|
|
||||||
A small utility that allows you do almost everyting you could do with Armory Crate but without extra bloat and unnecessary services.
|
A small utility that allows you do almost everyting you could do with Armory Crate but without extra bloat and unnecessary services.
|
||||||
|
|
||||||
|
### [Download latest release](https://github.com/seerge/g-helper/releases)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## NEW (and experimental) features
|
## NEW (and experimental) features
|
||||||
|
|
||||||
1. Set Power limits (PPT) for Total (APU + dGPU) and CPU.
|
1. Set Power limits (PPT) for Total (APU + dGPU) and CPU.
|
||||||
2. Anime matrix control thanks to https://github.com/vddCore/Starlight
|
2. Anime matrix control thanks to [Starlight](https://github.com/vddCore/Starlight) + some tweaks from my side
|
||||||
|
|
||||||
## Main features
|
## Main features
|
||||||
|
|
||||||
@@ -25,12 +29,6 @@ Designed and developed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU
|
|||||||
|
|
||||||
To keep autoswitching and hotkeys work app needs to stay in running in tray. It doesn't consume any resources.
|
To keep autoswitching and hotkeys work app needs to stay in running in tray. It doesn't consume any resources.
|
||||||
|
|
||||||
I recommend to keep "Asus Optimization Service" running, as it keeps basic laptop hotkeys such as screen or keyboard brightness adjustment working. If you have (or had) MyASUS app installed, that service is most probably still up an running even after MyASUS uninstall. It's part of [Asus System Controll Interface](https://www.asus.com/support/FAQ/1047338/). You can install it, and later disable / remove unnecesarily services by running [this bat file](https://raw.githubusercontent.com/seerge/g-helper/main/stop-asus-sv.bat ) as admin.
|
|
||||||
|
|
||||||
### [Download latest release](https://github.com/seerge/g-helper/releases)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Performance Profile switching
|
## Performance Profile switching
|
||||||
|
|
||||||
Profiles are **same** as in Armory Crate (as they are stored in bios), including default fan curves
|
Profiles are **same** as in Armory Crate (as they are stored in bios), including default fan curves
|
||||||
@@ -49,10 +47,14 @@ PPTs are shown for G14 2022, for other models PPTs will be different as they are
|
|||||||
|
|
||||||
## How to install
|
## How to install
|
||||||
|
|
||||||
1. Download latest release from https://github.com/seerge/g-helper/releases
|
1. Download latest release from [**Releases Page**](https://github.com/seerge/g-helper/releases)
|
||||||
2. Unzip to a folder of your choice
|
2. Unzip to a folder of your choice
|
||||||
3. Run **GHelper.exe**
|
3. Run **GHelper.exe**
|
||||||
|
|
||||||
|
App requires [.NET7](https://dotnet.microsoft.com/en-us/download) to be installed. Most probably you already have it. Otherwise you can [download it](https://dotnet.microsoft.com/en-us/download).
|
||||||
|
|
||||||
|
I recommend to keep "Asus Optimization Service" running, as it keeps basic laptop hotkeys such as screen or keyboard brightness adjustment working. If you have (or had) MyASUS app installed, that service is most probably still up an running even after MyASUS uninstall. It's part of [Asus System Controll Interface](https://www.asus.com/support/FAQ/1047338/). You can install it, and later disable / remove unnecesarily services by running [this bat file](https://raw.githubusercontent.com/seerge/g-helper/main/stop-asus-sv.bat) as admin.
|
||||||
|
|
||||||
Note: Uses low level ASUS ACPI commands and doens't require Armory Crate to be installed at all! Doesn't need administrator privileges to run!
|
Note: Uses low level ASUS ACPI commands and doens't require Armory Crate to be installed at all! Doesn't need administrator privileges to run!
|
||||||
|
|
||||||
I don`t have Microsoft certificate to sign app yet, so if you get a warning from Windows Defender on launch (Windows Protected your PC), click More Info -> Run anyway. Alternatively you can compile and run project by yourself using Visual Studio :)
|
I don`t have Microsoft certificate to sign app yet, so if you get a warning from Windows Defender on launch (Windows Protected your PC), click More Info -> Run anyway. Alternatively you can compile and run project by yourself using Visual Studio :)
|
||||||
@@ -66,3 +68,10 @@ P.S.: It's not recommended to use app in combination with Armory Crate, cause th
|
|||||||
Debloating helps to save your battery and keep laptop a bit cooler
|
Debloating helps to save your battery and keep laptop a bit cooler
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
---------
|
||||||
|
|
||||||
|
**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.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MISUSE OF THIS SOFTWARE COULD CAUSE SYSTEM INSTABILITY OR MALFUNCTION.
|
||||||
|
|||||||
BIN
Resources/icons8-processor-96.png
Normal file
BIN
Resources/icons8-processor-96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 710 B |
33
Settings.Designer.cs
generated
33
Settings.Designer.cs
generated
@@ -48,7 +48,6 @@
|
|||||||
checkStartup = new CheckBox();
|
checkStartup = new CheckBox();
|
||||||
panelPerformance = new Panel();
|
panelPerformance = new Panel();
|
||||||
buttonFans = new Button();
|
buttonFans = new Button();
|
||||||
checkBoost = new CheckBox();
|
|
||||||
picturePerf = new PictureBox();
|
picturePerf = new PictureBox();
|
||||||
labelPerf = new Label();
|
labelPerf = new Label();
|
||||||
labelCPUFan = new Label();
|
labelCPUFan = new Label();
|
||||||
@@ -113,17 +112,17 @@
|
|||||||
panelMatrix.Controls.Add(pictureMatrix);
|
panelMatrix.Controls.Add(pictureMatrix);
|
||||||
panelMatrix.Controls.Add(labelMatrix);
|
panelMatrix.Controls.Add(labelMatrix);
|
||||||
panelMatrix.Dock = DockStyle.Top;
|
panelMatrix.Dock = DockStyle.Top;
|
||||||
panelMatrix.Location = new Point(16, 806);
|
panelMatrix.Location = new Point(16, 814);
|
||||||
panelMatrix.Margin = new Padding(4);
|
panelMatrix.Margin = new Padding(4);
|
||||||
panelMatrix.Name = "panelMatrix";
|
panelMatrix.Name = "panelMatrix";
|
||||||
panelMatrix.Size = new Size(722, 156);
|
panelMatrix.Size = new Size(722, 180);
|
||||||
panelMatrix.TabIndex = 33;
|
panelMatrix.TabIndex = 33;
|
||||||
//
|
//
|
||||||
// checkMatrix
|
// checkMatrix
|
||||||
//
|
//
|
||||||
checkMatrix.AutoSize = true;
|
checkMatrix.AutoSize = true;
|
||||||
checkMatrix.ForeColor = SystemColors.GrayText;
|
checkMatrix.ForeColor = SystemColors.GrayText;
|
||||||
checkMatrix.Location = new Point(26, 112);
|
checkMatrix.Location = new Point(28, 109);
|
||||||
checkMatrix.Margin = new Padding(4, 2, 4, 2);
|
checkMatrix.Margin = new Padding(4, 2, 4, 2);
|
||||||
checkMatrix.Name = "checkMatrix";
|
checkMatrix.Name = "checkMatrix";
|
||||||
checkMatrix.Size = new Size(249, 36);
|
checkMatrix.Size = new Size(249, 36);
|
||||||
@@ -159,7 +158,7 @@
|
|||||||
buttonMatrix.Name = "buttonMatrix";
|
buttonMatrix.Name = "buttonMatrix";
|
||||||
buttonMatrix.Size = new Size(208, 42);
|
buttonMatrix.Size = new Size(208, 42);
|
||||||
buttonMatrix.TabIndex = 43;
|
buttonMatrix.TabIndex = 43;
|
||||||
buttonMatrix.Text = "Picture";
|
buttonMatrix.Text = "Picture / Gif";
|
||||||
buttonMatrix.UseVisualStyleBackColor = false;
|
buttonMatrix.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// comboMatrixRunning
|
// comboMatrixRunning
|
||||||
@@ -220,7 +219,7 @@
|
|||||||
panelBattery.Controls.Add(labelBatteryTitle);
|
panelBattery.Controls.Add(labelBatteryTitle);
|
||||||
panelBattery.Controls.Add(trackBattery);
|
panelBattery.Controls.Add(trackBattery);
|
||||||
panelBattery.Dock = DockStyle.Top;
|
panelBattery.Dock = DockStyle.Top;
|
||||||
panelBattery.Location = new Point(16, 962);
|
panelBattery.Location = new Point(16, 994);
|
||||||
panelBattery.Margin = new Padding(4);
|
panelBattery.Margin = new Padding(4);
|
||||||
panelBattery.Name = "panelBattery";
|
panelBattery.Name = "panelBattery";
|
||||||
panelBattery.Size = new Size(722, 148);
|
panelBattery.Size = new Size(722, 148);
|
||||||
@@ -291,7 +290,7 @@
|
|||||||
panelFooter.Controls.Add(buttonQuit);
|
panelFooter.Controls.Add(buttonQuit);
|
||||||
panelFooter.Controls.Add(checkStartup);
|
panelFooter.Controls.Add(checkStartup);
|
||||||
panelFooter.Dock = DockStyle.Top;
|
panelFooter.Dock = DockStyle.Top;
|
||||||
panelFooter.Location = new Point(16, 1110);
|
panelFooter.Location = new Point(16, 1142);
|
||||||
panelFooter.Margin = new Padding(4);
|
panelFooter.Margin = new Padding(4);
|
||||||
panelFooter.Name = "panelFooter";
|
panelFooter.Name = "panelFooter";
|
||||||
panelFooter.Size = new Size(722, 64);
|
panelFooter.Size = new Size(722, 64);
|
||||||
@@ -323,7 +322,6 @@
|
|||||||
// panelPerformance
|
// panelPerformance
|
||||||
//
|
//
|
||||||
panelPerformance.Controls.Add(buttonFans);
|
panelPerformance.Controls.Add(buttonFans);
|
||||||
panelPerformance.Controls.Add(checkBoost);
|
|
||||||
panelPerformance.Controls.Add(picturePerf);
|
panelPerformance.Controls.Add(picturePerf);
|
||||||
panelPerformance.Controls.Add(labelPerf);
|
panelPerformance.Controls.Add(labelPerf);
|
||||||
panelPerformance.Controls.Add(labelCPUFan);
|
panelPerformance.Controls.Add(labelCPUFan);
|
||||||
@@ -348,18 +346,6 @@
|
|||||||
buttonFans.Text = "Fans and Power";
|
buttonFans.Text = "Fans and Power";
|
||||||
buttonFans.UseVisualStyleBackColor = false;
|
buttonFans.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// checkBoost
|
|
||||||
//
|
|
||||||
checkBoost.AutoSize = true;
|
|
||||||
checkBoost.ForeColor = SystemColors.GrayText;
|
|
||||||
checkBoost.Location = new Point(27, 154);
|
|
||||||
checkBoost.Margin = new Padding(4, 2, 4, 2);
|
|
||||||
checkBoost.Name = "checkBoost";
|
|
||||||
checkBoost.Size = new Size(320, 36);
|
|
||||||
checkBoost.TabIndex = 33;
|
|
||||||
checkBoost.Text = "CPU Turbo Boost enabled";
|
|
||||||
checkBoost.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// picturePerf
|
// picturePerf
|
||||||
//
|
//
|
||||||
picturePerf.BackgroundImage = (Image)resources.GetObject("picturePerf.BackgroundImage");
|
picturePerf.BackgroundImage = (Image)resources.GetObject("picturePerf.BackgroundImage");
|
||||||
@@ -595,7 +581,7 @@
|
|||||||
//
|
//
|
||||||
checkScreen.AutoSize = true;
|
checkScreen.AutoSize = true;
|
||||||
checkScreen.ForeColor = SystemColors.GrayText;
|
checkScreen.ForeColor = SystemColors.GrayText;
|
||||||
checkScreen.Location = new Point(27, 154);
|
checkScreen.Location = new Point(27, 153);
|
||||||
checkScreen.Margin = new Padding(4, 2, 4, 2);
|
checkScreen.Margin = new Padding(4, 2, 4, 2);
|
||||||
checkScreen.Name = "checkScreen";
|
checkScreen.Name = "checkScreen";
|
||||||
checkScreen.Size = new Size(527, 36);
|
checkScreen.Size = new Size(527, 36);
|
||||||
@@ -683,7 +669,7 @@
|
|||||||
panelKeyboard.Location = new Point(16, 660);
|
panelKeyboard.Location = new Point(16, 660);
|
||||||
panelKeyboard.Margin = new Padding(4);
|
panelKeyboard.Margin = new Padding(4);
|
||||||
panelKeyboard.Name = "panelKeyboard";
|
panelKeyboard.Name = "panelKeyboard";
|
||||||
panelKeyboard.Size = new Size(722, 146);
|
panelKeyboard.Size = new Size(722, 154);
|
||||||
panelKeyboard.TabIndex = 39;
|
panelKeyboard.TabIndex = 39;
|
||||||
//
|
//
|
||||||
// tableLayoutKeyboard
|
// tableLayoutKeyboard
|
||||||
@@ -775,7 +761,7 @@
|
|||||||
buttonKeyboardColor.Name = "buttonKeyboardColor";
|
buttonKeyboardColor.Name = "buttonKeyboardColor";
|
||||||
buttonKeyboardColor.Size = new Size(208, 42);
|
buttonKeyboardColor.Size = new Size(208, 42);
|
||||||
buttonKeyboardColor.TabIndex = 39;
|
buttonKeyboardColor.TabIndex = 39;
|
||||||
buttonKeyboardColor.Text = "Color ";
|
buttonKeyboardColor.Text = "Color ";
|
||||||
buttonKeyboardColor.UseVisualStyleBackColor = false;
|
buttonKeyboardColor.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// pictureKeyboard
|
// pictureKeyboard
|
||||||
@@ -872,7 +858,6 @@
|
|||||||
private CheckBox checkStartup;
|
private CheckBox checkStartup;
|
||||||
private Panel panelPerformance;
|
private Panel panelPerformance;
|
||||||
private Button buttonFans;
|
private Button buttonFans;
|
||||||
private CheckBox checkBoost;
|
|
||||||
private PictureBox picturePerf;
|
private PictureBox picturePerf;
|
||||||
private Label labelPerf;
|
private Label labelPerf;
|
||||||
private Label labelCPUFan;
|
private Label labelCPUFan;
|
||||||
|
|||||||
262
Settings.cs
262
Settings.cs
@@ -1,7 +1,6 @@
|
|||||||
using Starlight.AnimeMatrix;
|
using Starlight.AnimeMatrix;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Reflection;
|
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
@@ -20,14 +19,14 @@ namespace GHelper
|
|||||||
static System.Timers.Timer aTimer = default!;
|
static System.Timers.Timer aTimer = default!;
|
||||||
static System.Timers.Timer matrixTimer = default!;
|
static System.Timers.Timer matrixTimer = default!;
|
||||||
|
|
||||||
|
public string versionUrl = "http://github.com/seerge/g-helper/releases";
|
||||||
|
|
||||||
public string perfName = "Balanced";
|
public string perfName = "Balanced";
|
||||||
|
|
||||||
Fans fans;
|
Fans fans;
|
||||||
Keyboard keyb;
|
Keyboard keyb;
|
||||||
|
|
||||||
static AnimeMatrixDevice mat;
|
static AnimeMatrixDevice mat;
|
||||||
static bool matEnabled = false;
|
|
||||||
|
|
||||||
|
|
||||||
public SettingsForm()
|
public SettingsForm()
|
||||||
{
|
{
|
||||||
@@ -61,7 +60,7 @@ namespace GHelper
|
|||||||
|
|
||||||
buttonQuit.Click += ButtonQuit_Click;
|
buttonQuit.Click += ButtonQuit_Click;
|
||||||
|
|
||||||
checkBoost.Click += CheckBoost_Click;
|
checkGPU.CheckedChanged += CheckGPU_CheckedChanged;
|
||||||
|
|
||||||
checkScreen.CheckedChanged += checkScreen_CheckedChanged;
|
checkScreen.CheckedChanged += checkScreen_CheckedChanged;
|
||||||
|
|
||||||
@@ -77,9 +76,6 @@ namespace GHelper
|
|||||||
pictureColor.Click += PictureColor_Click;
|
pictureColor.Click += PictureColor_Click;
|
||||||
pictureColor2.Click += PictureColor2_Click;
|
pictureColor2.Click += PictureColor2_Click;
|
||||||
|
|
||||||
labelVersion.Text = "Version " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
|
||||||
labelVersion.Click += LabelVersion_Click;
|
|
||||||
|
|
||||||
labelCPUFan.Click += LabelCPUFan_Click;
|
labelCPUFan.Click += LabelCPUFan_Click;
|
||||||
labelGPUFan.Click += LabelCPUFan_Click;
|
labelGPUFan.Click += LabelCPUFan_Click;
|
||||||
|
|
||||||
@@ -93,11 +89,52 @@ namespace GHelper
|
|||||||
|
|
||||||
buttonMatrix.Click += ButtonMatrix_Click;
|
buttonMatrix.Click += ButtonMatrix_Click;
|
||||||
|
|
||||||
|
checkStartup.CheckedChanged += CheckStartup_CheckedChanged;
|
||||||
|
|
||||||
|
labelVersion.Click += LabelVersion_Click;
|
||||||
|
|
||||||
SetTimer();
|
SetTimer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckGPU_CheckedChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is null) return;
|
||||||
|
CheckBox check = (CheckBox)sender;
|
||||||
|
Program.config.setConfig("gpu_auto", check.Checked ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVersionLabel(string label, string url = null)
|
||||||
|
{
|
||||||
|
labelVersion.Text = label;
|
||||||
|
if (url is not null)
|
||||||
|
{
|
||||||
|
versionUrl = url;
|
||||||
|
labelVersion.ForeColor = Color.Red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void LabelVersion_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo(versionUrl) { UseShellExecute = true });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CheckStartup_CheckedChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is null) return;
|
||||||
|
CheckBox chk = (CheckBox)sender;
|
||||||
|
|
||||||
|
if (chk.Checked)
|
||||||
|
{
|
||||||
|
Startup.Schedule();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Startup.UnSchedule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckMatrix_CheckedChanged(object? sender, EventArgs e)
|
private void CheckMatrix_CheckedChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -240,6 +277,8 @@ namespace GHelper
|
|||||||
|
|
||||||
StopMatrixTimer();
|
StopMatrixTimer();
|
||||||
|
|
||||||
|
mat.SetProvider();
|
||||||
|
|
||||||
if (brightness == 0 || (auto && Plugged != PowerLineStatus.Online))
|
if (brightness == 0 || (auto && Plugged != PowerLineStatus.Online))
|
||||||
{
|
{
|
||||||
mat.SetDisplayState(false);
|
mat.SetDisplayState(false);
|
||||||
@@ -258,6 +297,7 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
mat.SetBuiltInAnimation(true, animation);
|
mat.SetBuiltInAnimation(true, animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -270,11 +310,6 @@ namespace GHelper
|
|||||||
RefreshSensors();
|
RefreshSensors();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LabelVersion_Click(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Process.Start(new ProcessStartInfo("http://github.com/seerge/g-helper/releases") { UseShellExecute = true });
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PictureColor2_Click(object? sender, EventArgs e)
|
private void PictureColor2_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -373,36 +408,26 @@ namespace GHelper
|
|||||||
public void InitMatrix()
|
public void InitMatrix()
|
||||||
{
|
{
|
||||||
|
|
||||||
matrixTimer = new System.Timers.Timer();
|
|
||||||
matrixTimer.Enabled = false;
|
|
||||||
matrixTimer.Interval = 100;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
matEnabled = true;
|
|
||||||
mat = new AnimeMatrixDevice();
|
mat = new AnimeMatrixDevice();
|
||||||
|
matrixTimer = new System.Timers.Timer(100);
|
||||||
matrixTimer.Elapsed += MatrixTimer_Elapsed;
|
matrixTimer.Elapsed += MatrixTimer_Elapsed;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
|
||||||
matEnabled = false;
|
|
||||||
Debug.WriteLine("Anime Matrix not detected");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!matEnabled)
|
|
||||||
{
|
{
|
||||||
panelMatrix.Visible = false;
|
panelMatrix.Visible = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
int brightness = Program.config.getConfig("matrix_brightness");
|
|
||||||
int running = Program.config.getConfig("matrix_running");
|
|
||||||
|
|
||||||
comboMatrix.SelectedIndex = (brightness != -1) ? brightness : 0;
|
int brightness = Program.config.getConfig("matrix_brightness");
|
||||||
comboMatrixRunning.SelectedIndex = (running != -1) ? running : 0;
|
int running = Program.config.getConfig("matrix_running");
|
||||||
|
|
||||||
|
comboMatrix.SelectedIndex = (brightness != -1) ? brightness : 0;
|
||||||
|
comboMatrixRunning.SelectedIndex = (running != -1) ? running : 0;
|
||||||
|
|
||||||
|
checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1);
|
||||||
|
|
||||||
checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,19 +493,6 @@ namespace GHelper
|
|||||||
SetAuraMode(cmb.SelectedIndex);
|
SetAuraMode(cmb.SelectedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CheckBoost_Click(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (sender is null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CheckBox chk = (CheckBox)sender;
|
|
||||||
if (chk.Checked)
|
|
||||||
NativeMethods.SetCPUBoost(2);
|
|
||||||
else
|
|
||||||
NativeMethods.SetCPUBoost(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Button120Hz_Click(object? sender, EventArgs e)
|
private void Button120Hz_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SetScreen(1000, 1);
|
SetScreen(1000, 1);
|
||||||
@@ -506,28 +518,15 @@ namespace GHelper
|
|||||||
frequency = 120;
|
frequency = 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frequency > 0)
|
if (frequency <= 0) return;
|
||||||
NativeMethods.SetRefreshRate(frequency);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (overdrive > 0)
|
|
||||||
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Debug.WriteLine("Screen Overdrive not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
NativeMethods.SetRefreshRate(frequency);
|
||||||
|
if (overdrive > 0)
|
||||||
|
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
||||||
|
|
||||||
InitScreen();
|
InitScreen();
|
||||||
}
|
Debug.WriteLine(frequency);
|
||||||
|
|
||||||
|
|
||||||
public void InitBoost()
|
|
||||||
{
|
|
||||||
int boost = NativeMethods.GetCPUBoost();
|
|
||||||
checkBoost.Checked = (boost > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitScreen()
|
public void InitScreen()
|
||||||
@@ -693,15 +692,45 @@ namespace GHelper
|
|||||||
int limit_total = Program.config.getConfigPerf("limit_total");
|
int limit_total = Program.config.getConfigPerf("limit_total");
|
||||||
int limit_cpu = Program.config.getConfigPerf("limit_cpu");
|
int limit_cpu = Program.config.getConfigPerf("limit_cpu");
|
||||||
|
|
||||||
|
if (limit_total > ASUSWmi.MaxTotal) return;
|
||||||
|
if (limit_total < ASUSWmi.MinTotal) return;
|
||||||
|
|
||||||
|
if (limit_cpu > ASUSWmi.MaxCPU) return;
|
||||||
|
if (limit_cpu < ASUSWmi.MinCPU) return;
|
||||||
|
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total);
|
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total);
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total);
|
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total);
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
|
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
|
||||||
|
|
||||||
Debug.WriteLine(limit_total.ToString() + ", " + limit_cpu.ToString());
|
Debug.WriteLine(limit_total.ToString() + ", " + limit_cpu.ToString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void AutoFansAndPower()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (Program.config.getConfigPerf("auto_apply") == 1)
|
||||||
|
{
|
||||||
|
Program.wmi.SetFanCurve(0, Program.config.getFanConfig(0));
|
||||||
|
Program.wmi.SetFanCurve(1, Program.config.getFanConfig(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Program.config.getConfigPerf("auto_apply_power") == 1)
|
||||||
|
{
|
||||||
|
var timer = new System.Timers.Timer(1000);
|
||||||
|
timer.Elapsed += delegate
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
timer.Dispose();
|
||||||
|
SetPower();
|
||||||
|
};
|
||||||
|
timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -731,23 +760,7 @@ namespace GHelper
|
|||||||
Program.config.setConfig("performance_mode", PerformanceMode);
|
Program.config.setConfig("performance_mode", PerformanceMode);
|
||||||
|
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
||||||
|
Debug.WriteLine("Perf:" + PerformanceMode);
|
||||||
if (Program.config.getConfigPerf("auto_apply") == 1)
|
|
||||||
{
|
|
||||||
Program.wmi.SetFanCurve(0, Program.config.getFanConfig(0));
|
|
||||||
Program.wmi.SetFanCurve(1, Program.config.getFanConfig(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Program.config.getConfigPerf("auto_apply_power") == 1)
|
|
||||||
{
|
|
||||||
SetPower();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fans != null && fans.Text != "")
|
|
||||||
{
|
|
||||||
fans.InitFans();
|
|
||||||
fans.InitPower();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (notify && (oldMode != PerformanceMode))
|
if (notify && (oldMode != PerformanceMode))
|
||||||
{
|
{
|
||||||
@@ -761,6 +774,16 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoFansAndPower();
|
||||||
|
|
||||||
|
if (fans != null && fans.Text != "")
|
||||||
|
{
|
||||||
|
fans.InitFans();
|
||||||
|
fans.InitPower();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -789,7 +812,6 @@ namespace GHelper
|
|||||||
else
|
else
|
||||||
SetScreen(60, 0);
|
SetScreen(60, 0);
|
||||||
|
|
||||||
InitScreen();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,23 +824,24 @@ namespace GHelper
|
|||||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||||
|
|
||||||
|
|
||||||
if (mux == 0) // GPU in Ultimate, ignore
|
if (mux == 0) // GPU in Ultimate, ignore
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (eco == 1 && Plugged == PowerLineStatus.Online) // Eco going Standard on plugged
|
if (eco == 1 && Plugged == PowerLineStatus.Online) // Eco going Standard on plugged
|
||||||
{
|
{
|
||||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 0);
|
SetEcoGPU(0);
|
||||||
InitGPUMode();
|
|
||||||
}
|
}
|
||||||
else if (eco == 0 && Plugged != PowerLineStatus.Online) // Standard going Eco on plugged
|
else if (eco == 0 && Plugged != PowerLineStatus.Online) // Standard going Eco on plugged
|
||||||
{
|
{
|
||||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 1);
|
SetEcoGPU(1);
|
||||||
InitGPUMode();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AutoScreen(Plugged);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int InitGPUMode()
|
public int InitGPUMode()
|
||||||
@@ -838,10 +861,13 @@ namespace GHelper
|
|||||||
else
|
else
|
||||||
GpuMode = ASUSWmi.GPUModeStandard;
|
GpuMode = ASUSWmi.GPUModeStandard;
|
||||||
|
|
||||||
if (mux != 1)
|
buttonUltimate.Visible = (mux == 1);
|
||||||
Disable_Ultimate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ButtonEnabled(buttonEco, true);
|
||||||
|
ButtonEnabled(buttonStandard, true);
|
||||||
|
ButtonEnabled(buttonUltimate, true);
|
||||||
|
|
||||||
Program.config.setConfig("gpu_mode", GpuMode);
|
Program.config.setConfig("gpu_mode", GpuMode);
|
||||||
VisualiseGPUMode(GpuMode);
|
VisualiseGPUMode(GpuMode);
|
||||||
|
|
||||||
@@ -849,7 +875,31 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGPUMode(int GPUMode = ASUSWmi.GPUModeStandard)
|
|
||||||
|
public void SetEcoGPU(int eco)
|
||||||
|
{
|
||||||
|
|
||||||
|
ButtonEnabled(buttonEco, false);
|
||||||
|
ButtonEnabled(buttonStandard, false);
|
||||||
|
ButtonEnabled(buttonUltimate, false);
|
||||||
|
|
||||||
|
labelGPU.Text = "GPU Mode: Changing ...";
|
||||||
|
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
Thread.CurrentThread.IsBackground = true;
|
||||||
|
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco);
|
||||||
|
Program.settingsForm.BeginInvoke(delegate
|
||||||
|
{
|
||||||
|
InitGPUMode();
|
||||||
|
Thread.Sleep(500);
|
||||||
|
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
|
||||||
|
});
|
||||||
|
}).Start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetGPUMode(int GPUMode)
|
||||||
{
|
{
|
||||||
|
|
||||||
int CurrentGPU = Program.config.getConfig("gpu_mode");
|
int CurrentGPU = Program.config.getConfig("gpu_mode");
|
||||||
@@ -884,13 +934,13 @@ namespace GHelper
|
|||||||
else if (GPUMode == ASUSWmi.GPUModeEco)
|
else if (GPUMode == ASUSWmi.GPUModeEco)
|
||||||
{
|
{
|
||||||
VisualiseGPUMode(GPUMode);
|
VisualiseGPUMode(GPUMode);
|
||||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 1);
|
SetEcoGPU(1);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else if (GPUMode == ASUSWmi.GPUModeStandard)
|
else if (GPUMode == ASUSWmi.GPUModeStandard)
|
||||||
{
|
{
|
||||||
VisualiseGPUMode(GPUMode);
|
VisualiseGPUMode(GPUMode);
|
||||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 0);
|
SetEcoGPU(0);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -946,6 +996,7 @@ namespace GHelper
|
|||||||
Program.trayIcon.Icon = GHelper.Properties.Resources.standard;
|
Program.trayIcon.Icon = GHelper.Properties.Resources.standard;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -969,27 +1020,17 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disable_Ultimate()
|
public void ButtonEnabled(Button but, bool enabled)
|
||||||
{
|
{
|
||||||
buttonUltimate.Enabled = false;
|
but.Enabled = enabled;
|
||||||
buttonUltimate.BackColor = SystemColors.ControlLight;
|
but.BackColor = enabled ? SystemColors.ControlLightLight : SystemColors.ControlLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetStartupCheck(bool status)
|
public void SetStartupCheck(bool status)
|
||||||
{
|
{
|
||||||
|
checkStartup.CheckedChanged -= CheckStartup_CheckedChanged;
|
||||||
checkStartup.Checked = status;
|
checkStartup.Checked = status;
|
||||||
}
|
checkStartup.CheckedChanged += CheckStartup_CheckedChanged;
|
||||||
private void checkStartup_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CheckBox chk = (CheckBox)sender;
|
|
||||||
if (chk.Checked)
|
|
||||||
{
|
|
||||||
Startup.Schedule();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Startup.UnSchedule();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBatteryChargeLimit(int limit)
|
public void SetBatteryChargeLimit(int limit)
|
||||||
@@ -1012,13 +1053,6 @@ namespace GHelper
|
|||||||
SetBatteryChargeLimit(bar.Value);
|
SetBatteryChargeLimit(bar.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkGPU_CheckedChanged(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (sender is null) return;
|
|
||||||
CheckBox check = (CheckBox)sender;
|
|
||||||
Program.config.setConfig("gpu_auto", check.Checked ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void checkScreen_CheckedChanged(object? sender, EventArgs e)
|
private void checkScreen_CheckedChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
15
Startup.cs
15
Startup.cs
@@ -22,16 +22,25 @@ public class Startup
|
|||||||
|
|
||||||
var userId = WindowsIdentity.GetCurrent().Name;
|
var userId = WindowsIdentity.GetCurrent().Name;
|
||||||
|
|
||||||
//Debug.WriteLine(strExeFilePath);
|
|
||||||
TaskDefinition td = TaskService.Instance.NewTask();
|
TaskDefinition td = TaskService.Instance.NewTask();
|
||||||
td.RegistrationInfo.Description = "GHelper Auto Start";
|
td.RegistrationInfo.Description = "GHelper Auto Start";
|
||||||
td.Triggers.Add(new LogonTrigger { UserId = userId, });
|
td.Triggers.Add(new LogonTrigger { UserId = userId });
|
||||||
td.Actions.Add(strExeFilePath);
|
td.Actions.Add(strExeFilePath);
|
||||||
|
|
||||||
td.Settings.StopIfGoingOnBatteries = false;
|
td.Settings.StopIfGoingOnBatteries = false;
|
||||||
td.Settings.DisallowStartIfOnBatteries = false;
|
td.Settings.DisallowStartIfOnBatteries = false;
|
||||||
|
|
||||||
TaskService.Instance.RootFolder.RegisterTaskDefinition(taskName, td);
|
Debug.WriteLine(strExeFilePath);
|
||||||
|
Debug.WriteLine(userId);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TaskService.Instance.RootFolder.RegisterTaskDefinition(taskName, td);
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
MessageBox.Show("Can't schedule task", "Scheduler Error", MessageBoxButtons.OK);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnSchedule()
|
public static void UnSchedule()
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
<windowsSettings>
|
<windowsSettings>
|
||||||
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
|
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
|
||||||
</windowsSettings>
|
</windowsSettings>
|
||||||
</application>
|
</application>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
ps2exe .\ghelper.ps1 g14-helper.exe -title 'G14 Helper' -DPIAware -winFormsDPIAware -requireAdmin -iconFile 'standard.ico' -noConsole -copyright 'G14 Helper Tool' -noOutput
|
|
||||||
File diff suppressed because one or more lines are too long
BIN
old-ps1-script/ghelper.zip
Normal file
BIN
old-ps1-script/ghelper.zip
Normal file
Binary file not shown.
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.4 MiB |
Reference in New Issue
Block a user