mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Version bump
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
using GHelper.Helpers;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace GHelper.Display
|
||||
{
|
||||
public class ScreenControl
|
||||
public static class ScreenControl
|
||||
{
|
||||
|
||||
public const int MAX_REFRESH = 1000;
|
||||
|
||||
public static DisplayGammaRamp? gammaRamp;
|
||||
|
||||
public void AutoScreen(bool force = false)
|
||||
public static void AutoScreen(bool force = false)
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -36,10 +35,19 @@ namespace GHelper.Display
|
||||
|
||||
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 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();
|
||||
@@ -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);
|
||||
|
||||
@@ -80,9 +88,10 @@ namespace GHelper.Display
|
||||
var ramp = gammaRamp.AsBrightnessRamp(bright);
|
||||
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());
|
||||
}
|
||||
@@ -90,7 +99,7 @@ namespace GHelper.Display
|
||||
//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);
|
||||
|
||||
@@ -127,7 +136,7 @@ namespace GHelper.Display
|
||||
}
|
||||
|
||||
|
||||
public int ToogleMiniled()
|
||||
public static int ToogleMiniled()
|
||||
{
|
||||
int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1);
|
||||
int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2);
|
||||
@@ -155,7 +164,7 @@ namespace GHelper.Display
|
||||
return miniled;
|
||||
}
|
||||
|
||||
public void InitScreen()
|
||||
public static void InitScreen()
|
||||
{
|
||||
var laptopScreen = ScreenNative.FindLaptopScreen();
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace GHelper
|
||||
public partial class Extra : RForm
|
||||
{
|
||||
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
ClamshellModeControl clamshellControl = new ClamshellModeControl();
|
||||
|
||||
const string EMPTY = "--------------";
|
||||
@@ -679,7 +678,7 @@ namespace GHelper
|
||||
private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("no_overdrive", (checkNoOverdrive.Checked ? 1 : 0));
|
||||
screenControl.AutoScreen(true);
|
||||
ScreenControl.AutoScreen(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.156</AssemblyVersion>
|
||||
<AssemblyVersion>0.157</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace GHelper.Gpu
|
||||
public class GPUModeControl
|
||||
{
|
||||
SettingsForm settings;
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
public static int gpuMode;
|
||||
public static bool? gpuExists = null;
|
||||
@@ -159,7 +158,7 @@ namespace GHelper.Gpu
|
||||
settings.Invoke(delegate
|
||||
{
|
||||
InitGPUMode();
|
||||
screenControl.AutoScreen();
|
||||
ScreenControl.AutoScreen();
|
||||
});
|
||||
|
||||
if (eco == 0)
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace GHelper.Helpers
|
||||
ToggleLidAction();
|
||||
|
||||
if (Program.settingsForm.Visible)
|
||||
Program.screenControl.InitScreen();
|
||||
ScreenControl.InitScreen();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ namespace GHelper.Input
|
||||
public static Keys keyApp = Keys.F12;
|
||||
|
||||
static ModeControl modeControl = Program.modeControl;
|
||||
static ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
|
||||
static bool isTUF = AppConfig.IsTUF();
|
||||
|
||||
KeyboardListener listener;
|
||||
@@ -246,7 +245,7 @@ namespace GHelper.Input
|
||||
|
||||
static void SetBrightnessDimming(int delta)
|
||||
{
|
||||
int brightness = screenControl.SetBrightness(delta: delta);
|
||||
int brightness = ScreenControl.SetBrightness(delta: delta);
|
||||
if (brightness >= 0)
|
||||
Program.toast.RunToast(brightness + "%", (delta < 0) ? ToastIcon.BrightnessDown : ToastIcon.BrightnessUp);
|
||||
}
|
||||
@@ -479,7 +478,7 @@ namespace GHelper.Input
|
||||
break;
|
||||
case "miniled":
|
||||
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);
|
||||
break;
|
||||
case "aura":
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace GHelper
|
||||
public static ModeControl modeControl = new ModeControl();
|
||||
public static GPUModeControl gpuControl = new GPUModeControl(settingsForm);
|
||||
public static AllyControl allyControl = new AllyControl(settingsForm);
|
||||
public static ScreenControl screenControl = new ScreenControl();
|
||||
public static ClamshellModeControl clamshellControl = new ClamshellModeControl();
|
||||
|
||||
public static ToastForm toast = new ToastForm();
|
||||
@@ -166,7 +165,7 @@ namespace GHelper
|
||||
if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock)
|
||||
{
|
||||
Logger.WriteLine("Session:" + e.Reason.ToString());
|
||||
screenControl.AutoScreen();
|
||||
ScreenControl.AutoScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +223,7 @@ namespace GHelper
|
||||
if (!switched)
|
||||
{
|
||||
gpuControl.InitGPUMode();
|
||||
screenControl.AutoScreen();
|
||||
ScreenControl.AutoScreen();
|
||||
}
|
||||
|
||||
BatteryControl.AutoBattery(init);
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace GHelper
|
||||
|
||||
public GPUModeControl gpuControl;
|
||||
public AllyControl allyControl;
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
AutoUpdateControl updateControl;
|
||||
|
||||
AsusMouseSettings? mouseSettings;
|
||||
@@ -266,7 +265,7 @@ namespace GHelper
|
||||
VisualiseBrightness();
|
||||
|
||||
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
|
||||
sliderGamma.MouseUp += SliderGamma_ValueChanged;
|
||||
//sliderGamma.MouseUp += SliderGamma_ValueChanged;
|
||||
}
|
||||
|
||||
public void VisualiseBrightness()
|
||||
@@ -280,7 +279,7 @@ namespace GHelper
|
||||
|
||||
private void SliderGamma_ValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
screenControl.SetBrightness(sliderGamma.Value);
|
||||
ScreenControl.SetBrightness(sliderGamma.Value);
|
||||
}
|
||||
|
||||
private void ButtonOverlay_Click(object? sender, EventArgs e)
|
||||
@@ -422,7 +421,7 @@ namespace GHelper
|
||||
sensorTimer.Enabled = this.Visible;
|
||||
if (this.Visible)
|
||||
{
|
||||
screenControl.InitScreen();
|
||||
ScreenControl.InitScreen();
|
||||
VisualizeXGM();
|
||||
|
||||
Task.Run((Action)RefreshPeripheralsBattery);
|
||||
@@ -701,7 +700,7 @@ namespace GHelper
|
||||
private void ButtonScreenAuto_Click(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("screen_auto", 1);
|
||||
screenControl.AutoScreen();
|
||||
ScreenControl.AutoScreen();
|
||||
}
|
||||
|
||||
|
||||
@@ -1001,19 +1000,19 @@ namespace GHelper
|
||||
private void Button120Hz_Click(object? sender, EventArgs e)
|
||||
{
|
||||
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)
|
||||
{
|
||||
AppConfig.Set("screen_auto", 0);
|
||||
screenControl.SetScreen(60, 0);
|
||||
ScreenControl.SetScreen(60, 0);
|
||||
}
|
||||
|
||||
|
||||
private void ButtonMiniled_Click(object? sender, EventArgs e)
|
||||
{
|
||||
screenControl.ToogleMiniled();
|
||||
ScreenControl.ToogleMiniled();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user