mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd3a139c47 | ||
|
|
608b8571d4 | ||
|
|
82a39bcfa1 | ||
|
|
f9ccd92dc6 | ||
|
|
1fadc6c31e | ||
|
|
0b7dd42a5d |
@@ -1,4 +1,5 @@
|
|||||||
using GHelper;
|
using System.Globalization;
|
||||||
|
using System.IO.Pipes;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -205,7 +206,7 @@ public class ASUSWmi
|
|||||||
byte[] args = new byte[8];
|
byte[] args = new byte[8];
|
||||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||||
byte[] status = CallMethod(DSTS, args);
|
byte[] status = CallMethod(DSTS, args);
|
||||||
|
|
||||||
return BitConverter.ToInt32(status, 0) - 65536;
|
return BitConverter.ToInt32(status, 0) - 65536;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -215,7 +216,7 @@ public class ASUSWmi
|
|||||||
byte[] args = new byte[8];
|
byte[] args = new byte[8];
|
||||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||||
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
|
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
|
||||||
|
|
||||||
return CallMethod(DSTS, args);
|
return CallMethod(DSTS, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,9 +244,7 @@ public class ASUSWmi
|
|||||||
int result;
|
int result;
|
||||||
|
|
||||||
for (int i = 8; i < curve.Length; i++)
|
for (int i = 8; i < curve.Length; i++)
|
||||||
{
|
|
||||||
curve[i] = Math.Max((byte)0, Math.Min((byte)99, curve[i])); // it seems to be a bug, when some old model's bios can go nuts if fan is set to 100%
|
curve[i] = Math.Max((byte)0, Math.Min((byte)99, curve[i])); // it seems to be a bug, when some old model's bios can go nuts if fan is set to 100%
|
||||||
}
|
|
||||||
|
|
||||||
switch (device)
|
switch (device)
|
||||||
{
|
{
|
||||||
@@ -287,6 +286,47 @@ public class ASUSWmi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static bool IsEmptyCurve(byte[] curve) {
|
||||||
|
return curve.Length != 16 || curve.All(singleByte => singleByte == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] FixFanCurve(byte[] curve)
|
||||||
|
{
|
||||||
|
if (curve.Length != 16) throw new Exception("Incorrect curve");
|
||||||
|
|
||||||
|
var points = new Dictionary<byte, byte>();
|
||||||
|
for (int i = 0; i < 8; i++) points[curve[i]] = curve[i+8];
|
||||||
|
|
||||||
|
var pointsFixed = new Dictionary<byte, byte>();
|
||||||
|
bool fix = false;
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
foreach (var pair in points.OrderBy(x => x.Key))
|
||||||
|
{
|
||||||
|
if (count == 0 && pair.Key >= 40)
|
||||||
|
{
|
||||||
|
fix = true;
|
||||||
|
pointsFixed.Add(20, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count != 3 || !fix)
|
||||||
|
pointsFixed.Add(pair.Key, pair.Value);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
foreach (var pair in pointsFixed.OrderBy(x => x.Key))
|
||||||
|
{
|
||||||
|
curve[count] =pair.Key;
|
||||||
|
curve[count+8] = pair.Value;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return curve;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void TUFKeyboardBrightness(int brightness)
|
public void TUFKeyboardBrightness(int brightness)
|
||||||
{
|
{
|
||||||
int param = 0x80 | (brightness & 0x7F);
|
int param = 0x80 | (brightness & 0x7F);
|
||||||
@@ -336,7 +376,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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ namespace Starlight.AnimeMatrix
|
|||||||
public enum AnimeType
|
public enum AnimeType
|
||||||
{
|
{
|
||||||
GA401,
|
GA401,
|
||||||
GA402
|
GA402,
|
||||||
|
GU604
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -88,6 +89,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 +115,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 +186,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 +200,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 +244,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()
|
||||||
|
|||||||
33
app/Aura.cs
33
app/Aura.cs
@@ -1,8 +1,6 @@
|
|||||||
using HidLibrary;
|
using HidLibrary;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using OSD;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
@@ -163,11 +161,14 @@ namespace GHelper
|
|||||||
Color2 = Color.FromArgb(colorCode);
|
Color2 = Color.FromArgb(colorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<HidDevice> GetHidDevices(int[] deviceIds)
|
|
||||||
|
private static IEnumerable<HidDevice> GetHidDevices(int[] deviceIds, int minInput = 18)
|
||||||
{
|
{
|
||||||
HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
HidDevice[] HidDeviceList = HidDevices.Enumerate(0x0b05, deviceIds).ToArray();
|
||||||
foreach (HidDevice device in HidDeviceList)
|
foreach (HidDevice device in HidDeviceList)
|
||||||
if (device.IsConnected && device.Description.ToLower().Contains("hid") && device.Capabilities.FeatureReportByteLength >= 64)
|
if (device.IsConnected
|
||||||
|
&& device.Capabilities.FeatureReportByteLength > 0
|
||||||
|
&& device.Capabilities.InputReportByteLength >= minInput) //
|
||||||
yield return device;
|
yield return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,12 +197,13 @@ namespace GHelper
|
|||||||
byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness };
|
byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness };
|
||||||
|
|
||||||
var devices = GetHidDevices(deviceIds);
|
var devices = GetHidDevices(deviceIds);
|
||||||
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
//Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||||
|
|
||||||
foreach (HidDevice device in devices)
|
foreach (HidDevice device in devices)
|
||||||
{
|
{
|
||||||
device.OpenDevice();
|
device.OpenDevice();
|
||||||
device.Write(msg);
|
device.Write(msg);
|
||||||
|
Logger.WriteLine("USB-KB " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg));
|
||||||
device.CloseDevice();
|
device.CloseDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,27 +219,28 @@ namespace GHelper
|
|||||||
|
|
||||||
|
|
||||||
var devices = GetHidDevices(deviceIds);
|
var devices = GetHidDevices(deviceIds);
|
||||||
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
//Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
||||||
|
|
||||||
foreach (HidDevice device in devices)
|
foreach (HidDevice device in devices)
|
||||||
{
|
{
|
||||||
device.OpenDevice();
|
device.OpenDevice();
|
||||||
device.Write(msg);
|
device.Write(msg);
|
||||||
|
Logger.WriteLine("USB-KB " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg));
|
||||||
device.CloseDevice();
|
device.CloseDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Program.config.ContainsModel("TUF"))
|
if (Program.config.ContainsModel("TUF"))
|
||||||
Program.wmi.TUFKeyboardPower(
|
Program.wmi.TUFKeyboardPower(
|
||||||
flags.Contains(AuraDev19b6.AwakeKeyb),
|
flags.Contains(AuraDev19b6.AwakeKeyb),
|
||||||
flags.Contains(AuraDev19b6.BootKeyb),
|
flags.Contains(AuraDev19b6.BootKeyb),
|
||||||
flags.Contains(AuraDev19b6.SleepKeyb),
|
flags.Contains(AuraDev19b6.SleepKeyb),
|
||||||
flags.Contains(AuraDev19b6.ShutdownKeyb));
|
flags.Contains(AuraDev19b6.ShutdownKeyb));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ApplyXGMLight(bool status)
|
public static void ApplyXGMLight(bool status)
|
||||||
{
|
{
|
||||||
byte value = status? (byte)0x50:(byte)0;
|
byte value = status ? (byte)0x50 : (byte)0;
|
||||||
var msg = new byte[] { 0x5e, 0xc5, value };
|
var msg = new byte[] { 0x5e, 0xc5, value };
|
||||||
|
|
||||||
foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }))
|
foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }))
|
||||||
@@ -273,7 +276,11 @@ namespace GHelper
|
|||||||
byte[] msg = AuraMessage(Mode, Color1, Color2, _speed);
|
byte[] msg = AuraMessage(Mode, Color1, Color2, _speed);
|
||||||
|
|
||||||
var devices = GetHidDevices(deviceIds);
|
var devices = GetHidDevices(deviceIds);
|
||||||
if (devices.Count() > 0) Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
|
if (devices.Count() == 0)
|
||||||
|
{
|
||||||
|
Logger.WriteLine("USB-KB : not found");
|
||||||
|
GetHidDevices(deviceIds, 0);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (HidDevice device in devices)
|
foreach (HidDevice device in devices)
|
||||||
{
|
{
|
||||||
@@ -282,6 +289,7 @@ namespace GHelper
|
|||||||
device.Write(MESSAGE_SET);
|
device.Write(MESSAGE_SET);
|
||||||
device.Write(MESSAGE_APPLY);
|
device.Write(MESSAGE_APPLY);
|
||||||
device.CloseDevice();
|
device.CloseDevice();
|
||||||
|
Logger.WriteLine("USB-KB " + device.Capabilities.FeatureReportByteLength + "|" + device.Capabilities.InputReportByteLength + device.Description + device.DevicePath + ":" + BitConverter.ToString(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Program.config.ContainsModel("TUF"))
|
if (Program.config.ContainsModel("TUF"))
|
||||||
@@ -299,7 +307,8 @@ namespace GHelper
|
|||||||
myKey.SetValue("TurnOffKeybdLight", value, RegistryValueKind.DWord);
|
myKey.SetValue("TurnOffKeybdLight", value, RegistryValueKind.DWord);
|
||||||
myKey.Close();
|
myKey.Close();
|
||||||
}
|
}
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.WriteLine(ex.Message);
|
Logger.WriteLine(ex.Message);
|
||||||
}
|
}
|
||||||
|
|||||||
21
app/Fans.cs
21
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()
|
||||||
@@ -241,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);
|
||||||
|
|
||||||
@@ -250,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;
|
||||||
|
|
||||||
@@ -460,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));
|
||||||
|
|
||||||
@@ -577,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.61</AssemblyVersion>
|
<AssemblyVersion>0.62</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -117,10 +117,10 @@ public class NvidiaGpuControl : IGpuControl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string script = @"$device = Get-PnpDevice | Where-Object { $_.FriendlyName -imatch 'NVIDIA' -and $_.Class -eq 'Display' }; Disable-PnpDevice $device.InstanceId -Confirm:$false; Start-Sleep -Seconds 2; Enable-PnpDevice $device.InstanceId -Confirm:$false";
|
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);
|
Logger.WriteLine(script);
|
||||||
RunCMD("powershell", script);
|
RunCMD("powershell", script);
|
||||||
Thread.Sleep(2000);
|
//Thread.Sleep(2000);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex )
|
catch (Exception ex )
|
||||||
|
|||||||
@@ -115,10 +115,14 @@ public static class HardwareControl
|
|||||||
|
|
||||||
public static bool IsUsedGPU(int threshold = 20)
|
public static bool IsUsedGPU(int threshold = 20)
|
||||||
{
|
{
|
||||||
if (GetGpuUse() > threshold)
|
int use = GetGpuUse();
|
||||||
|
Logger.WriteLine("GPU usage: " + use);
|
||||||
|
if (use > threshold)
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
return (GetGpuUse() > threshold);
|
use = GetGpuUse();
|
||||||
|
Logger.WriteLine("GPU usage: " + use);
|
||||||
|
return (use > threshold);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
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.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 +139,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 +158,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 +245,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())
|
||||||
@@ -1086,7 +1083,7 @@ namespace GHelper
|
|||||||
int gpu_temp = Program.config.getConfigPerf("gpu_temp");
|
int gpu_temp = Program.config.getConfigPerf("gpu_temp");
|
||||||
|
|
||||||
|
|
||||||
if (gpu_boost < ASUSWmi.MinGPUBoost || gpu_boost > ASUSWmi.MaxGPUBoost ) return;
|
if (gpu_boost < ASUSWmi.MinGPUBoost || gpu_boost > ASUSWmi.MaxGPUBoost) return;
|
||||||
if (gpu_temp < ASUSWmi.MinGPUTemp || gpu_temp > ASUSWmi.MaxGPUTemp) return;
|
if (gpu_temp < ASUSWmi.MinGPUTemp || gpu_temp > ASUSWmi.MaxGPUTemp) return;
|
||||||
|
|
||||||
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC0) >= 0)
|
if (Program.wmi.DeviceGet(ASUSWmi.PPT_GPUC0) >= 0)
|
||||||
@@ -1312,9 +1309,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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1481,7 +1479,7 @@ namespace GHelper
|
|||||||
ButtonEnabled(buttonStandard, false);
|
ButtonEnabled(buttonStandard, false);
|
||||||
ButtonEnabled(buttonUltimate, false);
|
ButtonEnabled(buttonUltimate, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
var nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
|
var nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
|
||||||
bool status = nvControl.RestartGPU();
|
bool status = nvControl.RestartGPU();
|
||||||
|
|
||||||
@@ -1694,7 +1692,13 @@ namespace GHelper
|
|||||||
sliderBattery.Value = limit;
|
sliderBattery.Value = limit;
|
||||||
|
|
||||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit, "BatteryLimit");
|
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit, "BatteryLimit");
|
||||||
OptimizationService.SetChargeLimit(limit);
|
try
|
||||||
|
{
|
||||||
|
OptimizationService.SetChargeLimit(limit);
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(ex);
|
||||||
|
}
|
||||||
|
|
||||||
Program.config.setConfig("charge_limit", limit);
|
Program.config.setConfig("charge_limit", limit);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user