mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7683e68df3 | ||
|
|
e45bcdf8a5 | ||
|
|
ab8d42c216 | ||
|
|
d248fcf384 | ||
|
|
9bb5e41a5d | ||
|
|
bc965c003d | ||
|
|
a6cfc91de2 | ||
|
|
9ca6ec657f |
18
ASUSWmi.cs
18
ASUSWmi.cs
@@ -27,12 +27,16 @@ public class ASUSWmi
|
|||||||
public const uint DevsCPUFanCurve = 0x00110024;
|
public const uint DevsCPUFanCurve = 0x00110024;
|
||||||
public const uint DevsGPUFanCurve = 0x00110025;
|
public const uint DevsGPUFanCurve = 0x00110025;
|
||||||
|
|
||||||
public const int PPT_TotalA0 = 0x001200A0;
|
public const int PPT_TotalA0 = 0x001200A0; // Total PPT on 2022 and CPU PPT on 2021
|
||||||
public const int PPT_TotalA1 = 0x001200A1;
|
public const int PPT_EDCA1 = 0x001200A1; // CPU EDC
|
||||||
|
public const int PPT_TDCA2 = 0x001200A2; // CPU TDC
|
||||||
|
public const int PPT_APUA3 = 0x001200A3; // APU PPT ON 2021, doesn't work on 2022
|
||||||
|
|
||||||
public const int PPT_CPUB0 = 0x001200B0;
|
public const int PPT_CPUB0 = 0x001200B0; // CPU PPT on 2022
|
||||||
public const int PPT_CPUB1 = 0x001200B1;
|
public const int PPT_CPUB1 = 0x001200B1; // APU PPT on 2022
|
||||||
public const int PPT_CPUA2 = 0x001200A2;
|
|
||||||
|
public const int PPT_APUC1 = 0x001200C1;
|
||||||
|
public const int PPT_APUC2 = 0x001200C2;
|
||||||
|
|
||||||
public const int PerformanceBalanced = 0;
|
public const int PerformanceBalanced = 0;
|
||||||
public const int PerformanceTurbo = 1;
|
public const int PerformanceTurbo = 1;
|
||||||
@@ -44,11 +48,11 @@ public class ASUSWmi
|
|||||||
|
|
||||||
|
|
||||||
public const int MaxTotal = 150;
|
public const int MaxTotal = 150;
|
||||||
public const int MinTotal = 15;
|
public const int MinTotal = 5;
|
||||||
public const int DefaultTotal = 125;
|
public const int DefaultTotal = 125;
|
||||||
|
|
||||||
public const int MaxCPU = 90;
|
public const int MaxCPU = 90;
|
||||||
public const int MinCPU = 15;
|
public const int MinCPU = 5;
|
||||||
public const int DefaultCPU = 80;
|
public const int DefaultCPU = 80;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
13
Fans.cs
13
Fans.cs
@@ -168,8 +168,17 @@ namespace GHelper
|
|||||||
public void InitPower(bool changed = false)
|
public void InitPower(bool changed = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
panelPower.Visible = (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0);
|
bool cpuBmode = (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0); // 2022 model +
|
||||||
panelCPU.Visible = (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0);
|
bool cpuAmode = (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0); // 2021 model +
|
||||||
|
|
||||||
|
panelPower.Visible = cpuAmode;
|
||||||
|
panelCPU.Visible = cpuBmode;
|
||||||
|
|
||||||
|
// Yes, that's stupid, but Total slider on 2021 model actually adjusts CPU PPT
|
||||||
|
if (!cpuBmode)
|
||||||
|
{
|
||||||
|
label1.Text = "CPU SPPT";
|
||||||
|
}
|
||||||
|
|
||||||
int limit_total;
|
int limit_total;
|
||||||
int limit_cpu;
|
int limit_cpu;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.26</AssemblyVersion>
|
<AssemblyVersion>0.28</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using static Tools.ScreenInterrogatory;
|
using static Tools.ScreenInterrogatory;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Tools
|
namespace Tools
|
||||||
{
|
{
|
||||||
@@ -457,6 +458,15 @@ public class NativeMethods
|
|||||||
static readonly Guid GUID_CPU = new Guid("54533251-82be-4824-96c1-47b60b740d00");
|
static readonly Guid GUID_CPU = new Guid("54533251-82be-4824-96c1-47b60b740d00");
|
||||||
static readonly Guid GUID_BOOST = new Guid("be337238-0d82-4146-a960-4f3749d470c7");
|
static readonly Guid GUID_BOOST = new Guid("be337238-0d82-4146-a960-4f3749d470c7");
|
||||||
|
|
||||||
|
[DllImportAttribute("powrprof.dll", EntryPoint = "PowerGetActualOverlayScheme")]
|
||||||
|
public static extern uint PowerGetActualOverlayScheme(out Guid ActualOverlayGuid);
|
||||||
|
|
||||||
|
[DllImportAttribute("powrprof.dll", EntryPoint = "PowerGetEffectiveOverlayScheme")]
|
||||||
|
public static extern uint PowerGetEffectiveOverlayScheme(out Guid EffectiveOverlayGuid);
|
||||||
|
|
||||||
|
[DllImportAttribute("powrprof.dll", EntryPoint = "PowerSetActiveOverlayScheme")]
|
||||||
|
public static extern uint PowerSetActiveOverlayScheme(Guid OverlaySchemeGuid);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||||
public struct DEVMODE
|
public struct DEVMODE
|
||||||
{
|
{
|
||||||
@@ -545,22 +555,19 @@ public class NativeMethods
|
|||||||
|
|
||||||
foreach (var device in devices)
|
foreach (var device in devices)
|
||||||
{
|
{
|
||||||
if (device.outputTechnology == DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY.DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL)
|
if (device.outputTechnology == DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY.DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL ||
|
||||||
|
device.outputTechnology == DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY.DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED)
|
||||||
{
|
{
|
||||||
displayNum = count;
|
displayNum = count;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
//Debug.WriteLine(device.outputTechnology);
|
//Logger.WriteLine(device.outputTechnology.ToString());
|
||||||
//Debug.WriteLine(device.monitorFriendlyDeviceName);
|
//Logger.WriteLine(device.monitorFriendlyDeviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
var screens = Screen.AllScreens;
|
var screens = Screen.AllScreens;
|
||||||
|
|
||||||
if (screens.Length != count)
|
if (screens.Length != count) return null;
|
||||||
{
|
|
||||||
Debug.WriteLine("Mismatch between enumerated and available screens");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
foreach (var screen in screens)
|
foreach (var screen in screens)
|
||||||
@@ -569,13 +576,15 @@ public class NativeMethods
|
|||||||
{
|
{
|
||||||
laptopScreen = screen.DeviceName;
|
laptopScreen = screen.DeviceName;
|
||||||
}
|
}
|
||||||
//Debug.WriteLine(screen.DeviceName);
|
//Logger.WriteLine(screen.DeviceName);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Can't find internal screen");
|
Logger.WriteLine(ex.ToString());
|
||||||
|
Logger.WriteLine("Can't detect internal screen");
|
||||||
|
//laptopScreen = Screen.PrimaryScreen.DeviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -666,4 +675,20 @@ public class NativeMethods
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetPowerScheme(int mode)
|
||||||
|
{
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case 0: // balanced
|
||||||
|
PowerSetActiveOverlayScheme(new Guid("00000000-0000-0000-0000-000000000000"));
|
||||||
|
break;
|
||||||
|
case 1: // turbo
|
||||||
|
PowerSetActiveOverlayScheme(new Guid("ded574b5-45a0-4f42-8737-46345c09c238"));
|
||||||
|
break;
|
||||||
|
case 2: //silent
|
||||||
|
PowerSetActiveOverlayScheme(new Guid("961cc777-2547-4f9d-8174-7d86181b8a7a"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
91
Program.cs
91
Program.cs
@@ -6,20 +6,36 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
public static class Logger
|
public static class Logger
|
||||||
{
|
{
|
||||||
|
static string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
||||||
|
static string logFile = appPath + "\\log.txt";
|
||||||
|
|
||||||
public static void WriteLine(string logMessage)
|
public static void WriteLine(string logMessage)
|
||||||
{
|
{
|
||||||
Debug.WriteLine(logMessage);
|
Debug.WriteLine(logMessage);
|
||||||
|
|
||||||
var appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
|
||||||
var logFile = appPath + "\\log.txt";
|
|
||||||
|
|
||||||
if (!Directory.Exists(appPath)) Directory.CreateDirectory(appPath);
|
if (!Directory.Exists(appPath)) Directory.CreateDirectory(appPath);
|
||||||
|
|
||||||
using (StreamWriter w = File.AppendText(logFile))
|
try
|
||||||
{
|
{
|
||||||
w.WriteLine($"{DateTime.Now}: {logMessage}");
|
using (StreamWriter w = File.AppendText(logFile))
|
||||||
}
|
{
|
||||||
|
w.WriteLine($"{DateTime.Now}: {logMessage}");
|
||||||
|
w.Close();
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
|
||||||
|
if (new Random().Next(100) == 1) Cleanup();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Cleanup()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var file = File.ReadAllLines(logFile);
|
||||||
|
int skip = Math.Max(0, file.Count() - 500);
|
||||||
|
File.WriteAllLines(logFile, file.Skip(skip).ToArray());
|
||||||
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -30,31 +46,6 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Native methods for sleep detection
|
|
||||||
|
|
||||||
[DllImport("Powrprof.dll", SetLastError = true)]
|
|
||||||
static extern uint PowerRegisterSuspendResumeNotification(uint flags, ref DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS receipient, ref IntPtr registrationHandle);
|
|
||||||
|
|
||||||
|
|
||||||
private const int WM_POWERBROADCAST = 536; // (0x218)
|
|
||||||
private const int PBT_APMPOWERSTATUSCHANGE = 10; // (0xA) - Power status has changed.
|
|
||||||
private const int PBT_APMRESUMEAUTOMATIC = 18; // (0x12) - Operation is resuming automatically from a low-power state.This message is sent every time the system resumes.
|
|
||||||
private const int PBT_APMRESUMESUSPEND = 7; // (0x7) - Operation is resuming from a low-power state.This message is sent after PBT_APMRESUMEAUTOMATIC if the resume is triggered by user input, such as pressing a key.
|
|
||||||
private const int PBT_APMSUSPEND = 4; // (0x4) - System is suspending operation.
|
|
||||||
private const int PBT_POWERSETTINGCHANGE = 32787; // (0x8013) - A power setting change event has been received.
|
|
||||||
private const int DEVICE_NOTIFY_CALLBACK = 2;
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
struct DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS
|
|
||||||
{
|
|
||||||
public DeviceNotifyCallbackRoutine Callback;
|
|
||||||
public IntPtr Context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate int DeviceNotifyCallbackRoutine(IntPtr context, int type, IntPtr setting);
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
public static NotifyIcon trayIcon = new NotifyIcon
|
public static NotifyIcon trayIcon = new NotifyIcon
|
||||||
{
|
{
|
||||||
Text = "G-Helper",
|
Text = "G-Helper",
|
||||||
@@ -112,20 +103,6 @@ namespace GHelper
|
|||||||
SetAutoModes();
|
SetAutoModes();
|
||||||
HardwareMonitor.RecreateGpuTemperatureProvider();
|
HardwareMonitor.RecreateGpuTemperatureProvider();
|
||||||
|
|
||||||
// Subscribing for native power change events
|
|
||||||
|
|
||||||
/*
|
|
||||||
IntPtr registrationHandle = new IntPtr();
|
|
||||||
DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS recipient = new DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS();
|
|
||||||
recipient.Callback = new DeviceNotifyCallbackRoutine(DeviceNotifyCallback);
|
|
||||||
recipient.Context = IntPtr.Zero;
|
|
||||||
|
|
||||||
IntPtr pRecipient = Marshal.AllocHGlobal(Marshal.SizeOf(recipient));
|
|
||||||
Marshal.StructureToPtr(recipient, pRecipient, false);
|
|
||||||
|
|
||||||
uint result = PowerRegisterSuspendResumeNotification(DEVICE_NOTIFY_CALLBACK, ref recipient, ref registrationHandle);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Subscribing for monitor power on events
|
// Subscribing for monitor power on events
|
||||||
var settingGuid = new NativeMethods.PowerSettingGuid();
|
var settingGuid = new NativeMethods.PowerSettingGuid();
|
||||||
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(ds, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
|
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(ds, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||||
@@ -133,29 +110,11 @@ namespace GHelper
|
|||||||
// Subscribing for system power change events
|
// Subscribing for system power change events
|
||||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||||
|
|
||||||
|
|
||||||
CheckForUpdates();
|
CheckForUpdates();
|
||||||
Application.Run();
|
Application.Run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int DeviceNotifyCallback(IntPtr context, int type, IntPtr setting)
|
|
||||||
{
|
|
||||||
Logger.WriteLine($"Power callback {type}");
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case PBT_APMRESUMEAUTOMATIC:
|
|
||||||
settingsForm.BeginInvoke(delegate
|
|
||||||
{
|
|
||||||
SetAutoModes();
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static async void CheckForUpdates()
|
static async void CheckForUpdates()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -204,7 +163,9 @@ namespace GHelper
|
|||||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||||
|
|
||||||
settingsForm.AutoPerformance(isPlugged);
|
settingsForm.AutoPerformance(isPlugged);
|
||||||
settingsForm.AutoGPUMode(isPlugged);
|
|
||||||
|
bool switched = settingsForm.AutoGPUMode(isPlugged);
|
||||||
|
if (!switched) settingsForm.AutoScreen(isPlugged);
|
||||||
|
|
||||||
settingsForm.SetMatrix(isPlugged);
|
settingsForm.SetMatrix(isPlugged);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# G-Helper / GHelper for Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
|
# G-Helper / GHelper
|
||||||
|
|
||||||
|
## Open source Armory Crate alternative for Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
|
||||||
|
|
||||||
A small utility that allows you do almost everyting you could do with Armory Crate but without extra bloat and unnecessary services.
|
A small utility that allows you do almost everyting you could do with Armory Crate but without extra bloat and unnecessary services.
|
||||||
|
|
||||||
@@ -14,7 +16,7 @@ A small utility that allows you do almost everyting you could do with Armory Cra
|
|||||||
## Main features
|
## Main features
|
||||||
|
|
||||||
1. Switch between built-in system **Performance modes** Silent / Balanced / Turbo and apply default fan curves
|
1. Switch between built-in system **Performance modes** Silent / Balanced / Turbo and apply default fan curves
|
||||||
2. Switch between Eco / Standard or Ultimate **GPU modes**
|
2. Seamless (!) switch between Eco / Standard or Ultimate **GPU modes**
|
||||||
3. Change laptop screen refresh rate - 60hz or your maximum (120hz, 144hz, etc depending on the model) with display overdrive (OD)
|
3. Change laptop screen refresh rate - 60hz or your maximum (120hz, 144hz, etc depending on the model) with display overdrive (OD)
|
||||||
4. View default fan profiles for every mode and **auto apply** custom ones
|
4. View default fan profiles for every mode and **auto apply** custom ones
|
||||||
5. Control keyboard backlit animation and colors
|
5. Control keyboard backlit animation and colors
|
||||||
|
|||||||
24
Settings.Designer.cs
generated
24
Settings.Designer.cs
generated
@@ -193,7 +193,7 @@
|
|||||||
//
|
//
|
||||||
pictureMatrix.BackgroundImage = Properties.Resources.icons8_matrix_desktop_48;
|
pictureMatrix.BackgroundImage = Properties.Resources.icons8_matrix_desktop_48;
|
||||||
pictureMatrix.BackgroundImageLayout = ImageLayout.Zoom;
|
pictureMatrix.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
pictureMatrix.Location = new Point(29, 10);
|
pictureMatrix.Location = new Point(25, 10);
|
||||||
pictureMatrix.Margin = new Padding(4, 2, 4, 2);
|
pictureMatrix.Margin = new Padding(4, 2, 4, 2);
|
||||||
pictureMatrix.Name = "pictureMatrix";
|
pictureMatrix.Name = "pictureMatrix";
|
||||||
pictureMatrix.Size = new Size(36, 36);
|
pictureMatrix.Size = new Size(36, 36);
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
//
|
//
|
||||||
labelMatrix.AutoSize = true;
|
labelMatrix.AutoSize = true;
|
||||||
labelMatrix.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelMatrix.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelMatrix.Location = new Point(68, 12);
|
labelMatrix.Location = new Point(64, 12);
|
||||||
labelMatrix.Margin = new Padding(4, 0, 4, 0);
|
labelMatrix.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelMatrix.Name = "labelMatrix";
|
labelMatrix.Name = "labelMatrix";
|
||||||
labelMatrix.Size = new Size(170, 32);
|
labelMatrix.Size = new Size(170, 32);
|
||||||
@@ -252,7 +252,7 @@
|
|||||||
//
|
//
|
||||||
pictureBattery.BackgroundImage = (Image)resources.GetObject("pictureBattery.BackgroundImage");
|
pictureBattery.BackgroundImage = (Image)resources.GetObject("pictureBattery.BackgroundImage");
|
||||||
pictureBattery.BackgroundImageLayout = ImageLayout.Zoom;
|
pictureBattery.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
pictureBattery.Location = new Point(29, 10);
|
pictureBattery.Location = new Point(25, 10);
|
||||||
pictureBattery.Margin = new Padding(4, 2, 4, 2);
|
pictureBattery.Margin = new Padding(4, 2, 4, 2);
|
||||||
pictureBattery.Name = "pictureBattery";
|
pictureBattery.Name = "pictureBattery";
|
||||||
pictureBattery.Size = new Size(36, 38);
|
pictureBattery.Size = new Size(36, 38);
|
||||||
@@ -262,7 +262,7 @@
|
|||||||
// labelBatteryTitle
|
// labelBatteryTitle
|
||||||
//
|
//
|
||||||
labelBatteryTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelBatteryTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelBatteryTitle.Location = new Point(70, 12);
|
labelBatteryTitle.Location = new Point(66, 12);
|
||||||
labelBatteryTitle.Margin = new Padding(4, 0, 4, 0);
|
labelBatteryTitle.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelBatteryTitle.Name = "labelBatteryTitle";
|
labelBatteryTitle.Name = "labelBatteryTitle";
|
||||||
labelBatteryTitle.Size = new Size(408, 36);
|
labelBatteryTitle.Size = new Size(408, 36);
|
||||||
@@ -351,7 +351,7 @@
|
|||||||
picturePerf.BackgroundImage = (Image)resources.GetObject("picturePerf.BackgroundImage");
|
picturePerf.BackgroundImage = (Image)resources.GetObject("picturePerf.BackgroundImage");
|
||||||
picturePerf.BackgroundImageLayout = ImageLayout.Zoom;
|
picturePerf.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
picturePerf.InitialImage = null;
|
picturePerf.InitialImage = null;
|
||||||
picturePerf.Location = new Point(29, 10);
|
picturePerf.Location = new Point(25, 10);
|
||||||
picturePerf.Margin = new Padding(4, 2, 4, 2);
|
picturePerf.Margin = new Padding(4, 2, 4, 2);
|
||||||
picturePerf.Name = "picturePerf";
|
picturePerf.Name = "picturePerf";
|
||||||
picturePerf.Size = new Size(36, 38);
|
picturePerf.Size = new Size(36, 38);
|
||||||
@@ -362,7 +362,7 @@
|
|||||||
//
|
//
|
||||||
labelPerf.AutoSize = true;
|
labelPerf.AutoSize = true;
|
||||||
labelPerf.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelPerf.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelPerf.Location = new Point(68, 12);
|
labelPerf.Location = new Point(64, 12);
|
||||||
labelPerf.Margin = new Padding(4, 0, 4, 0);
|
labelPerf.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelPerf.Name = "labelPerf";
|
labelPerf.Name = "labelPerf";
|
||||||
labelPerf.Size = new Size(234, 32);
|
labelPerf.Size = new Size(234, 32);
|
||||||
@@ -476,7 +476,7 @@
|
|||||||
//
|
//
|
||||||
pictureGPU.BackgroundImage = (Image)resources.GetObject("pictureGPU.BackgroundImage");
|
pictureGPU.BackgroundImage = (Image)resources.GetObject("pictureGPU.BackgroundImage");
|
||||||
pictureGPU.BackgroundImageLayout = ImageLayout.Zoom;
|
pictureGPU.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
pictureGPU.Location = new Point(29, 10);
|
pictureGPU.Location = new Point(25, 10);
|
||||||
pictureGPU.Margin = new Padding(4, 2, 4, 2);
|
pictureGPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
pictureGPU.Name = "pictureGPU";
|
pictureGPU.Name = "pictureGPU";
|
||||||
pictureGPU.Size = new Size(36, 38);
|
pictureGPU.Size = new Size(36, 38);
|
||||||
@@ -487,7 +487,7 @@
|
|||||||
//
|
//
|
||||||
labelGPU.AutoSize = true;
|
labelGPU.AutoSize = true;
|
||||||
labelGPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelGPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelGPU.Location = new Point(70, 12);
|
labelGPU.Location = new Point(66, 12);
|
||||||
labelGPU.Margin = new Padding(4, 0, 4, 0);
|
labelGPU.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelGPU.Name = "labelGPU";
|
labelGPU.Name = "labelGPU";
|
||||||
labelGPU.Size = new Size(136, 32);
|
labelGPU.Size = new Size(136, 32);
|
||||||
@@ -648,7 +648,7 @@
|
|||||||
//
|
//
|
||||||
pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage");
|
pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage");
|
||||||
pictureScreen.BackgroundImageLayout = ImageLayout.Zoom;
|
pictureScreen.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
pictureScreen.Location = new Point(29, 8);
|
pictureScreen.Location = new Point(25, 8);
|
||||||
pictureScreen.Margin = new Padding(4, 2, 4, 2);
|
pictureScreen.Margin = new Padding(4, 2, 4, 2);
|
||||||
pictureScreen.Name = "pictureScreen";
|
pictureScreen.Name = "pictureScreen";
|
||||||
pictureScreen.Size = new Size(36, 38);
|
pictureScreen.Size = new Size(36, 38);
|
||||||
@@ -659,7 +659,7 @@
|
|||||||
//
|
//
|
||||||
labelSreen.AutoSize = true;
|
labelSreen.AutoSize = true;
|
||||||
labelSreen.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelSreen.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelSreen.Location = new Point(72, 10);
|
labelSreen.Location = new Point(68, 10);
|
||||||
labelSreen.Margin = new Padding(4, 0, 4, 0);
|
labelSreen.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelSreen.Name = "labelSreen";
|
labelSreen.Name = "labelSreen";
|
||||||
labelSreen.Size = new Size(176, 32);
|
labelSreen.Size = new Size(176, 32);
|
||||||
@@ -774,7 +774,7 @@
|
|||||||
//
|
//
|
||||||
pictureKeyboard.BackgroundImage = Properties.Resources.icons8_keyboard_48;
|
pictureKeyboard.BackgroundImage = Properties.Resources.icons8_keyboard_48;
|
||||||
pictureKeyboard.BackgroundImageLayout = ImageLayout.Zoom;
|
pictureKeyboard.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
pictureKeyboard.Location = new Point(29, 16);
|
pictureKeyboard.Location = new Point(25, 16);
|
||||||
pictureKeyboard.Margin = new Padding(4, 2, 4, 2);
|
pictureKeyboard.Margin = new Padding(4, 2, 4, 2);
|
||||||
pictureKeyboard.Name = "pictureKeyboard";
|
pictureKeyboard.Name = "pictureKeyboard";
|
||||||
pictureKeyboard.Size = new Size(36, 36);
|
pictureKeyboard.Size = new Size(36, 36);
|
||||||
@@ -785,7 +785,7 @@
|
|||||||
//
|
//
|
||||||
label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
label1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
label1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
label1.Location = new Point(72, 16);
|
label1.Location = new Point(68, 16);
|
||||||
label1.Margin = new Padding(4, 0, 4, 0);
|
label1.Margin = new Padding(4, 0, 4, 0);
|
||||||
label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
label1.Size = new Size(210, 32);
|
label1.Size = new Size(210, 32);
|
||||||
|
|||||||
34
Settings.cs
34
Settings.cs
@@ -741,9 +741,11 @@ namespace GHelper
|
|||||||
if (limit_cpu > ASUSWmi.MaxCPU) return;
|
if (limit_cpu > ASUSWmi.MaxCPU) return;
|
||||||
if (limit_cpu < ASUSWmi.MinCPU) return;
|
if (limit_cpu < ASUSWmi.MinCPU) return;
|
||||||
|
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total);
|
if (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0)
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total);
|
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total);
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
|
|
||||||
|
if (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0)
|
||||||
|
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
|
||||||
|
|
||||||
Logger.WriteLine("PowerLimits " + limit_total.ToString() + ", " + limit_cpu.ToString());
|
Logger.WriteLine("PowerLimits " + limit_total.ToString() + ", " + limit_cpu.ToString());
|
||||||
|
|
||||||
@@ -819,6 +821,13 @@ namespace GHelper
|
|||||||
|
|
||||||
AutoFansAndPower();
|
AutoFansAndPower();
|
||||||
|
|
||||||
|
NativeMethods.SetPowerScheme(PerformanceMode);
|
||||||
|
|
||||||
|
if (NativeMethods.PowerGetEffectiveOverlayScheme(out Guid activeScheme) == 0)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Effective :" + activeScheme);
|
||||||
|
}
|
||||||
|
|
||||||
if (fans != null && fans.Text != "")
|
if (fans != null && fans.Text != "")
|
||||||
{
|
{
|
||||||
fans.InitFans();
|
fans.InitFans();
|
||||||
@@ -858,33 +867,33 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AutoGPUMode(PowerLineStatus Plugged = PowerLineStatus.Online)
|
public bool AutoGPUMode(PowerLineStatus Plugged = PowerLineStatus.Online)
|
||||||
{
|
{
|
||||||
|
|
||||||
int GpuAuto = Program.config.getConfig("gpu_auto");
|
int GpuAuto = Program.config.getConfig("gpu_auto");
|
||||||
if (GpuAuto != 1) return;
|
if (GpuAuto != 1) return false;
|
||||||
|
|
||||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||||
|
|
||||||
if (mux == 0) // GPU in Ultimate, ignore
|
if (mux == 0) // GPU in Ultimate, ignore
|
||||||
return;
|
return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (eco == 1 && Plugged == PowerLineStatus.Online) // Eco going Standard on plugged
|
if (eco == 1 && Plugged == PowerLineStatus.Online) // Eco going Standard on plugged
|
||||||
{
|
{
|
||||||
SetEcoGPU(0);
|
SetEcoGPU(0);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (eco == 0 && Plugged != PowerLineStatus.Online) // Standard going Eco on plugged
|
else if (eco == 0 && Plugged != PowerLineStatus.Online) // Standard going Eco on plugged
|
||||||
{
|
{
|
||||||
SetEcoGPU(1);
|
SetEcoGPU(1);
|
||||||
}
|
return true;
|
||||||
else
|
|
||||||
{
|
|
||||||
AutoScreen(Plugged);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int InitGPUMode()
|
public int InitGPUMode()
|
||||||
@@ -988,9 +997,10 @@ namespace GHelper
|
|||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed)
|
||||||
|
{
|
||||||
Program.config.setConfig("gpu_mode", GPUMode);
|
Program.config.setConfig("gpu_mode", GPUMode);
|
||||||
|
|
||||||
HardwareMonitor.RecreateGpuTemperatureProviderWithRetry();
|
HardwareMonitor.RecreateGpuTemperatureProviderWithRetry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 3.4 MiB |
Reference in New Issue
Block a user