mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7afe94b8d | ||
|
|
97c97e8e19 | ||
|
|
ffc5a6f641 | ||
|
|
f87e6c5c88 | ||
|
|
22f136fe9e | ||
|
|
6d85376734 | ||
|
|
62512a7c05 | ||
|
|
7a6301328c | ||
|
|
3c6c4d122d | ||
|
|
0142c25929 | ||
|
|
27bc7339d8 | ||
|
|
2985fe378c | ||
|
|
71daba25a8 | ||
|
|
16feeb05a1 | ||
|
|
c69bf65c84 | ||
|
|
56ea434626 | ||
|
|
432508cfc5 | ||
|
|
deb515066d | ||
|
|
ac19a822f7 | ||
|
|
41caaefc97 |
@@ -1,4 +1,5 @@
|
||||
using System.Management;
|
||||
using GHelper;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class ASUSWmi
|
||||
@@ -218,6 +219,20 @@ public class ASUSWmi
|
||||
return CallMethod(DSTS, args);
|
||||
}
|
||||
|
||||
public int SetGPUEco(int eco)
|
||||
{
|
||||
int ecoFlag = DeviceGet(GPUEco);
|
||||
if (ecoFlag < 0) return -1;
|
||||
|
||||
if (ecoFlag == 1 && eco == 0)
|
||||
return DeviceSet(GPUEco, eco, "GPUEco");
|
||||
|
||||
if (ecoFlag == 0 && eco == 1)
|
||||
return DeviceSet(GPUEco, eco, "GPUEco");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public int SetFanCurve(int device, byte[] curve)
|
||||
{
|
||||
|
||||
48
app/Aura.cs
48
app/Aura.cs
@@ -1,6 +1,8 @@
|
||||
using HidLibrary;
|
||||
using Microsoft.Win32;
|
||||
using OSD;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
@@ -16,14 +18,10 @@ namespace GHelper
|
||||
SleepKeyb = 1 << 5,
|
||||
ShutdownLogo = 1 << 6,
|
||||
ShutdownKeyb = 1 << 7,
|
||||
Unknown1 = 1 << 8,
|
||||
BootBar = 1u << (7 + 2),
|
||||
AwakeBar = 1u << (7 + 3),
|
||||
SleepBar = 1u << (7 + 4),
|
||||
ShutdownBar = 1u << (7 + 5),
|
||||
Unknown2 = 1 << 13,
|
||||
Unknown3 = 1 << 14,
|
||||
Unknown4 = 1 << 15,
|
||||
BootLid = 1u << (15 + 1),
|
||||
AwakeLid = 1u << (15 + 2),
|
||||
SleepLid = 1u << (15 + 3),
|
||||
@@ -59,7 +57,7 @@ namespace GHelper
|
||||
static byte[] MESSAGE_SET = { 0x5d, 0xb5, 0, 0, 0 };
|
||||
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 };
|
||||
|
||||
static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0 };
|
||||
static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0, 0x18c6 };
|
||||
|
||||
private static int mode = 0;
|
||||
private static int speed = 1;
|
||||
@@ -197,15 +195,16 @@ namespace GHelper
|
||||
{
|
||||
byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness };
|
||||
|
||||
foreach (HidDevice device in GetHidDevices(new int[] { 0x19b6 }))
|
||||
var devices = GetHidDevices(deviceIds);
|
||||
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
|
||||
foreach (HidDevice device in devices)
|
||||
{
|
||||
device.OpenDevice();
|
||||
device.Write(msg);
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardBrightness(brightness);
|
||||
}
|
||||
@@ -216,18 +215,18 @@ namespace GHelper
|
||||
|
||||
byte[] msg = AuraDev19b6Extensions.ToBytes(flags.ToArray());
|
||||
|
||||
Debug.WriteLine(BitConverter.ToString(msg));
|
||||
|
||||
foreach (HidDevice device in GetHidDevices(new int[] { 0x19b6 }))
|
||||
var devices = GetHidDevices(deviceIds);
|
||||
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
|
||||
foreach (HidDevice device in devices)
|
||||
{
|
||||
device.OpenDevice();
|
||||
device.Write(msg);
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
|
||||
//if (Program.config.ContainsModel("TUF"))
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardPower(
|
||||
flags.Contains(AuraDev19b6.AwakeKeyb),
|
||||
flags.Contains(AuraDev19b6.BootKeyb),
|
||||
@@ -273,7 +272,10 @@ namespace GHelper
|
||||
|
||||
byte[] msg = AuraMessage(Mode, Color1, Color2, _speed);
|
||||
|
||||
foreach (HidDevice device in GetHidDevices(deviceIds))
|
||||
var devices = GetHidDevices(deviceIds);
|
||||
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
|
||||
foreach (HidDevice device in devices)
|
||||
{
|
||||
device.OpenDevice();
|
||||
device.Write(msg);
|
||||
@@ -286,6 +288,24 @@ namespace GHelper
|
||||
Program.wmi.TUFKeyboardRGB(Mode, Color1, _speed);
|
||||
|
||||
}
|
||||
|
||||
public static void SetBacklightOffDelay(int value = 60)
|
||||
{
|
||||
try
|
||||
{
|
||||
RegistryKey myKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\ASUS\ASUS System Control Interface\AsusOptimization\ASUS Keyboard Hotkeys", true);
|
||||
if (myKey != null)
|
||||
{
|
||||
myKey.SetValue("TurnOffKeybdLight", value, RegistryValueKind.DWord);
|
||||
myKey.Close();
|
||||
}
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public static class ControlHelper
|
||||
}
|
||||
|
||||
var chk = control as CheckBox;
|
||||
if (chk != null && chk.Padding.Left > 5)
|
||||
if (chk != null && chk.Padding.Right > 5)
|
||||
{
|
||||
chk.BackColor = RForm.buttonSecond;
|
||||
}
|
||||
|
||||
194
app/Extra.Designer.cs
generated
194
app/Extra.Designer.cs
generated
@@ -44,6 +44,8 @@ namespace GHelper
|
||||
labelM3 = new Label();
|
||||
groupLight = new GroupBox();
|
||||
panelBacklightExtra = new Panel();
|
||||
numericBacklightTime = new NumericUpDown();
|
||||
labelBacklightTimeout = new Label();
|
||||
labelBrightness = new Label();
|
||||
trackBrightness = new TrackBar();
|
||||
labelSpeed = new Label();
|
||||
@@ -72,14 +74,15 @@ namespace GHelper
|
||||
checkSleepLid = new CheckBox();
|
||||
checkShutdownLid = new CheckBox();
|
||||
groupOther = new GroupBox();
|
||||
checkKeyboardAuto = new CheckBox();
|
||||
checkUSBC = new CheckBox();
|
||||
checkNoOverdrive = new CheckBox();
|
||||
checkKeyboardAuto = new CheckBox();
|
||||
checkTopmost = new CheckBox();
|
||||
groupBindings.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureHelp).BeginInit();
|
||||
groupLight.SuspendLayout();
|
||||
panelBacklightExtra.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericBacklightTime).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)trackBrightness).BeginInit();
|
||||
panelXMG.SuspendLayout();
|
||||
tableBacklight.SuspendLayout();
|
||||
@@ -101,7 +104,7 @@ namespace GHelper
|
||||
groupBindings.Dock = DockStyle.Top;
|
||||
groupBindings.Location = new Point(10, 10);
|
||||
groupBindings.Name = "groupBindings";
|
||||
groupBindings.Size = new Size(848, 242);
|
||||
groupBindings.Size = new Size(954, 242);
|
||||
groupBindings.TabIndex = 0;
|
||||
groupBindings.TabStop = false;
|
||||
groupBindings.Text = "Key Bindings";
|
||||
@@ -111,7 +114,7 @@ namespace GHelper
|
||||
pictureHelp.BackgroundImage = Resources.icons8_help_64;
|
||||
pictureHelp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
pictureHelp.Cursor = Cursors.Hand;
|
||||
pictureHelp.Location = new Point(744, 57);
|
||||
pictureHelp.Location = new Point(884, 58);
|
||||
pictureHelp.Name = "pictureHelp";
|
||||
pictureHelp.Size = new Size(32, 32);
|
||||
pictureHelp.TabIndex = 9;
|
||||
@@ -122,7 +125,7 @@ namespace GHelper
|
||||
textFNF4.Location = new Point(415, 176);
|
||||
textFNF4.Name = "textFNF4";
|
||||
textFNF4.PlaceholderText = "action";
|
||||
textFNF4.Size = new Size(320, 39);
|
||||
textFNF4.Size = new Size(448, 39);
|
||||
textFNF4.TabIndex = 8;
|
||||
//
|
||||
// comboFNF4
|
||||
@@ -149,7 +152,7 @@ namespace GHelper
|
||||
textM4.Location = new Point(415, 113);
|
||||
textM4.Name = "textM4";
|
||||
textM4.PlaceholderText = "action";
|
||||
textM4.Size = new Size(320, 39);
|
||||
textM4.Size = new Size(448, 39);
|
||||
textM4.TabIndex = 5;
|
||||
//
|
||||
// textM3
|
||||
@@ -157,7 +160,7 @@ namespace GHelper
|
||||
textM3.Location = new Point(415, 54);
|
||||
textM3.Name = "textM3";
|
||||
textM3.PlaceholderText = "notepad /p \"file.txt\"";
|
||||
textM3.Size = new Size(320, 39);
|
||||
textM3.Size = new Size(448, 39);
|
||||
textM3.TabIndex = 4;
|
||||
//
|
||||
// comboM4
|
||||
@@ -209,14 +212,15 @@ namespace GHelper
|
||||
groupLight.Dock = DockStyle.Top;
|
||||
groupLight.Location = new Point(10, 252);
|
||||
groupLight.Name = "groupLight";
|
||||
groupLight.Size = new Size(848, 475);
|
||||
groupLight.Size = new Size(954, 516);
|
||||
groupLight.TabIndex = 1;
|
||||
groupLight.TabStop = false;
|
||||
groupLight.Text = "Keyboard Backlight";
|
||||
//
|
||||
// panelBacklightExtra
|
||||
//
|
||||
panelBacklightExtra.AutoSize = true;
|
||||
panelBacklightExtra.Controls.Add(numericBacklightTime);
|
||||
panelBacklightExtra.Controls.Add(labelBacklightTimeout);
|
||||
panelBacklightExtra.Controls.Add(labelBrightness);
|
||||
panelBacklightExtra.Controls.Add(trackBrightness);
|
||||
panelBacklightExtra.Controls.Add(labelSpeed);
|
||||
@@ -224,9 +228,25 @@ namespace GHelper
|
||||
panelBacklightExtra.Dock = DockStyle.Top;
|
||||
panelBacklightExtra.Location = new Point(3, 319);
|
||||
panelBacklightExtra.Name = "panelBacklightExtra";
|
||||
panelBacklightExtra.Size = new Size(842, 153);
|
||||
panelBacklightExtra.Size = new Size(948, 194);
|
||||
panelBacklightExtra.TabIndex = 43;
|
||||
//
|
||||
// numericBacklightTime
|
||||
//
|
||||
numericBacklightTime.Location = new Point(477, 131);
|
||||
numericBacklightTime.Maximum = new decimal(new int[] { 3600, 0, 0, 0 });
|
||||
numericBacklightTime.Name = "numericBacklightTime";
|
||||
numericBacklightTime.Size = new Size(240, 39);
|
||||
numericBacklightTime.TabIndex = 47;
|
||||
//
|
||||
// labelBacklightTimeout
|
||||
//
|
||||
labelBacklightTimeout.Location = new Point(13, 133);
|
||||
labelBacklightTimeout.Name = "labelBacklightTimeout";
|
||||
labelBacklightTimeout.Size = new Size(489, 45);
|
||||
labelBacklightTimeout.TabIndex = 46;
|
||||
labelBacklightTimeout.Text = "Seconds to turn off backlight on battery";
|
||||
//
|
||||
// labelBrightness
|
||||
//
|
||||
labelBrightness.Location = new Point(13, 76);
|
||||
@@ -237,6 +257,7 @@ namespace GHelper
|
||||
//
|
||||
// trackBrightness
|
||||
//
|
||||
trackBrightness.LargeChange = 1;
|
||||
trackBrightness.Location = new Point(216, 60);
|
||||
trackBrightness.Maximum = 3;
|
||||
trackBrightness.Name = "trackBrightness";
|
||||
@@ -276,7 +297,7 @@ namespace GHelper
|
||||
panelXMG.Dock = DockStyle.Top;
|
||||
panelXMG.Location = new Point(3, 261);
|
||||
panelXMG.Name = "panelXMG";
|
||||
panelXMG.Size = new Size(842, 58);
|
||||
panelXMG.Size = new Size(948, 58);
|
||||
panelXMG.TabIndex = 42;
|
||||
//
|
||||
// checkXMG
|
||||
@@ -328,243 +349,254 @@ namespace GHelper
|
||||
tableBacklight.RowStyles.Add(new RowStyle());
|
||||
tableBacklight.RowStyles.Add(new RowStyle());
|
||||
tableBacklight.RowStyles.Add(new RowStyle());
|
||||
tableBacklight.Size = new Size(842, 226);
|
||||
tableBacklight.Size = new Size(948, 226);
|
||||
tableBacklight.TabIndex = 41;
|
||||
//
|
||||
// labelBacklight
|
||||
//
|
||||
labelBacklight.AutoSize = true;
|
||||
labelBacklight.Dock = DockStyle.Fill;
|
||||
labelBacklight.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelBacklight.Location = new Point(3, 0);
|
||||
labelBacklight.Name = "labelBacklight";
|
||||
labelBacklight.Padding = new Padding(10, 5, 5, 5);
|
||||
labelBacklight.Size = new Size(139, 42);
|
||||
labelBacklight.Size = new Size(231, 42);
|
||||
labelBacklight.TabIndex = 6;
|
||||
labelBacklight.Text = "Keyboard";
|
||||
//
|
||||
// checkAwake
|
||||
//
|
||||
checkAwake.AutoSize = true;
|
||||
checkAwake.Dock = DockStyle.Fill;
|
||||
checkAwake.Location = new Point(3, 45);
|
||||
checkAwake.Name = "checkAwake";
|
||||
checkAwake.Padding = new Padding(15, 2, 5, 2);
|
||||
checkAwake.Size = new Size(135, 40);
|
||||
checkAwake.Size = new Size(231, 40);
|
||||
checkAwake.TabIndex = 1;
|
||||
checkAwake.Text = Strings.Awake;
|
||||
checkAwake.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoot
|
||||
//
|
||||
checkBoot.AutoSize = true;
|
||||
checkBoot.Dock = DockStyle.Fill;
|
||||
checkBoot.Location = new Point(3, 91);
|
||||
checkBoot.Name = "checkBoot";
|
||||
checkBoot.Padding = new Padding(15, 2, 5, 2);
|
||||
checkBoot.Size = new Size(116, 40);
|
||||
checkBoot.Size = new Size(231, 40);
|
||||
checkBoot.TabIndex = 2;
|
||||
checkBoot.Text = Strings.Boot;
|
||||
checkBoot.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkSleep
|
||||
//
|
||||
checkSleep.AutoSize = true;
|
||||
checkSleep.Dock = DockStyle.Fill;
|
||||
checkSleep.Location = new Point(3, 137);
|
||||
checkSleep.Name = "checkSleep";
|
||||
checkSleep.Padding = new Padding(15, 2, 5, 2);
|
||||
checkSleep.Size = new Size(125, 40);
|
||||
checkSleep.Size = new Size(231, 40);
|
||||
checkSleep.TabIndex = 3;
|
||||
checkSleep.Text = Strings.Sleep;
|
||||
checkSleep.Text = "Sleep";
|
||||
checkSleep.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkShutdown
|
||||
//
|
||||
checkShutdown.AutoSize = true;
|
||||
checkShutdown.Dock = DockStyle.Fill;
|
||||
checkShutdown.Location = new Point(3, 183);
|
||||
checkShutdown.Name = "checkShutdown";
|
||||
checkShutdown.Padding = new Padding(15, 2, 5, 2);
|
||||
checkShutdown.Size = new Size(174, 40);
|
||||
checkShutdown.Size = new Size(231, 40);
|
||||
checkShutdown.TabIndex = 4;
|
||||
checkShutdown.Text = Strings.Shutdown;
|
||||
checkShutdown.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelBacklightLogo
|
||||
//
|
||||
labelBacklightLogo.AutoSize = true;
|
||||
labelBacklightLogo.Dock = DockStyle.Fill;
|
||||
labelBacklightLogo.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelBacklightLogo.Location = new Point(213, 0);
|
||||
labelBacklightLogo.Location = new Point(240, 0);
|
||||
labelBacklightLogo.Name = "labelBacklightLogo";
|
||||
labelBacklightLogo.Padding = new Padding(10, 5, 5, 5);
|
||||
labelBacklightLogo.Size = new Size(86, 42);
|
||||
labelBacklightLogo.Size = new Size(231, 42);
|
||||
labelBacklightLogo.TabIndex = 21;
|
||||
labelBacklightLogo.Text = "Logo";
|
||||
//
|
||||
// checkAwakeLogo
|
||||
//
|
||||
checkAwakeLogo.AutoSize = true;
|
||||
checkAwakeLogo.Location = new Point(213, 45);
|
||||
checkAwakeLogo.Dock = DockStyle.Fill;
|
||||
checkAwakeLogo.Location = new Point(240, 45);
|
||||
checkAwakeLogo.Name = "checkAwakeLogo";
|
||||
checkAwakeLogo.Padding = new Padding(15, 2, 5, 2);
|
||||
checkAwakeLogo.Size = new Size(135, 40);
|
||||
checkAwakeLogo.Size = new Size(231, 40);
|
||||
checkAwakeLogo.TabIndex = 17;
|
||||
checkAwakeLogo.Text = Strings.Awake;
|
||||
checkAwakeLogo.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBootLogo
|
||||
//
|
||||
checkBootLogo.AutoSize = true;
|
||||
checkBootLogo.Location = new Point(213, 91);
|
||||
checkBootLogo.Dock = DockStyle.Fill;
|
||||
checkBootLogo.Location = new Point(240, 91);
|
||||
checkBootLogo.Name = "checkBootLogo";
|
||||
checkBootLogo.Padding = new Padding(15, 2, 5, 2);
|
||||
checkBootLogo.Size = new Size(116, 40);
|
||||
checkBootLogo.Size = new Size(231, 40);
|
||||
checkBootLogo.TabIndex = 18;
|
||||
checkBootLogo.Text = Strings.Boot;
|
||||
checkBootLogo.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkSleepLogo
|
||||
//
|
||||
checkSleepLogo.AutoSize = true;
|
||||
checkSleepLogo.Location = new Point(213, 137);
|
||||
checkSleepLogo.Dock = DockStyle.Fill;
|
||||
checkSleepLogo.Location = new Point(240, 137);
|
||||
checkSleepLogo.Name = "checkSleepLogo";
|
||||
checkSleepLogo.Padding = new Padding(15, 2, 5, 2);
|
||||
checkSleepLogo.Size = new Size(125, 40);
|
||||
checkSleepLogo.Size = new Size(231, 40);
|
||||
checkSleepLogo.TabIndex = 19;
|
||||
checkSleepLogo.Text = Strings.Sleep;
|
||||
checkSleepLogo.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkShutdownLogo
|
||||
//
|
||||
checkShutdownLogo.AutoSize = true;
|
||||
checkShutdownLogo.Location = new Point(213, 183);
|
||||
checkShutdownLogo.Dock = DockStyle.Fill;
|
||||
checkShutdownLogo.Location = new Point(240, 183);
|
||||
checkShutdownLogo.Name = "checkShutdownLogo";
|
||||
checkShutdownLogo.Padding = new Padding(15, 2, 5, 2);
|
||||
checkShutdownLogo.Size = new Size(174, 40);
|
||||
checkShutdownLogo.Size = new Size(231, 40);
|
||||
checkShutdownLogo.TabIndex = 20;
|
||||
checkShutdownLogo.Text = Strings.Shutdown;
|
||||
checkShutdownLogo.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelBacklightBar
|
||||
//
|
||||
labelBacklightBar.AutoSize = true;
|
||||
labelBacklightBar.Dock = DockStyle.Fill;
|
||||
labelBacklightBar.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelBacklightBar.Location = new Point(423, 0);
|
||||
labelBacklightBar.Location = new Point(477, 0);
|
||||
labelBacklightBar.Name = "labelBacklightBar";
|
||||
labelBacklightBar.Padding = new Padding(10, 5, 5, 5);
|
||||
labelBacklightBar.Size = new Size(124, 42);
|
||||
labelBacklightBar.Size = new Size(231, 42);
|
||||
labelBacklightBar.TabIndex = 11;
|
||||
labelBacklightBar.Text = "Lightbar";
|
||||
//
|
||||
// checkAwakeBar
|
||||
//
|
||||
checkAwakeBar.AutoSize = true;
|
||||
checkAwakeBar.Location = new Point(423, 45);
|
||||
checkAwakeBar.Dock = DockStyle.Fill;
|
||||
checkAwakeBar.Location = new Point(477, 45);
|
||||
checkAwakeBar.Name = "checkAwakeBar";
|
||||
checkAwakeBar.Padding = new Padding(15, 2, 5, 2);
|
||||
checkAwakeBar.Size = new Size(135, 40);
|
||||
checkAwakeBar.Size = new Size(231, 40);
|
||||
checkAwakeBar.TabIndex = 7;
|
||||
checkAwakeBar.Text = Strings.Awake;
|
||||
checkAwakeBar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBootBar
|
||||
//
|
||||
checkBootBar.AutoSize = true;
|
||||
checkBootBar.Location = new Point(423, 91);
|
||||
checkBootBar.Dock = DockStyle.Fill;
|
||||
checkBootBar.Location = new Point(477, 91);
|
||||
checkBootBar.Name = "checkBootBar";
|
||||
checkBootBar.Padding = new Padding(15, 2, 5, 2);
|
||||
checkBootBar.Size = new Size(116, 40);
|
||||
checkBootBar.Size = new Size(231, 40);
|
||||
checkBootBar.TabIndex = 8;
|
||||
checkBootBar.Text = Strings.Boot;
|
||||
checkBootBar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkSleepBar
|
||||
//
|
||||
checkSleepBar.AutoSize = true;
|
||||
checkSleepBar.Location = new Point(423, 137);
|
||||
checkSleepBar.Dock = DockStyle.Fill;
|
||||
checkSleepBar.Location = new Point(477, 137);
|
||||
checkSleepBar.Name = "checkSleepBar";
|
||||
checkSleepBar.Padding = new Padding(15, 2, 5, 2);
|
||||
checkSleepBar.Size = new Size(125, 40);
|
||||
checkSleepBar.Size = new Size(231, 40);
|
||||
checkSleepBar.TabIndex = 9;
|
||||
checkSleepBar.Text = Strings.Sleep;
|
||||
checkSleepBar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkShutdownBar
|
||||
//
|
||||
checkShutdownBar.AutoSize = true;
|
||||
checkShutdownBar.Location = new Point(423, 183);
|
||||
checkShutdownBar.Dock = DockStyle.Fill;
|
||||
checkShutdownBar.Location = new Point(477, 183);
|
||||
checkShutdownBar.Name = "checkShutdownBar";
|
||||
checkShutdownBar.Padding = new Padding(15, 2, 5, 2);
|
||||
checkShutdownBar.Size = new Size(174, 40);
|
||||
checkShutdownBar.Size = new Size(231, 40);
|
||||
checkShutdownBar.TabIndex = 10;
|
||||
checkShutdownBar.Text = Strings.Shutdown;
|
||||
checkShutdownBar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelBacklightLid
|
||||
//
|
||||
labelBacklightLid.AutoSize = true;
|
||||
labelBacklightLid.Dock = DockStyle.Fill;
|
||||
labelBacklightLid.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelBacklightLid.Location = new Point(633, 0);
|
||||
labelBacklightLid.Location = new Point(714, 0);
|
||||
labelBacklightLid.Name = "labelBacklightLid";
|
||||
labelBacklightLid.Padding = new Padding(10, 5, 5, 5);
|
||||
labelBacklightLid.Size = new Size(63, 42);
|
||||
labelBacklightLid.Size = new Size(231, 42);
|
||||
labelBacklightLid.TabIndex = 16;
|
||||
labelBacklightLid.Text = "Lid";
|
||||
//
|
||||
// checkAwakeLid
|
||||
//
|
||||
checkAwakeLid.AutoSize = true;
|
||||
checkAwakeLid.Location = new Point(633, 45);
|
||||
checkAwakeLid.Dock = DockStyle.Fill;
|
||||
checkAwakeLid.Location = new Point(714, 45);
|
||||
checkAwakeLid.Name = "checkAwakeLid";
|
||||
checkAwakeLid.Padding = new Padding(15, 2, 5, 2);
|
||||
checkAwakeLid.Size = new Size(135, 40);
|
||||
checkAwakeLid.Size = new Size(231, 40);
|
||||
checkAwakeLid.TabIndex = 12;
|
||||
checkAwakeLid.Text = Strings.Awake;
|
||||
checkAwakeLid.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBootLid
|
||||
//
|
||||
checkBootLid.AutoSize = true;
|
||||
checkBootLid.Location = new Point(633, 91);
|
||||
checkBootLid.Dock = DockStyle.Fill;
|
||||
checkBootLid.Location = new Point(714, 91);
|
||||
checkBootLid.Name = "checkBootLid";
|
||||
checkBootLid.Padding = new Padding(15, 2, 5, 2);
|
||||
checkBootLid.Size = new Size(116, 40);
|
||||
checkBootLid.Size = new Size(231, 40);
|
||||
checkBootLid.TabIndex = 13;
|
||||
checkBootLid.Text = Strings.Boot;
|
||||
checkBootLid.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkSleepLid
|
||||
//
|
||||
checkSleepLid.AutoSize = true;
|
||||
checkSleepLid.Location = new Point(633, 137);
|
||||
checkSleepLid.Dock = DockStyle.Fill;
|
||||
checkSleepLid.Location = new Point(714, 137);
|
||||
checkSleepLid.Name = "checkSleepLid";
|
||||
checkSleepLid.Padding = new Padding(15, 2, 5, 2);
|
||||
checkSleepLid.Size = new Size(125, 40);
|
||||
checkSleepLid.Size = new Size(231, 40);
|
||||
checkSleepLid.TabIndex = 14;
|
||||
checkSleepLid.Text = Strings.Sleep;
|
||||
checkSleepLid.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkShutdownLid
|
||||
//
|
||||
checkShutdownLid.AutoSize = true;
|
||||
checkShutdownLid.Location = new Point(633, 183);
|
||||
checkShutdownLid.Dock = DockStyle.Fill;
|
||||
checkShutdownLid.Location = new Point(714, 183);
|
||||
checkShutdownLid.Name = "checkShutdownLid";
|
||||
checkShutdownLid.Padding = new Padding(15, 2, 5, 2);
|
||||
checkShutdownLid.Size = new Size(174, 40);
|
||||
checkShutdownLid.Size = new Size(231, 40);
|
||||
checkShutdownLid.TabIndex = 15;
|
||||
checkShutdownLid.Text = Strings.Shutdown;
|
||||
checkShutdownLid.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupOther
|
||||
//
|
||||
groupOther.Controls.Add(checkKeyboardAuto);
|
||||
groupOther.Controls.Add(checkUSBC);
|
||||
groupOther.Controls.Add(checkNoOverdrive);
|
||||
groupOther.Controls.Add(checkKeyboardAuto);
|
||||
groupOther.Controls.Add(checkTopmost);
|
||||
groupOther.Dock = DockStyle.Top;
|
||||
groupOther.Location = new Point(10, 727);
|
||||
groupOther.Location = new Point(10, 768);
|
||||
groupOther.Name = "groupOther";
|
||||
groupOther.Size = new Size(848, 293);
|
||||
groupOther.Size = new Size(954, 276);
|
||||
groupOther.TabIndex = 2;
|
||||
groupOther.TabStop = false;
|
||||
groupOther.Text = "Other";
|
||||
//
|
||||
// checkKeyboardAuto
|
||||
//
|
||||
checkKeyboardAuto.AutoSize = true;
|
||||
checkKeyboardAuto.Location = new Point(25, 53);
|
||||
checkKeyboardAuto.MaximumSize = new Size(780, 0);
|
||||
checkKeyboardAuto.Name = "checkKeyboardAuto";
|
||||
checkKeyboardAuto.Size = new Size(712, 36);
|
||||
checkKeyboardAuto.TabIndex = 46;
|
||||
checkKeyboardAuto.Text = Strings.KeyboardAuto;
|
||||
checkKeyboardAuto.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkUSBC
|
||||
//
|
||||
checkUSBC.AutoSize = true;
|
||||
@@ -585,17 +617,6 @@ namespace GHelper
|
||||
checkNoOverdrive.Text = Strings.DisableOverdrive;
|
||||
checkNoOverdrive.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkKeyboardAuto
|
||||
//
|
||||
checkKeyboardAuto.AutoSize = true;
|
||||
checkKeyboardAuto.Location = new Point(25, 52);
|
||||
checkKeyboardAuto.MaximumSize = new Size(780, 0);
|
||||
checkKeyboardAuto.Name = "checkKeyboardAuto";
|
||||
checkKeyboardAuto.Size = new Size(712, 36);
|
||||
checkKeyboardAuto.TabIndex = 2;
|
||||
checkKeyboardAuto.Text = Strings.KeyboardAuto;
|
||||
checkKeyboardAuto.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkTopmost
|
||||
//
|
||||
checkTopmost.AutoSize = true;
|
||||
@@ -610,7 +631,9 @@ namespace GHelper
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(868, 1011);
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(974, 1059);
|
||||
Controls.Add(groupOther);
|
||||
Controls.Add(groupLight);
|
||||
Controls.Add(groupBindings);
|
||||
@@ -618,6 +641,7 @@ namespace GHelper
|
||||
MaximizeBox = false;
|
||||
MdiChildrenMinimizedAnchorBottom = false;
|
||||
MinimizeBox = false;
|
||||
MinimumSize = new Size(1000, 0);
|
||||
Name = "Extra";
|
||||
Padding = new Padding(10);
|
||||
ShowIcon = false;
|
||||
@@ -630,11 +654,11 @@ namespace GHelper
|
||||
groupLight.PerformLayout();
|
||||
panelBacklightExtra.ResumeLayout(false);
|
||||
panelBacklightExtra.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericBacklightTime).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)trackBrightness).EndInit();
|
||||
panelXMG.ResumeLayout(false);
|
||||
panelXMG.PerformLayout();
|
||||
tableBacklight.ResumeLayout(false);
|
||||
tableBacklight.PerformLayout();
|
||||
groupOther.ResumeLayout(false);
|
||||
groupOther.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
@@ -656,7 +680,6 @@ namespace GHelper
|
||||
private GroupBox groupLight;
|
||||
private GroupBox groupOther;
|
||||
private CheckBox checkTopmost;
|
||||
private CheckBox checkKeyboardAuto;
|
||||
private CheckBox checkNoOverdrive;
|
||||
private PictureBox pictureHelp;
|
||||
private CheckBox checkUSBC;
|
||||
@@ -688,5 +711,8 @@ namespace GHelper
|
||||
private RComboBox comboKeyboardSpeed;
|
||||
private Panel panelXMG;
|
||||
private CheckBox checkXMG;
|
||||
private Label labelBacklightTimeout;
|
||||
private NumericUpDown numericBacklightTime;
|
||||
private CheckBox checkKeyboardAuto;
|
||||
}
|
||||
}
|
||||
16
app/Extra.cs
16
app/Extra.cs
@@ -186,7 +186,18 @@ namespace GHelper
|
||||
checkXMG.Checked = !(Program.config.getConfig("xmg_light") == 0);
|
||||
checkXMG.CheckedChanged += CheckXMG_CheckedChanged;
|
||||
|
||||
int kb_timeout = Program.config.getConfig("keyboard_light_tiomeout");
|
||||
numericBacklightTime.Value = (kb_timeout >= 0) ? kb_timeout : 60;
|
||||
|
||||
numericBacklightTime.ValueChanged += NumericBacklightTime_ValueChanged;
|
||||
|
||||
}
|
||||
|
||||
private void NumericBacklightTime_ValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.RunAsAdmin("extra");
|
||||
Program.config.setConfig("keyboard_light_tiomeout", (int)numericBacklightTime.Value);
|
||||
Aura.SetBacklightOffDelay((int)numericBacklightTime.Value);
|
||||
}
|
||||
|
||||
private void CheckXMG_CheckedChanged(object? sender, EventArgs e)
|
||||
@@ -272,11 +283,6 @@ namespace GHelper
|
||||
if (checkSleepLogo.Checked) flags.Add(AuraDev19b6.SleepLogo);
|
||||
if (checkShutdownLogo.Checked) flags.Add(AuraDev19b6.ShutdownLogo);
|
||||
|
||||
flags.Add(AuraDev19b6.Unknown1);
|
||||
flags.Add(AuraDev19b6.Unknown2);
|
||||
flags.Add(AuraDev19b6.Unknown3);
|
||||
flags.Add(AuraDev19b6.Unknown4);
|
||||
|
||||
Aura.ApplyAuraPower(flags);
|
||||
|
||||
}
|
||||
|
||||
35
app/Fans.cs
35
app/Fans.cs
@@ -107,7 +107,7 @@ namespace GHelper
|
||||
InitFans();
|
||||
InitPower();
|
||||
InitBoost();
|
||||
InitGPU();
|
||||
InitGPU(true);
|
||||
|
||||
comboBoost.SelectedValueChanged += ComboBoost_Changed;
|
||||
|
||||
@@ -119,10 +119,11 @@ namespace GHelper
|
||||
|
||||
private void TrackGPU_MouseUp(object? sender, MouseEventArgs e)
|
||||
{
|
||||
Program.settingsForm.AutoGPUSettings(true);
|
||||
Program.settingsForm.SetGPUPower();
|
||||
Program.settingsForm.SetGPUClocks(true);
|
||||
}
|
||||
|
||||
public void InitGPU()
|
||||
public void InitGPU(bool readClocks = false)
|
||||
{
|
||||
if (HardwareControl.GpuControl is not null && HardwareControl.GpuControl.IsNvidia)
|
||||
{
|
||||
@@ -138,17 +139,24 @@ namespace GHelper
|
||||
{
|
||||
panelGPU.Visible = true;
|
||||
|
||||
nvControl.GetClocks(out int core, out int memory, out string gpuTitle);
|
||||
|
||||
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
|
||||
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
|
||||
labelGPU.Text = gpuTitle;
|
||||
|
||||
int gpu_boost = Program.config.getConfigPerf("gpu_boost");
|
||||
int gpu_temp = Program.config.getConfigPerf("gpu_temp");
|
||||
int core = Program.config.getConfigPerf("gpu_core");
|
||||
int memory = Program.config.getConfigPerf("gpu_memory");
|
||||
|
||||
if (gpu_boost < 0) gpu_boost = ASUSWmi.MaxGPUBoost;
|
||||
if (gpu_temp < 0) gpu_temp = ASUSWmi.MaxGPUTemp;
|
||||
if (core == -1) core = 0;
|
||||
if (memory == 1) memory = 0;
|
||||
|
||||
if (readClocks)
|
||||
{
|
||||
nvControl.GetClocks(out core, out memory, out string gpuTitle);
|
||||
labelGPU.Text = gpuTitle;
|
||||
}
|
||||
|
||||
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
|
||||
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
|
||||
|
||||
trackGPUBoost.Value = Math.Max(Math.Min(gpu_boost, ASUSWmi.MaxGPUBoost), ASUSWmi.MinGPUBoost);
|
||||
trackGPUTemp.Value = Math.Max(Math.Min(gpu_temp, ASUSWmi.MaxGPUTemp), ASUSWmi.MinGPUTemp);
|
||||
@@ -502,7 +510,14 @@ namespace GHelper
|
||||
trackGPUBoost.Value = ASUSWmi.MaxGPUBoost;
|
||||
trackGPUTemp.Value = ASUSWmi.MaxGPUTemp;
|
||||
|
||||
Program.settingsForm.AutoGPUSettings(true);
|
||||
Program.config.setConfigPerf("gpu_boost", trackGPUBoost.Value);
|
||||
Program.config.setConfigPerf("gpu_temp", trackGPUTemp.Value);
|
||||
Program.config.setConfigPerf("gpu_core", trackGPUCore.Value);
|
||||
Program.config.setConfigPerf("gpu_memory", trackGPUMemory.Value);
|
||||
VisualiseGPUSettings();
|
||||
|
||||
Program.settingsForm.SetGPUClocks(true);
|
||||
Program.settingsForm.SetGPUPower();
|
||||
}
|
||||
|
||||
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.59</AssemblyVersion>
|
||||
<AssemblyVersion>0.60</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using NvAPIWrapper.GPU;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.Delegates;
|
||||
using NvAPIWrapper.Native.GPU;
|
||||
using NvAPIWrapper.Native.GPU.Structures;
|
||||
using NvAPIWrapper.Native.Interfaces.GPU;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using static NvAPIWrapper.Native.GPU.Structures.PerformanceStates20InfoV1;
|
||||
|
||||
namespace GHelper.Gpu;
|
||||
@@ -46,25 +49,68 @@ public class NvidiaGpuControl : IGpuControl
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void GetClocks(out int core, out int memory, out string gpu)
|
||||
public int GetClocks(out int core, out int memory, out string gpu)
|
||||
{
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
|
||||
gpu = internalGpu.FullName;
|
||||
|
||||
Logger.WriteLine(internalGpu.FullName);
|
||||
Logger.WriteLine(internalGpu.ArchitectInformation.ToString());
|
||||
//Logger.WriteLine(internalGpu.FullName);
|
||||
//Logger.WriteLine(internalGpu.ArchitectInformation.ToString());
|
||||
|
||||
IPerformanceStates20Info states = GPUApi.GetPerformanceStates20(internalGpu.Handle);
|
||||
try
|
||||
{
|
||||
IPerformanceStates20Info states = GPUApi.GetPerformanceStates20(internalGpu.Handle);
|
||||
core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000;
|
||||
memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000;
|
||||
Logger.WriteLine($"GET GPU Clock offsets : {core}, {memory}");
|
||||
return 0;
|
||||
|
||||
//Logger.WriteLine("IPerformanceStates20Info type : " + states.GetType());
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.Message);
|
||||
core = memory = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000;
|
||||
memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000;
|
||||
}
|
||||
|
||||
Logger.WriteLine($"GET GPU Clock offsets : {core}, {memory}");
|
||||
private static void RunCMD(string name, string args)
|
||||
{
|
||||
var cmd = new Process();
|
||||
cmd.StartInfo.UseShellExecute = false;
|
||||
cmd.StartInfo.CreateNoWindow = true;
|
||||
cmd.StartInfo.RedirectStandardOutput = true;
|
||||
cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
cmd.StartInfo.FileName = name;
|
||||
cmd.StartInfo.Arguments = args;
|
||||
cmd.Start();
|
||||
Logger.WriteLine(cmd.StandardOutput.ReadToEnd());
|
||||
cmd.WaitForExit();
|
||||
}
|
||||
|
||||
|
||||
public bool RestartGPU()
|
||||
{
|
||||
|
||||
if (!IsValid) return false;
|
||||
|
||||
try
|
||||
{
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
var pnpDeviceId = internalGpu.BusInformation.PCIIdentifiers.ToString();
|
||||
Logger.WriteLine("Device ID:"+ pnpDeviceId);
|
||||
RunCMD("pnputil", $"/disable-device /deviceid \"{pnpDeviceId}\"");
|
||||
Thread.Sleep(3000);
|
||||
RunCMD("pnputil", $"/enable-device /deviceid \"{pnpDeviceId}\"");
|
||||
Thread.Sleep(2000);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex )
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int SetClocksFromConfig()
|
||||
@@ -86,7 +132,7 @@ public class NvidiaGpuControl : IGpuControl
|
||||
var coreClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Graphics, new PerformanceStates20ParameterDelta(core * 1000));
|
||||
var memoryClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Memory, new PerformanceStates20ParameterDelta(memory * 1000));
|
||||
|
||||
PerformanceStates20ClockEntryV1[] clocks = { coreClock , memoryClock};
|
||||
PerformanceStates20ClockEntryV1[] clocks = { coreClock, memoryClock };
|
||||
PerformanceStates20BaseVoltageEntryV1[] voltages = { };
|
||||
|
||||
PerformanceState20[] performanceStates = { new PerformanceState20(PerformanceStateId.P0_3DPerformance, clocks, voltages) };
|
||||
@@ -95,8 +141,8 @@ public class NvidiaGpuControl : IGpuControl
|
||||
|
||||
try
|
||||
{
|
||||
Logger.WriteLine($"SET GPU Clock : {core}, {memory}");
|
||||
GPUApi.SetPerformanceStates20(internalGpu.Handle, overclock);
|
||||
Logger.WriteLine($"SET GPU Clock offsets : {core}, {memory}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -81,9 +81,9 @@ public static class HardwareControl
|
||||
cpuTemp = ct.NextValue() - 273;
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("Failed reading CPU temp");
|
||||
Debug.WriteLine("Failed reading CPU temp :" + ex.Message);
|
||||
}
|
||||
|
||||
try
|
||||
@@ -94,8 +94,7 @@ public static class HardwareControl
|
||||
catch (Exception ex)
|
||||
{
|
||||
gpuTemp = -1;
|
||||
Debug.WriteLine("Failed reading GPU temp");
|
||||
Debug.WriteLine(ex.ToString());
|
||||
Debug.WriteLine("Failed reading GPU temp :" + ex.Message);
|
||||
}
|
||||
|
||||
if (gpuTemp is null || gpuTemp < 0)
|
||||
|
||||
@@ -652,7 +652,7 @@ public class NativeMethods
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
Logger.WriteLine("Can't detect internal screen");
|
||||
//laptopScreen = Screen.PrimaryScreen.DeviceName;
|
||||
laptopScreen = Screen.PrimaryScreen.DeviceName;
|
||||
}
|
||||
|
||||
|
||||
@@ -761,6 +761,7 @@ public class NativeMethods
|
||||
{
|
||||
PowerSetActiveScheme(IntPtr.Zero, new Guid(scheme));
|
||||
PowerSetActiveOverlayScheme(new Guid(scheme));
|
||||
Logger.WriteLine(scheme);
|
||||
}
|
||||
|
||||
public static void SetPowerScheme(int mode)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace GHelper
|
||||
Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture;
|
||||
Debug.WriteLine(CultureInfo.CurrentUICulture);
|
||||
|
||||
//Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("zh");
|
||||
//Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("es");
|
||||
|
||||
CheckProcesses();
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace GHelper
|
||||
startInfo.Arguments = param;
|
||||
startInfo.Verb = "runas";
|
||||
Process.Start(startInfo);
|
||||
//Application.Exit();
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,6 +270,9 @@
|
||||
<data name="GPUModeUltimate" xml:space="preserve">
|
||||
<value>Exclusivo dGPU</value>
|
||||
</data>
|
||||
<data name="GPUSettings" xml:space="preserve">
|
||||
<value>Ajustes de GPU</value>
|
||||
</data>
|
||||
<data name="KeyBindings" xml:space="preserve">
|
||||
<value>Atajos de teclado</value>
|
||||
</data>
|
||||
@@ -288,6 +291,15 @@
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Pantalla del portátil</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Tapa</value>
|
||||
</data>
|
||||
<data name="Lightbar" xml:space="preserve">
|
||||
<value>Barra de luz</value>
|
||||
</data>
|
||||
<data name="Logo" xml:space="preserve">
|
||||
<value>Logo</value>
|
||||
</data>
|
||||
<data name="MatrixBanner" xml:space="preserve">
|
||||
<value>Banner binario</value>
|
||||
</data>
|
||||
@@ -388,7 +400,7 @@
|
||||
<value>Alternar Aura</value>
|
||||
</data>
|
||||
<data name="ToggleMiniled" xml:space="preserve">
|
||||
<value>Alternar Miniled (si es compatible)</value>
|
||||
<value>Alternar Miniled (si comp.)</value>
|
||||
</data>
|
||||
<data name="ToggleScreen" xml:space="preserve">
|
||||
<value>Alternar pantalla</value>
|
||||
|
||||
148
app/Settings.cs
148
app/Settings.cs
@@ -948,7 +948,7 @@ namespace GHelper
|
||||
SetGPUMode(ASUSWmi.GPUModeEco);
|
||||
}
|
||||
|
||||
public void RefreshSensors(bool force = false)
|
||||
public async void RefreshSensors(bool force = false)
|
||||
{
|
||||
|
||||
if (!force && Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastRefresh) < 2000) return;
|
||||
@@ -1045,14 +1045,45 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
public void AutoGPUSettings(bool launchAsAdmin = false)
|
||||
|
||||
public void SetGPUClocks(bool launchAsAdmin = true)
|
||||
{
|
||||
|
||||
int gpu_core = Program.config.getConfigPerf("gpu_core");
|
||||
int gpu_memory = Program.config.getConfigPerf("gpu_memory");
|
||||
|
||||
if (gpu_core == -1 && gpu_memory == -1) return;
|
||||
|
||||
//if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false;
|
||||
|
||||
if (HardwareControl.GpuControl is null) return;
|
||||
if (!HardwareControl.GpuControl!.IsNvidia) return;
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.GPUEco) == 1) return;
|
||||
|
||||
using NvidiaGpuControl nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
|
||||
try
|
||||
{
|
||||
int getStatus = nvControl.GetClocks(out int current_core, out int current_memory, out string gpuName);
|
||||
if (getStatus == -1) return;
|
||||
|
||||
if (Math.Abs(gpu_core - current_core) < 5 && Math.Abs(gpu_memory - current_memory) < 5) return;
|
||||
|
||||
int setStatus = nvControl.SetClocks(gpu_core, gpu_memory);
|
||||
if (launchAsAdmin && setStatus == -1) Program.RunAsAdmin("gpu");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGPUPower()
|
||||
{
|
||||
|
||||
int gpu_boost = Program.config.getConfigPerf("gpu_boost");
|
||||
int gpu_temp = Program.config.getConfigPerf("gpu_temp");
|
||||
|
||||
int gpu_core = Program.config.getConfigPerf("gpu_core");
|
||||
int gpu_memory = Program.config.getConfigPerf("gpu_memory");
|
||||
|
||||
if (gpu_boost < ASUSWmi.MinGPUBoost || gpu_boost > ASUSWmi.MaxGPUBoost ) return;
|
||||
if (gpu_temp < ASUSWmi.MinGPUTemp || gpu_temp > ASUSWmi.MaxGPUTemp) return;
|
||||
@@ -1067,23 +1098,6 @@ namespace GHelper
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_GPUC2, gpu_temp, "PowerLimit C2");
|
||||
}
|
||||
|
||||
if (gpu_core == -1 && gpu_memory == -1) return;
|
||||
|
||||
if (HardwareControl.GpuControl is not null && HardwareControl.GpuControl.IsNvidia)
|
||||
{
|
||||
using NvidiaGpuControl nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
|
||||
try
|
||||
{
|
||||
int status = nvControl.SetClocks(gpu_core, gpu_memory);
|
||||
if (launchAsAdmin && status == -1) Program.RunAsAdmin("gpu");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void LabelFansResult(string text)
|
||||
@@ -1148,24 +1162,25 @@ namespace GHelper
|
||||
|
||||
customPower = 0;
|
||||
|
||||
if (Program.config.getConfigPerf("auto_apply_power") == 1)
|
||||
{
|
||||
if (delay > 0)
|
||||
{
|
||||
var timer = new System.Timers.Timer(1000);
|
||||
timer.Elapsed += delegate
|
||||
{
|
||||
timer.Stop();
|
||||
timer.Dispose();
|
||||
SetPower();
|
||||
};
|
||||
timer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPower();
|
||||
}
|
||||
bool applyPower = Program.config.getConfigPerf("auto_apply_power") == 1;
|
||||
bool applyGPU = true;
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
var timer = new System.Timers.Timer(delay);
|
||||
timer.Elapsed += delegate
|
||||
{
|
||||
timer.Stop();
|
||||
timer.Dispose();
|
||||
if (applyPower) SetPower();
|
||||
SetGPUPower();
|
||||
};
|
||||
timer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (applyPower) SetPower();
|
||||
SetGPUPower();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1220,8 +1235,9 @@ namespace GHelper
|
||||
}
|
||||
}
|
||||
|
||||
SetGPUClocks();
|
||||
|
||||
AutoFans();
|
||||
AutoGPUSettings();
|
||||
AutoPower(1000);
|
||||
|
||||
|
||||
@@ -1336,7 +1352,7 @@ namespace GHelper
|
||||
if (eco == 1)
|
||||
if ((GpuAuto && IsPlugged()) || (ForceGPU && GpuMode == ASUSWmi.GPUModeStandard))
|
||||
{
|
||||
SetEcoGPU(0);
|
||||
SetGPUEco(0);
|
||||
return true;
|
||||
}
|
||||
if (eco == 0)
|
||||
@@ -1349,7 +1365,7 @@ namespace GHelper
|
||||
if (dialogResult == DialogResult.No) return false;
|
||||
}
|
||||
|
||||
SetEcoGPU(1);
|
||||
SetGPUEco(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1360,15 +1376,16 @@ namespace GHelper
|
||||
|
||||
public bool ReEnableGPU()
|
||||
{
|
||||
if (Screen.AllScreens.Length <= 1) return false;
|
||||
|
||||
if (Program.config.getConfig("gpu_reenable") != 1) return false;
|
||||
if (Screen.AllScreens.Length <= 1) return false;
|
||||
|
||||
Logger.WriteLine("Re-enabling gpu for 503 model");
|
||||
|
||||
Thread.Sleep(1000);
|
||||
SetEcoGPU(1);
|
||||
SetGPUEco(1);
|
||||
Thread.Sleep(1000);
|
||||
SetEcoGPU(0);
|
||||
SetGPUEco(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1436,8 +1453,23 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
public bool RestartGPU()
|
||||
{
|
||||
if (HardwareControl.GpuControl is null) return false;
|
||||
if (!HardwareControl.GpuControl!.IsNvidia) return false;
|
||||
|
||||
public void SetEcoGPU(int eco)
|
||||
DialogResult dialogResult = MessageBox.Show("Something is using dGPU and blocking Eco mode. Restart dGPU in a device manager and try to set Eco again?", Properties.Strings.EcoMode, MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.No) return false;
|
||||
|
||||
Program.RunAsAdmin();
|
||||
|
||||
Logger.WriteLine("Trying to restart GPU");
|
||||
var nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
|
||||
return nvControl.RestartGPU();
|
||||
|
||||
}
|
||||
|
||||
public void SetGPUEco(int eco, bool hardWay = false)
|
||||
{
|
||||
|
||||
ButtonEnabled(buttonOptimized, false);
|
||||
@@ -1447,20 +1479,26 @@ namespace GHelper
|
||||
|
||||
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUChanging + " ...";
|
||||
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
|
||||
|
||||
int status;
|
||||
|
||||
if (eco == 1)
|
||||
{
|
||||
string[] tokill = { "EADesktop", "RadeonSoftware" };
|
||||
foreach (string kill in tokill)
|
||||
foreach (var process in Process.GetProcessesByName(kill)) process.Kill();
|
||||
}
|
||||
|
||||
status = Program.wmi.SetGPUEco(eco);
|
||||
|
||||
if (status == 0 && eco == 1 && hardWay)
|
||||
{
|
||||
if (RestartGPU()) Program.wmi.SetGPUEco(1);
|
||||
}
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco, "GPUEco");
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(500));
|
||||
Program.settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
InitGPUMode();
|
||||
@@ -1468,7 +1506,11 @@ namespace GHelper
|
||||
});
|
||||
|
||||
if (eco == 0)
|
||||
HardwareControl.RecreateGpuControlWithDelay();
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(1000));
|
||||
HardwareControl.RecreateGpuControl();
|
||||
SetGPUClocks(false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1514,13 +1556,13 @@ namespace GHelper
|
||||
else if (GPUMode == ASUSWmi.GPUModeEco)
|
||||
{
|
||||
VisualiseGPUMode(GPUMode);
|
||||
SetEcoGPU(1);
|
||||
SetGPUEco(1, true);
|
||||
changed = true;
|
||||
}
|
||||
else if (GPUMode == ASUSWmi.GPUModeStandard)
|
||||
{
|
||||
VisualiseGPUMode(GPUMode);
|
||||
SetEcoGPU(0);
|
||||
SetGPUEco(0);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,11 +94,16 @@ Most probably either you are using Eco / Optimized mode and your dGPU is simply
|
||||
#### It says, that app is already running
|
||||
Please check system tray for a (G) icon. By default windows is keen to hide all icons, so you may need to click ^ to see them all. I would advise to right click on Task Bar select Task Bar Settings -> Other System Tray icons -> Mark G-Helper to be always ON.
|
||||
|
||||
#### App doesn't start / or crashes, what should I do ?
|
||||
#### App doesn't crash or doesn't work properly what should I do ?
|
||||
Open "Event Viewer" from start menu, go to Windows Logs -> Application and check for recent Errors mentioning G-Helper. If you see one - please post a [new issue](https://github.com/seerge/g-helper/issues) with all details from this error.
|
||||
|
||||
#### Battery charge limiter is not working
|
||||
Open application log.text from ``%AppData%\GHelper`` . If you see something like ``BatteryLimit = 60 : OK`` there (with your selected limit). App has done everything it could to set a limit. It could be that MyASUS or other Asus services are overwriting this limit after. You may want to right click and save this [debloat.bat](https://raw.githubusercontent.com/seerge/g-helper/main/debloat.bat) and then right-click Run it As Admin. It will stop not mandatory asus services.
|
||||
|
||||
What you can also try is to open ``C:\ProgramData\ASUS\ASUS System Control Interface\ASUSOptimization\Customization.ini`` and find following section from that file : ``[BatteryHealthCharging] ... value=100`` and either delete it or put same value as you use in G-helper.
|
||||
|
||||
#### Can I use MyASUS app along with G-Helper?
|
||||
Sure, you can! The only problem is that MyASUS may override the battery charge limit that you set before. My advice in such a situation would be to set the same limit (i.e. 80%) in both MyASUS and G-Helper.
|
||||
You can, the only problem is that MyASUS may override the battery charge limit that you set before. My advice in such a situation would be to set the same limit (i.e. 80%) in both MyASUS and G-Helper.
|
||||
|
||||
#### How do I set Mute Microphone to M3?
|
||||
This function is handled by Asus Optimization Service (therefore G-helper doesn't interfere and doesn't touch this function). Make sure that this service is up and running
|
||||
@@ -140,7 +145,7 @@ It's a lightweight Armoury Crate alternative for Asus laptops. A small utility t
|
||||
|
||||
- I recommend keeping "Asus Optimization Service" running, as it keeps basic laptop hotkeys such as screen or keyboard brightness adjustment working.
|
||||
|
||||
- Optionally(!) you can disable / remove unnecessary services by running [this debloat bat file](https://raw.githubusercontent.com/seerge/g-helper/main/debloat.bat) as admin. To restore services - run [this bloat bat file](https://raw.githubusercontent.com/seerge/g-helper/main/bloat.bat) instead.
|
||||
- Optionally(!) you can disable / remove unnecessary services. Ruight click and save [debloat.bat](https://raw.githubusercontent.com/seerge/g-helper/main/debloat.bat). Then right click and Run it as Admin. To restore services - save and run [bloat.bat](https://raw.githubusercontent.com/seerge/g-helper/main/bloat.bat) instead.
|
||||
|
||||
- It's not recommended to use an app in combination with Armoury Crate services, because they adjust the same settings. You can [uninstall it using it's own uninstall tool](https://dlcdnets.asus.com/pub/ASUS/mb/14Utilities/Armoury_Crate_Uninstall_Tool.zip?model=armoury%20crate). Just in case, you can always install it back later.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user