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);
|
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||||
|
|
||||||
settingsForm.InitGPUMode();
|
|
||||||
settingsForm.InitAura();
|
settingsForm.InitAura();
|
||||||
settingsForm.InitMatrix();
|
settingsForm.InitMatrix();
|
||||||
|
|
||||||
@@ -79,6 +78,10 @@ namespace GHelper
|
|||||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||||
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
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('\\'))
|
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\'))
|
||||||
{
|
{
|
||||||
@@ -129,7 +132,12 @@ namespace GHelper
|
|||||||
settingsForm.AutoPerformance();
|
settingsForm.AutoPerformance();
|
||||||
|
|
||||||
bool switched = settingsForm.AutoGPUMode();
|
bool switched = settingsForm.AutoGPUMode();
|
||||||
if (!switched) settingsForm.AutoScreen();
|
|
||||||
|
if (!switched)
|
||||||
|
{
|
||||||
|
settingsForm.InitGPUMode();
|
||||||
|
settingsForm.AutoScreen();
|
||||||
|
}
|
||||||
|
|
||||||
settingsForm.AutoKeyboard();
|
settingsForm.AutoKeyboard();
|
||||||
settingsForm.SetMatrix();
|
settingsForm.SetMatrix();
|
||||||
|
|||||||
@@ -120,10 +120,6 @@ namespace GHelper
|
|||||||
aTimer = new System.Timers.Timer(1000);
|
aTimer = new System.Timers.Timer(1000);
|
||||||
aTimer.Elapsed += OnTimedEvent;
|
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);
|
SetVersionLabel("Version: " + Assembly.GetExecutingAssembly().GetName().Version);
|
||||||
|
|
||||||
string model = Program.config.GetModel();
|
string model = Program.config.GetModel();
|
||||||
@@ -1049,7 +1045,11 @@ namespace GHelper
|
|||||||
var Plugged = SystemInformation.PowerStatus.PowerLineStatus;
|
var Plugged = SystemInformation.PowerStatus.PowerLineStatus;
|
||||||
|
|
||||||
bool GpuAuto = Program.config.getConfig("gpu_auto") == 1;
|
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 eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
|
||||||
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
|
||||||
@@ -1058,16 +1058,18 @@ namespace GHelper
|
|||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (eco == 1 && Plugged == PowerLineStatus.Online) // Eco going Standard on plugged
|
if (eco == 1)
|
||||||
{
|
if ((GpuAuto && Plugged == PowerLineStatus.Online) || (ForceGPU && GpuMode == ASUSWmi.GPUModeStandard))
|
||||||
SetEcoGPU(0);
|
{
|
||||||
return true;
|
SetEcoGPU(0);
|
||||||
}
|
return true;
|
||||||
else if (eco == 0 && Plugged != PowerLineStatus.Online) // Standard going Eco on plugged
|
}
|
||||||
{
|
if (eco == 0)
|
||||||
SetEcoGPU(1);
|
if ((GpuAuto && Plugged != PowerLineStatus.Online) || (ForceGPU && GpuMode == ASUSWmi.GPUModeEco))
|
||||||
return true;
|
{
|
||||||
}
|
SetEcoGPU(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1096,8 +1098,8 @@ namespace GHelper
|
|||||||
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);
|
||||||
|
|
||||||
//Logger.WriteLine("Eco flag : " + eco);
|
Logger.WriteLine("Eco flag : " + eco);
|
||||||
//Logger.WriteLine("Mux flag : " + mux);
|
Logger.WriteLine("Mux flag : " + mux);
|
||||||
|
|
||||||
int GpuMode;
|
int GpuMode;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user