mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
253e1eb095 | ||
|
|
b95768d547 | ||
|
|
dfbfd16d23 | ||
|
|
3eeac0353a | ||
|
|
5e7c9a4191 | ||
|
|
ee84ba6304 | ||
|
|
d15c6cb073 | ||
|
|
1e683a0884 | ||
|
|
1ad48bf763 | ||
|
|
dcc052a574 | ||
|
|
38fca560df | ||
|
|
7e0459bd44 | ||
|
|
228ad70b8d | ||
|
|
b42e565cd6 | ||
|
|
e021d59737 | ||
|
|
dba7967ad5 | ||
|
|
a7a7170676 | ||
|
|
1d43ca3ce4 | ||
|
|
ff7618f16f | ||
|
|
bb947bf8bf | ||
|
|
63092d8415 | ||
|
|
6fbce2f495 | ||
|
|
8d89a04608 | ||
|
|
0cbc48d526 | ||
|
|
81013ca0be | ||
|
|
af2509fc17 | ||
|
|
136b5b4f55 | ||
|
|
4e2abff942 | ||
|
|
2c8a11fc24 | ||
|
|
8af8823ee4 | ||
|
|
ec0a1b710e | ||
|
|
2ac2e84161 | ||
|
|
14dc1741f7 | ||
|
|
fbed195194 | ||
|
|
0d002edf65 | ||
|
|
28a17562a8 | ||
|
|
583cb677d0 | ||
|
|
1888fe7bd9 | ||
|
|
089b339e61 | ||
|
|
cab4a04339 | ||
|
|
7ab3b450cd | ||
|
|
ea2dc7b75d | ||
|
|
ccd69a8628 | ||
|
|
c1d23159a0 | ||
|
|
1c865624e6 | ||
|
|
4853c09c2c |
@@ -1,6 +1,4 @@
|
||||
using GHelper;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class ASUSWmi
|
||||
@@ -12,6 +10,10 @@ public class ASUSWmi
|
||||
const uint DSTS = 0x53545344;
|
||||
const uint DEVS = 0x53564544;
|
||||
|
||||
public const uint UniversalControl = 0x00100021;
|
||||
public const int KB_Light_Up = 0xc4;
|
||||
public const int KB_Light_Down = 0xc5;
|
||||
|
||||
public const uint CPU_Fan = 0x00110013;
|
||||
public const uint GPU_Fan = 0x00110014;
|
||||
public const uint Mid_Fan = 0x00110031;
|
||||
@@ -29,6 +31,10 @@ public class ASUSWmi
|
||||
public const uint DevsGPUFanCurve = 0x00110025;
|
||||
public const uint DevsMidFanCurve = 0x00110032;
|
||||
|
||||
public const int Temp_CPU = 0x00120094;
|
||||
public const int Temp_GPU = 0x00120097;
|
||||
|
||||
|
||||
public const int PPT_TotalA0 = 0x001200A0; // Total PPT on 2022 and CPU PPT on 2021
|
||||
public const int PPT_EDCA1 = 0x001200A1; // CPU EDC
|
||||
public const int PPT_TDCA2 = 0x001200A2; // CPU TDC
|
||||
@@ -151,21 +157,31 @@ public class ASUSWmi
|
||||
|
||||
}
|
||||
|
||||
public byte[] DeviceSet(uint DeviceID, int Status)
|
||||
public int DeviceSet(uint DeviceID, int Status, string logName)
|
||||
{
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
|
||||
return CallMethod(DEVS, args);
|
||||
|
||||
byte[] status = CallMethod(DEVS, args);
|
||||
int result = BitConverter.ToInt32(status, 0);
|
||||
|
||||
Logger.WriteLine(logName + " = " + Status + " : " + (result == 1 ? "OK" : result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public byte[] DeviceSet(uint DeviceID, byte[] Params)
|
||||
public int DeviceSet(uint DeviceID, byte[] Params, string logName)
|
||||
{
|
||||
byte[] args = new byte[4 + Params.Length];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
Params.CopyTo(args, 4);
|
||||
return CallMethod(DEVS, args);
|
||||
|
||||
byte[] status = CallMethod(DEVS, args);
|
||||
int result = BitConverter.ToInt32(status, 0);
|
||||
|
||||
Logger.WriteLine(logName + " = " + BitConverter.ToString(Params) + " : " + (result == 1 ? "OK" : result));
|
||||
return BitConverter.ToInt32(status, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +190,9 @@ public class ASUSWmi
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
byte[] status = CallMethod(DSTS, args);
|
||||
|
||||
return BitConverter.ToInt32(status, 0) - 65536;
|
||||
|
||||
}
|
||||
|
||||
public byte[] DeviceGetBuffer(uint DeviceID, uint Status = 0)
|
||||
@@ -182,35 +200,33 @@ public class ASUSWmi
|
||||
byte[] args = new byte[8];
|
||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
|
||||
|
||||
return CallMethod(DSTS, args);
|
||||
}
|
||||
|
||||
|
||||
public void SetFanCurve(int device, byte[] curve)
|
||||
public int SetFanCurve(int device, byte[] curve)
|
||||
{
|
||||
|
||||
if (curve.Length != 16) return;
|
||||
if (curve.All(singleByte => singleByte == 0)) return;
|
||||
if (curve.Length != 16) return -1;
|
||||
if (curve.All(singleByte => singleByte == 0)) return -1;
|
||||
|
||||
string name;
|
||||
int result;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case 1:
|
||||
DeviceSet(DevsGPUFanCurve, curve);
|
||||
name = "GPU";
|
||||
result = DeviceSet(DevsGPUFanCurve, curve, "FanGPU");
|
||||
break;
|
||||
case 2:
|
||||
DeviceSet(DevsMidFanCurve, curve);
|
||||
name = "Mid";
|
||||
result = DeviceSet(DevsMidFanCurve, curve, "FanMid");
|
||||
break;
|
||||
default:
|
||||
DeviceSet(DevsCPUFanCurve, curve);
|
||||
name = "CPU";
|
||||
result = DeviceSet(DevsCPUFanCurve, curve, "FanCPU");
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.WriteLine("Fans" + name + " " + BitConverter.ToString(curve));
|
||||
return result;
|
||||
}
|
||||
|
||||
public byte[] GetFanCurve(int device, int mode = 0)
|
||||
@@ -231,7 +247,7 @@ public class ASUSWmi
|
||||
return DeviceGetBuffer(DevsGPUFanCurve, fan_mode);
|
||||
case 2:
|
||||
return DeviceGetBuffer(DevsMidFanCurve, fan_mode);
|
||||
default:
|
||||
default:
|
||||
return DeviceGetBuffer(DevsCPUFanCurve, fan_mode);
|
||||
}
|
||||
|
||||
@@ -248,33 +264,27 @@ public class ASUSWmi
|
||||
setting[4] = color.B;
|
||||
setting[5] = (byte)speed;
|
||||
|
||||
DeviceSet(TUF_KB, setting);
|
||||
DeviceSet(TUF_KB, setting, "TUF RGB");
|
||||
//Debug.WriteLine(BitConverter.ToString(setting));
|
||||
|
||||
}
|
||||
|
||||
const int ASUS_WMI_KEYBOARD_POWER_BOOT = 0x03 << 16;
|
||||
const int ASUS_WMI_KEYBOARD_POWER_AWAKE = 0x0C << 16;
|
||||
const int ASUS_WMI_KEYBOARD_POWER_SLEEP = 0x30 << 16;
|
||||
const int ASUS_WMI_KEYBOARD_POWER_SHUTDOWN = 0xC0 << 16;
|
||||
public void TUFKeyboardPower(bool awake = true, bool boot = false, bool sleep = false, bool shutdown = false)
|
||||
{
|
||||
uint flags;
|
||||
uint cmd = 1;
|
||||
int state = 0xbd;
|
||||
|
||||
flags = 0;
|
||||
if (boot)
|
||||
flags |= (1 << 1);
|
||||
if (awake)
|
||||
flags |= (1 << 3);
|
||||
if (sleep)
|
||||
flags |= (1 << 5);
|
||||
if (shutdown)
|
||||
flags |= (1 << 7);
|
||||
if (boot) state = state | ASUS_WMI_KEYBOARD_POWER_BOOT;
|
||||
if (awake) state = state | ASUS_WMI_KEYBOARD_POWER_AWAKE;
|
||||
if (sleep) state = state | ASUS_WMI_KEYBOARD_POWER_SLEEP;
|
||||
if (shutdown) state = state | ASUS_WMI_KEYBOARD_POWER_SHUTDOWN;
|
||||
|
||||
byte[] state = new byte[12];
|
||||
state[0] = 0xbd;
|
||||
state[1] = (byte)((cmd != 0) ? (1 << 2) : 0);
|
||||
state[2] = (byte)flags;
|
||||
state = state | 0x01 << 8;
|
||||
|
||||
DeviceSet(TUF_KB, state);
|
||||
Debug.WriteLine(BitConverter.ToString(state));
|
||||
DeviceSet(TUF_KB_STATE, state, "TUF_KB");
|
||||
}
|
||||
|
||||
public void SubscribeToEvents(Action<object, EventArrivedEventArgs> EventHandler)
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
using Starlight.Communication;
|
||||
using System.Management;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System;
|
||||
|
||||
namespace Starlight.AnimeMatrix
|
||||
{
|
||||
@@ -86,6 +88,7 @@ namespace Starlight.AnimeMatrix
|
||||
//public int FullRows = 11;
|
||||
//public int FullEvenRows = -1;
|
||||
|
||||
public int dx = 0;
|
||||
public int MaxColumns = 34;
|
||||
|
||||
private int frameIndex = 0;
|
||||
@@ -102,12 +105,14 @@ namespace Starlight.AnimeMatrix
|
||||
_model = AnimeType.GA401;
|
||||
|
||||
MaxColumns = 33;
|
||||
dx = 1;
|
||||
|
||||
//FullRows = 7;
|
||||
//FullEvenRows = 3;
|
||||
|
||||
MaxRows = 55;
|
||||
LedCount = 1214;
|
||||
LedCount = 1245;
|
||||
|
||||
UpdatePageLength = 410;
|
||||
}
|
||||
|
||||
@@ -176,7 +181,8 @@ namespace Starlight.AnimeMatrix
|
||||
if (y < 11)
|
||||
{
|
||||
return 0;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
return (y) / 2 - 5;
|
||||
}
|
||||
@@ -211,7 +217,7 @@ namespace Starlight.AnimeMatrix
|
||||
return 33;
|
||||
case 1:
|
||||
case 3:
|
||||
return 35; // Some rows are padded
|
||||
return 35;
|
||||
default:
|
||||
return 36 - y / 2;
|
||||
}
|
||||
@@ -257,7 +263,8 @@ namespace Starlight.AnimeMatrix
|
||||
|
||||
if (x >= FirstX(y) && x < Width(y))
|
||||
{
|
||||
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x, value);
|
||||
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x + dx, value);
|
||||
//Debug.Write((RowToLinearAddress(y) - FirstX(y) + x + dx).ToString() + " ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,75 +361,85 @@ namespace Starlight.AnimeMatrix
|
||||
}
|
||||
|
||||
|
||||
public void PresentClock()
|
||||
{
|
||||
int second = DateTime.Now.Second;
|
||||
|
||||
public void PresentText(string text, float fontSize = 8F)
|
||||
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
|
||||
PresentText(DateTime.Now.ToString("H" + ((second % 2 == 0)?":":" ") + "mm"));
|
||||
else
|
||||
PresentText(DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mm"), DateTime.Now.ToString("tt"));
|
||||
}
|
||||
|
||||
public void PresentText(string text1, string text2 = "")
|
||||
{
|
||||
using (Bitmap bmp = new Bitmap(MaxColumns * 3, MaxRows))
|
||||
{
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
{
|
||||
using (Font font = new Font("Arial", fontSize))
|
||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
using (Font font = new Font("Arial", 12F))
|
||||
{
|
||||
|
||||
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||
|
||||
/*
|
||||
SizeF textSize = g.MeasureString(text, font);
|
||||
g.TranslateTransform(bmp.Width / 2, bmp.Height / 2);
|
||||
g.RotateTransform(33);
|
||||
g.DrawString(text, font, Brushes.White, -textSize.Width/2, -textSize.Height / 2);
|
||||
*/
|
||||
|
||||
g.DrawString(text, font, Brushes.White, 12, -2);
|
||||
SizeF textSize = g.MeasureString(text1, font);
|
||||
g.DrawString(text1, font, Brushes.White, (MaxColumns*3 - textSize.Width)+3, -5);
|
||||
}
|
||||
|
||||
if (text2.Length > 0)
|
||||
using (Font font = new Font("Arial", 9F))
|
||||
{
|
||||
SizeF textSize = g.MeasureString(text2, font);
|
||||
g.DrawString(text2, font, Brushes.White, (MaxColumns * 3 - textSize.Width)+1, 25);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GenerateFrame(bmp);
|
||||
GenerateFrame(bmp, InterpolationMode.Bicubic);
|
||||
Present();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void GenerateFrame(Image image)
|
||||
public void GenerateFrame(Image image, InterpolationMode interpolation = InterpolationMode.High)
|
||||
{
|
||||
|
||||
int width = MaxColumns * 3;
|
||||
int width = MaxColumns/2 * 6;
|
||||
int height = MaxRows;
|
||||
|
||||
int targetWidth = MaxColumns * 2;
|
||||
|
||||
float scale;
|
||||
|
||||
using (Bitmap canvas = new Bitmap(width, height))
|
||||
using (Bitmap bmp = new Bitmap(targetWidth, height))
|
||||
{
|
||||
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
|
||||
|
||||
using (var graph = Graphics.FromImage(canvas))
|
||||
using (var graph = Graphics.FromImage(bmp))
|
||||
{
|
||||
var scaleWidth = (int)(image.Width * scale);
|
||||
var scaleHeight = (int)(image.Height * scale);
|
||||
var scaleWidth = (float)(image.Width * scale);
|
||||
var scaleHeight = (float)(image.Height * scale);
|
||||
|
||||
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
|
||||
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||
graph.InterpolationMode = interpolation;
|
||||
graph.CompositingQuality = CompositingQuality.HighQuality;
|
||||
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight);
|
||||
graph.DrawImage(image, (float)Math.Round(targetWidth - scaleWidth * targetWidth / width), 0, (float)Math.Round(scaleWidth * targetWidth / width), scaleHeight);
|
||||
|
||||
}
|
||||
|
||||
using (Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows))
|
||||
for (int y = 0; y < bmp.Height; y++)
|
||||
{
|
||||
for (int y = 0; y < bmp.Height; y++)
|
||||
{
|
||||
for (int x = 0; x < bmp.Width; x++)
|
||||
if (x % 2 == y % 2)
|
||||
{
|
||||
var pixel = bmp.GetPixel(x, y);
|
||||
SetLedPlanar(x / 2, y, (byte)((pixel.R + pixel.G + pixel.B) / 3));
|
||||
}
|
||||
}
|
||||
for (int x = 0; x < bmp.Width; x++)
|
||||
if (x % 2 == (y+dx) % 2)
|
||||
{
|
||||
var pixel = bmp.GetPixel(x, y);
|
||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||
if (color < 10) color = 0;
|
||||
SetLedPlanar(x / 2, y, (byte)color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void EnsureRowInRange(int row)
|
||||
|
||||
@@ -40,8 +40,7 @@ public class AppConfig
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool ContainsModel(string contains)
|
||||
public string GetModel()
|
||||
{
|
||||
if (_model is null)
|
||||
{
|
||||
@@ -56,6 +55,12 @@ public class AppConfig
|
||||
}
|
||||
}
|
||||
|
||||
return _model;
|
||||
}
|
||||
public bool ContainsModel(string contains)
|
||||
{
|
||||
|
||||
GetModel();
|
||||
return (_model is not null && _model.Contains(contains));
|
||||
|
||||
}
|
||||
@@ -103,6 +108,8 @@ public class AppConfig
|
||||
|
||||
if (device == 1)
|
||||
name = "gpu";
|
||||
else if (device == 2)
|
||||
name = "mid";
|
||||
else
|
||||
name = "cpu";
|
||||
|
||||
|
||||
81
app/Aura.cs
81
app/Aura.cs
@@ -1,7 +1,8 @@
|
||||
using HidLibrary;
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using static Starlight.AnimeMatrix.BuiltInAnimation;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
|
||||
using System.Security.Policy;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
@@ -36,7 +37,7 @@ namespace GHelper
|
||||
{
|
||||
a |= (uint)n;
|
||||
}
|
||||
return new byte[] {0x5d, 0xbd, 0x01, (byte)(a & 0xff), (byte)((a & 0xff00) >> 8), (byte)((a & 0xff0000) >> 16) };
|
||||
return new byte[] { 0x5d, 0xbd, 0x01, (byte)(a & 0xff), (byte)((a & 0xff00) >> 8), (byte)((a & 0xff0000) >> 16) };
|
||||
}
|
||||
|
||||
public static ushort BitOr(this AuraDev19b6 self, AuraDev19b6 rhs)
|
||||
@@ -56,6 +57,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 };
|
||||
|
||||
private static int mode = 0;
|
||||
private static int speed = 1;
|
||||
@@ -72,9 +74,8 @@ namespace GHelper
|
||||
{ 2, "Fast" }
|
||||
};
|
||||
}
|
||||
public static Dictionary<int, string> GetModes()
|
||||
{
|
||||
return new Dictionary<int, string>
|
||||
|
||||
static Dictionary<int, string> _modes = new Dictionary<int, string>
|
||||
{
|
||||
{ 0, "Static" },
|
||||
{ 1, "Breathe" },
|
||||
@@ -82,6 +83,43 @@ namespace GHelper
|
||||
{ 3, "Rainbow" },
|
||||
{ 10, "Strobe" },
|
||||
};
|
||||
|
||||
static Dictionary<int, string> _modesStrix = new Dictionary<int, string>
|
||||
{
|
||||
{ 0, "Static" },
|
||||
{ 1, "Breathe" },
|
||||
{ 2, "Color Cycle" },
|
||||
{ 3, "Rainbow" },
|
||||
{ 4, "Star" },
|
||||
{ 5, "Rain" },
|
||||
{ 6, "Highlight" },
|
||||
{ 7, "Laser" },
|
||||
{ 8, "Ripple" },
|
||||
{ 10, "Strobe" },
|
||||
{ 11, "Comet" },
|
||||
{ 12, "Flash" },
|
||||
};
|
||||
|
||||
|
||||
public static Dictionary<int, string> GetModes()
|
||||
{
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
{
|
||||
_modes.Remove(3);
|
||||
}
|
||||
|
||||
if (Program.config.ContainsModel("401"))
|
||||
{
|
||||
_modes.Remove(2);
|
||||
_modes.Remove(3);
|
||||
}
|
||||
|
||||
if (Program.config.ContainsModel("Strix") || Program.config.ContainsModel("Scar"))
|
||||
{
|
||||
return _modesStrix;
|
||||
}
|
||||
|
||||
return _modes;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +130,7 @@ namespace GHelper
|
||||
{
|
||||
if (GetModes().ContainsKey(value))
|
||||
mode = value;
|
||||
else
|
||||
else
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
@@ -145,6 +183,22 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
public static void ApplyBrightness(int brightness)
|
||||
{
|
||||
HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
||||
|
||||
byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness };
|
||||
|
||||
foreach (HidDevice device in HidDeviceList)
|
||||
if (device.IsConnected && device.Description.Contains("HID"))
|
||||
{
|
||||
device.OpenDevice();
|
||||
device.Write(msg);
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void ApplyAuraPower(bool awake = true, bool boot = false, bool sleep = false, bool shutdown = false)
|
||||
{
|
||||
@@ -158,7 +212,7 @@ namespace GHelper
|
||||
if (shutdown) flags.Add(AuraDev19b6.ShutdownKeyb);
|
||||
|
||||
byte[] msg = AuraDev19b6Extensions.ToBytes(flags.ToArray());
|
||||
|
||||
|
||||
Debug.WriteLine(BitConverter.ToString(msg));
|
||||
|
||||
foreach (HidDevice device in HidDeviceList)
|
||||
@@ -169,17 +223,15 @@ namespace GHelper
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
Program.wmi.TUFKeyboardPower(awake, boot, sleep, shutdown);
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardPower(awake, boot, sleep, shutdown);
|
||||
|
||||
}
|
||||
|
||||
public static void ApplyAura()
|
||||
{
|
||||
|
||||
HidDevice[] HidDeviceList;
|
||||
int[] deviceIds = { 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0 };
|
||||
|
||||
HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
||||
HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
||||
|
||||
int _speed;
|
||||
|
||||
@@ -208,7 +260,8 @@ namespace GHelper
|
||||
device.CloseDevice();
|
||||
}
|
||||
|
||||
Program.wmi.TUFKeyboardRGB(Mode, Color1, _speed);
|
||||
if (Program.config.ContainsModel("TUF"))
|
||||
Program.wmi.TUFKeyboardRGB(Mode, Color1, _speed);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CustomControls;
|
||||
using WinFormsSliderBar;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
|
||||
@@ -8,6 +9,7 @@ public static class ControlHelper
|
||||
static bool _invert = false;
|
||||
static bool _darkTheme = false;
|
||||
|
||||
|
||||
static float _scale = 1;
|
||||
|
||||
static Color formBack;
|
||||
@@ -53,7 +55,7 @@ public static class ControlHelper
|
||||
public static void Resize(RForm container, float baseScale = 2)
|
||||
{
|
||||
_scale = GetDpiScale(container).Value / baseScale;
|
||||
ResizeControls(container.Controls);
|
||||
if (Math.Abs(_scale - 1) > 0.2) ResizeControls(container.Controls);
|
||||
|
||||
}
|
||||
|
||||
@@ -65,9 +67,11 @@ public static class ControlHelper
|
||||
if (button != null && button.Image is not null)
|
||||
button.Image = ResizeImage(button.Image);
|
||||
|
||||
/*
|
||||
var pictureBox = control as PictureBox;
|
||||
if (pictureBox != null && pictureBox.BackgroundImage is not null)
|
||||
pictureBox.BackgroundImage = ResizeImage(pictureBox.BackgroundImage);
|
||||
*/
|
||||
|
||||
ResizeControls(control.Controls);
|
||||
}
|
||||
@@ -95,14 +99,15 @@ public static class ControlHelper
|
||||
if (pictureBox != null && pictureBox.BackgroundImage is not null)
|
||||
pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
|
||||
|
||||
|
||||
|
||||
var combo = control as RComboBox;
|
||||
if (combo != null)
|
||||
{
|
||||
combo.BackColor = backMain;
|
||||
combo.ForeColor = foreMain;
|
||||
combo.BorderColor = backMain;
|
||||
combo.ButtonColor = buttonMain;
|
||||
combo.ButtonColor = backMain;
|
||||
combo.ArrowColor = foreMain;
|
||||
}
|
||||
|
||||
var gb = control as GroupBox;
|
||||
@@ -111,6 +116,11 @@ public static class ControlHelper
|
||||
gb.ForeColor = foreMain;
|
||||
}
|
||||
|
||||
var sl = control as Slider;
|
||||
if (sl != null)
|
||||
{
|
||||
sl.borderColor = buttonMain;
|
||||
}
|
||||
|
||||
var chart = control as Chart;
|
||||
if (chart != null)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Win32;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -30,9 +31,9 @@ namespace CustomControls
|
||||
return (int)registryValueObject <= 0;
|
||||
}
|
||||
|
||||
public void InitTheme(bool setDPI = true)
|
||||
public bool InitTheme(bool setDPI = false)
|
||||
{
|
||||
bool newDarkTheme = IsDarkTheme();
|
||||
bool newDarkTheme = CheckSystemDarkModeStatus();
|
||||
bool changed = (darkTheme != newDarkTheme);
|
||||
darkTheme = newDarkTheme;
|
||||
|
||||
@@ -45,16 +46,13 @@ namespace CustomControls
|
||||
ControlHelper.Adjust(this, darkTheme, changed);
|
||||
}
|
||||
|
||||
return changed;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class RTrackBar : TrackBar
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class RComboBox : ComboBox
|
||||
{
|
||||
private Color borderColor = Color.Gray;
|
||||
@@ -71,8 +69,10 @@ namespace CustomControls
|
||||
}
|
||||
}
|
||||
}
|
||||
private Color buttonColor = Color.FromArgb(255,230, 230, 230);
|
||||
[DefaultValue(typeof(Color), "230, 230, 230")]
|
||||
|
||||
|
||||
private Color buttonColor = Color.FromArgb(255, 255, 255, 255);
|
||||
[DefaultValue(typeof(Color), "255, 255, 255")]
|
||||
public Color ButtonColor
|
||||
{
|
||||
get { return buttonColor; }
|
||||
|
||||
36
app/Fans.cs
36
app/Fans.cs
@@ -18,7 +18,7 @@ namespace GHelper
|
||||
{
|
||||
if (percentage == 0) return "OFF";
|
||||
|
||||
return (200 * Math.Round((float)(MinRPM + (MaxRPM - MinRPM) * percentage * 0.01) / 200)).ToString() + unit;
|
||||
return (200 * Math.Round((float)(MinRPM*100 + (MaxRPM - MinRPM) * percentage) / 200)).ToString() + unit;
|
||||
}
|
||||
|
||||
void SetChart(Chart chart, int device)
|
||||
@@ -89,14 +89,8 @@ namespace GHelper
|
||||
InitializeComponent();
|
||||
InitTheme();
|
||||
|
||||
MinRPM = 1800;
|
||||
|
||||
if (Program.config.ContainsModel("401"))
|
||||
MaxRPM = 7200;
|
||||
else if (Program.config.ContainsModel("503"))
|
||||
MaxRPM = 6800;
|
||||
else
|
||||
MaxRPM = 5800;
|
||||
MinRPM = 18;
|
||||
MaxRPM = HardwareMonitor.GetFanMax();
|
||||
|
||||
|
||||
|
||||
@@ -146,7 +140,7 @@ namespace GHelper
|
||||
InitPower();
|
||||
InitBoost();
|
||||
|
||||
comboBoost.SelectedIndexChanged += ComboBoost_Changed;
|
||||
comboBoost.SelectedValueChanged += ComboBoost_Changed;
|
||||
|
||||
Shown += Fans_Shown;
|
||||
|
||||
@@ -162,9 +156,11 @@ namespace GHelper
|
||||
|
||||
private void ComboBoost_Changed(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null) return;
|
||||
ComboBox cmb = (ComboBox)sender;
|
||||
NativeMethods.SetCPUBoost(cmb.SelectedIndex);
|
||||
if (Program.config.getConfigPerf("auto_boost") != comboBoost.SelectedIndex)
|
||||
{
|
||||
NativeMethods.SetCPUBoost(comboBoost.SelectedIndex);
|
||||
Program.config.setConfigPerf("auto_boost", comboBoost.SelectedIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckApplyPower_Click(object? sender, EventArgs e)
|
||||
@@ -338,7 +334,7 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
void ApplyProfile(Series series, int device)
|
||||
void SaveProfile(Series series, int device)
|
||||
{
|
||||
byte[] curve = new byte[16];
|
||||
int i = 0;
|
||||
@@ -350,17 +346,19 @@ namespace GHelper
|
||||
}
|
||||
|
||||
Program.config.setFanConfig(device, curve);
|
||||
Program.wmi.SetFanCurve(device, curve);
|
||||
//Program.wmi.SetFanCurve(device, curve);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ButtonApply_Click(object? sender, EventArgs e)
|
||||
{
|
||||
ApplyProfile(seriesCPU, 0);
|
||||
ApplyProfile(seriesGPU, 1);
|
||||
SaveProfile(seriesCPU, 0);
|
||||
SaveProfile(seriesGPU, 1);
|
||||
if (Program.config.getConfig("mid_fan") == 1)
|
||||
ApplyProfile(seriesMid, 2);
|
||||
SaveProfile(seriesMid, 2);
|
||||
|
||||
Program.settingsForm.AutoFans(true);
|
||||
}
|
||||
|
||||
private void ButtonReset_Click(object? sender, EventArgs e)
|
||||
@@ -377,7 +375,7 @@ namespace GHelper
|
||||
Program.config.setConfigPerf("auto_apply", 0);
|
||||
Program.config.setConfigPerf("auto_apply_power", 0);
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"));
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, Program.config.getConfig("performance_mode"), "PerfMode");
|
||||
|
||||
ApplyLabel(false);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.39</AssemblyVersion>
|
||||
<AssemblyVersion>0.44</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using GHelper;
|
||||
using GHelper.Gpu;
|
||||
|
||||
public static class HardwareMonitor
|
||||
@@ -9,12 +10,52 @@ public static class HardwareMonitor
|
||||
public static float? batteryDischarge = -1;
|
||||
public static int? gpuTemp = null;
|
||||
|
||||
public static string? cpuFan;
|
||||
public static string? gpuFan;
|
||||
public static string? midFan;
|
||||
|
||||
public static int GetFanMax()
|
||||
{
|
||||
int max = 58;
|
||||
if (Program.config.ContainsModel("401")) max = 72;
|
||||
else if (Program.config.ContainsModel("503")) max = 68;
|
||||
return Math.Max(max, Program.config.getConfig("fan_max"));
|
||||
}
|
||||
|
||||
public static void SetFanMax(int fan)
|
||||
{
|
||||
Program.config.setConfig("fan_max", fan);
|
||||
}
|
||||
private static string FormatFan(int fan)
|
||||
{
|
||||
// fix for old models
|
||||
if (fan < 0)
|
||||
{
|
||||
fan += 65536;
|
||||
if (fan <= 0 || fan > 100) return null; //nothing reasonable
|
||||
}
|
||||
|
||||
int fanMax = GetFanMax();
|
||||
if (fan > fanMax) SetFanMax(fan);
|
||||
|
||||
if (Program.config.getConfig("fan_rpm") == 1)
|
||||
return " Fan: " + (fan * 100).ToString() + "RPM";
|
||||
else
|
||||
return " Fan: " + Math.Min(Math.Round((float)fan/fanMax*100), 100).ToString() + "%"; // relatively to 6000 rpm
|
||||
}
|
||||
|
||||
public static void ReadSensors()
|
||||
{
|
||||
cpuTemp = -1;
|
||||
batteryDischarge = -1;
|
||||
|
||||
try
|
||||
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
||||
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
|
||||
midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
|
||||
|
||||
cpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_CPU);
|
||||
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
||||
|
||||
if (cpuTemp < 0) try
|
||||
{
|
||||
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
||||
cpuTemp = ct.NextValue() - 273;
|
||||
@@ -24,26 +65,29 @@ public static class HardwareMonitor
|
||||
Logger.WriteLine("Failed reading CPU temp");
|
||||
}
|
||||
|
||||
if (gpuTemp < 0) try
|
||||
{
|
||||
if (GpuTemperatureProvider is null) RecreateGpuTemperatureProvider();
|
||||
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
gpuTemp = null;
|
||||
Logger.WriteLine("Failed reading GPU temp");
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);
|
||||
batteryDischarge = cb.NextValue() / 1000;
|
||||
cb.Dispose();
|
||||
|
||||
} catch
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.WriteLine("Failed reading Battery discharge");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
||||
} catch (Exception ex) {
|
||||
gpuTemp = null;
|
||||
Logger.WriteLine("Failed reading GPU temp");
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RecreateGpuTemperatureProviderWithDelay() {
|
||||
|
||||
163
app/Keyboard.Designer.cs
generated
163
app/Keyboard.Designer.cs
generated
@@ -41,14 +41,19 @@ namespace GHelper
|
||||
comboM3 = new RComboBox();
|
||||
labelM3 = new Label();
|
||||
groupLight = new GroupBox();
|
||||
checkAwake = new CheckBox();
|
||||
checkBoot = new CheckBox();
|
||||
checkSleep = new CheckBox();
|
||||
checkShutdown = new CheckBox();
|
||||
comboKeyboardSpeed = new RComboBox();
|
||||
labelSpeed = new Label();
|
||||
comboKeyboardSpeed = new RComboBox();
|
||||
checkShutdown = new CheckBox();
|
||||
checkSleep = new CheckBox();
|
||||
checkBoot = new CheckBox();
|
||||
checkAwake = new CheckBox();
|
||||
groupOther = new GroupBox();
|
||||
checkKeyboardAuto = new CheckBox();
|
||||
checkTopmost = new CheckBox();
|
||||
checkNoOverdrive = new CheckBox();
|
||||
groupBox1.SuspendLayout();
|
||||
groupLight.SuspendLayout();
|
||||
groupOther.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
@@ -65,7 +70,7 @@ namespace GHelper
|
||||
groupBox1.Dock = DockStyle.Top;
|
||||
groupBox1.Location = new Point(10, 10);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(751, 242);
|
||||
groupBox1.Size = new Size(756, 242);
|
||||
groupBox1.TabIndex = 0;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Key Bindings";
|
||||
@@ -158,50 +163,19 @@ namespace GHelper
|
||||
groupLight.Dock = DockStyle.Top;
|
||||
groupLight.Location = new Point(10, 252);
|
||||
groupLight.Name = "groupLight";
|
||||
groupLight.Size = new Size(751, 304);
|
||||
groupLight.Size = new Size(756, 304);
|
||||
groupLight.TabIndex = 1;
|
||||
groupLight.TabStop = false;
|
||||
groupLight.Text = "Keyboard Backlight";
|
||||
//
|
||||
// checkAwake
|
||||
// labelSpeed
|
||||
//
|
||||
checkAwake.AutoSize = true;
|
||||
checkAwake.Location = new Point(25, 59);
|
||||
checkAwake.Name = "checkAwake";
|
||||
checkAwake.Size = new Size(115, 36);
|
||||
checkAwake.TabIndex = 0;
|
||||
checkAwake.Text = "Awake";
|
||||
checkAwake.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoot
|
||||
//
|
||||
checkBoot.AutoSize = true;
|
||||
checkBoot.Location = new Point(25, 101);
|
||||
checkBoot.Name = "checkBoot";
|
||||
checkBoot.Size = new Size(96, 36);
|
||||
checkBoot.TabIndex = 1;
|
||||
checkBoot.Text = "Boot";
|
||||
checkBoot.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkSleep
|
||||
//
|
||||
checkSleep.AutoSize = true;
|
||||
checkSleep.Location = new Point(25, 143);
|
||||
checkSleep.Name = "checkSleep";
|
||||
checkSleep.Size = new Size(105, 36);
|
||||
checkSleep.TabIndex = 2;
|
||||
checkSleep.Text = "Sleep";
|
||||
checkSleep.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkShutdown
|
||||
//
|
||||
checkShutdown.AutoSize = true;
|
||||
checkShutdown.Location = new Point(25, 185);
|
||||
checkShutdown.Name = "checkShutdown";
|
||||
checkShutdown.Size = new Size(154, 36);
|
||||
checkShutdown.TabIndex = 3;
|
||||
checkShutdown.Text = "Shutdown";
|
||||
checkShutdown.UseVisualStyleBackColor = true;
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(25, 237);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(198, 32);
|
||||
labelSpeed.TabIndex = 40;
|
||||
labelSpeed.Text = "Animation Speed";
|
||||
//
|
||||
// comboKeyboardSpeed
|
||||
//
|
||||
@@ -219,20 +193,95 @@ namespace GHelper
|
||||
comboKeyboardSpeed.TabIndex = 39;
|
||||
comboKeyboardSpeed.TabStop = false;
|
||||
//
|
||||
// labelSpeed
|
||||
// checkShutdown
|
||||
//
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(25, 237);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(198, 32);
|
||||
labelSpeed.TabIndex = 40;
|
||||
labelSpeed.Text = "Animation Speed";
|
||||
checkShutdown.AutoSize = true;
|
||||
checkShutdown.Location = new Point(25, 185);
|
||||
checkShutdown.Name = "checkShutdown";
|
||||
checkShutdown.Size = new Size(154, 36);
|
||||
checkShutdown.TabIndex = 3;
|
||||
checkShutdown.Text = "Shutdown";
|
||||
checkShutdown.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkSleep
|
||||
//
|
||||
checkSleep.AutoSize = true;
|
||||
checkSleep.Location = new Point(25, 143);
|
||||
checkSleep.Name = "checkSleep";
|
||||
checkSleep.Size = new Size(105, 36);
|
||||
checkSleep.TabIndex = 2;
|
||||
checkSleep.Text = "Sleep";
|
||||
checkSleep.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoot
|
||||
//
|
||||
checkBoot.AutoSize = true;
|
||||
checkBoot.Location = new Point(25, 101);
|
||||
checkBoot.Name = "checkBoot";
|
||||
checkBoot.Size = new Size(96, 36);
|
||||
checkBoot.TabIndex = 1;
|
||||
checkBoot.Text = "Boot";
|
||||
checkBoot.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkAwake
|
||||
//
|
||||
checkAwake.AutoSize = true;
|
||||
checkAwake.Location = new Point(25, 59);
|
||||
checkAwake.Name = "checkAwake";
|
||||
checkAwake.Size = new Size(115, 36);
|
||||
checkAwake.TabIndex = 0;
|
||||
checkAwake.Text = "Awake";
|
||||
checkAwake.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupOther
|
||||
//
|
||||
groupOther.Controls.Add(checkNoOverdrive);
|
||||
groupOther.Controls.Add(checkKeyboardAuto);
|
||||
groupOther.Controls.Add(checkTopmost);
|
||||
groupOther.Dock = DockStyle.Top;
|
||||
groupOther.Location = new Point(10, 556);
|
||||
groupOther.Name = "groupOther";
|
||||
groupOther.Size = new Size(756, 225);
|
||||
groupOther.TabIndex = 2;
|
||||
groupOther.TabStop = false;
|
||||
groupOther.Text = "Other";
|
||||
//
|
||||
// checkKeyboardAuto
|
||||
//
|
||||
checkKeyboardAuto.AutoSize = true;
|
||||
checkKeyboardAuto.Location = new Point(25, 51);
|
||||
checkKeyboardAuto.Name = "checkKeyboardAuto";
|
||||
checkKeyboardAuto.Size = new Size(712, 36);
|
||||
checkKeyboardAuto.TabIndex = 2;
|
||||
checkKeyboardAuto.Text = "Lower backlight brightness on battery and back when plugged";
|
||||
checkKeyboardAuto.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkTopmost
|
||||
//
|
||||
checkTopmost.AutoSize = true;
|
||||
checkTopmost.Location = new Point(25, 104);
|
||||
checkTopmost.Name = "checkTopmost";
|
||||
checkTopmost.Size = new Size(390, 36);
|
||||
checkTopmost.TabIndex = 1;
|
||||
checkTopmost.Text = "Keep app window always on top";
|
||||
checkTopmost.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkNoOverdrive
|
||||
//
|
||||
checkNoOverdrive.AutoSize = true;
|
||||
checkNoOverdrive.Location = new Point(25, 156);
|
||||
checkNoOverdrive.Name = "checkNoOverdrive";
|
||||
checkNoOverdrive.Size = new Size(307, 36);
|
||||
checkNoOverdrive.TabIndex = 3;
|
||||
checkNoOverdrive.Text = "Disable screen overdrive";
|
||||
checkNoOverdrive.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// Keyboard
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(771, 858);
|
||||
ClientSize = new Size(776, 858);
|
||||
Controls.Add(groupOther);
|
||||
Controls.Add(groupLight);
|
||||
Controls.Add(groupBox1);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
@@ -243,11 +292,13 @@ namespace GHelper
|
||||
Padding = new Padding(10);
|
||||
ShowIcon = false;
|
||||
ShowInTaskbar = false;
|
||||
Text = "Keyboard";
|
||||
Text = "Extra Settings";
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBox1.PerformLayout();
|
||||
groupLight.ResumeLayout(false);
|
||||
groupLight.PerformLayout();
|
||||
groupOther.ResumeLayout(false);
|
||||
groupOther.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@@ -270,5 +321,9 @@ namespace GHelper
|
||||
private CheckBox checkShutdown;
|
||||
private Label labelSpeed;
|
||||
private RComboBox comboKeyboardSpeed;
|
||||
private GroupBox groupOther;
|
||||
private CheckBox checkTopmost;
|
||||
private CheckBox checkKeyboardAuto;
|
||||
private CheckBox checkNoOverdrive;
|
||||
}
|
||||
}
|
||||
@@ -78,8 +78,33 @@ namespace GHelper
|
||||
checkSleep.CheckedChanged += CheckPower_CheckedChanged;
|
||||
checkShutdown.CheckedChanged += CheckPower_CheckedChanged;
|
||||
|
||||
checkTopmost.Checked = (Program.config.getConfig("topmost") == 1);
|
||||
checkTopmost.CheckedChanged += CheckTopmost_CheckedChanged; ;
|
||||
|
||||
checkKeyboardAuto.Checked = (Program.config.getConfig("keyboard_auto") == 1);
|
||||
checkKeyboardAuto.CheckedChanged += CheckKeyboardAuto_CheckedChanged;
|
||||
|
||||
checkNoOverdrive.Checked = (Program.config.getConfig("no_overdrive") == 1);
|
||||
checkNoOverdrive.CheckedChanged += CheckNoOverdrive_CheckedChanged;
|
||||
|
||||
}
|
||||
|
||||
private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("no_overdrive", (checkNoOverdrive.Checked ? 1 : 0));
|
||||
Program.settingsForm.AutoScreen(true);
|
||||
}
|
||||
|
||||
private void CheckKeyboardAuto_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("keyboard_auto", (checkKeyboardAuto.Checked ? 1 : 0));
|
||||
}
|
||||
|
||||
private void CheckTopmost_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("topmost", (checkTopmost.Checked ? 1 : 0));
|
||||
Program.settingsForm.TopMost = checkTopmost.Checked;
|
||||
}
|
||||
|
||||
private void CheckPower_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Xml.Linq;
|
||||
using static Tools.ScreenInterrogatory;
|
||||
|
||||
namespace Tools
|
||||
@@ -588,7 +590,7 @@ public class NativeMethods
|
||||
return laptopScreen;
|
||||
}
|
||||
|
||||
public static int GetRefreshRate()
|
||||
public static int GetRefreshRate(bool max = false)
|
||||
{
|
||||
DEVMODE dm = CreateDevmode();
|
||||
|
||||
@@ -598,11 +600,23 @@ public class NativeMethods
|
||||
if (laptopScreen is null)
|
||||
return -1;
|
||||
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
if (max)
|
||||
{
|
||||
frequency = dm.dmDisplayFrequency;
|
||||
int i = 0;
|
||||
while (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, i, ref dm))
|
||||
{
|
||||
if (dm.dmDisplayFrequency > frequency) frequency = dm.dmDisplayFrequency;
|
||||
i++;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||
{
|
||||
frequency = dm.dmDisplayFrequency;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return frequency;
|
||||
}
|
||||
|
||||
@@ -618,6 +632,7 @@ public class NativeMethods
|
||||
{
|
||||
dm.dmDisplayFrequency = frequency;
|
||||
int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
||||
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
|
||||
return iRet;
|
||||
}
|
||||
|
||||
@@ -671,6 +686,7 @@ public class NativeMethods
|
||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||
*/
|
||||
|
||||
Logger.WriteLine("Boost " + boost);
|
||||
}
|
||||
|
||||
public static void SetPowerScheme(int mode)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
@@ -32,6 +30,15 @@ namespace GHelper
|
||||
// The main entry point for the application
|
||||
public static void Main()
|
||||
{
|
||||
|
||||
if (Process.GetProcesses().Count(p => p.ProcessName == "GHelper") > 1)
|
||||
{
|
||||
MessageBox.Show("G-Helper is already running. Check system tray for an icon.", "App already running", MessageBoxButtons.OK);
|
||||
Application.Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
wmi = new ASUSWmi();
|
||||
@@ -49,16 +56,13 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
Logger.WriteLine("App launched");
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
|
||||
SystemEvents.UserPreferenceChanged += new
|
||||
UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
|
||||
|
||||
var ds = settingsForm.Handle;
|
||||
|
||||
trayIcon.MouseClick += TrayIcon_MouseClick;
|
||||
|
||||
|
||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||
|
||||
@@ -69,10 +73,10 @@ namespace GHelper
|
||||
settingsForm.SetStartupCheck(Startup.IsScheduled());
|
||||
|
||||
SetAutoModes();
|
||||
HardwareMonitor.RecreateGpuTemperatureProvider();
|
||||
|
||||
// Subscribing for system power change events
|
||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||
|
||||
|
||||
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
|
||||
@@ -97,13 +101,13 @@ namespace GHelper
|
||||
case UserPreferenceCategory.General:
|
||||
Debug.WriteLine("Theme Changed");
|
||||
Thread.Sleep(1000);
|
||||
settingsForm.InitTheme(false);
|
||||
settingsForm.InitTheme();
|
||||
|
||||
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
|
||||
settingsForm.fans.InitTheme(false);
|
||||
settingsForm.fans.InitTheme();
|
||||
|
||||
if (settingsForm.keyb is not null && settingsForm.keyb.Text != "")
|
||||
settingsForm.keyb.InitTheme(false);
|
||||
settingsForm.keyb.InitTheme();
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -111,27 +115,22 @@ namespace GHelper
|
||||
|
||||
|
||||
|
||||
public static void SetAutoModes(bool wait = false)
|
||||
public static void SetAutoModes()
|
||||
{
|
||||
|
||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 2000) return;
|
||||
lastAuto = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
|
||||
isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
|
||||
|
||||
Logger.WriteLine("AutoSetting for " + isPlugged.ToString());
|
||||
|
||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||
settingsForm.AutoPerformance();
|
||||
|
||||
settingsForm.AutoPerformance(isPlugged);
|
||||
bool switched = settingsForm.AutoGPUMode();
|
||||
if (!switched) settingsForm.AutoScreen();
|
||||
|
||||
// waiting a bit before turning off dGPU
|
||||
// if (wait && isPlugged != PowerLineStatus.Online) Thread.Sleep(3000);
|
||||
|
||||
bool switched = settingsForm.AutoGPUMode(isPlugged);
|
||||
if (!switched) settingsForm.AutoScreen(isPlugged);
|
||||
|
||||
settingsForm.SetMatrix(isPlugged);
|
||||
settingsForm.SetMatrix();
|
||||
}
|
||||
|
||||
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
@@ -139,7 +138,8 @@ namespace GHelper
|
||||
if (SystemInformation.PowerStatus.PowerLineStatus == isPlugged) return;
|
||||
|
||||
Logger.WriteLine("Windows - Power Mode Changed");
|
||||
SetAutoModes(true);
|
||||
settingsForm.AutoKeyboard();
|
||||
SetAutoModes();
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace GHelper
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.WriteLine("Failed to run " + fileName);
|
||||
Logger.WriteLine("Failed to run " + fileName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
59
app/Settings.Designer.cs
generated
59
app/Settings.Designer.cs
generated
@@ -40,11 +40,12 @@ namespace GHelper
|
||||
pictureMatrix = new PictureBox();
|
||||
labelMatrix = new Label();
|
||||
panelBattery = new Panel();
|
||||
sliderBattery = new WinFormsSliderBar.Slider();
|
||||
labelModel = new Label();
|
||||
labelVersion = new Label();
|
||||
labelBattery = new Label();
|
||||
pictureBattery = new PictureBox();
|
||||
labelBatteryTitle = new Label();
|
||||
trackBattery = new TrackBar();
|
||||
panelFooter = new Panel();
|
||||
buttonQuit = new RButton();
|
||||
checkStartup = new CheckBox();
|
||||
@@ -92,7 +93,6 @@ namespace GHelper
|
||||
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
|
||||
panelBattery.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBattery).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)trackBattery).BeginInit();
|
||||
panelFooter.SuspendLayout();
|
||||
panelPerformance.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
|
||||
@@ -163,7 +163,6 @@ namespace GHelper
|
||||
// comboMatrix
|
||||
//
|
||||
comboMatrix.BorderColor = Color.White;
|
||||
comboMatrix.ButtonColor = SystemColors.ControlLight;
|
||||
comboMatrix.Dock = DockStyle.Top;
|
||||
comboMatrix.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboMatrix.FormattingEnabled = true;
|
||||
@@ -179,7 +178,6 @@ namespace GHelper
|
||||
// comboMatrixRunning
|
||||
//
|
||||
comboMatrixRunning.BorderColor = Color.White;
|
||||
comboMatrixRunning.ButtonColor = SystemColors.ControlLight;
|
||||
comboMatrixRunning.Dock = DockStyle.Top;
|
||||
comboMatrixRunning.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboMatrixRunning.FormattingEnabled = true;
|
||||
@@ -236,25 +234,49 @@ namespace GHelper
|
||||
//
|
||||
panelBattery.AutoSize = true;
|
||||
panelBattery.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelBattery.Controls.Add(sliderBattery);
|
||||
panelBattery.Controls.Add(labelModel);
|
||||
panelBattery.Controls.Add(labelVersion);
|
||||
panelBattery.Controls.Add(labelBattery);
|
||||
panelBattery.Controls.Add(pictureBattery);
|
||||
panelBattery.Controls.Add(labelBatteryTitle);
|
||||
panelBattery.Controls.Add(trackBattery);
|
||||
panelBattery.Dock = DockStyle.Top;
|
||||
panelBattery.Location = new Point(10, 926);
|
||||
panelBattery.Margin = new Padding(8);
|
||||
panelBattery.Name = "panelBattery";
|
||||
panelBattery.Padding = new Padding(0, 0, 0, 12);
|
||||
panelBattery.Size = new Size(810, 158);
|
||||
panelBattery.Size = new Size(810, 163);
|
||||
panelBattery.TabIndex = 34;
|
||||
//
|
||||
// sliderBattery
|
||||
//
|
||||
sliderBattery.Location = new Point(16, 70);
|
||||
sliderBattery.Max = 100;
|
||||
sliderBattery.Min = 50;
|
||||
sliderBattery.Name = "sliderBattery";
|
||||
sliderBattery.Size = new Size(772, 40);
|
||||
sliderBattery.TabIndex = 39;
|
||||
sliderBattery.Text = "sliderBattery";
|
||||
sliderBattery.Value = 80;
|
||||
//
|
||||
// labelModel
|
||||
//
|
||||
labelModel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelModel.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
labelModel.ForeColor = SystemColors.ControlDark;
|
||||
labelModel.Location = new Point(291, 119);
|
||||
labelModel.Margin = new Padding(8, 0, 8, 0);
|
||||
labelModel.Name = "labelModel";
|
||||
labelModel.Size = new Size(492, 32);
|
||||
labelModel.TabIndex = 38;
|
||||
labelModel.TextAlign = ContentAlignment.TopRight;
|
||||
//
|
||||
// labelVersion
|
||||
//
|
||||
labelVersion.AutoSize = true;
|
||||
labelVersion.Font = new Font("Segoe UI", 9F, FontStyle.Underline, GraphicsUnit.Point);
|
||||
labelVersion.ForeColor = SystemColors.ControlDark;
|
||||
labelVersion.Location = new Point(25, 109);
|
||||
labelVersion.Location = new Point(25, 119);
|
||||
labelVersion.Margin = new Padding(8, 0, 8, 0);
|
||||
labelVersion.Name = "labelVersion";
|
||||
labelVersion.Size = new Size(44, 32);
|
||||
@@ -293,22 +315,6 @@ namespace GHelper
|
||||
labelBatteryTitle.TabIndex = 34;
|
||||
labelBatteryTitle.Text = "Battery Charge Limit";
|
||||
//
|
||||
// trackBattery
|
||||
//
|
||||
trackBattery.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
trackBattery.LargeChange = 10;
|
||||
trackBattery.Location = new Point(20, 52);
|
||||
trackBattery.Margin = new Padding(8, 4, 8, 4);
|
||||
trackBattery.Maximum = 100;
|
||||
trackBattery.Minimum = 50;
|
||||
trackBattery.Name = "trackBattery";
|
||||
trackBattery.Size = new Size(766, 90);
|
||||
trackBattery.SmallChange = 5;
|
||||
trackBattery.TabIndex = 33;
|
||||
trackBattery.TickFrequency = 10;
|
||||
trackBattery.TickStyle = TickStyle.TopLeft;
|
||||
trackBattery.Value = 100;
|
||||
//
|
||||
// panelFooter
|
||||
//
|
||||
panelFooter.AutoSize = true;
|
||||
@@ -316,7 +322,7 @@ namespace GHelper
|
||||
panelFooter.Controls.Add(buttonQuit);
|
||||
panelFooter.Controls.Add(checkStartup);
|
||||
panelFooter.Dock = DockStyle.Top;
|
||||
panelFooter.Location = new Point(10, 1084);
|
||||
panelFooter.Location = new Point(10, 1089);
|
||||
panelFooter.Margin = new Padding(8);
|
||||
panelFooter.Name = "panelFooter";
|
||||
panelFooter.Padding = new Padding(0, 0, 0, 10);
|
||||
@@ -882,7 +888,6 @@ namespace GHelper
|
||||
// comboKeyboard
|
||||
//
|
||||
comboKeyboard.BorderColor = Color.White;
|
||||
comboKeyboard.ButtonColor = SystemColors.ControlLight;
|
||||
comboKeyboard.Dock = DockStyle.Top;
|
||||
comboKeyboard.FlatStyle = FlatStyle.Flat;
|
||||
comboKeyboard.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
@@ -1019,7 +1024,6 @@ namespace GHelper
|
||||
panelBattery.ResumeLayout(false);
|
||||
panelBattery.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBattery).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)trackBattery).EndInit();
|
||||
panelFooter.ResumeLayout(false);
|
||||
panelFooter.PerformLayout();
|
||||
panelPerformance.ResumeLayout(false);
|
||||
@@ -1055,7 +1059,6 @@ namespace GHelper
|
||||
private Label labelBattery;
|
||||
private PictureBox pictureBattery;
|
||||
private Label labelBatteryTitle;
|
||||
private TrackBar trackBattery;
|
||||
private Panel panelFooter;
|
||||
private RButton buttonQuit;
|
||||
private CheckBox checkStartup;
|
||||
@@ -1103,5 +1106,7 @@ namespace GHelper
|
||||
private RButton buttonKeyboardColor;
|
||||
private RButton buttonFans;
|
||||
private Label labelMidFan;
|
||||
private Label labelModel;
|
||||
private WinFormsSliderBar.Slider sliderBattery;
|
||||
}
|
||||
}
|
||||
209
app/Settings.cs
209
app/Settings.cs
@@ -25,12 +25,13 @@ namespace GHelper
|
||||
public Keyboard keyb;
|
||||
|
||||
static AnimeMatrixDevice mat;
|
||||
static int matrixTick = 0;
|
||||
static long lastRefresh;
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitTheme();
|
||||
InitTheme(true);
|
||||
|
||||
FormClosing += SettingsForm_FormClosing;
|
||||
|
||||
@@ -113,32 +114,38 @@ namespace GHelper
|
||||
button120Hz.MouseMove += Button120Hz_MouseHover;
|
||||
button120Hz.MouseLeave += ButtonScreen_MouseLeave;
|
||||
|
||||
trackBattery.ValueChanged += TrackBattery_ValueChanged;
|
||||
sliderBattery.ValueChanged += SliderBattery_ValueChanged;
|
||||
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
||||
|
||||
//buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16)));
|
||||
|
||||
aTimer = new System.Timers.Timer(500);
|
||||
aTimer = new System.Timers.Timer(1000);
|
||||
aTimer.Elapsed += OnTimedEvent;
|
||||
|
||||
SetVersionLabel("Version: " + Assembly.GetExecutingAssembly().GetName().Version);
|
||||
Thread t = new Thread(() =>
|
||||
{
|
||||
CheckForUpdatesAsync();
|
||||
});
|
||||
t.Start();
|
||||
t.Join();
|
||||
|
||||
// Subscribing for monitor power on events
|
||||
var settingGuid = new NativeMethods.PowerSettingGuid();
|
||||
Program.unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(Handle, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||
|
||||
SetVersionLabel("Version: " + Assembly.GetExecutingAssembly().GetName().Version);
|
||||
|
||||
string model = Program.config.GetModel();
|
||||
int trim = model.LastIndexOf("_");
|
||||
if (trim > 0) model = model.Substring(0, trim);
|
||||
|
||||
labelModel.Text = model;
|
||||
|
||||
this.TopMost = Program.config.getConfig("topmost") == 1;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
CheckForUpdatesAsync();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void TrackBattery_ValueChanged(object? sender, EventArgs e)
|
||||
private void SliderBattery_ValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
SetBatteryChargeLimit(trackBattery.Value);
|
||||
SetBatteryChargeLimit(sliderBattery.Value);
|
||||
}
|
||||
|
||||
|
||||
@@ -156,8 +163,6 @@ namespace GHelper
|
||||
var tag = config.GetProperty("tag_name").ToString().Replace("v", "");
|
||||
var url = config.GetProperty("assets")[0].GetProperty("browser_download_url").ToString();
|
||||
|
||||
Thread.Sleep(5000);
|
||||
|
||||
var gitVersion = new Version(tag);
|
||||
var appVersion = new Version(Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
|
||||
@@ -196,7 +201,7 @@ namespace GHelper
|
||||
|
||||
private void Button120Hz_MouseHover(object? sender, EventArgs e)
|
||||
{
|
||||
labelTipScreen.Text = "Max refresh rate + screen overdrive for lower latency";
|
||||
labelTipScreen.Text = "Max refresh rate for lower latency";
|
||||
}
|
||||
|
||||
private void Button60Hz_MouseHover(object? sender, EventArgs e)
|
||||
@@ -244,14 +249,14 @@ namespace GHelper
|
||||
{
|
||||
Program.config.setConfig("gpu_auto", (Program.config.getConfig("gpu_auto") == 1) ? 0 : 1);
|
||||
VisualiseGPUMode();
|
||||
AutoGPUMode(SystemInformation.PowerStatus.PowerLineStatus);
|
||||
AutoGPUMode();
|
||||
}
|
||||
|
||||
private void ButtonScreenAuto_Click(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("screen_auto", 1);
|
||||
InitScreen();
|
||||
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
|
||||
AutoScreen();
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
@@ -267,6 +272,7 @@ namespace GHelper
|
||||
{
|
||||
case 0:
|
||||
Logger.WriteLine("Monitor Power Off");
|
||||
SetBatteryChargeLimit(Program.config.getConfig("charge_limit"));
|
||||
break;
|
||||
case 1:
|
||||
Logger.WriteLine("Monitor Power On");
|
||||
@@ -347,7 +353,7 @@ namespace GHelper
|
||||
mat.PresentNextFrame();
|
||||
break;
|
||||
case 3:
|
||||
mat.PresentText(DateTime.Now.ToString("H:mm:ss"));
|
||||
mat.PresentClock();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -449,7 +455,7 @@ namespace GHelper
|
||||
SetMatrix();
|
||||
}
|
||||
|
||||
public void SetMatrix(PowerLineStatus Plugged = PowerLineStatus.Online)
|
||||
public void SetMatrix()
|
||||
{
|
||||
|
||||
if (mat is null) return;
|
||||
@@ -472,7 +478,7 @@ namespace GHelper
|
||||
|
||||
mat.SetProvider();
|
||||
|
||||
if (brightness == 0 || (auto && Plugged != PowerLineStatus.Online))
|
||||
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
|
||||
{
|
||||
mat.SetDisplayState(false);
|
||||
}
|
||||
@@ -506,7 +512,7 @@ namespace GHelper
|
||||
private void LabelCPUFan_Click(object? sender, EventArgs e)
|
||||
{
|
||||
Program.config.setConfig("fan_rpm", (Program.config.getConfig("fan_rpm") == 1) ? 0 : 1);
|
||||
RefreshSensors();
|
||||
RefreshSensors(true);
|
||||
}
|
||||
|
||||
private void PictureColor2_Click(object? sender, EventArgs e)
|
||||
@@ -681,22 +687,24 @@ namespace GHelper
|
||||
|
||||
if (frequency >= 1000)
|
||||
{
|
||||
frequency = Program.config.getConfig("max_frequency");
|
||||
if (frequency <= 60) frequency = 120;
|
||||
frequency = NativeMethods.GetRefreshRate(true);
|
||||
}
|
||||
|
||||
if (frequency > 0)
|
||||
{
|
||||
NativeMethods.SetRefreshRate(frequency);
|
||||
Logger.WriteLine("Screen " + frequency.ToString() + "Hz");
|
||||
}
|
||||
|
||||
if (overdrive >= 0)
|
||||
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
||||
{
|
||||
if (Program.config.getConfig("no_overdrive") == 1) overdrive = 0;
|
||||
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive, "ScreenOverdrive");
|
||||
|
||||
}
|
||||
|
||||
if (miniled >= 0)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.ScreenMiniled, miniled);
|
||||
Program.wmi.DeviceSet(ASUSWmi.ScreenMiniled, miniled, "Miniled");
|
||||
Debug.WriteLine("Miniled " + miniled);
|
||||
}
|
||||
|
||||
@@ -708,9 +716,10 @@ namespace GHelper
|
||||
{
|
||||
|
||||
int frequency = NativeMethods.GetRefreshRate();
|
||||
int maxFrequency = Program.config.getConfig("max_frequency");
|
||||
int maxFrequency = NativeMethods.GetRefreshRate(true);
|
||||
|
||||
bool screenAuto = (Program.config.getConfig("screen_auto") == 1);
|
||||
bool overdriveSetting = (Program.config.getConfig("no_overdrive") != 1);
|
||||
|
||||
int overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
|
||||
int miniled = Program.wmi.DeviceGet(ASUSWmi.ScreenMiniled);
|
||||
@@ -738,18 +747,14 @@ namespace GHelper
|
||||
{
|
||||
button60Hz.Activated = true;
|
||||
}
|
||||
else
|
||||
else if (frequency > 60)
|
||||
{
|
||||
if (frequency > 60)
|
||||
maxFrequency = frequency;
|
||||
|
||||
Program.config.setConfig("max_frequency", maxFrequency);
|
||||
button120Hz.Activated = true;
|
||||
}
|
||||
|
||||
if (maxFrequency > 60)
|
||||
{
|
||||
button120Hz.Text = maxFrequency.ToString() + "Hz + OD";
|
||||
button120Hz.Text = maxFrequency.ToString() + "Hz" + (overdriveSetting ? " + OD" : "");
|
||||
}
|
||||
|
||||
if (miniled >= 0)
|
||||
@@ -798,26 +803,12 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
private static string FormatFan(int fan)
|
||||
{
|
||||
if (fan < 0) return null;
|
||||
|
||||
if (Program.config.getConfig("fan_rpm") == 1)
|
||||
return " Fan: " + (fan * 100).ToString() + "RPM";
|
||||
else
|
||||
return " Fan: " + Math.Min(Math.Round(fan / 0.6), 100).ToString() + "%"; // relatively to 6000 rpm
|
||||
}
|
||||
|
||||
private static void RefreshSensors()
|
||||
private static void RefreshSensors(bool force = false)
|
||||
{
|
||||
|
||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastRefresh) < 2000) return;
|
||||
if (!force && Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastRefresh) < 2000) return;
|
||||
lastRefresh = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
|
||||
string cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
||||
string gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
|
||||
string midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
|
||||
|
||||
string cpuTemp = "";
|
||||
string gpuTemp = "";
|
||||
string battery = "";
|
||||
@@ -837,12 +828,16 @@ namespace GHelper
|
||||
|
||||
Program.settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan;
|
||||
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan;
|
||||
if (midFan is not null) Program.settingsForm.labelMidFan.Text = "Mid" + midFan;
|
||||
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan;
|
||||
Program.settingsForm.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 + cpuFan + "\n" + "GPU" + gpuTemp + gpuFan + ((battery.Length > 0) ? ("\n" + battery) : "");
|
||||
Program.trayIcon.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan + "\n"
|
||||
+ "GPU" + gpuTemp + HardwareMonitor.gpuFan +
|
||||
((battery.Length > 0) ? ("\n" + battery) : "");
|
||||
|
||||
});
|
||||
}
|
||||
@@ -858,7 +853,7 @@ namespace GHelper
|
||||
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
||||
this.Activate();
|
||||
|
||||
aTimer.Interval = 300;
|
||||
//aTimer.Interval = 300;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
//RefreshSensors();
|
||||
@@ -881,30 +876,45 @@ namespace GHelper
|
||||
if (limit_cpu < ASUSWmi.MinCPU) return;
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0)
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total, "PowerLimit A");
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0)
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu, "PowerLimit B");
|
||||
|
||||
|
||||
Logger.WriteLine("PowerLimits " + limit_total.ToString() + ", " + limit_cpu.ToString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void AutoFansAndPower()
|
||||
public void AutoFans(bool force = false)
|
||||
{
|
||||
|
||||
if (Program.config.getConfigPerf("auto_apply") == 1)
|
||||
if (force || Program.config.getConfigPerf("auto_apply") == 1)
|
||||
{
|
||||
Program.wmi.SetFanCurve(0, Program.config.getFanConfig(0));
|
||||
Program.wmi.SetFanCurve(1, Program.config.getFanConfig(1));
|
||||
int cpuResult = Program.wmi.SetFanCurve(0, Program.config.getFanConfig(0));
|
||||
int gpuResult = Program.wmi.SetFanCurve(1, Program.config.getFanConfig(1));
|
||||
|
||||
if (Program.config.getConfig("mid_fan") == 1)
|
||||
Program.wmi.SetFanCurve(2, Program.config.getFanConfig(2));
|
||||
}
|
||||
|
||||
if (Program.config.getConfigPerf("auto_apply_power") == 1)
|
||||
if (cpuResult != 1 || gpuResult != 1) // something went wrong, resetting to default profile
|
||||
{
|
||||
int mode = Program.config.getConfig("performance_mode");
|
||||
Logger.WriteLine("Bios rejected fan curve, resetting mode to " + mode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, mode, "PerformanceMode");
|
||||
}
|
||||
else
|
||||
labelPerf.Text = "Performance Mode+";
|
||||
}
|
||||
else
|
||||
labelPerf.Text = "Performance Mode";
|
||||
|
||||
}
|
||||
|
||||
public void AutoPower(bool force = false)
|
||||
{
|
||||
if (force || Program.config.getConfigPerf("auto_apply_power") == 1)
|
||||
{
|
||||
var timer = new System.Timers.Timer(1000);
|
||||
timer.Elapsed += delegate
|
||||
@@ -918,6 +928,7 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
||||
{
|
||||
|
||||
@@ -947,8 +958,7 @@ namespace GHelper
|
||||
Program.config.setConfig("performance_" + (int)SystemInformation.PowerStatus.PowerLineStatus, PerformanceMode);
|
||||
Program.config.setConfig("performance_mode", PerformanceMode);
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
||||
Logger.WriteLine("PerfMode " + perfName + " " + PerformanceMode);
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode, "PerformanceMode");
|
||||
|
||||
if (notify && (oldMode != PerformanceMode))
|
||||
{
|
||||
@@ -962,7 +972,13 @@ namespace GHelper
|
||||
}
|
||||
}
|
||||
|
||||
AutoFansAndPower();
|
||||
AutoFans();
|
||||
AutoPower();
|
||||
|
||||
if (Program.config.getConfigPerf("auto_boost") != -1)
|
||||
{
|
||||
NativeMethods.SetCPUBoost(Program.config.getConfigPerf("auto_boost"));
|
||||
}
|
||||
|
||||
NativeMethods.SetPowerScheme(PerformanceMode);
|
||||
|
||||
@@ -975,6 +991,7 @@ namespace GHelper
|
||||
{
|
||||
fans.InitFans();
|
||||
fans.InitPower();
|
||||
fans.InitBoost();
|
||||
}
|
||||
|
||||
|
||||
@@ -987,8 +1004,25 @@ namespace GHelper
|
||||
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1, true);
|
||||
}
|
||||
|
||||
public void AutoPerformance(PowerLineStatus Plugged = PowerLineStatus.Online)
|
||||
|
||||
public void AutoKeyboard()
|
||||
{
|
||||
if (Program.config.getConfig("keyboard_auto") != 1) return;
|
||||
|
||||
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online)
|
||||
Aura.ApplyBrightness(3);
|
||||
//Program.wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.KB_Light_Up);
|
||||
else
|
||||
Aura.ApplyBrightness(0);
|
||||
//Program.wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.KB_Light_Down);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void AutoPerformance()
|
||||
{
|
||||
var Plugged = SystemInformation.PowerStatus.PowerLineStatus;
|
||||
|
||||
int mode = Program.config.getConfig("performance_" + (int)Plugged);
|
||||
if (mode != -1)
|
||||
SetPerformanceMode(mode, true);
|
||||
@@ -997,11 +1031,11 @@ namespace GHelper
|
||||
}
|
||||
|
||||
|
||||
public void AutoScreen(PowerLineStatus Plugged = PowerLineStatus.Online)
|
||||
public void AutoScreen(bool force = false)
|
||||
{
|
||||
if (Program.config.getConfig("screen_auto") != 1) return;
|
||||
if (!force && Program.config.getConfig("screen_auto") != 1) return;
|
||||
|
||||
if (Plugged == PowerLineStatus.Online)
|
||||
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online)
|
||||
SetScreen(1000, 1);
|
||||
else
|
||||
SetScreen(60, 0);
|
||||
@@ -1009,9 +1043,11 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
public bool AutoGPUMode(PowerLineStatus Plugged = PowerLineStatus.Online)
|
||||
public bool AutoGPUMode()
|
||||
{
|
||||
|
||||
var Plugged = SystemInformation.PowerStatus.PowerLineStatus;
|
||||
|
||||
bool GpuAuto = Program.config.getConfig("gpu_auto") == 1;
|
||||
if (!GpuAuto) return false;
|
||||
|
||||
@@ -1060,6 +1096,9 @@ namespace GHelper
|
||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
|
||||
//Logger.WriteLine("Eco flag : " + eco);
|
||||
//Logger.WriteLine("Mux flag : " + mux);
|
||||
|
||||
int GpuMode;
|
||||
|
||||
if (mux == 0)
|
||||
@@ -1110,13 +1149,13 @@ namespace GHelper
|
||||
foreach (var process in Process.GetProcessesByName(kill)) process.Kill();
|
||||
}
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco);
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, eco, "GPUEco");
|
||||
|
||||
Program.settingsForm.BeginInvoke(delegate
|
||||
{
|
||||
InitGPUMode();
|
||||
HardwareMonitor.RecreateGpuTemperatureProviderWithDelay();
|
||||
Thread.Sleep(500);
|
||||
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
|
||||
InitGPUMode();
|
||||
AutoScreen();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1144,7 +1183,7 @@ namespace GHelper
|
||||
DialogResult dialogResult = MessageBox.Show("Switching off Ultimate Mode requires restart", "Reboot now?", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUMux, 1);
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUMux, 1, "GPUMux");
|
||||
restart = true;
|
||||
changed = true;
|
||||
}
|
||||
@@ -1154,7 +1193,7 @@ namespace GHelper
|
||||
DialogResult dialogResult = MessageBox.Show("Ultimate Mode requires restart", "Reboot now?", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUMux, 0);
|
||||
Program.wmi.DeviceSet(ASUSWmi.GPUMux, 0, "GPUMux");
|
||||
restart = true;
|
||||
changed = true;
|
||||
}
|
||||
@@ -1265,10 +1304,12 @@ namespace GHelper
|
||||
|
||||
if (limit < 40 || limit > 100) return;
|
||||
|
||||
labelBatteryTitle.Text = "Battery Charge Limit: " + limit.ToString() + "%";
|
||||
trackBattery.Value = limit;
|
||||
//Debug.WriteLine(limit);
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
|
||||
labelBatteryTitle.Text = "Battery Charge Limit: " + limit.ToString() + "%";
|
||||
sliderBattery.Value = limit;
|
||||
|
||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit, "BatteryLimit");
|
||||
Program.config.setConfig("charge_limit", limit);
|
||||
|
||||
}
|
||||
|
||||
168
app/Slider.cs
Normal file
168
app/Slider.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace WinFormsSliderBar
|
||||
{
|
||||
public static class GraphicsExtensions
|
||||
{
|
||||
public static void DrawCircle(this Graphics g, Pen pen,
|
||||
float centerX, float centerY, float radius)
|
||||
{
|
||||
g.DrawEllipse(pen, centerX - radius, centerY - radius,
|
||||
radius + radius, radius + radius);
|
||||
}
|
||||
|
||||
public static void FillCircle(this Graphics g, Brush brush,
|
||||
float centerX, float centerY, float radius)
|
||||
{
|
||||
g.FillEllipse(brush, centerX - radius, centerY - radius,
|
||||
radius + radius, radius + radius);
|
||||
}
|
||||
}
|
||||
|
||||
public class Slider : Control
|
||||
{
|
||||
private float _radius;
|
||||
private PointF _thumbPos;
|
||||
private SizeF _barSize;
|
||||
private PointF _barPos;
|
||||
|
||||
private int _step = 5;
|
||||
|
||||
public Color accentColor = Color.FromArgb(255, 58, 174, 239);
|
||||
public Color borderColor = Color.White;
|
||||
|
||||
public event EventHandler ValueChanged;
|
||||
|
||||
public Slider()
|
||||
{
|
||||
// This reduces flicker
|
||||
DoubleBuffered = true;
|
||||
}
|
||||
|
||||
private int _min = 0;
|
||||
public int Min
|
||||
{
|
||||
get => _min;
|
||||
set
|
||||
{
|
||||
_min = value;
|
||||
RecalculateParameters();
|
||||
}
|
||||
}
|
||||
|
||||
private int _max = 100;
|
||||
public int Max
|
||||
{
|
||||
get => _max;
|
||||
set
|
||||
{
|
||||
_max = value;
|
||||
RecalculateParameters();
|
||||
}
|
||||
}
|
||||
|
||||
private int _value = 50;
|
||||
public int Value
|
||||
{
|
||||
get => _value;
|
||||
set
|
||||
{
|
||||
|
||||
value = (int)Math.Round(value / (float)_step) * _step;
|
||||
|
||||
if (_value != value)
|
||||
{
|
||||
_value = value;
|
||||
ValueChanged?.Invoke(this, EventArgs.Empty);
|
||||
RecalculateParameters();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Brush brushAccent = new SolidBrush(accentColor);
|
||||
Brush brushEmpty = new SolidBrush(Color.Gray);
|
||||
Brush brushBorder = new SolidBrush(borderColor);
|
||||
|
||||
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
e.Graphics.FillRectangle(brushEmpty,
|
||||
_barPos.X, _barPos.Y, _barSize.Width, _barSize.Height);
|
||||
e.Graphics.FillRectangle(brushAccent,
|
||||
_barPos.X, _barPos.Y, _thumbPos.X - _barPos.X, _barSize.Height);
|
||||
|
||||
e.Graphics.FillCircle(brushBorder, _thumbPos.X, _thumbPos.Y, _radius);
|
||||
e.Graphics.FillCircle(brushAccent, _thumbPos.X, _thumbPos.Y, 0.7f * _radius);
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
RecalculateParameters();
|
||||
}
|
||||
|
||||
private void RecalculateParameters()
|
||||
{
|
||||
_radius = 0.4F * ClientSize.Height;
|
||||
_barSize = new SizeF(ClientSize.Width - 4 * _radius, ClientSize.Height * 0.15F);
|
||||
_barPos = new PointF(_radius, (ClientSize.Height - _barSize.Height) / 2);
|
||||
_thumbPos = new PointF(
|
||||
_barSize.Width / (Max - Min) * (Value - Min) + _barPos.X,
|
||||
_barPos.Y + 0.5f * _barSize.Height);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
bool _moving = false;
|
||||
SizeF _delta;
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
|
||||
// Difference between tumb and mouse position.
|
||||
_delta = new SizeF(e.Location.X - _thumbPos.X, e.Location.Y - _thumbPos.Y);
|
||||
if (_delta.Width * _delta.Width + _delta.Height * _delta.Height <= _radius * _radius)
|
||||
{
|
||||
// Clicking inside thumb.
|
||||
_moving = true;
|
||||
}
|
||||
|
||||
_calculateValue(e);
|
||||
|
||||
}
|
||||
|
||||
private void _calculateValue(MouseEventArgs e)
|
||||
{
|
||||
float thumbX = e.Location.X; // - _delta.Width;
|
||||
if (thumbX < _barPos.X)
|
||||
{
|
||||
thumbX = _barPos.X;
|
||||
}
|
||||
else if (thumbX > _barPos.X + _barSize.Width)
|
||||
{
|
||||
thumbX = _barPos.X + _barSize.Width;
|
||||
}
|
||||
Value = (int)Math.Round(Min + (thumbX - _barPos.X) * (Max - Min) / _barSize.Width);
|
||||
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if (_moving)
|
||||
{
|
||||
_calculateValue(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
_moving = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
19
bloat.bat
Normal file
19
bloat.bat
Normal file
@@ -0,0 +1,19 @@
|
||||
sc config AsusAppService start= auto
|
||||
sc config ASUSLinkNear start= auto
|
||||
sc config ASUSLinkRemote start= auto
|
||||
sc config ASUSSoftwareManager start= auto
|
||||
sc config ASUSSwitch start= auto
|
||||
sc config ASUSSystemAnalysis start= auto
|
||||
sc config ASUSSystemDiagnosis start= auto
|
||||
sc config ArmouryCrateControlInterface start= auto
|
||||
|
||||
sc START AsusAppService
|
||||
sc START ASUSLinkNear
|
||||
sc START ASUSLinkRemote
|
||||
sc START ASUSSoftwareManager
|
||||
sc START ASUSSwitch
|
||||
sc START ASUSSystemAnalysis
|
||||
sc START ASUSSystemDiagnosis
|
||||
sc START ArmouryCrateControlInterface
|
||||
|
||||
set /p asd="Hit enter to finish"
|
||||
18
debloat.bat
18
debloat.bat
@@ -7,11 +7,13 @@ sc STOP ASUSSystemAnalysis
|
||||
sc STOP ASUSSystemDiagnosis
|
||||
sc STOP ArmouryCrateControlInterface
|
||||
|
||||
sc DELETE AsusAppService
|
||||
sc DELETE ASUSLinkNear
|
||||
sc DELETE ASUSLinkRemote
|
||||
sc DELETE ASUSSoftwareManager
|
||||
sc DELETE ASUSSwitch
|
||||
sc DELETE ASUSSystemAnalysis
|
||||
sc DELETE ASUSSystemDiagnosis
|
||||
sc DELETE ArmouryCrateControlInterface
|
||||
sc config AsusAppService start= disabled
|
||||
sc config ASUSLinkNear start= disabled
|
||||
sc config ASUSLinkRemote start= disabled
|
||||
sc config ASUSSoftwareManager start= disabled
|
||||
sc config ASUSSwitch start= disabled
|
||||
sc config ASUSSystemAnalysis start= disabled
|
||||
sc config ASUSSystemDiagnosis start= disabled
|
||||
sc config ArmouryCrateControlInterface start= disabled
|
||||
|
||||
set /p asd="Hit enter to finish"
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
# [G-Helper (GHelper)](https://github.com/seerge/g-helper)
|
||||
|
||||
# [G-Helper](https://github.com/seerge/g-helper)
|
||||
|
||||
[](https://GitHub.com/seerge/g-helper/releases/) [](https://GitHub.com/seerge/g-helper/releases/) [](https://GitHub.com/seerge/g-helper/stargazers/)
|
||||
[](https://GitHub.com/seerge/g-helper/releases/) [](https://GitHub.com/seerge/g-helper/releases/) [](https://GitHub.com/seerge/g-helper/stargazers/)
|
||||
|
||||
## Open source Armoury Crate alternative for Asus laptops such as ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
|
||||
## Lightweight Armoury Crate alternative for Asus laptops
|
||||
### Control tool for ROG Zephyrus G14, G15, Flow X13, Flow X16, TUF, Strix, Scar and other models
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
2. All performance modes can be fully customised (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 UI with easy access to all settings
|
||||
4. Simple and clean native UI with easy access to all settings
|
||||
|
||||
### [:floppy_disk: Download latest release](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 app - please include a link. Thanks.
|
||||
|
||||

|
||||
|
||||
### :zap: Main features
|
||||
|
||||
@@ -34,7 +38,7 @@ If you like this app, please [star :star: it on Github](https://github.com/seerg
|
||||
11. Battery charge limit to preserve battery health
|
||||
12. Monitor CPU / GPU temperature, fan speeds and battery discharge rate
|
||||
|
||||
### :apple: Automatic switching of modes when on battery or plugged in
|
||||
### :gear: Automatic switching of modes when on battery or plugged in
|
||||
- Performance modes (app remembers last mode used on battery or when plugged)
|
||||
- Optimized GPU mode - disables dGPU on battery and enables when plugged
|
||||
- Auto Screen refresh rate (60hz on battery, 120+ hz when plugged)
|
||||
@@ -43,7 +47,9 @@ To keep auto switching and hotkeys working the app needs to stay in running in t
|
||||
|
||||
### :rocket: Performance Modes
|
||||
|
||||
Modes are **same** as in Armory 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
|
||||
@@ -60,10 +66,11 @@ PPTs are shown for G14 2022, for other models PPTs will be different as they are
|
||||
|
||||
## :question: FAQ
|
||||
|
||||
### How do I stop Armory Crate install popup appearing every time I press M4 / Rog key?
|
||||
Go to BIOS (F2 on boot), open Advanced Settings and disable "Armory Control Interface". If it still appears - delete or move somwhere following file C:\Windows\System32\ASUSACCI\ArmouryCrateKeyControl.exe
|
||||
### How do I stop the Armory Crate install popup appearing every time I press the M4 / Rog key?
|
||||
Go to BIOS (F2 on boot), open Advanced Settings and disable "Armory Control Interface".
|
||||
If it still appears - delete or move somewhere following file ``C:\Windows\System32\ASUSACCI\ArmouryCrateKeyControl.exe``
|
||||
|
||||
### Why Ultimate GPU mode is not available on my laptop?
|
||||
### Why is Ultimate GPU mode not available on my laptop?
|
||||
Ultimate mode is supported (by hardware) only on G14 2022 (and possibly other models from 2022+)
|
||||
|
||||
### I can't set Eco mode (disable dGPU) on my G14 2020
|
||||
@@ -79,11 +86,17 @@ It doesn't. Your bios does (same as in case with armoury). What G-helper can do
|
||||
Click on them
|
||||
|
||||
### I don't see a GPU temperature in G-helper
|
||||
Most probably either you are using Eco / Optimized mode and your dGPU is simply off, or your windows has put dGPU into sleep (to preserve power). In this situations G-helper won't be able to reach your GPU and get readings
|
||||
Most probably either you are using Eco / Optimized mode and your dGPU is simply off, or your windows has put the dGPU into sleep (to preserve power). In this situations G-helper won't be able to reach your GPU and get readings
|
||||
|
||||
### 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 ?
|
||||
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.
|
||||
|
||||
### Can I use MyASUS app along with G-Helper?
|
||||
Sure, you can! The only problem is that MyASUS may override battery charge limit that you set before. My advice in such case would be to set same limit (i.e. 80%) in both MyASUS and G-Helper.
|
||||
|
||||
### How do I uninstall G-helper?
|
||||
G-helper is a single exe, and it doesn't install anything in the system. To remove it - you can simply delete exe :) If you have applied any custom fan profiles or PPTs - before removing I would recommend selecting your favorite performance mode (for example balanced) and clicking "Factory defaults" under Fans + Power.
|
||||
|
||||
@@ -95,13 +108,15 @@ G-helper is a single exe, and it doesn't install anything in the system. To remo
|
||||
2. Unzip to a folder of your choice
|
||||
3. Run **GHelper.exe**
|
||||
|
||||
### Dependencies
|
||||
### Dependencies & Requirements
|
||||
|
||||
- App requires [.NET7](https://dotnet.microsoft.com/en-us/download) to be installed. Most probably you already have it. Otherwise you can [download it](https://dotnet.microsoft.com/en-us/download).
|
||||
- Microsoft [.NET7](https://dotnet.microsoft.com/en-us/download). Most probably you already have it. Otherwise you can [download it](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.202-windows-x64-installer) from the official website.
|
||||
|
||||
- I recommend keeping "Asus Optimization Service" running, as it keeps basic laptop hotkeys such as screen or keyboard brightness adjustment working. If you have (or had) MyASUS app installed, that service is most probably still up and running even after MyASUS uninstalls. It's part of [Asus System Control Interface](https://www.asus.com/support/FAQ/1047338/). You can install it, and later disable / remove unnecessary services by running [this bat file](https://raw.githubusercontent.com/seerge/g-helper/main/debloat.bat) as admin.
|
||||
- [Asus System Control Interface](https://dlcdnets.asus.com/pub/ASUS/nb/Image/CustomComponent/ASUSSystemControlInterfaceV3/ASUSSystemControlInterfaceV3.exe). If you have or had MyASUS app installed this "driver" probably still in place (even after MyASUS uninstalls). Alternatively - you can download and install it, and later disable / remove unnecessary services by running [this bat file](https://raw.githubusercontent.com/seerge/g-helper/main/debloat.bat) as admin.
|
||||
|
||||
- It's not recommended to use an app in combination with Armoury Crate, cause 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.
|
||||
- I recommend keeping "Asus Optimization Service" running, as it keeps basic laptop hotkeys such as screen or keyboard brightness adjustment working.
|
||||
|
||||
- It's not recommended to use an app in combination with Armoury Crate services, cause 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.
|
||||
|
||||
Note: Doesn't need administrator privileges to run!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user