mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a1dd9f137 | ||
|
|
325f16cf55 | ||
|
|
42cc1bdb98 | ||
|
|
83a2d1dc9f | ||
|
|
3aae223b15 | ||
|
|
b22d2f8ceb | ||
|
|
2041861a14 | ||
|
|
dfc3c0e515 | ||
|
|
796ec34284 | ||
|
|
50894a59d3 |
@@ -1,5 +1,4 @@
|
|||||||
using System.Diagnostics;
|
using System.Management;
|
||||||
using System.Management;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public enum AsusFan
|
public enum AsusFan
|
||||||
|
|||||||
133
app/AsusUSB.cs
133
app/AsusUSB.cs
@@ -1,5 +1,4 @@
|
|||||||
using HidLibrary;
|
using HidLibrary;
|
||||||
using Microsoft.Win32;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
@@ -175,12 +174,12 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static IEnumerable<HidDevice> GetHidDevices(int[] deviceIds, int minInput = 18)
|
private static IEnumerable<HidDevice> GetHidDevices(int[] deviceIds, int minInput = 18, int minFeatures = 1)
|
||||||
{
|
{
|
||||||
HidDevice[] HidDeviceList = HidDevices.Enumerate(ASUS_ID, deviceIds).ToArray();
|
HidDevice[] HidDeviceList = HidDevices.Enumerate(ASUS_ID, deviceIds).ToArray();
|
||||||
foreach (HidDevice device in HidDeviceList)
|
foreach (HidDevice device in HidDeviceList)
|
||||||
if (device.IsConnected
|
if (device.IsConnected
|
||||||
&& device.Capabilities.FeatureReportByteLength > 0
|
&& device.Capabilities.FeatureReportByteLength >= minFeatures
|
||||||
&& device.Capabilities.InputReportByteLength >= minInput)
|
&& device.Capabilities.InputReportByteLength >= minInput)
|
||||||
yield return device;
|
yield return device;
|
||||||
}
|
}
|
||||||
@@ -248,33 +247,41 @@ namespace GHelper
|
|||||||
|
|
||||||
public static void ApplyBrightness(int brightness)
|
public static void ApplyBrightness(int brightness)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (AppConfig.ContainsModel("TUF"))
|
if (AppConfig.ContainsModel("TUF"))
|
||||||
Program.acpi.TUFKeyboardBrightness(brightness);
|
Program.acpi.TUFKeyboardBrightness(brightness);
|
||||||
|
|
||||||
byte[] msg = { AURA_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
|
|
||||||
|
|
||||||
var devices = GetHidDevices(deviceIds);
|
Task.Run(async () =>
|
||||||
foreach (HidDevice device in devices)
|
|
||||||
{
|
{
|
||||||
device.OpenDevice();
|
|
||||||
device.WriteFeatureData(msg);
|
|
||||||
Logger.WriteLine("KB Backlight:" + BitConverter.ToString(msg));
|
|
||||||
device.CloseDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Backup payload for old models
|
byte[] msg = { AURA_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
|
||||||
if (AppConfig.ContainsModel("503"))
|
|
||||||
{
|
|
||||||
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
|
|
||||||
|
|
||||||
var devicesBackup = GetHidDevices(deviceIds, 0);
|
var devices = GetHidDevices(deviceIds);
|
||||||
foreach (HidDevice device in devicesBackup)
|
foreach (HidDevice device in devices)
|
||||||
{
|
{
|
||||||
device.OpenDevice();
|
device.OpenDevice();
|
||||||
device.WriteFeatureData(msgBackup);
|
device.WriteFeatureData(msg);
|
||||||
|
Logger.WriteLine("KB Backlight:" + BitConverter.ToString(msg));
|
||||||
device.CloseDevice();
|
device.CloseDevice();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Backup payload for old models
|
||||||
|
if (AppConfig.ContainsModel("503"))
|
||||||
|
{
|
||||||
|
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
|
||||||
|
|
||||||
|
var devicesBackup = GetHidDevices(deviceIds, 0);
|
||||||
|
foreach (HidDevice device in devicesBackup)
|
||||||
|
{
|
||||||
|
device.OpenDevice();
|
||||||
|
device.WriteFeatureData(msgBackup);
|
||||||
|
device.CloseDevice();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,49 +312,6 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int SetXGM(byte[] msg)
|
|
||||||
{
|
|
||||||
|
|
||||||
//Logger.WriteLine("XGM Payload :" + BitConverter.ToString(msg));
|
|
||||||
|
|
||||||
var payload = new byte[300];
|
|
||||||
Array.Copy(msg, payload, msg.Length);
|
|
||||||
|
|
||||||
foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }, 0))
|
|
||||||
{
|
|
||||||
device.OpenDevice();
|
|
||||||
Logger.WriteLine("XGM " + device.Attributes.ProductHexId + "|" + device.Capabilities.FeatureReportByteLength + ":" + BitConverter.ToString(msg));
|
|
||||||
device.WriteFeatureData(payload);
|
|
||||||
device.CloseDevice();
|
|
||||||
//return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyXGMLight(bool status)
|
|
||||||
{
|
|
||||||
SetXGM(new byte[] { 0x5e, 0xc5, status ? (byte)0x50 : (byte)0 });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static int ResetXGM()
|
|
||||||
{
|
|
||||||
return SetXGM(new byte[] { 0x5e, 0xd1, 0x02 });
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int SetXGMFan(byte[] curve)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (AsusACPI.IsInvalidCurve(curve)) return -1;
|
|
||||||
|
|
||||||
byte[] msg = new byte[19];
|
|
||||||
Array.Copy(new byte[] { 0x5e, 0xd1, 0x01 }, msg, 3);
|
|
||||||
Array.Copy(curve, 0, msg, 3, curve.Length);
|
|
||||||
|
|
||||||
return SetXGM(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void ApplyAura()
|
public static void ApplyAura()
|
||||||
{
|
{
|
||||||
@@ -393,6 +357,51 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Reference : thanks to https://github.com/RomanYazvinsky/ for initial discovery of XGM payloads
|
||||||
|
public static int SetXGM(byte[] msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Logger.WriteLine("XGM Payload :" + BitConverter.ToString(msg));
|
||||||
|
|
||||||
|
var payload = new byte[300];
|
||||||
|
Array.Copy(msg, payload, msg.Length);
|
||||||
|
|
||||||
|
foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }, 0, 300))
|
||||||
|
{
|
||||||
|
device.OpenDevice();
|
||||||
|
Logger.WriteLine("XGM " + device.Attributes.ProductHexId + "|" + device.Capabilities.FeatureReportByteLength + ":" + BitConverter.ToString(msg));
|
||||||
|
device.WriteFeatureData(payload);
|
||||||
|
device.CloseDevice();
|
||||||
|
//return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ApplyXGMLight(bool status)
|
||||||
|
{
|
||||||
|
SetXGM(new byte[] { 0x5e, 0xc5, status ? (byte)0x50 : (byte)0 });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int ResetXGM()
|
||||||
|
{
|
||||||
|
return SetXGM(new byte[] { 0x5e, 0xd1, 0x02 });
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int SetXGMFan(byte[] curve)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (AsusACPI.IsInvalidCurve(curve)) return -1;
|
||||||
|
|
||||||
|
byte[] msg = new byte[19];
|
||||||
|
Array.Copy(new byte[] { 0x5e, 0xd1, 0x01 }, msg, 3);
|
||||||
|
Array.Copy(curve, 0, msg, 3, curve.Length);
|
||||||
|
|
||||||
|
return SetXGM(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
59
app/Extra.Designer.cs
generated
59
app/Extra.Designer.cs
generated
@@ -51,6 +51,8 @@ namespace GHelper
|
|||||||
pictureHelp = new PictureBox();
|
pictureHelp = new PictureBox();
|
||||||
groupLight = new GroupBox();
|
groupLight = new GroupBox();
|
||||||
panelBacklightExtra = new Panel();
|
panelBacklightExtra = new Panel();
|
||||||
|
numericBacklightPluggedTime = new NumericUpDown();
|
||||||
|
labelBacklightTimeoutPlugged = new Label();
|
||||||
numericBacklightTime = new NumericUpDown();
|
numericBacklightTime = new NumericUpDown();
|
||||||
labelBacklightTimeout = new Label();
|
labelBacklightTimeout = new Label();
|
||||||
labelBrightness = new Label();
|
labelBrightness = new Label();
|
||||||
@@ -81,24 +83,23 @@ namespace GHelper
|
|||||||
checkSleepLid = new CheckBox();
|
checkSleepLid = new CheckBox();
|
||||||
checkShutdownLid = new CheckBox();
|
checkShutdownLid = new CheckBox();
|
||||||
groupOther = new GroupBox();
|
groupOther = new GroupBox();
|
||||||
|
checkGpuApps = new CheckBox();
|
||||||
checkAutoApplyWindowsPowerMode = new CheckBox();
|
checkAutoApplyWindowsPowerMode = new CheckBox();
|
||||||
checkKeyboardAuto = new CheckBox();
|
checkKeyboardAuto = new CheckBox();
|
||||||
checkUSBC = new CheckBox();
|
checkUSBC = new CheckBox();
|
||||||
checkNoOverdrive = new CheckBox();
|
checkNoOverdrive = new CheckBox();
|
||||||
checkTopmost = new CheckBox();
|
checkTopmost = new CheckBox();
|
||||||
numericBacklightPluggedTime = new NumericUpDown();
|
|
||||||
labelBacklightTimeoutPlugged = new Label();
|
|
||||||
groupBindings.SuspendLayout();
|
groupBindings.SuspendLayout();
|
||||||
tableKeys.SuspendLayout();
|
tableKeys.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureHelp).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureHelp).BeginInit();
|
||||||
groupLight.SuspendLayout();
|
groupLight.SuspendLayout();
|
||||||
panelBacklightExtra.SuspendLayout();
|
panelBacklightExtra.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericBacklightPluggedTime).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericBacklightTime).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericBacklightTime).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)trackBrightness).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackBrightness).BeginInit();
|
||||||
panelXMG.SuspendLayout();
|
panelXMG.SuspendLayout();
|
||||||
tableBacklight.SuspendLayout();
|
tableBacklight.SuspendLayout();
|
||||||
groupOther.SuspendLayout();
|
groupOther.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)numericBacklightPluggedTime).BeginInit();
|
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBindings
|
// groupBindings
|
||||||
@@ -326,6 +327,22 @@ namespace GHelper
|
|||||||
panelBacklightExtra.Size = new Size(948, 241);
|
panelBacklightExtra.Size = new Size(948, 241);
|
||||||
panelBacklightExtra.TabIndex = 43;
|
panelBacklightExtra.TabIndex = 43;
|
||||||
//
|
//
|
||||||
|
// numericBacklightPluggedTime
|
||||||
|
//
|
||||||
|
numericBacklightPluggedTime.Location = new Point(655, 181);
|
||||||
|
numericBacklightPluggedTime.Maximum = new decimal(new int[] { 3600, 0, 0, 0 });
|
||||||
|
numericBacklightPluggedTime.Name = "numericBacklightPluggedTime";
|
||||||
|
numericBacklightPluggedTime.Size = new Size(240, 39);
|
||||||
|
numericBacklightPluggedTime.TabIndex = 49;
|
||||||
|
//
|
||||||
|
// labelBacklightTimeoutPlugged
|
||||||
|
//
|
||||||
|
labelBacklightTimeoutPlugged.Location = new Point(13, 183);
|
||||||
|
labelBacklightTimeoutPlugged.Name = "labelBacklightTimeoutPlugged";
|
||||||
|
labelBacklightTimeoutPlugged.Size = new Size(636, 45);
|
||||||
|
labelBacklightTimeoutPlugged.TabIndex = 48;
|
||||||
|
labelBacklightTimeoutPlugged.Text = "Seconds to turn off backlight when plugged";
|
||||||
|
//
|
||||||
// numericBacklightTime
|
// numericBacklightTime
|
||||||
//
|
//
|
||||||
numericBacklightTime.Location = new Point(655, 133);
|
numericBacklightTime.Location = new Point(655, 133);
|
||||||
@@ -667,6 +684,7 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
// groupOther
|
// groupOther
|
||||||
//
|
//
|
||||||
|
groupOther.Controls.Add(checkGpuApps);
|
||||||
groupOther.Controls.Add(checkAutoApplyWindowsPowerMode);
|
groupOther.Controls.Add(checkAutoApplyWindowsPowerMode);
|
||||||
groupOther.Controls.Add(checkKeyboardAuto);
|
groupOther.Controls.Add(checkKeyboardAuto);
|
||||||
groupOther.Controls.Add(checkUSBC);
|
groupOther.Controls.Add(checkUSBC);
|
||||||
@@ -675,15 +693,25 @@ namespace GHelper
|
|||||||
groupOther.Dock = DockStyle.Top;
|
groupOther.Dock = DockStyle.Top;
|
||||||
groupOther.Location = new Point(10, 897);
|
groupOther.Location = new Point(10, 897);
|
||||||
groupOther.Name = "groupOther";
|
groupOther.Name = "groupOther";
|
||||||
groupOther.Size = new Size(954, 276);
|
groupOther.Size = new Size(954, 310);
|
||||||
groupOther.TabIndex = 2;
|
groupOther.TabIndex = 2;
|
||||||
groupOther.TabStop = false;
|
groupOther.TabStop = false;
|
||||||
groupOther.Text = "Other";
|
groupOther.Text = "Other";
|
||||||
//
|
//
|
||||||
|
// checkGpuApps
|
||||||
|
//
|
||||||
|
checkGpuApps.AutoSize = true;
|
||||||
|
checkGpuApps.Location = new Point(25, 220);
|
||||||
|
checkGpuApps.Name = "checkGpuApps";
|
||||||
|
checkGpuApps.Size = new Size(544, 36);
|
||||||
|
checkGpuApps.TabIndex = 48;
|
||||||
|
checkGpuApps.Text = "Stop all apps using GPU when switching to Eco";
|
||||||
|
checkGpuApps.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// checkAutoApplyWindowsPowerMode
|
// checkAutoApplyWindowsPowerMode
|
||||||
//
|
//
|
||||||
checkAutoApplyWindowsPowerMode.AutoSize = true;
|
checkAutoApplyWindowsPowerMode.AutoSize = true;
|
||||||
checkAutoApplyWindowsPowerMode.Location = new Point(25, 220);
|
checkAutoApplyWindowsPowerMode.Location = new Point(25, 268);
|
||||||
checkAutoApplyWindowsPowerMode.Name = "checkAutoApplyWindowsPowerMode";
|
checkAutoApplyWindowsPowerMode.Name = "checkAutoApplyWindowsPowerMode";
|
||||||
checkAutoApplyWindowsPowerMode.Size = new Size(416, 36);
|
checkAutoApplyWindowsPowerMode.Size = new Size(416, 36);
|
||||||
checkAutoApplyWindowsPowerMode.TabIndex = 47;
|
checkAutoApplyWindowsPowerMode.TabIndex = 47;
|
||||||
@@ -731,29 +759,13 @@ namespace GHelper
|
|||||||
checkTopmost.Text = Strings.WindowTop;
|
checkTopmost.Text = Strings.WindowTop;
|
||||||
checkTopmost.UseVisualStyleBackColor = true;
|
checkTopmost.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// numericBacklightPluggedTime
|
|
||||||
//
|
|
||||||
numericBacklightPluggedTime.Location = new Point(655, 181);
|
|
||||||
numericBacklightPluggedTime.Maximum = new decimal(new int[] { 3600, 0, 0, 0 });
|
|
||||||
numericBacklightPluggedTime.Name = "numericBacklightPluggedTime";
|
|
||||||
numericBacklightPluggedTime.Size = new Size(240, 39);
|
|
||||||
numericBacklightPluggedTime.TabIndex = 49;
|
|
||||||
//
|
|
||||||
// labelBacklightTimeoutPlugged
|
|
||||||
//
|
|
||||||
labelBacklightTimeoutPlugged.Location = new Point(13, 183);
|
|
||||||
labelBacklightTimeoutPlugged.Name = "labelBacklightTimeoutPlugged";
|
|
||||||
labelBacklightTimeoutPlugged.Size = new Size(636, 45);
|
|
||||||
labelBacklightTimeoutPlugged.TabIndex = 48;
|
|
||||||
labelBacklightTimeoutPlugged.Text = "Seconds to turn off backlight when plugged";
|
|
||||||
//
|
|
||||||
// Extra
|
// Extra
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
AutoSize = true;
|
AutoSize = true;
|
||||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
ClientSize = new Size(974, 1131);
|
ClientSize = new Size(974, 1220);
|
||||||
Controls.Add(groupOther);
|
Controls.Add(groupOther);
|
||||||
Controls.Add(groupLight);
|
Controls.Add(groupLight);
|
||||||
Controls.Add(groupBindings);
|
Controls.Add(groupBindings);
|
||||||
@@ -775,6 +787,7 @@ namespace GHelper
|
|||||||
groupLight.PerformLayout();
|
groupLight.PerformLayout();
|
||||||
panelBacklightExtra.ResumeLayout(false);
|
panelBacklightExtra.ResumeLayout(false);
|
||||||
panelBacklightExtra.PerformLayout();
|
panelBacklightExtra.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericBacklightPluggedTime).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericBacklightTime).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericBacklightTime).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)trackBrightness).EndInit();
|
((System.ComponentModel.ISupportInitialize)trackBrightness).EndInit();
|
||||||
panelXMG.ResumeLayout(false);
|
panelXMG.ResumeLayout(false);
|
||||||
@@ -782,7 +795,6 @@ namespace GHelper
|
|||||||
tableBacklight.ResumeLayout(false);
|
tableBacklight.ResumeLayout(false);
|
||||||
groupOther.ResumeLayout(false);
|
groupOther.ResumeLayout(false);
|
||||||
groupOther.PerformLayout();
|
groupOther.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)numericBacklightPluggedTime).EndInit();
|
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@@ -846,5 +858,6 @@ namespace GHelper
|
|||||||
private TextBox textM1;
|
private TextBox textM1;
|
||||||
private NumericUpDown numericBacklightPluggedTime;
|
private NumericUpDown numericBacklightPluggedTime;
|
||||||
private Label labelBacklightTimeoutPlugged;
|
private Label labelBacklightTimeoutPlugged;
|
||||||
|
private CheckBox checkGpuApps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
10
app/Extra.cs
10
app/Extra.cs
@@ -99,6 +99,8 @@ namespace GHelper
|
|||||||
labelBacklightLid.Text = Properties.Strings.Lid;
|
labelBacklightLid.Text = Properties.Strings.Lid;
|
||||||
labelBacklightLogo.Text = Properties.Strings.Logo;
|
labelBacklightLogo.Text = Properties.Strings.Logo;
|
||||||
|
|
||||||
|
checkGpuApps.Text = Properties.Strings.KillGpuApps;
|
||||||
|
|
||||||
Text = Properties.Strings.ExtraSettings;
|
Text = Properties.Strings.ExtraSettings;
|
||||||
|
|
||||||
InitTheme();
|
InitTheme();
|
||||||
@@ -217,6 +219,14 @@ namespace GHelper
|
|||||||
numericBacklightTime.ValueChanged += NumericBacklightTime_ValueChanged;
|
numericBacklightTime.ValueChanged += NumericBacklightTime_ValueChanged;
|
||||||
numericBacklightPluggedTime.ValueChanged += NumericBacklightTime_ValueChanged;
|
numericBacklightPluggedTime.ValueChanged += NumericBacklightTime_ValueChanged;
|
||||||
|
|
||||||
|
checkGpuApps.Checked = AppConfig.isConfig("kill_gpu_apps");
|
||||||
|
checkGpuApps.CheckedChanged += CheckGpuApps_CheckedChanged;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckGpuApps_CheckedChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AppConfig.setConfig("kill_gpu_apps", (checkGpuApps.Checked ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NumericBacklightTime_ValueChanged(object? sender, EventArgs e)
|
private void NumericBacklightTime_ValueChanged(object? sender, EventArgs e)
|
||||||
|
|||||||
14
app/Fans.cs
14
app/Fans.cs
@@ -303,7 +303,7 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MinimumSize = new Size(0, Program.settingsForm.Height);
|
Size = MinimumSize = new Size(0, Program.settingsForm.Height);
|
||||||
Height = Program.settingsForm.Height;
|
Height = Program.settingsForm.Height;
|
||||||
Top = Program.settingsForm.Top;
|
Top = Program.settingsForm.Top;
|
||||||
}
|
}
|
||||||
@@ -466,7 +466,6 @@ namespace GHelper
|
|||||||
chartMid.Visible = true;
|
chartMid.Visible = true;
|
||||||
SetChart(chartMid, AsusFan.Mid);
|
SetChart(chartMid, AsusFan.Mid);
|
||||||
LoadProfile(seriesMid, AsusFan.Mid);
|
LoadProfile(seriesMid, AsusFan.Mid);
|
||||||
MinimumSize = new Size(0, chartCount * 400 + 200);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -481,13 +480,22 @@ namespace GHelper
|
|||||||
chartXGM.Visible = true;
|
chartXGM.Visible = true;
|
||||||
SetChart(chartXGM, AsusFan.XGM);
|
SetChart(chartXGM, AsusFan.XGM);
|
||||||
LoadProfile(seriesXGM, AsusFan.XGM);
|
LoadProfile(seriesXGM, AsusFan.XGM);
|
||||||
MinimumSize = new Size(0, chartCount * 400 + 200);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AppConfig.setConfig("xgm_fan", 0);
|
AppConfig.setConfig("xgm_fan", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (chartCount > 2)
|
||||||
|
Size = MinimumSize = new Size(0, (int)(ControlHelper.GetDpiScale(this).Value * (chartCount * 200 + 100)));
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SetChart(chartCPU, AsusFan.CPU);
|
SetChart(chartCPU, AsusFan.CPU);
|
||||||
SetChart(chartGPU, AsusFan.GPU);
|
SetChart(chartGPU, AsusFan.GPU);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.70</AssemblyVersion>
|
<AssemblyVersion>0.71</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using NvAPIWrapper.GPU;
|
using NvAPIWrapper;
|
||||||
|
using NvAPIWrapper.GPU;
|
||||||
using NvAPIWrapper.Native;
|
using NvAPIWrapper.Native;
|
||||||
using NvAPIWrapper.Native.Delegates;
|
using NvAPIWrapper.Native.Delegates;
|
||||||
using NvAPIWrapper.Native.GPU;
|
using NvAPIWrapper.Native.GPU;
|
||||||
@@ -35,8 +36,7 @@ public class NvidiaGpuControl : IGpuControl
|
|||||||
|
|
||||||
public int? GetCurrentTemperature()
|
public int? GetCurrentTemperature()
|
||||||
{
|
{
|
||||||
if (!IsValid)
|
if (!IsValid) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
PhysicalGPU internalGpu = _internalGpu!;
|
PhysicalGPU internalGpu = _internalGpu!;
|
||||||
IThermalSensor? gpuSensor =
|
IThermalSensor? gpuSensor =
|
||||||
@@ -50,6 +50,38 @@ public class NvidiaGpuControl : IGpuControl
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void KillGPUApps()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!IsValid) return;
|
||||||
|
PhysicalGPU internalGpu = _internalGpu!;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process[] processes = internalGpu.GetActiveApplications();
|
||||||
|
foreach (Process process in processes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
process?.Kill();
|
||||||
|
Logger.WriteLine("Stopped: " + process.ProcessName);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//NVIDIA.RestartDisplayDriver();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public int GetClocks(out int core, out int memory)
|
public int GetClocks(out int core, out int memory)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,10 +60,11 @@ namespace GHelper
|
|||||||
private static nint windowHandle;
|
private static nint windowHandle;
|
||||||
|
|
||||||
public static Keys keyProfile = Keys.F5;
|
public static Keys keyProfile = Keys.F5;
|
||||||
|
public static Keys keyApp = Keys.F12;
|
||||||
|
|
||||||
KeyboardListener listener;
|
KeyboardListener listener;
|
||||||
|
|
||||||
KeyHandler m1, m2, togggle;
|
KeyHandler m1, m2, handlerProfile, handlerApp;
|
||||||
|
|
||||||
public InputDispatcher(nint handle)
|
public InputDispatcher(nint handle)
|
||||||
{
|
{
|
||||||
@@ -76,11 +77,12 @@ namespace GHelper
|
|||||||
Program.acpi.SubscribeToEvents(WatcherEventArrived);
|
Program.acpi.SubscribeToEvents(WatcherEventArrived);
|
||||||
//Task.Run(Program.acpi.RunListener);
|
//Task.Run(Program.acpi.RunListener);
|
||||||
|
|
||||||
|
|
||||||
// CTRL + SHIFT + F5 to cycle profiles
|
// CTRL + SHIFT + F5 to cycle profiles
|
||||||
if (AppConfig.getConfig("keybind_profile") != -1) keyProfile = (Keys)AppConfig.getConfig("keybind_profile");
|
if (AppConfig.getConfig("keybind_profile") != -1) keyProfile = (Keys)AppConfig.getConfig("keybind_profile");
|
||||||
|
|
||||||
togggle = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, keyProfile, windowHandle);
|
handlerProfile = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, keyProfile, windowHandle);
|
||||||
|
handlerApp = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, keyApp, windowHandle);
|
||||||
|
|
||||||
m1 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeDown, windowHandle);
|
m1 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeDown, windowHandle);
|
||||||
m2 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeUp, windowHandle);
|
m2 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeUp, windowHandle);
|
||||||
|
|
||||||
@@ -115,7 +117,7 @@ namespace GHelper
|
|||||||
AsusUSB.ApplyBrightness(AppConfig.getConfig("keyboard_brightness"));
|
AsusUSB.ApplyBrightness(AppConfig.getConfig("keyboard_brightness"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.WriteLine(iddle.TotalSeconds);
|
//Debug.WriteLine(iddle.TotalSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
@@ -144,24 +146,16 @@ namespace GHelper
|
|||||||
string actionM1 = AppConfig.getConfigString("m1");
|
string actionM1 = AppConfig.getConfigString("m1");
|
||||||
string actionM2 = AppConfig.getConfigString("m2");
|
string actionM2 = AppConfig.getConfigString("m2");
|
||||||
|
|
||||||
togggle.Unregiser();
|
handlerProfile.Unregiser();
|
||||||
m1.Unregiser();
|
m1.Unregiser();
|
||||||
m2.Unregiser();
|
m2.Unregiser();
|
||||||
|
|
||||||
if (keyProfile != Keys.None)
|
if (keyProfile != Keys.None) handlerProfile.Register();
|
||||||
{
|
if (keyApp != Keys.None) handlerApp.Register();
|
||||||
togggle.Register();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actionM1 is not null && actionM1.Length > 0)
|
if (actionM1 is not null && actionM1.Length > 0) m1.Register();
|
||||||
{
|
|
||||||
m1.Register();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actionM2 is not null && actionM2.Length > 0)
|
if (actionM2 is not null && actionM2.Length > 0) m2.Register();
|
||||||
{
|
|
||||||
m2.Register();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
app/Properties/Strings.Designer.cs
generated
9
app/Properties/Strings.Designer.cs
generated
@@ -627,6 +627,15 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Stop all apps using GPU when switching to Eco.
|
||||||
|
/// </summary>
|
||||||
|
internal static string KillGpuApps {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("KillGpuApps", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Laptop Backlight.
|
/// Looks up a localized string similar to Laptop Backlight.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -306,6 +306,9 @@
|
|||||||
<data name="KeyboardAuto" xml:space="preserve">
|
<data name="KeyboardAuto" xml:space="preserve">
|
||||||
<value>Lower backlight brightness on battery and back when plugged</value>
|
<value>Lower backlight brightness on battery and back when plugged</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="KillGpuApps" xml:space="preserve">
|
||||||
|
<value>Stop all apps using GPU when switching to Eco</value>
|
||||||
|
</data>
|
||||||
<data name="LaptopBacklight" xml:space="preserve">
|
<data name="LaptopBacklight" xml:space="preserve">
|
||||||
<value>Laptop Backlight</value>
|
<value>Laptop Backlight</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ namespace GHelper
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (key == InputDispatcher.keyProfile) CyclePerformanceMode();
|
if (key == InputDispatcher.keyProfile) CyclePerformanceMode();
|
||||||
|
if (key == InputDispatcher.keyApp) Program.SettingsToggle();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +204,8 @@ namespace GHelper
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
base.WndProc(ref m);
|
base.WndProc(ref m);
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.WriteLine(ex.ToString());
|
Debug.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
@@ -1414,7 +1416,7 @@ namespace GHelper
|
|||||||
if (eco < 0)
|
if (eco < 0)
|
||||||
{
|
{
|
||||||
tableGPU.Visible = false;
|
tableGPU.Visible = false;
|
||||||
if (Program.acpi.DeviceGet(AsusACPI.GPU_Fan) < 0 ) panelGPU.Visible = false;
|
if (Program.acpi.DeviceGet(AsusACPI.GPU_Fan) < 0) panelGPU.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1477,9 +1479,15 @@ namespace GHelper
|
|||||||
protected static void KillGPUApps()
|
protected static void KillGPUApps()
|
||||||
{
|
{
|
||||||
string[] tokill = { "EADesktop", "RadeonSoftware", "epicgameslauncher" };
|
string[] tokill = { "EADesktop", "RadeonSoftware", "epicgameslauncher" };
|
||||||
|
|
||||||
foreach (string kill in tokill)
|
foreach (string kill in tokill)
|
||||||
foreach (var process in Process.GetProcessesByName(kill)) process.Kill();
|
foreach (var process in Process.GetProcessesByName(kill)) process.Kill();
|
||||||
|
|
||||||
|
if (AppConfig.isConfig("kill_gpu_apps") && HardwareControl.GpuControl is not null && HardwareControl.GpuControl.IsNvidia)
|
||||||
|
{
|
||||||
|
NvidiaGpuControl nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
|
||||||
|
nvControl.KillGPUApps();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetGPUEco(int eco, bool hardWay = false)
|
public void SetGPUEco(int eco, bool hardWay = false)
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ sc config ASUSSwitch start= auto
|
|||||||
sc config ASUSSystemAnalysis start= auto
|
sc config ASUSSystemAnalysis start= auto
|
||||||
sc config ASUSSystemDiagnosis start= auto
|
sc config ASUSSystemDiagnosis start= auto
|
||||||
sc config ArmouryCrateControlInterface start= auto
|
sc config ArmouryCrateControlInterface start= auto
|
||||||
|
sc config AsusCertService start= auto
|
||||||
|
sc config ASUSOptimization start= auto
|
||||||
|
|
||||||
sc START AsusAppService
|
sc START AsusAppService
|
||||||
sc START ASUSLinkNear
|
sc START ASUSLinkNear
|
||||||
@@ -14,6 +16,8 @@ sc START ASUSSoftwareManager
|
|||||||
sc START ASUSSwitch
|
sc START ASUSSwitch
|
||||||
sc START ASUSSystemAnalysis
|
sc START ASUSSystemAnalysis
|
||||||
sc START ASUSSystemDiagnosis
|
sc START ASUSSystemDiagnosis
|
||||||
sc START ArmouryCrateControlInterface
|
sc START ArmouryCrateControlInterface
|
||||||
|
sc START AsusCertService
|
||||||
|
sc START ASUSOptimization
|
||||||
|
|
||||||
set /p asd="Hit enter to finish"
|
set /p asd="Hit enter to finish"
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ sc STOP ASUSSoftwareManager
|
|||||||
sc STOP ASUSSwitch
|
sc STOP ASUSSwitch
|
||||||
sc STOP ASUSSystemAnalysis
|
sc STOP ASUSSystemAnalysis
|
||||||
sc STOP ASUSSystemDiagnosis
|
sc STOP ASUSSystemDiagnosis
|
||||||
sc STOP ArmouryCrateControlInterface
|
sc STOP ArmouryCrateControlInterface
|
||||||
|
sc STOP AsusCertService
|
||||||
|
sc STOP ASUSOptimization
|
||||||
|
|
||||||
sc config AsusAppService start= disabled
|
sc config AsusAppService start= disabled
|
||||||
sc config ASUSLinkNear start= disabled
|
sc config ASUSLinkNear start= disabled
|
||||||
@@ -15,5 +17,7 @@ sc config ASUSSwitch start= disabled
|
|||||||
sc config ASUSSystemAnalysis start= disabled
|
sc config ASUSSystemAnalysis start= disabled
|
||||||
sc config ASUSSystemDiagnosis start= disabled
|
sc config ASUSSystemDiagnosis start= disabled
|
||||||
sc config ArmouryCrateControlInterface start= disabled
|
sc config ArmouryCrateControlInterface start= disabled
|
||||||
|
sc config AsusCertService start= disabled
|
||||||
|
sc config ASUSOptimization start= disabled
|
||||||
|
|
||||||
set /p asd="Hit enter to finish"
|
set /p asd="Hit enter to finish"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Lightweight Armoury Crate alternative for Asus lapopts. A small utility that all
|
|||||||
## [:floppy_disk: Download App](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip)
|
## [:floppy_disk: Download App](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip)
|
||||||
|
|
||||||
If you like this app, please [star :star: it on Github](https://github.com/seerge/g-helper) and spread a word about it!
|
If you like this app, please [star :star: it on Github](https://github.com/seerge/g-helper) and spread a word about it!
|
||||||
### [:euro: Donate EUR](https://www.paypal.com/donate/?hosted_button_id=4HMSHS4EBQWTA) | [💵 Donate USD](https://www.paypal.com/donate/?hosted_button_id=SRM6QUX6ACXDY) | [:coin: Donate via Stripe](https://buy.stripe.com/00gaFJ9Lf79v7WobII)
|
### [:euro: Donate EUR](https://www.paypal.com/donate/?hosted_button_id=4HMSHS4EBQWTA) | [💵 Donate USD](https://www.paypal.com/donate/?hosted_button_id=SRM6QUX6ACXDY) | [:credit_card: Donate via Stripe](https://buy.stripe.com/00gaFJ9Lf79v7WobII)
|
||||||
|
|
||||||
_If you post about the app - please include a link. Thanks._
|
_If you post about the app - please include a link. Thanks._
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user