Compare commits

...

22 Commits
v0.60 ... v0.63

Author SHA1 Message Date
Serge
8590d0301a Merge pull request #391 from seerge/revert-385-windows-power-plan-changes-optional
Revert "Adjustment of Windows Power Overlay is now optional"
2023-05-16 11:39:41 +02:00
Serge
8804d19567 Revert "Adjustment of Windows Power Overlay is now optional" 2023-05-16 11:38:17 +02:00
Serge
57ce0631a3 Merge pull request #385 from IceStormNG/windows-power-plan-changes-optional
Adjustment of Windows Power Overlay is now optional
2023-05-16 11:30:41 +02:00
Carsten Braun
b796f9f9d4 Moved checkbox to 2023-05-16 10:41:02 +02:00
Serge
f39563fcdf Added touchpad toggle for tablet mode on x13/x16 2023-05-15 23:59:21 +02:00
Serge
853d0c231d Auto update 2023-05-15 22:23:16 +02:00
Serge
df3324d641 Auto update 2023-05-15 22:21:41 +02:00
Serge
75c90ee155 Merge branch 'main' of https://github.com/seerge/g-helper 2023-05-15 22:11:29 +02:00
Serge
4015e0a7f7 Added auto-update checker 2023-05-15 22:11:27 +02:00
Carsten Braun
2a82e41894 Adjustment of Windows Power Overlay is now optional 2023-05-15 13:23:20 +02:00
Serge
a5541dfe10 Update README.md 2023-05-14 19:52:02 +02:00
Serge
fd3a139c47 Aura tweaks 2023-05-14 10:28:48 +02:00
Serge
608b8571d4 Fix for turkish keyboard, tweak for default fan curves 2023-05-13 22:13:00 +02:00
Serge
82a39bcfa1 Merge pull request #375 from IceStormNG/animematrix-for-GU604
Supports AniMeMatrix for Zephyrus M16 2023 (GU604)
2023-05-13 18:24:37 +02:00
Carsten Braun
f9ccd92dc6 Supports AniMeMatrix for Zephyrus M16 2023 (GU604) 2023-05-13 18:10:18 +02:00
Serge
1fadc6c31e Hotfix for possible crash 2023-05-13 09:43:26 +02:00
Serge
0b7dd42a5d UI tweak 2023-05-12 17:21:04 +02:00
Serge
51cd700e25 Improved GPU restart 2023-05-12 15:51:57 +02:00
Serge
7484253007 Merge branch 'main' of https://github.com/seerge/g-helper 2023-05-12 14:06:19 +02:00
Serge
f5cf768017 Display workaround 2023-05-12 14:06:15 +02:00
Serge
ca57669596 NV Clocks tweaks 2023-05-11 19:38:53 +02:00
Serge
35f1a3a25b Clock tweak 2023-05-11 11:18:42 +02:00
17 changed files with 397 additions and 103 deletions

View File

@@ -1,4 +1,5 @@
using GHelper; using System.Globalization;
using System.IO.Pipes;
using System.Management; using System.Management;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@@ -14,6 +15,7 @@ public class ASUSWmi
public const uint UniversalControl = 0x00100021; public const uint UniversalControl = 0x00100021;
public const int KB_Light_Up = 0xc4; public const int KB_Light_Up = 0xc4;
public const int KB_Light_Down = 0xc5; public const int KB_Light_Down = 0xc5;
public const int Touchpad_Toggle = 0x6B;
public const int ChargerMode = 0x0012006C; public const int ChargerMode = 0x0012006C;
@@ -58,6 +60,13 @@ public class ASUSWmi
public const int TUF_KB = 0x00100056; public const int TUF_KB = 0x00100056;
public const int TUF_KB_STATE = 0x00100057; public const int TUF_KB_STATE = 0x00100057;
public const int TabletState = 0x00060077;
public const int Tablet_Notebook = 0;
public const int Tablet_Tablet = 1;
public const int Tablet_Tent = 2;
public const int Tablet_Rotated = 3;
public const int PerformanceBalanced = 0; public const int PerformanceBalanced = 0;
public const int PerformanceTurbo = 1; public const int PerformanceTurbo = 1;
public const int PerformanceSilent = 2; public const int PerformanceSilent = 2;
@@ -205,7 +214,7 @@ public class ASUSWmi
byte[] args = new byte[8]; byte[] args = new byte[8];
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0); BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
byte[] status = CallMethod(DSTS, args); byte[] status = CallMethod(DSTS, args);
return BitConverter.ToInt32(status, 0) - 65536; return BitConverter.ToInt32(status, 0) - 65536;
} }
@@ -215,7 +224,7 @@ public class ASUSWmi
byte[] args = new byte[8]; byte[] args = new byte[8];
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0); BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
BitConverter.GetBytes((uint)Status).CopyTo(args, 4); BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
return CallMethod(DSTS, args); return CallMethod(DSTS, args);
} }
@@ -243,9 +252,7 @@ public class ASUSWmi
int result; int result;
for (int i = 8; i < curve.Length; i++) for (int i = 8; i < curve.Length; i++)
{
curve[i] = Math.Max((byte)0, Math.Min((byte)99, curve[i])); // it seems to be a bug, when some old model's bios can go nuts if fan is set to 100% curve[i] = Math.Max((byte)0, Math.Min((byte)99, curve[i])); // it seems to be a bug, when some old model's bios can go nuts if fan is set to 100%
}
switch (device) switch (device)
{ {
@@ -287,6 +294,47 @@ public class ASUSWmi
} }
public static bool IsEmptyCurve(byte[] curve) {
return curve.Length != 16 || curve.All(singleByte => singleByte == 0);
}
public static byte[] FixFanCurve(byte[] curve)
{
if (curve.Length != 16) throw new Exception("Incorrect curve");
var points = new Dictionary<byte, byte>();
for (int i = 0; i < 8; i++) points[curve[i]] = curve[i+8];
var pointsFixed = new Dictionary<byte, byte>();
bool fix = false;
int count = 0;
foreach (var pair in points.OrderBy(x => x.Key))
{
if (count == 0 && pair.Key >= 40)
{
fix = true;
pointsFixed.Add(20, 0);
}
if (count != 3 || !fix)
pointsFixed.Add(pair.Key, pair.Value);
count++;
}
count = 0;
foreach (var pair in pointsFixed.OrderBy(x => x.Key))
{
curve[count] =pair.Key;
curve[count+8] = pair.Value;
count++;
}
return curve;
}
public void TUFKeyboardBrightness(int brightness) public void TUFKeyboardBrightness(int brightness)
{ {
int param = 0x80 | (brightness & 0x7F); int param = 0x80 | (brightness & 0x7F);
@@ -336,7 +384,8 @@ public class ASUSWmi
watcher.Scope = new ManagementScope("root\\wmi"); watcher.Scope = new ManagementScope("root\\wmi");
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent"); watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
watcher.Start(); watcher.Start();
} catch }
catch
{ {
Logger.WriteLine("Can't connect to ASUS WMI events"); Logger.WriteLine("Can't connect to ASUS WMI events");
} }

View File

@@ -2,6 +2,7 @@
using Starlight.Communication; using Starlight.Communication;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Globalization; using System.Globalization;
using System.Management; using System.Management;
using System.Text; using System.Text;
@@ -61,7 +62,8 @@ namespace Starlight.AnimeMatrix
public enum AnimeType public enum AnimeType
{ {
GA401, GA401,
GA402 GA402,
GU604
} }
@@ -88,6 +90,8 @@ namespace Starlight.AnimeMatrix
//public int FullEvenRows = -1; //public int FullEvenRows = -1;
public int dx = 0; public int dx = 0;
//Shifts the whole frame to the left or right to align with the diagonal cut
public int frameShiftX = 0;
public int MaxColumns = 34; public int MaxColumns = 34;
private int frameIndex = 0; private int frameIndex = 0;
@@ -112,6 +116,16 @@ namespace Starlight.AnimeMatrix
UpdatePageLength = 410; UpdatePageLength = 410;
} }
if (model.Contains("GU604"))
{
_model = AnimeType.GU604;
MaxColumns = 39;
MaxRows = 92;
LedCount = 1711;
frameShiftX = -5;
UpdatePageLength = 630;
}
_displayBuffer = new byte[LedCount]; _displayBuffer = new byte[LedCount];
@@ -173,6 +187,9 @@ namespace Starlight.AnimeMatrix
{ {
return (y + 1) / 2 - 3; return (y + 1) / 2 - 3;
} }
case AnimeType.GU604:
return (int)Math.Ceiling(Math.Max(0, y - 9) / 2F);
default: default:
return (int)Math.Ceiling(Math.Max(0, y - 11) / 2F); return (int)Math.Ceiling(Math.Max(0, y - 11) / 2F);
} }
@@ -184,6 +201,8 @@ namespace Starlight.AnimeMatrix
{ {
case AnimeType.GA401: case AnimeType.GA401:
return 33; return 33;
case AnimeType.GU604:
return 39;
default: default:
return 34; return 34;
} }
@@ -226,7 +245,7 @@ namespace Starlight.AnimeMatrix
if (!IsRowInRange(y)) return; if (!IsRowInRange(y)) return;
if (x >= FirstX(y) && x < Width(y)) if (x >= FirstX(y) && x < Width(y))
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x + dx, value); SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x + dx + frameShiftX, value);
} }
public void WakeUp() public void WakeUp()
@@ -325,11 +344,17 @@ namespace Starlight.AnimeMatrix
public void PresentClock() public void PresentClock()
{ {
int second = DateTime.Now.Second; int second = DateTime.Now.Second;
string time;
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H")) if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
PresentTextDiagonal(DateTime.Now.ToString("H" + ((second % 2 == 0) ? ":" : " ") + "mm")); time = DateTime.Now.ToString("H" + ((second % 2 == 0) ? ":" : " ") + "mm");
else else
PresentTextDiagonal(DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mmtt")); time = DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mmtt");
if (_model == AnimeType.GA401)
PresentText(time);
else
PresentTextDiagonal(time);
} }
public void PresentText(string text1, string text2 = "") public void PresentText(string text1, string text2 = "")
@@ -341,14 +366,14 @@ namespace Starlight.AnimeMatrix
g.CompositingQuality = CompositingQuality.HighQuality; g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.AntiAlias; g.SmoothingMode = SmoothingMode.AntiAlias;
using (Font font = new Font("Arial", 24F, GraphicsUnit.Pixel)) using (Font font = new Font("Consolas", 24F, FontStyle.Regular, GraphicsUnit.Pixel))
{ {
SizeF textSize = g.MeasureString(text1, font); SizeF textSize = g.MeasureString(text1, font);
g.DrawString(text1, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 3, -3); g.DrawString(text1, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 3, -4);
} }
if (text2.Length > 0) if (text2.Length > 0)
using (Font font = new Font("Arial", 18F, GraphicsUnit.Pixel)) using (Font font = new Font("Consolas", 18F, GraphicsUnit.Pixel))
{ {
SizeF textSize = g.MeasureString(text2, font); SizeF textSize = g.MeasureString(text2, font);
g.DrawString(text2, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 1, 25); g.DrawString(text2, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 1, 25);
@@ -419,6 +444,24 @@ namespace Starlight.AnimeMatrix
Clear(); Clear();
InstalledFontCollection installedFontCollection = new InstalledFontCollection();
string familyName;
string familyList = "";
FontFamily[] fontFamilies;
// Get the array of FontFamily objects.
fontFamilies = installedFontCollection.Families;
int count = fontFamilies.Length;
for (int j = 0; j < count; ++j)
{
familyName = fontFamilies[j].Name;
familyList = familyList + familyName;
familyList = familyList + ", ";
}
int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns); int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns);
using (Bitmap bmp = new Bitmap(maxX, MaxRows)) using (Bitmap bmp = new Bitmap(maxX, MaxRows))
@@ -428,10 +471,10 @@ namespace Starlight.AnimeMatrix
g.CompositingQuality = CompositingQuality.HighQuality; g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.AntiAlias; g.SmoothingMode = SmoothingMode.AntiAlias;
using (Font font = new Font("Calibri", 13F, GraphicsUnit.Pixel)) using (Font font = new Font("Consolas", 13F, FontStyle.Regular, GraphicsUnit.Pixel))
{ {
SizeF textSize = g.MeasureString(text, font); SizeF textSize = g.MeasureString(text, font);
g.DrawString(text, font, Brushes.White, 4, 0); g.DrawString(text, font, Brushes.White, 4, 1);
} }
} }

View File

@@ -1,8 +1,6 @@
using HidLibrary; using HidLibrary;
using Microsoft.Win32; using Microsoft.Win32;
using OSD;
using System.Diagnostics; using System.Diagnostics;
using System.Windows.Forms;
namespace GHelper namespace GHelper
{ {
@@ -163,11 +161,14 @@ namespace GHelper
Color2 = Color.FromArgb(colorCode); Color2 = Color.FromArgb(colorCode);
} }
private static IEnumerable<HidDevice> GetHidDevices(int[] deviceIds)
private static IEnumerable<HidDevice> GetHidDevices(int[] deviceIds, int minInput = 18)
{ {
HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray(); HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
foreach (HidDevice device in HidDeviceList) foreach (HidDevice device in HidDeviceList)
if (device.IsConnected && device.Description.ToLower().Contains("hid") && device.Capabilities.FeatureReportByteLength >= 64) if (device.IsConnected
&& device.Capabilities.FeatureReportByteLength > 0
&& device.Capabilities.InputReportByteLength >= minInput) //
yield return device; yield return device;
} }
@@ -196,12 +197,13 @@ namespace GHelper
byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness }; byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness };
var devices = GetHidDevices(deviceIds); var devices = GetHidDevices(deviceIds);
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg)); //Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
foreach (HidDevice device in devices) foreach (HidDevice device in devices)
{ {
device.OpenDevice(); device.OpenDevice();
device.Write(msg); device.Write(msg);
Logger.WriteLine("USB-KB " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg));
device.CloseDevice(); device.CloseDevice();
} }
@@ -217,27 +219,28 @@ namespace GHelper
var devices = GetHidDevices(deviceIds); var devices = GetHidDevices(deviceIds);
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg)); //Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
foreach (HidDevice device in devices) foreach (HidDevice device in devices)
{ {
device.OpenDevice(); device.OpenDevice();
device.Write(msg); device.Write(msg);
Logger.WriteLine("USB-KB " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg));
device.CloseDevice(); device.CloseDevice();
} }
if (Program.config.ContainsModel("TUF")) if (Program.config.ContainsModel("TUF"))
Program.wmi.TUFKeyboardPower( Program.wmi.TUFKeyboardPower(
flags.Contains(AuraDev19b6.AwakeKeyb), flags.Contains(AuraDev19b6.AwakeKeyb),
flags.Contains(AuraDev19b6.BootKeyb), flags.Contains(AuraDev19b6.BootKeyb),
flags.Contains(AuraDev19b6.SleepKeyb), flags.Contains(AuraDev19b6.SleepKeyb),
flags.Contains(AuraDev19b6.ShutdownKeyb)); flags.Contains(AuraDev19b6.ShutdownKeyb));
} }
public static void ApplyXGMLight(bool status) public static void ApplyXGMLight(bool status)
{ {
byte value = status? (byte)0x50:(byte)0; byte value = status ? (byte)0x50 : (byte)0;
var msg = new byte[] { 0x5e, 0xc5, value }; var msg = new byte[] { 0x5e, 0xc5, value };
foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 })) foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }))
@@ -273,7 +276,11 @@ namespace GHelper
byte[] msg = AuraMessage(Mode, Color1, Color2, _speed); byte[] msg = AuraMessage(Mode, Color1, Color2, _speed);
var devices = GetHidDevices(deviceIds); var devices = GetHidDevices(deviceIds);
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg)); if (devices.Count() == 0)
{
Logger.WriteLine("USB-KB : not found");
GetHidDevices(deviceIds, 0);
}
foreach (HidDevice device in devices) foreach (HidDevice device in devices)
{ {
@@ -282,6 +289,7 @@ namespace GHelper
device.Write(MESSAGE_SET); device.Write(MESSAGE_SET);
device.Write(MESSAGE_APPLY); device.Write(MESSAGE_APPLY);
device.CloseDevice(); device.CloseDevice();
Logger.WriteLine("USB-KB " + device.Capabilities.FeatureReportByteLength + "|" + device.Capabilities.InputReportByteLength + device.Description + device.DevicePath + ":" + BitConverter.ToString(msg));
} }
if (Program.config.ContainsModel("TUF")) if (Program.config.ContainsModel("TUF"))
@@ -299,7 +307,8 @@ namespace GHelper
myKey.SetValue("TurnOffKeybdLight", value, RegistryValueKind.DWord); myKey.SetValue("TurnOffKeybdLight", value, RegistryValueKind.DWord);
myKey.Close(); myKey.Close();
} }
} catch (Exception ex) }
catch (Exception ex)
{ {
Logger.WriteLine(ex.Message); Logger.WriteLine(ex.Message);
} }

View File

@@ -15,6 +15,8 @@ namespace GHelper
static int MinRPM, MaxRPM; static int MinRPM, MaxRPM;
const int fansMax = 100;
NvidiaGpuControl? nvControl = null; NvidiaGpuControl? nvControl = null;
public Fans() public Fans()
@@ -146,15 +148,23 @@ namespace GHelper
if (gpu_boost < 0) gpu_boost = ASUSWmi.MaxGPUBoost; if (gpu_boost < 0) gpu_boost = ASUSWmi.MaxGPUBoost;
if (gpu_temp < 0) gpu_temp = ASUSWmi.MaxGPUTemp; if (gpu_temp < 0) gpu_temp = ASUSWmi.MaxGPUTemp;
if (core == -1) core = 0; if (core == -1) core = 0;
if (memory == 1) memory = 0; if (memory == -1) memory = 0;
if (readClocks) //if (readClocks)
//{
int status = nvControl.GetClocks(out int current_core, out int current_memory);
if (status != -1)
{ {
nvControl.GetClocks(out core, out memory, out string gpuTitle); core = current_core;
labelGPU.Text = gpuTitle; memory = current_memory;
} }
labelGPU.Text = nvControl.FullName;
//}
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset); trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset); trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
@@ -233,7 +243,7 @@ namespace GHelper
chart.ChartAreas[0].AxisX.Interval = 10; chart.ChartAreas[0].AxisX.Interval = 10;
chart.ChartAreas[0].AxisY.Minimum = 0; chart.ChartAreas[0].AxisY.Minimum = 0;
chart.ChartAreas[0].AxisY.Maximum = 100; chart.ChartAreas[0].AxisY.Maximum = fansMax;
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F); chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
@@ -242,10 +252,10 @@ namespace GHelper
chart.ChartAreas[0].AxisX.LineColor = chartGrid; chart.ChartAreas[0].AxisX.LineColor = chartGrid;
chart.ChartAreas[0].AxisY.LineColor = chartGrid; chart.ChartAreas[0].AxisY.LineColor = chartGrid;
for (int i = 0; i <= 90; i += 10) for (int i = 0; i <= fansMax-10; i += 10)
chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartPercToRPM(i)); chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartPercToRPM(i));
chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, Properties.Strings.RPM); chart.ChartAreas[0].AxisY.CustomLabels.Add(fansMax-2, fansMax+2, Properties.Strings.RPM);
chart.ChartAreas[0].AxisY.Interval = 10; chart.ChartAreas[0].AxisY.Interval = 10;
@@ -452,11 +462,16 @@ namespace GHelper
int mode = Program.config.getConfig("performance_mode"); int mode = Program.config.getConfig("performance_mode");
byte[] curve = Program.config.getFanConfig(device); byte[] curve = Program.config.getFanConfig(device);
if (def == 1 || curve.Length != 16) if (def == 1 || ASUSWmi.IsEmptyCurve(curve))
{
curve = Program.wmi.GetFanCurve(device, mode); curve = Program.wmi.GetFanCurve(device, mode);
if (ASUSWmi.IsEmptyCurve(curve))
curve = Program.config.getDefaultCurve(device);
if (curve.Length != 16 || curve.All(singleByte => singleByte == 0)) curve = ASUSWmi.FixFanCurve(curve);
curve = Program.config.getDefaultCurve(device);
}
//Debug.WriteLine(BitConverter.ToString(curve)); //Debug.WriteLine(BitConverter.ToString(curve));
@@ -569,7 +584,7 @@ namespace GHelper
if (dx > 100) dx = 100; if (dx > 100) dx = 100;
if (dy < 0) dy = 0; if (dy < 0) dy = 0;
if (dy > 100) dy = 100; if (dy > fansMax) dy = fansMax;
dymin = (dx - 65) * 1.2; dymin = (dx - 65) * 1.2;

View File

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

View File

@@ -11,7 +11,7 @@ public class AmdGpuControl : IGpuControl {
public bool IsNvidia => false; public bool IsNvidia => false;
public string FullName => _internalDiscreteAdapter!.AdapterName;
public AmdGpuControl() { public AmdGpuControl() {
if (!Adl2.Load()) if (!Adl2.Load())
return; return;

View File

@@ -3,6 +3,7 @@
public interface IGpuControl : IDisposable { public interface IGpuControl : IDisposable {
bool IsNvidia { get; } bool IsNvidia { get; }
bool IsValid { get; } bool IsValid { get; }
public string FullName { get; }
int? GetCurrentTemperature(); int? GetCurrentTemperature();
int? GetGpuUse(); int? GetGpuUse();
} }

View File

@@ -31,6 +31,8 @@ public class NvidiaGpuControl : IGpuControl
public bool IsNvidia => IsValid; public bool IsNvidia => IsValid;
public string FullName => _internalGpu!.FullName;
public int? GetCurrentTemperature() public int? GetCurrentTemperature()
{ {
if (!IsValid) if (!IsValid)
@@ -49,12 +51,10 @@ public class NvidiaGpuControl : IGpuControl
} }
public int GetClocks(out int core, out int memory, out string gpu) public int GetClocks(out int core, out int memory)
{ {
PhysicalGPU internalGpu = _internalGpu!; PhysicalGPU internalGpu = _internalGpu!;
gpu = internalGpu.FullName;
//Logger.WriteLine(internalGpu.FullName); //Logger.WriteLine(internalGpu.FullName);
//Logger.WriteLine(internalGpu.ArchitectInformation.ToString()); //Logger.WriteLine(internalGpu.ArchitectInformation.ToString());
@@ -63,12 +63,12 @@ public class NvidiaGpuControl : IGpuControl
IPerformanceStates20Info states = GPUApi.GetPerformanceStates20(internalGpu.Handle); IPerformanceStates20Info states = GPUApi.GetPerformanceStates20(internalGpu.Handle);
core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000; core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000;
memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000; memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000;
Logger.WriteLine($"GET GPU Clock offsets : {core}, {memory}"); Logger.WriteLine($"GET GPU CLOCKS: {core}, {memory}");
return 0; return 0;
} catch (Exception ex) } catch (Exception ex)
{ {
Logger.WriteLine(ex.Message); Logger.WriteLine("GET GPU CLOCKS:" + ex.Message);
core = memory = 0; core = memory = 0;
return -1; return -1;
} }
@@ -90,7 +90,7 @@ public class NvidiaGpuControl : IGpuControl
} }
public bool RestartGPU() public bool RestartGPUPnP()
{ {
if (!IsValid) return false; if (!IsValid) return false;
@@ -99,13 +99,30 @@ public class NvidiaGpuControl : IGpuControl
{ {
PhysicalGPU internalGpu = _internalGpu!; PhysicalGPU internalGpu = _internalGpu!;
var pnpDeviceId = internalGpu.BusInformation.PCIIdentifiers.ToString(); var pnpDeviceId = internalGpu.BusInformation.PCIIdentifiers.ToString();
Logger.WriteLine("Device ID:"+ pnpDeviceId); Logger.WriteLine("Device ID:" + pnpDeviceId);
RunCMD("pnputil", $"/disable-device /deviceid \"{pnpDeviceId}\""); RunCMD("pnputil", $"/disable-device /deviceid \"{pnpDeviceId}\"");
Thread.Sleep(3000); Thread.Sleep(3000);
RunCMD("pnputil", $"/enable-device /deviceid \"{pnpDeviceId}\""); RunCMD("pnputil", $"/enable-device /deviceid \"{pnpDeviceId}\"");
Thread.Sleep(2000); Thread.Sleep(2000);
return true; return true;
} }
catch (Exception ex)
{
Logger.WriteLine(ex.ToString());
return false;
}
}
public bool RestartGPU()
{
try
{
string script = @"$device = Get-PnpDevice | Where-Object { $_.FriendlyName -imatch 'NVIDIA' -and $_.Class -eq 'Display' }; Disable-PnpDevice $device.InstanceId -Confirm:$false; Start-Sleep -Seconds 3; Enable-PnpDevice $device.InstanceId -Confirm:$false";
Logger.WriteLine(script);
RunCMD("powershell", script);
//Thread.Sleep(2000);
return true;
}
catch (Exception ex ) catch (Exception ex )
{ {
Logger.WriteLine(ex.ToString()); Logger.WriteLine(ex.ToString());
@@ -141,12 +158,12 @@ public class NvidiaGpuControl : IGpuControl
try try
{ {
Logger.WriteLine($"SET GPU Clock : {core}, {memory}"); Logger.WriteLine($"SET GPU CLOCKS: {core}, {memory}");
GPUApi.SetPerformanceStates20(internalGpu.Handle, overclock); GPUApi.SetPerformanceStates20(internalGpu.Handle, overclock);
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine(ex.Message); Logger.WriteLine("SET GPU CLOCKS: "+ex.Message);
return -1; return -1;
} }

View File

@@ -51,6 +51,7 @@ public static class HardwareControl
try try
{ {
int? gpuUse = GpuControl?.GetGpuUse(); int? gpuUse = GpuControl?.GetGpuUse();
Logger.WriteLine("GPU usage: " + GpuControl?.FullName + " " + gpuUse + "%");
if (gpuUse is not null) return (int)gpuUse; if (gpuUse is not null) return (int)gpuUse;
} }
catch (Exception ex) catch (Exception ex)
@@ -113,7 +114,7 @@ public static class HardwareControl
} }
} }
public static bool IsUsedGPU(int threshold = 20) public static bool IsUsedGPU(int threshold = 10)
{ {
if (GetGpuUse() > threshold) if (GetGpuUse() > threshold)
{ {
@@ -132,7 +133,7 @@ public static class HardwareControl
return null; return null;
} }
public static void RecreateGpuControlWithDelay(int delay = 3) public static void RecreateGpuControlWithDelay(int delay = 5)
{ {
// Re-enabling the discrete GPU takes a bit of time, // Re-enabling the discrete GPU takes a bit of time,
// so a simple workaround is to refresh again after that happens // so a simple workaround is to refresh again after that happens

View File

@@ -647,6 +647,8 @@ public class NativeMethods
//Logger.WriteLine(screen.DeviceName); //Logger.WriteLine(screen.DeviceName);
count++; count++;
} }
if (displayNum > 0 && count == 0) laptopScreen = defaultDevice;
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -0,0 +1,38 @@
using System.Text.RegularExpressions;
using System.Text;
namespace GHelper
{
public static class OptimizationService
{
public static void SetChargeLimit (int newValue)
{
// Set the path to the .ini file
string path = @"C:\ProgramData\ASUS\ASUS System Control Interface\ASUSOptimization\Customization.ini";
// Make a backup copy of the INI file
string backupPath = path + ".bak";
File.Copy(path, backupPath, true);
string fileContents = File.ReadAllText(path, Encoding.Unicode);
// Find the section [BatteryHealthCharging]
string sectionPattern = @"\[BatteryHealthCharging\]\s*(version=\d+)?\s+value=(\d+)";
Match sectionMatch = Regex.Match(fileContents, sectionPattern);
if (sectionMatch.Success)
{
// Replace the value with the new value
string oldValueString = sectionMatch.Groups[2].Value;
int oldValue = int.Parse(oldValueString);
string newSection = sectionMatch.Value.Replace($"value={oldValue}", $"value={newValue}");
// Replace the section in the file contents
fileContents = fileContents.Replace(sectionMatch.Value, newSection);
File.WriteAllText(path, fileContents, Encoding.Unicode);
}
}
}
}

View File

@@ -1,4 +1,3 @@
using GHelper.Gpu;
using Microsoft.Win32; using Microsoft.Win32;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
@@ -64,7 +63,7 @@ namespace GHelper
} }
Logger.WriteLine("------------"); Logger.WriteLine("------------");
Logger.WriteLine("App launched: " + config.GetModel() + " :" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + (IsUserAdministrator()?"A":"")); Logger.WriteLine("App launched: " + config.GetModel() + " :" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + (IsUserAdministrator() ? "A" : ""));
Application.EnableVisualStyles(); Application.EnableVisualStyles();
@@ -253,6 +252,23 @@ namespace GHelper
} }
} }
static void TabletMode()
{
bool touchpadState, tabletState;
using (var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\PrecisionTouchPad\Status", false))
{
touchpadState = (key?.GetValue("Enabled")?.ToString() == "1");
}
tabletState = wmi.DeviceGet(ASUSWmi.TabletState) > 0;
Logger.WriteLine("Tablet: " + tabletState + " Touchpad: " + touchpadState);
if ((tabletState && touchpadState) || (!tabletState && !touchpadState))
wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.Touchpad_Toggle, "Touchpad");
}
static void WatcherEventArrived(object sender, EventArrivedEventArgs e) static void WatcherEventArrived(object sender, EventArrivedEventArgs e)
{ {
@@ -278,6 +294,10 @@ namespace GHelper
case 179: // FN+F4 case 179: // FN+F4
KeyProcess("fnf4"); KeyProcess("fnf4");
return; return;
case 189: // Tablet mode
TabletMode();
return;
} }
@@ -291,16 +311,19 @@ namespace GHelper
{ {
settingsForm.Show(); settingsForm.Show();
settingsForm.Activate(); settingsForm.Activate();
settingsForm.VisualiseGPUMode();
if (action == "gpu") switch (action)
{ {
Startup.ReScheduleAdmin(); case "gpu":
settingsForm.FansToggle(); Startup.ReScheduleAdmin();
settingsForm.FansToggle();
break;
case "gpurestart":
settingsForm.RestartGPU(false);
break;
} }
} }
settingsForm.VisualiseGPUMode();
} }
static void TrayIcon_MouseClick(object? sender, MouseEventArgs e) static void TrayIcon_MouseClick(object? sender, MouseEventArgs e)

View File

@@ -825,6 +825,15 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Something is using dGPU and preventing Eco mode. Restart dGPU in device manager? * Please proceed on your own risk..
/// </summary>
internal static string RestartGPU {
get {
return ResourceManager.GetString("RestartGPU", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to RPM. /// Looks up a localized string similar to RPM.
/// </summary> /// </summary>

View File

@@ -372,6 +372,9 @@
<data name="Quit" xml:space="preserve"> <data name="Quit" xml:space="preserve">
<value>Quit</value> <value>Quit</value>
</data> </data>
<data name="RestartGPU" xml:space="preserve">
<value>Something is using dGPU and preventing Eco mode. Restart dGPU in device manager? * Please proceed on your own risk.</value>
</data>
<data name="RPM" xml:space="preserve"> <data name="RPM" xml:space="preserve">
<value>RPM</value> <value>RPM</value>
</data> </data>

View File

@@ -267,24 +267,25 @@ namespace GHelper
labelModel.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelModel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelModel.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); labelModel.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
labelModel.ForeColor = SystemColors.ControlDark; labelModel.ForeColor = SystemColors.ControlDark;
labelModel.Location = new Point(291, 119); labelModel.Location = new Point(380, 119);
labelModel.Margin = new Padding(8, 0, 8, 0); labelModel.Margin = new Padding(8, 0, 8, 0);
labelModel.Name = "labelModel"; labelModel.Name = "labelModel";
labelModel.Size = new Size(492, 32); labelModel.Size = new Size(400, 32);
labelModel.TabIndex = 38; labelModel.TabIndex = 38;
labelModel.TextAlign = ContentAlignment.TopRight; labelModel.TextAlign = ContentAlignment.TopRight;
// //
// labelVersion // labelVersion
// //
labelVersion.AutoSize = true; labelVersion.AutoSize = false;
labelVersion.Font = new Font("Segoe UI", 9F, FontStyle.Underline, GraphicsUnit.Point); labelVersion.Font = new Font("Segoe UI", 9F, FontStyle.Underline, GraphicsUnit.Point);
labelVersion.ForeColor = SystemColors.ControlDark; labelVersion.ForeColor = SystemColors.ControlDark;
labelVersion.Location = new Point(25, 119); labelVersion.Location = new Point(25, 119);
labelVersion.Margin = new Padding(8, 0, 8, 0); labelVersion.Margin = new Padding(8, 0, 8, 0);
labelVersion.Name = "labelVersion"; labelVersion.Name = "labelVersion";
labelVersion.Size = new Size(44, 32); labelVersion.Size = new Size(300, 32);
labelVersion.TabIndex = 37; labelVersion.TabIndex = 37;
labelVersion.Text = "v.0"; labelVersion.Text = "v.0";
labelVersion.Cursor = Cursors.Hand;
// //
// labelBattery // labelBattery
// //

View File

@@ -1,14 +1,12 @@
using CustomControls; using CustomControls;
using GHelper.Gpu; using GHelper.Gpu;
using Starlight.AnimeMatrix; using Starlight.AnimeMatrix;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Net;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.Json; using System.Text.Json;
using System.Timers; using System.Timers;
using System.Windows.Forms;
using Tools; using Tools;
namespace GHelper namespace GHelper
@@ -142,7 +140,7 @@ namespace GHelper
int trim = model.LastIndexOf("_"); int trim = model.LastIndexOf("_");
if (trim > 0) model = model.Substring(0, trim); if (trim > 0) model = model.Substring(0, trim);
labelModel.Text = model+(Program.IsUserAdministrator()?".":""); labelModel.Text = model + (Program.IsUserAdministrator() ? "." : "");
TopMost = Program.config.getConfig("topmost") == 1; TopMost = Program.config.getConfig("topmost") == 1;
@@ -161,7 +159,7 @@ namespace GHelper
contextMenuStrip.Items.Clear(); contextMenuStrip.Items.Clear();
Padding padding = new Padding(5, 5, 5, 5); Padding padding = new Padding(15, 5, 5, 5);
/* /*
TableLayoutPanel[] tables = { tablePerf, tableGPU }; TableLayoutPanel[] tables = { tablePerf, tableGPU };
@@ -248,7 +246,7 @@ namespace GHelper
quit.Margin = padding; quit.Margin = padding;
contextMenuStrip.Items.Add(quit); contextMenuStrip.Items.Add(quit);
contextMenuStrip.ShowCheckMargin = true; //contextMenuStrip.ShowCheckMargin = true;
contextMenuStrip.RenderMode = ToolStripRenderMode.System; contextMenuStrip.RenderMode = ToolStripRenderMode.System;
if (CheckSystemDarkModeStatus()) if (CheckSystemDarkModeStatus())
@@ -297,10 +295,20 @@ namespace GHelper
var gitVersion = new Version(tag); var gitVersion = new Version(tag);
var appVersion = new Version(Assembly.GetExecutingAssembly().GetName().Version.ToString()); var appVersion = new Version(Assembly.GetExecutingAssembly().GetName().Version.ToString());
//appVersion = new Version("0.50.0.0");
if (gitVersion.CompareTo(appVersion) > 0) if (gitVersion.CompareTo(appVersion) > 0)
{ {
SetVersionLabel(Properties.Strings.DownloadUpdate + ": " + tag, url); SetVersionLabel(Properties.Strings.DownloadUpdate + ": " + tag, url);
if (Program.config.getConfigString("skip_version") != tag)
{
DialogResult dialogResult = MessageBox.Show(Properties.Strings.DownloadUpdate + ": G-Helper " + tag + "?", "Update", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
AutoUpdate(url);
else
Program.config.setConfig("skip_version", tag);
}
} }
else else
{ {
@@ -317,6 +325,57 @@ namespace GHelper
} }
void SetVersionLabel(string label, string url = null)
{
BeginInvoke(delegate
{
labelVersion.Text = label;
if (url is not null)
{
this.versionUrl = url;
labelVersion.ForeColor = Color.Red;
}
});
}
public async void AutoUpdate(string requestUri)
{
Uri uri = new Uri(requestUri);
string zipName = Path.GetFileName(uri.LocalPath);
string exeLocation = Application.ExecutablePath;
string exeDir = Path.GetDirectoryName(exeLocation);
string zipLocation = exeDir + "\\" + zipName;
using (WebClient client = new WebClient())
{
client.DownloadFile(uri, zipLocation);
}
var cmd = new Process();
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.FileName = "powershell";
cmd.StartInfo.Arguments = $"Start-Sleep -Seconds 1; Expand-Archive {zipLocation} -DestinationPath {exeDir} -Force; {exeLocation}";
cmd.Start();
Debug.WriteLine(requestUri);
Debug.WriteLine(zipLocation);
Application.Exit();
return;
}
private void LabelVersion_Click(object? sender, EventArgs e)
{
Process.Start(new ProcessStartInfo(versionUrl) { UseShellExecute = true });
}
private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e) private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e)
{ {
Program.settingsForm.RefreshSensors(); Program.settingsForm.RefreshSensors();
@@ -422,22 +481,8 @@ namespace GHelper
} }
void SetVersionLabel(string label, string url = null)
{
labelVersion.Text = label;
if (url is not null)
{
this.versionUrl = url;
labelVersion.ForeColor = Color.Red;
}
}
private void LabelVersion_Click(object? sender, EventArgs e)
{
Process.Start(new ProcessStartInfo(versionUrl) { UseShellExecute = true });
}
private void CheckStartup_CheckedChanged(object? sender, EventArgs e) private void CheckStartup_CheckedChanged(object? sender, EventArgs e)
{ {
@@ -1056,17 +1101,18 @@ namespace GHelper
//if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false; //if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false;
if (Program.wmi.DeviceGet(ASUSWmi.GPUEco) == 1) return;
if (HardwareControl.GpuControl is null) return; if (HardwareControl.GpuControl is null) return;
if (!HardwareControl.GpuControl!.IsNvidia) return; if (!HardwareControl.GpuControl!.IsNvidia) return;
if (Program.wmi.DeviceGet(ASUSWmi.GPUEco) == 1) return;
using NvidiaGpuControl nvControl = (NvidiaGpuControl)HardwareControl.GpuControl; using NvidiaGpuControl nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
try try
{ {
int getStatus = nvControl.GetClocks(out int current_core, out int current_memory, out string gpuName); int getStatus = nvControl.GetClocks(out int current_core, out int current_memory);
if (getStatus == -1) return; if (getStatus != -1)
{
if (Math.Abs(gpu_core - current_core) < 5 && Math.Abs(gpu_memory - current_memory) < 5) 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); int setStatus = nvControl.SetClocks(gpu_core, gpu_memory);
if (launchAsAdmin && setStatus == -1) Program.RunAsAdmin("gpu"); if (launchAsAdmin && setStatus == -1) Program.RunAsAdmin("gpu");
@@ -1085,7 +1131,7 @@ namespace GHelper
int gpu_temp = Program.config.getConfigPerf("gpu_temp"); int gpu_temp = Program.config.getConfigPerf("gpu_temp");
if (gpu_boost < ASUSWmi.MinGPUBoost || gpu_boost > ASUSWmi.MaxGPUBoost ) return; if (gpu_boost < ASUSWmi.MinGPUBoost || gpu_boost > ASUSWmi.MaxGPUBoost) return;
if (gpu_temp < ASUSWmi.MinGPUTemp || gpu_temp > ASUSWmi.MaxGPUTemp) return; if (gpu_temp < ASUSWmi.MinGPUTemp || gpu_temp > ASUSWmi.MaxGPUTemp) return;
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC0) >= 0) if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC0) >= 0)
@@ -1311,9 +1357,10 @@ namespace GHelper
SetScreen(1000, 1); SetScreen(1000, 1);
else else
SetScreen(60, 0); SetScreen(60, 0);
} else }
else
{ {
SetScreen(overdrive : Program.config.getConfig("overdrive")); SetScreen(overdrive: Program.config.getConfig("overdrive"));
} }
@@ -1453,19 +1500,43 @@ namespace GHelper
} }
public bool RestartGPU() public void RestartGPU(bool confirm = true)
{ {
if (HardwareControl.GpuControl is null) return false; if (HardwareControl.GpuControl is null) return;
if (!HardwareControl.GpuControl!.IsNvidia) return false; if (!HardwareControl.GpuControl!.IsNvidia) return;
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 (confirm)
if (dialogResult == DialogResult.No) return false; {
DialogResult dialogResult = MessageBox.Show(Properties.Strings.RestartGPU, Properties.Strings.EcoMode, MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.No) return;
}
Program.RunAsAdmin(); Program.RunAsAdmin("gpurestart");
Logger.WriteLine("Trying to restart GPU"); if (!Program.IsUserAdministrator()) return;
var nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
return nvControl.RestartGPU(); Logger.WriteLine("Trying to restart dGPU");
Task.Run(async () =>
{
Program.settingsForm.BeginInvoke(delegate
{
labelTipGPU.Text = "Restarting GPU ...";
ButtonEnabled(buttonOptimized, false);
ButtonEnabled(buttonEco, false);
ButtonEnabled(buttonStandard, false);
ButtonEnabled(buttonUltimate, false);
});
var nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
bool status = nvControl.RestartGPU();
Program.settingsForm.BeginInvoke(delegate
{
labelTipGPU.Text = status ? "GPU Restarted, you can try Eco mode again" : "Failed to restart GPU";
InitGPUMode();
});
});
} }
@@ -1489,13 +1560,14 @@ namespace GHelper
string[] tokill = { "EADesktop", "RadeonSoftware" }; string[] tokill = { "EADesktop", "RadeonSoftware" };
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 (eco == 1) status = 0; else
status = Program.wmi.SetGPUEco(eco); status = Program.wmi.SetGPUEco(eco);
if (status == 0 && eco == 1 && hardWay) if (status == 0 && eco == 1 && hardWay)
{ {
if (RestartGPU()) Program.wmi.SetGPUEco(1); RestartGPU();
} }
await Task.Delay(TimeSpan.FromMilliseconds(500)); await Task.Delay(TimeSpan.FromMilliseconds(500));
@@ -1507,7 +1579,7 @@ namespace GHelper
if (eco == 0) if (eco == 0)
{ {
await Task.Delay(TimeSpan.FromMilliseconds(1000)); await Task.Delay(TimeSpan.FromMilliseconds(3000));
HardwareControl.RecreateGpuControl(); HardwareControl.RecreateGpuControl();
SetGPUClocks(false); SetGPUClocks(false);
} }
@@ -1668,6 +1740,15 @@ namespace GHelper
sliderBattery.Value = limit; sliderBattery.Value = limit;
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit, "BatteryLimit"); Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit, "BatteryLimit");
try
{
OptimizationService.SetChargeLimit(limit);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
Program.config.setConfig("charge_limit", limit); Program.config.setConfig("charge_limit", limit);
} }

View File

@@ -149,6 +149,8 @@ It's a lightweight Armoury Crate alternative for Asus laptops. A small utility t
- 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. - 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.
- Also, it's not recommended to have "ASUS Smart Display Control" app running, as it will try to change refresh rates and fight with g-helper for the same function. You can safely uninstall it.
------------------------------- -------------------------------
Designed and developed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models for relevant and supported features. Designed and developed for Asus Zephyrus G14 2022 (with AMD Radeon iGPU and dGPU). But could and should potentially work for G14 of 2021 and 2020, G15, X FLOW, and other ROG models for relevant and supported features.