mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
602dfea1a6 | ||
|
|
c13a6e9ded | ||
|
|
e11027963f | ||
|
|
9d2b8b506e | ||
|
|
988c9e11dd | ||
|
|
2c6bb32e4a | ||
|
|
e33a0d05ed | ||
|
|
1c283766aa | ||
|
|
f2ef6d197f |
@@ -60,11 +60,11 @@ public class ASUSWmi
|
||||
public const int GPUModeUltimate = 2;
|
||||
|
||||
|
||||
public const int MaxTotal = 180;
|
||||
public const int MaxTotal = 200;
|
||||
public const int MinTotal = 5;
|
||||
public const int DefaultTotal = 125;
|
||||
|
||||
public const int MaxCPU = 90;
|
||||
public const int MaxCPU = 130;
|
||||
public const int MinCPU = 5;
|
||||
public const int DefaultCPU = 80;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Data;
|
||||
using System.Diagnostics;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
|
||||
using System.Security.Policy;
|
||||
using HidSharp.Utility;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
@@ -57,7 +58,7 @@ namespace GHelper
|
||||
static byte[] MESSAGE_SET = { 0x5d, 0xb5, 0, 0, 0 };
|
||||
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 };
|
||||
|
||||
static int[] deviceIds = { 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 };
|
||||
|
||||
private static int mode = 0;
|
||||
private static int speed = 1;
|
||||
@@ -197,6 +198,7 @@ namespace GHelper
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
}
|
||||
|
||||
|
||||
@@ -223,6 +225,8 @@ namespace GHelper
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardPower(awake, boot, sleep, shutdown);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace CustomControls
|
||||
[DllImport("DwmApi")] //System.Runtime.InteropServices
|
||||
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
|
||||
|
||||
public bool darkTheme;
|
||||
public bool darkTheme = false;
|
||||
|
||||
public static void InitColors(bool darkTheme)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,23 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.48</AssemblyVersion>
|
||||
<AssemblyVersion>0.49</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using GHelper;
|
||||
using GHelper.Gpu;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
|
||||
public static class HardwareMonitor
|
||||
{
|
||||
@@ -62,6 +63,7 @@ public static class HardwareMonitor
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public static void ReadSensors()
|
||||
{
|
||||
batteryDischarge = -1;
|
||||
|
||||
@@ -1,12 +1,53 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Xml.Linq;
|
||||
using static Tools.ScreenInterrogatory;
|
||||
|
||||
namespace Tools
|
||||
{
|
||||
|
||||
public class KeyHandler
|
||||
{
|
||||
|
||||
public const int NOMOD = 0x0000;
|
||||
public const int ALT = 0x0001;
|
||||
public const int CTRL = 0x0002;
|
||||
public const int SHIFT = 0x0004;
|
||||
public const int WIN = 0x0008;
|
||||
|
||||
public const int WM_HOTKEY_MSG_ID = 0x0312;
|
||||
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk);
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
||||
|
||||
private int modifier;
|
||||
private int key;
|
||||
private IntPtr hWnd;
|
||||
private int id;
|
||||
public KeyHandler(int modifier, Keys key, nint handle)
|
||||
{
|
||||
this.modifier = modifier;
|
||||
this.key = (int)key;
|
||||
this.hWnd = handle;
|
||||
id = this.GetHashCode();
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return modifier ^ key ^ hWnd.ToInt32();
|
||||
}
|
||||
public bool Register()
|
||||
{
|
||||
return RegisterHotKey(hWnd, id, modifier, key);
|
||||
}
|
||||
public bool Unregiser()
|
||||
{
|
||||
return UnregisterHotKey(hWnd, id);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ScreenInterrogatory
|
||||
{
|
||||
public const int ERROR_SUCCESS = 0;
|
||||
@@ -608,7 +649,8 @@ public class NativeMethods
|
||||
if (dm.dmDisplayFrequency > frequency) frequency = dm.dmDisplayFrequency;
|
||||
i++;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
{
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using Tools;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
|
||||
|
||||
public static NotifyIcon trayIcon = new NotifyIcon
|
||||
{
|
||||
Text = "G-Helper",
|
||||
@@ -15,7 +14,7 @@ namespace GHelper
|
||||
Visible = true
|
||||
};
|
||||
|
||||
public static ASUSWmi wmi;
|
||||
public static ASUSWmi? wmi;
|
||||
public static AppConfig config = new AppConfig();
|
||||
|
||||
public static SettingsForm settingsForm = new SettingsForm();
|
||||
@@ -57,7 +56,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
Logger.WriteLine("------------");
|
||||
Logger.WriteLine("App launched");
|
||||
Logger.WriteLine("App launched: " + config.GetModel());
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
|
||||
@@ -84,6 +83,9 @@ namespace GHelper
|
||||
var settingGuid = new NativeMethods.PowerSettingGuid();
|
||||
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(ds, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||
|
||||
// CTRL + SHIFT + F5 to cycle profiles
|
||||
var ghk = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, Keys.F5, ds);
|
||||
ghk.Register();
|
||||
|
||||
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
|
||||
{
|
||||
@@ -100,14 +102,16 @@ namespace GHelper
|
||||
{
|
||||
|
||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return;
|
||||
lastTheme = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
|
||||
switch (e.Category)
|
||||
{
|
||||
case UserPreferenceCategory.General:
|
||||
Debug.WriteLine("Theme Changed");
|
||||
Thread.Sleep(1000);
|
||||
settingsForm.InitTheme();
|
||||
bool changed = settingsForm.InitTheme();
|
||||
if (changed)
|
||||
{
|
||||
Debug.WriteLine("Theme Changed");
|
||||
lastTheme = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
}
|
||||
|
||||
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
|
||||
settingsForm.fans.InitTheme();
|
||||
|
||||
2
app/Settings.Designer.cs
generated
2
app/Settings.Designer.cs
generated
@@ -826,7 +826,7 @@ namespace GHelper
|
||||
buttonMiniled.Secondary = false;
|
||||
buttonMiniled.Size = new Size(185, 72);
|
||||
buttonMiniled.TabIndex = 3;
|
||||
buttonMiniled.Text = "Miniled";
|
||||
buttonMiniled.Text = "Multizone";
|
||||
buttonMiniled.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// pictureScreen
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Drawing.Imaging;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Timers;
|
||||
using Tools;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
@@ -27,6 +28,9 @@ namespace GHelper
|
||||
static AnimeMatrixDevice mat;
|
||||
static long lastRefresh;
|
||||
|
||||
private bool customFans = false;
|
||||
private int customPower = 0;
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -185,13 +189,13 @@ namespace GHelper
|
||||
|
||||
private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e)
|
||||
{
|
||||
RefreshSensors();
|
||||
Program.settingsForm.RefreshSensors();
|
||||
}
|
||||
|
||||
|
||||
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
|
||||
{
|
||||
RefreshSensors();
|
||||
Program.settingsForm.RefreshSensors();
|
||||
}
|
||||
|
||||
private void Button120Hz_MouseHover(object? sender, EventArgs e)
|
||||
@@ -280,6 +284,9 @@ namespace GHelper
|
||||
}
|
||||
m.Result = (IntPtr)1;
|
||||
break;
|
||||
case KeyHandler.WM_HOTKEY_MSG_ID:
|
||||
CyclePerformanceMode();
|
||||
break;
|
||||
}
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
@@ -795,7 +802,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
private static void RefreshSensors(bool force = false)
|
||||
private void RefreshSensors(bool force = false)
|
||||
{
|
||||
|
||||
if (!force && Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastRefresh) < 2000) return;
|
||||
@@ -820,18 +827,19 @@ namespace GHelper
|
||||
|
||||
Program.settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan;
|
||||
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + HardwareMonitor.gpuFan;
|
||||
labelCPUFan.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan;
|
||||
labelGPUFan.Text = "GPU" + gpuTemp + HardwareMonitor.gpuFan;
|
||||
if (HardwareMonitor.midFan is not null)
|
||||
Program.settingsForm.labelMidFan.Text = "Mid" + HardwareMonitor.midFan;
|
||||
|
||||
Program.settingsForm.labelBattery.Text = battery;
|
||||
|
||||
Program.trayIcon.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan + "\n"
|
||||
+ "GPU" + gpuTemp + HardwareMonitor.gpuFan +
|
||||
((battery.Length > 0) ? ("\n" + battery) : "");
|
||||
labelMidFan.Text = "Mid" + HardwareMonitor.midFan;
|
||||
|
||||
labelBattery.Text = battery;
|
||||
});
|
||||
|
||||
|
||||
Program.trayIcon.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan + "\n"
|
||||
+ "GPU" + gpuTemp + HardwareMonitor.gpuFan +
|
||||
((battery.Length > 0) ? ("\n" + battery) : "");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -853,6 +861,12 @@ namespace GHelper
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetPerformanceLabel()
|
||||
{
|
||||
labelPerf.Text = "Performance Mode" + (customFans?"+":"") + ((customPower > 0) ? " "+customPower+"W" : "");
|
||||
}
|
||||
|
||||
public void SetPower()
|
||||
{
|
||||
int limit_total = Program.config.getConfigPerf("limit_total");
|
||||
@@ -865,16 +879,25 @@ namespace GHelper
|
||||
if (limit_cpu < ASUSWmi.MinCPU) return;
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total, "PowerLimit A");
|
||||
customPower = limit_total;
|
||||
}
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu, "PowerLimit B");
|
||||
customPower = limit_cpu;
|
||||
}
|
||||
|
||||
Program.settingsForm.BeginInvoke(SetPerformanceLabel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void AutoFans()
|
||||
{
|
||||
customFans = false;
|
||||
|
||||
if (Program.config.getConfigPerf("auto_apply") == 1)
|
||||
{
|
||||
@@ -890,16 +913,18 @@ namespace GHelper
|
||||
Logger.WriteLine("Driver rejected fan curve, resetting mode to " + mode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, mode, "PerformanceMode");
|
||||
}
|
||||
else
|
||||
labelPerf.Text = "Performance Mode+";
|
||||
else customFans = true;
|
||||
}
|
||||
else
|
||||
labelPerf.Text = "Performance Mode";
|
||||
|
||||
Program.settingsForm.BeginInvoke(SetPerformanceLabel);
|
||||
|
||||
}
|
||||
|
||||
public void AutoPower(int delay = 0)
|
||||
{
|
||||
|
||||
customPower = 0;
|
||||
|
||||
if (Program.config.getConfigPerf("auto_apply_power") == 1)
|
||||
{
|
||||
if (delay > 0)
|
||||
@@ -989,15 +1014,19 @@ namespace GHelper
|
||||
fans.InitPower();
|
||||
fans.InitBoost();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void CyclePerformanceMode()
|
||||
{
|
||||
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1, true);
|
||||
int mode = Program.config.getConfig("performance_mode");
|
||||
|
||||
if (Control.ModifierKeys == Keys.Shift)
|
||||
mode = (mode == 0) ? 2 : mode - 1;
|
||||
else
|
||||
mode++;
|
||||
|
||||
SetPerformanceMode(mode, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# [G-Helper](https://github.com/seerge/g-helper)
|
||||
# G-Helper (GHelper)
|
||||
|
||||
[](https://GitHub.com/seerge/g-helper/releases/) [](https://GitHub.com/seerge/g-helper/releases/) [](https://GitHub.com/seerge/g-helper/stargazers/)
|
||||
|
||||
@@ -7,37 +7,33 @@
|
||||
|
||||
A small utility that allows you to do almost everything you could do with Armoury Crate but without extra bloat and unnecessary services.
|
||||
|
||||
### :gift: Main advantages
|
||||
## :gift: Main advantages
|
||||
|
||||
1. Seamless and automatic GPU switching (without asking you to close all apps, etc)
|
||||
2. All performance modes can be fully customized (with fan curves and PPTs)
|
||||
3. Very lightweight and consumes almost no resources, doesn't install any services. Just a single exe to run
|
||||
4. Simple and clean native UI with easy access to all settings
|
||||
5. Doesn't need administrator privileges to run!
|
||||
|
||||
_Doesn't need administrator privileges to run!_
|
||||
|
||||
### [:floppy_disk: Download latest release](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 post about the app - please include a link. Thanks.
|
||||
_If you post about the app - please include a link. Thanks._
|
||||
|
||||

|
||||
|
||||
### :zap: Main features
|
||||
|
||||
1. Built-in **Performance modes**: Silent - Balanced - Turbo (with default fan curves)
|
||||
1. **Performance modes**: Silent - Balanced - Turbo (built-in, with default fan curves)
|
||||
2. **GPU modes**: Eco - Standard - Ultimate - Optimized
|
||||
3. Laptop screen refresh rate 60hz or 120hz (144hz, etc depending on the model) with display overdrive (OD)
|
||||
4. Default and custom fan profiles for every performance mode
|
||||
5. Power limits (PPT) for every performance mode
|
||||
6. CPU turbo boost setting for each mode
|
||||
7. Keyboard backlit animation and colors
|
||||
8. Anime matrix control thanks to [Starlight](https://github.com/vddCore/Starlight) + some tweaks from my side (including animated GIFs)
|
||||
9. FN+F5 cycles performance modes, FN+F4 cycles keyboard animation modes
|
||||
10. Keybindings for M3 and M4 keys
|
||||
11. Battery charge limit to preserve battery health
|
||||
12. Monitor CPU / GPU temperature, fan speeds and battery discharge rate
|
||||
3. Laptop screen refresh rate 60hz or 120hz (144hz, etc) with display overdrive (OD) and miniled multizone switch
|
||||
4. Custom fan curve editor, power limits (PPT) and turbo boost selection for every performance mode
|
||||
5. Anime matrix control thanks to [Starlight](https://github.com/vddCore/Starlight) + some tweaks from my side including animated GIFs
|
||||
6. Keyboard backlit animation and colors (including sleep animation and support for TUF models)
|
||||
7. Custom bindings for M3, M4 keys and FN+F5 (performance mode) FN+F4 (keyboard animation modes)
|
||||
8. Monitor CPU / GPU temperature, fan speeds and battery discharge rate
|
||||
9. Battery charge limit to preserve battery health
|
||||
|
||||
### :gear: Automatic switching when on battery or plugged in
|
||||
- Performance modes (app remembers last mode used on battery or when plugged)
|
||||
@@ -45,26 +41,26 @@ If you post about the app - please include a link. Thanks.
|
||||
- Auto Screen refresh rate (60hz on battery, 120+ hz when plugged)
|
||||
- Keyboard backlight can be turned off on battery
|
||||
|
||||
To keep auto switching and hotkeys working the app needs to stay in running in the tray. It doesn't consume any resources.
|
||||
To keep auto switching and hotkeys working the app needs to stay running in the tray. It doesn't consume any resources.
|
||||
|
||||
### :rocket: Performance Modes
|
||||
|
||||
Modes are **same** as in Armoury Crate (as they are stored in bios), including default fan curves
|
||||
|
||||

|
||||
Modes are **same** as in Armoury Crate as they are stored in bios including default fan curves
|
||||
|
||||
1. Silent (minimal or no fans, 70W PPT total, up to 45W PPT to CPU) + Best power efficiency setting in windows
|
||||
2. Balanced (balanced fans, 100W PPT total, up to 45W PPT to CPU) + Balanced setting in windows
|
||||
3. Turbo (intense fans, 125W PPT total, up to 80W PPT to CPU) + Best performance setting in windows
|
||||
|
||||
PPTs are shown for G14 2022, for other models PPTs will be different as they are set in bios.
|
||||
_PPTs are shown for G14 2022, for other models PPTs will be different as they are set in bios._
|
||||
|
||||

|
||||
|
||||
### :video_game: GPU Modes
|
||||
|
||||
1. Eco mode : only low power integrated GPU enabled, iGPU drives built in display
|
||||
2. Standard mode (MS Hybrid) : iGPU and dGPU enabled, iGPU drives built in display
|
||||
3. Ultimate mode: iGPU and dGPU enabled, but dGPU drives built in display (supported only on G14 2022 model)
|
||||
4. Optimized (formerly existed as a checkbox): disables dGPU on battery (Eco) and enables when plugged (Standard)
|
||||
4. Optimized: disables dGPU on battery (Eco) and enables when plugged (Standard)
|
||||
|
||||
## :question: FAQ
|
||||
|
||||
|
||||
Reference in New Issue
Block a user