mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Force GPU mode
This commit is contained in:
@@ -67,7 +67,6 @@ namespace GHelper
|
||||
|
||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||
|
||||
settingsForm.InitGPUMode();
|
||||
settingsForm.InitAura();
|
||||
settingsForm.InitMatrix();
|
||||
|
||||
@@ -79,6 +78,10 @@ namespace GHelper
|
||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||
|
||||
// Subscribing for monitor power on events
|
||||
var settingGuid = new NativeMethods.PowerSettingGuid();
|
||||
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(ds, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||
|
||||
|
||||
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
|
||||
{
|
||||
@@ -129,7 +132,12 @@ namespace GHelper
|
||||
settingsForm.AutoPerformance();
|
||||
|
||||
bool switched = settingsForm.AutoGPUMode();
|
||||
if (!switched) settingsForm.AutoScreen();
|
||||
|
||||
if (!switched)
|
||||
{
|
||||
settingsForm.InitGPUMode();
|
||||
settingsForm.AutoScreen();
|
||||
}
|
||||
|
||||
settingsForm.AutoKeyboard();
|
||||
settingsForm.SetMatrix();
|
||||
|
||||
@@ -120,10 +120,6 @@ namespace GHelper
|
||||
aTimer = new System.Timers.Timer(1000);
|
||||
aTimer.Elapsed += OnTimedEvent;
|
||||
|
||||
// Subscribing for monitor power on events
|
||||
var settingGuid = new NativeMethods.PowerSettingGuid();
|
||||
Program.unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(Handle, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||
|
||||
SetVersionLabel("Version: " + Assembly.GetExecutingAssembly().GetName().Version);
|
||||
|
||||
string model = Program.config.GetModel();
|
||||
@@ -1049,7 +1045,11 @@ namespace GHelper
|
||||
var Plugged = SystemInformation.PowerStatus.PowerLineStatus;
|
||||
|
||||
bool GpuAuto = Program.config.getConfig("gpu_auto") == 1;
|
||||
if (!GpuAuto) return false;
|
||||
bool ForceGPU = Program.config.ContainsModel("503");
|
||||
|
||||
int GpuMode = Program.config.getConfig("gpu_mode");
|
||||
|
||||
if (!GpuAuto && !ForceGPU) return false;
|
||||
|
||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
@@ -1058,16 +1058,18 @@ namespace GHelper
|
||||
return false;
|
||||
else
|
||||
{
|
||||
if (eco == 1 && Plugged == PowerLineStatus.Online) // Eco going Standard on plugged
|
||||
{
|
||||
SetEcoGPU(0);
|
||||
return true;
|
||||
}
|
||||
else if (eco == 0 && Plugged != PowerLineStatus.Online) // Standard going Eco on plugged
|
||||
{
|
||||
SetEcoGPU(1);
|
||||
return true;
|
||||
}
|
||||
if (eco == 1)
|
||||
if ((GpuAuto && Plugged == PowerLineStatus.Online) || (ForceGPU && GpuMode == ASUSWmi.GPUModeStandard))
|
||||
{
|
||||
SetEcoGPU(0);
|
||||
return true;
|
||||
}
|
||||
if (eco == 0)
|
||||
if ((GpuAuto && Plugged != PowerLineStatus.Online) || (ForceGPU && GpuMode == ASUSWmi.GPUModeEco))
|
||||
{
|
||||
SetEcoGPU(1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1096,8 +1098,8 @@ namespace GHelper
|
||||
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||
|
||||
//Logger.WriteLine("Eco flag : " + eco);
|
||||
//Logger.WriteLine("Mux flag : " + mux);
|
||||
Logger.WriteLine("Eco flag : " + eco);
|
||||
Logger.WriteLine("Mux flag : " + mux);
|
||||
|
||||
int GpuMode;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user