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