mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
CPU boost per mode
This commit is contained in:
@@ -30,9 +30,9 @@ namespace CustomControls
|
|||||||
return (int)registryValueObject <= 0;
|
return (int)registryValueObject <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitTheme(bool setDPI = true)
|
public bool InitTheme(bool setDPI = true)
|
||||||
{
|
{
|
||||||
bool newDarkTheme = IsDarkTheme();
|
bool newDarkTheme = CheckSystemDarkModeStatus();
|
||||||
bool changed = (darkTheme != newDarkTheme);
|
bool changed = (darkTheme != newDarkTheme);
|
||||||
darkTheme = newDarkTheme;
|
darkTheme = newDarkTheme;
|
||||||
|
|
||||||
@@ -45,6 +45,8 @@ namespace CustomControls
|
|||||||
ControlHelper.Adjust(this, darkTheme, changed);
|
ControlHelper.Adjust(this, darkTheme, changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
app/Fans.cs
10
app/Fans.cs
@@ -146,7 +146,7 @@ namespace GHelper
|
|||||||
InitPower();
|
InitPower();
|
||||||
InitBoost();
|
InitBoost();
|
||||||
|
|
||||||
comboBoost.SelectedIndexChanged += ComboBoost_Changed;
|
comboBoost.SelectedValueChanged += ComboBoost_Changed;
|
||||||
|
|
||||||
Shown += Fans_Shown;
|
Shown += Fans_Shown;
|
||||||
|
|
||||||
@@ -162,9 +162,11 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ComboBoost_Changed(object? sender, EventArgs e)
|
private void ComboBoost_Changed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is null) return;
|
if (Program.config.getConfigPerf("auto_boost") != comboBoost.SelectedIndex)
|
||||||
ComboBox cmb = (ComboBox)sender;
|
{
|
||||||
NativeMethods.SetCPUBoost(cmb.SelectedIndex);
|
NativeMethods.SetCPUBoost(comboBoost.SelectedIndex);
|
||||||
|
Program.config.setConfigPerf("auto_boost", comboBoost.SelectedIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckApplyPower_Click(object? sender, EventArgs e)
|
private void CheckApplyPower_Click(object? sender, EventArgs e)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Xml.Linq;
|
||||||
using static Tools.ScreenInterrogatory;
|
using static Tools.ScreenInterrogatory;
|
||||||
|
|
||||||
namespace Tools
|
namespace Tools
|
||||||
@@ -672,7 +674,6 @@ public class NativeMethods
|
|||||||
|
|
||||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||||
|
|
||||||
/*
|
|
||||||
var hrDC = PowerWriteDCValueIndex(
|
var hrDC = PowerWriteDCValueIndex(
|
||||||
IntPtr.Zero,
|
IntPtr.Zero,
|
||||||
activeSchemeGuid,
|
activeSchemeGuid,
|
||||||
@@ -681,8 +682,8 @@ public class NativeMethods
|
|||||||
boost);
|
boost);
|
||||||
|
|
||||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||||
*/
|
|
||||||
|
|
||||||
|
Logger.WriteLine("Boost " + boost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetPowerScheme(int mode)
|
public static void SetPowerScheme(int mode)
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
@@ -61,13 +59,12 @@ namespace GHelper
|
|||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
|
|
||||||
SystemEvents.UserPreferenceChanged += new
|
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
|
||||||
UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
|
|
||||||
|
|
||||||
var ds = settingsForm.Handle;
|
var ds = settingsForm.Handle;
|
||||||
|
|
||||||
trayIcon.MouseClick += TrayIcon_MouseClick;
|
trayIcon.MouseClick += TrayIcon_MouseClick;
|
||||||
|
|
||||||
|
|
||||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||||
|
|
||||||
|
|||||||
@@ -932,6 +932,10 @@ namespace GHelper
|
|||||||
timer.Start();
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Program.config.getConfigPerf("auto_boost") != -1)
|
||||||
|
{
|
||||||
|
NativeMethods.SetCPUBoost(Program.config.getConfigPerf("auto_boost"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
||||||
@@ -991,6 +995,7 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
fans.InitFans();
|
fans.InitFans();
|
||||||
fans.InitPower();
|
fans.InitPower();
|
||||||
|
fans.InitBoost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user