Version bump

This commit is contained in:
Serge
2024-03-07 11:28:21 +01:00
parent 092ecc7ede
commit d77acfd97a
8 changed files with 38 additions and 34 deletions

View File

@@ -1,16 +1,15 @@
using GHelper.Helpers; using GHelper.Helpers;
using System.Runtime.InteropServices;
namespace GHelper.Display namespace GHelper.Display
{ {
public class ScreenControl public static class ScreenControl
{ {
public const int MAX_REFRESH = 1000; public const int MAX_REFRESH = 1000;
public static DisplayGammaRamp? gammaRamp; public static DisplayGammaRamp? gammaRamp;
public void AutoScreen(bool force = false) public static void AutoScreen(bool force = false)
{ {
if (force || AppConfig.Is("screen_auto")) if (force || AppConfig.Is("screen_auto"))
{ {
@@ -25,7 +24,7 @@ namespace GHelper.Display
} }
} }
public int SetBrightness(int brightness = -1, int delta = 0) public static int SetBrightness(int brightness = -1, int delta = 0)
{ {
if (!AppConfig.IsOLED()) return -1; if (!AppConfig.IsOLED()) return -1;
@@ -36,10 +35,19 @@ namespace GHelper.Display
Task.Run(() => Task.Run(() =>
{ {
bool isGameVisual = System.IO.Directory.Exists("C:\\ProgramData\\ASUS\\GameVisual") ;
var splendid = Environment.SystemDirectory + "\\DriverStore\\FileRepository\\asussci2.inf_amd64_f2eed2fae3b45a67\\ASUSOptimization\\AsusSplendid.exe"; var splendid = Environment.SystemDirectory + "\\DriverStore\\FileRepository\\asussci2.inf_amd64_f2eed2fae3b45a67\\ASUSOptimization\\AsusSplendid.exe";
var result = ProcessHelper.RunCMD(splendid, (isGameVisual ? 19 : 9) + " 0 " + (40 + brightness * 0.6));
if (result.Contains("file not exist")) SetGamma(brightness); bool isSplenddid = File.Exists(splendid);
bool isGameVisual = Directory.Exists("C:\\ProgramData\\ASUS\\GameVisual");
if (isSplenddid)
{
var result = ProcessHelper.RunCMD(splendid, (isGameVisual ? 19 : 9) + " 0 " + (40 + brightness * 0.6));
if (!result.Contains("file not exist")) return;
}
// GammaRamp Fallback
SetGamma(brightness);
}); });
Program.settingsForm.VisualiseBrightness(); Program.settingsForm.VisualiseBrightness();
@@ -49,7 +57,7 @@ namespace GHelper.Display
public void SetGamma(int brightness = 100) public static void SetGamma(int brightness = 100)
{ {
var bright = Math.Round((float)brightness / 200 + 0.5, 2); var bright = Math.Round((float)brightness / 200 + 0.5, 2);
@@ -80,9 +88,10 @@ namespace GHelper.Display
var ramp = gammaRamp.AsBrightnessRamp(bright); var ramp = gammaRamp.AsBrightnessRamp(bright);
bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp); bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp);
Logger.WriteLine("Brightness " + bright.ToString() + ": " + result); Logger.WriteLine("Gamma " + bright.ToString() + ": " + result);
} catch (Exception ex) }
catch (Exception ex)
{ {
Logger.WriteLine(ex.ToString()); Logger.WriteLine(ex.ToString());
} }
@@ -90,7 +99,7 @@ namespace GHelper.Display
//ScreenBrightness.Set(60 + (int)(40 * bright)); //ScreenBrightness.Set(60 + (int)(40 * bright));
} }
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1) public static void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
{ {
var laptopScreen = ScreenNative.FindLaptopScreen(true); var laptopScreen = ScreenNative.FindLaptopScreen(true);
@@ -127,7 +136,7 @@ namespace GHelper.Display
} }
public int ToogleMiniled() public static int ToogleMiniled()
{ {
int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1); int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1);
int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2); int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2);
@@ -155,7 +164,7 @@ namespace GHelper.Display
return miniled; return miniled;
} }
public void InitScreen() public static void InitScreen()
{ {
var laptopScreen = ScreenNative.FindLaptopScreen(); var laptopScreen = ScreenNative.FindLaptopScreen();

View File

@@ -12,7 +12,6 @@ namespace GHelper
public partial class Extra : RForm public partial class Extra : RForm
{ {
ScreenControl screenControl = new ScreenControl();
ClamshellModeControl clamshellControl = new ClamshellModeControl(); ClamshellModeControl clamshellControl = new ClamshellModeControl();
const string EMPTY = "--------------"; const string EMPTY = "--------------";
@@ -679,7 +678,7 @@ namespace GHelper
private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e) private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e)
{ {
AppConfig.Set("no_overdrive", (checkNoOverdrive.Checked ? 1 : 0)); AppConfig.Set("no_overdrive", (checkNoOverdrive.Checked ? 1 : 0));
screenControl.AutoScreen(true); ScreenControl.AutoScreen(true);
} }

View File

@@ -15,7 +15,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.156</AssemblyVersion> <AssemblyVersion>0.157</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -9,7 +9,6 @@ namespace GHelper.Gpu
public class GPUModeControl public class GPUModeControl
{ {
SettingsForm settings; SettingsForm settings;
ScreenControl screenControl = new ScreenControl();
public static int gpuMode; public static int gpuMode;
public static bool? gpuExists = null; public static bool? gpuExists = null;
@@ -159,7 +158,7 @@ namespace GHelper.Gpu
settings.Invoke(delegate settings.Invoke(delegate
{ {
InitGPUMode(); InitGPUMode();
screenControl.AutoScreen(); ScreenControl.AutoScreen();
}); });
if (eco == 0) if (eco == 0)

View File

@@ -99,7 +99,7 @@ namespace GHelper.Helpers
ToggleLidAction(); ToggleLidAction();
if (Program.settingsForm.Visible) if (Program.settingsForm.Visible)
Program.screenControl.InitScreen(); ScreenControl.InitScreen();
} }

View File

@@ -19,8 +19,7 @@ namespace GHelper.Input
public static Keys keyApp = Keys.F12; public static Keys keyApp = Keys.F12;
static ModeControl modeControl = Program.modeControl; static ModeControl modeControl = Program.modeControl;
static ScreenControl screenControl = new ScreenControl();
static bool isTUF = AppConfig.IsTUF(); static bool isTUF = AppConfig.IsTUF();
KeyboardListener listener; KeyboardListener listener;
@@ -246,7 +245,7 @@ namespace GHelper.Input
static void SetBrightnessDimming(int delta) static void SetBrightnessDimming(int delta)
{ {
int brightness = screenControl.SetBrightness(delta: delta); int brightness = ScreenControl.SetBrightness(delta: delta);
if (brightness >= 0) if (brightness >= 0)
Program.toast.RunToast(brightness + "%", (delta < 0) ? ToastIcon.BrightnessDown : ToastIcon.BrightnessUp); Program.toast.RunToast(brightness + "%", (delta < 0) ? ToastIcon.BrightnessDown : ToastIcon.BrightnessUp);
} }
@@ -479,7 +478,7 @@ namespace GHelper.Input
break; break;
case "miniled": case "miniled":
if (ScreenCCD.GetHDRStatus()) return; if (ScreenCCD.GetHDRStatus()) return;
int miniled = screenControl.ToogleMiniled(); int miniled = ScreenControl.ToogleMiniled();
Program.toast.RunToast(miniled == 1 ? "Multi-Zone" : "Single-Zone", miniled == 1 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); Program.toast.RunToast(miniled == 1 ? "Multi-Zone" : "Single-Zone", miniled == 1 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
break; break;
case "aura": case "aura":

View File

@@ -32,7 +32,6 @@ namespace GHelper
public static ModeControl modeControl = new ModeControl(); public static ModeControl modeControl = new ModeControl();
public static GPUModeControl gpuControl = new GPUModeControl(settingsForm); public static GPUModeControl gpuControl = new GPUModeControl(settingsForm);
public static AllyControl allyControl = new AllyControl(settingsForm); public static AllyControl allyControl = new AllyControl(settingsForm);
public static ScreenControl screenControl = new ScreenControl();
public static ClamshellModeControl clamshellControl = new ClamshellModeControl(); public static ClamshellModeControl clamshellControl = new ClamshellModeControl();
public static ToastForm toast = new ToastForm(); public static ToastForm toast = new ToastForm();
@@ -166,7 +165,7 @@ namespace GHelper
if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock) if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock)
{ {
Logger.WriteLine("Session:" + e.Reason.ToString()); Logger.WriteLine("Session:" + e.Reason.ToString());
screenControl.AutoScreen(); ScreenControl.AutoScreen();
} }
} }
@@ -224,7 +223,7 @@ namespace GHelper
if (!switched) if (!switched)
{ {
gpuControl.InitGPUMode(); gpuControl.InitGPUMode();
screenControl.AutoScreen(); ScreenControl.AutoScreen();
} }
BatteryControl.AutoBattery(init); BatteryControl.AutoBattery(init);

View File

@@ -24,7 +24,6 @@ namespace GHelper
public GPUModeControl gpuControl; public GPUModeControl gpuControl;
public AllyControl allyControl; public AllyControl allyControl;
ScreenControl screenControl = new ScreenControl();
AutoUpdateControl updateControl; AutoUpdateControl updateControl;
AsusMouseSettings? mouseSettings; AsusMouseSettings? mouseSettings;
@@ -266,7 +265,7 @@ namespace GHelper
VisualiseBrightness(); VisualiseBrightness();
sliderGamma.ValueChanged += SliderGamma_ValueChanged; sliderGamma.ValueChanged += SliderGamma_ValueChanged;
sliderGamma.MouseUp += SliderGamma_ValueChanged; //sliderGamma.MouseUp += SliderGamma_ValueChanged;
} }
public void VisualiseBrightness() public void VisualiseBrightness()
@@ -280,7 +279,7 @@ namespace GHelper
private void SliderGamma_ValueChanged(object? sender, EventArgs e) private void SliderGamma_ValueChanged(object? sender, EventArgs e)
{ {
screenControl.SetBrightness(sliderGamma.Value); ScreenControl.SetBrightness(sliderGamma.Value);
} }
private void ButtonOverlay_Click(object? sender, EventArgs e) private void ButtonOverlay_Click(object? sender, EventArgs e)
@@ -422,7 +421,7 @@ namespace GHelper
sensorTimer.Enabled = this.Visible; sensorTimer.Enabled = this.Visible;
if (this.Visible) if (this.Visible)
{ {
screenControl.InitScreen(); ScreenControl.InitScreen();
VisualizeXGM(); VisualizeXGM();
Task.Run((Action)RefreshPeripheralsBattery); Task.Run((Action)RefreshPeripheralsBattery);
@@ -701,7 +700,7 @@ namespace GHelper
private void ButtonScreenAuto_Click(object? sender, EventArgs e) private void ButtonScreenAuto_Click(object? sender, EventArgs e)
{ {
AppConfig.Set("screen_auto", 1); AppConfig.Set("screen_auto", 1);
screenControl.AutoScreen(); ScreenControl.AutoScreen();
} }
@@ -1001,19 +1000,19 @@ namespace GHelper
private void Button120Hz_Click(object? sender, EventArgs e) private void Button120Hz_Click(object? sender, EventArgs e)
{ {
AppConfig.Set("screen_auto", 0); AppConfig.Set("screen_auto", 0);
screenControl.SetScreen(ScreenControl.MAX_REFRESH, 1); ScreenControl.SetScreen(ScreenControl.MAX_REFRESH, 1);
} }
private void Button60Hz_Click(object? sender, EventArgs e) private void Button60Hz_Click(object? sender, EventArgs e)
{ {
AppConfig.Set("screen_auto", 0); AppConfig.Set("screen_auto", 0);
screenControl.SetScreen(60, 0); ScreenControl.SetScreen(60, 0);
} }
private void ButtonMiniled_Click(object? sender, EventArgs e) private void ButtonMiniled_Click(object? sender, EventArgs e)
{ {
screenControl.ToogleMiniled(); ScreenControl.ToogleMiniled();
} }