mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
5 Commits
v0.158
...
visual_mod
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
274c773a8b | ||
|
|
93399288bf | ||
|
|
f42b91b408 | ||
|
|
9bf7400f69 | ||
|
|
dff69d48ce |
@@ -539,7 +539,7 @@ public static class AppConfig
|
|||||||
|
|
||||||
public static bool IsAMDLight()
|
public static bool IsAMDLight()
|
||||||
{
|
{
|
||||||
return ContainsModel("GA402X") || ContainsModel("GA403") || ContainsModel("FA507N") || ContainsModel("FA507X") || ContainsModel("FA707N") || ContainsModel("FA707X");
|
return ContainsModel("GA402X") || ContainsModel("GU605") || ContainsModel("GA403") || ContainsModel("FA507N") || ContainsModel("FA507X") || ContainsModel("FA707N") || ContainsModel("FA707X");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsPowerRequired()
|
public static bool IsPowerRequired()
|
||||||
|
|||||||
@@ -1,15 +1,174 @@
|
|||||||
using GHelper.Helpers;
|
using GHelper.Helpers;
|
||||||
|
using GHelper.Mode;
|
||||||
|
using GHelper.USB;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
|
|
||||||
namespace GHelper.Display
|
namespace GHelper.Display
|
||||||
{
|
{
|
||||||
public class ScreenControl
|
public enum SplendidGamut : int
|
||||||
|
{
|
||||||
|
Native = 50,
|
||||||
|
sRGB = 51,
|
||||||
|
DCIP3 = 53,
|
||||||
|
DisplayP3 = 54
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SplendidCommand: int
|
||||||
|
{
|
||||||
|
Init = 10,
|
||||||
|
DimmingAsus = 9,
|
||||||
|
DimmingVisual = 19,
|
||||||
|
GamutMode = 200,
|
||||||
|
|
||||||
|
Default = 11,
|
||||||
|
Racing = 21,
|
||||||
|
Scenery = 22,
|
||||||
|
RTS = 23,
|
||||||
|
FPS = 24,
|
||||||
|
Cinema = 25,
|
||||||
|
Vivid = 13,
|
||||||
|
Eyecare = 17,
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ScreenControl
|
||||||
{
|
{
|
||||||
|
|
||||||
public const int MAX_REFRESH = 1000;
|
public const int MAX_REFRESH = 1000;
|
||||||
|
|
||||||
|
public static DisplayGammaRamp? gammaRamp;
|
||||||
|
|
||||||
public void AutoScreen(bool force = false)
|
private static int _brightness = 100;
|
||||||
|
private static bool _init = true;
|
||||||
|
private static string? _splendidPath = null;
|
||||||
|
|
||||||
|
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(100);
|
||||||
|
|
||||||
|
|
||||||
|
static ScreenControl () {
|
||||||
|
brightnessTimer.Elapsed += BrightnessTimerTimer_Elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Dictionary<SplendidGamut, string> GetGamutModes ()
|
||||||
|
{
|
||||||
|
Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>();
|
||||||
|
|
||||||
|
DirectoryInfo d = new DirectoryInfo("C:\\ProgramData\\ASUS\\GameVisual");
|
||||||
|
FileInfo[] icms = d.GetFiles("*.icm");
|
||||||
|
|
||||||
|
if (icms.Length == 0) return _modes;
|
||||||
|
|
||||||
|
_modes.Add(SplendidGamut.Native, "Gamut - Native");
|
||||||
|
foreach (FileInfo icm in icms)
|
||||||
|
{
|
||||||
|
if (icm.Name.Contains("sRGB")) _modes.Add(SplendidGamut.sRGB, "Gamut - sRGB");
|
||||||
|
if (icm.Name.Contains("DCIP3")) _modes.Add(SplendidGamut.DCIP3, "Gamut - DCIP3");
|
||||||
|
if (icm.Name.Contains("DisplayP3")) _modes.Add(SplendidGamut.DisplayP3, "Gamut - DisplayP3");
|
||||||
|
}
|
||||||
|
return _modes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Dictionary<SplendidCommand, string> GetVisualModes()
|
||||||
|
{
|
||||||
|
return new Dictionary<SplendidCommand, string>
|
||||||
|
{
|
||||||
|
{ SplendidCommand.Default, "Default"},
|
||||||
|
{ SplendidCommand.Racing, "Racing"},
|
||||||
|
{ SplendidCommand.Scenery, "Scenery"},
|
||||||
|
{ SplendidCommand.RTS, "RTS/RPG"},
|
||||||
|
{ SplendidCommand.FPS, "FPS"},
|
||||||
|
{ SplendidCommand.Cinema, "Cinema"},
|
||||||
|
{ SplendidCommand.Vivid, "Vivid" },
|
||||||
|
{ SplendidCommand.Eyecare, "Eyecare"}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetGamut(int mode = 50)
|
||||||
|
{
|
||||||
|
if (RunSplendid(SplendidCommand.GamutMode, 0, mode)) return;
|
||||||
|
|
||||||
|
if (_init)
|
||||||
|
{
|
||||||
|
_init = false;
|
||||||
|
RunSplendid(SplendidCommand.Init);
|
||||||
|
RunSplendid(SplendidCommand.GamutMode, 0, mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = 50)
|
||||||
|
{
|
||||||
|
int balance = mode == SplendidCommand.Eyecare ? 2 : whiteBalance;
|
||||||
|
RunSplendid(mode, 0, balance);
|
||||||
|
|
||||||
|
if (_init)
|
||||||
|
{
|
||||||
|
_init = false;
|
||||||
|
RunSplendid(SplendidCommand.Init);
|
||||||
|
RunSplendid(mode, 0, balance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetSplendidPath()
|
||||||
|
{
|
||||||
|
if (_splendidPath == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_SystemDriver WHERE Name='ATKWMIACPIIO'"))
|
||||||
|
{
|
||||||
|
foreach (var driver in searcher.Get())
|
||||||
|
{
|
||||||
|
string path = driver["PathName"].ToString();
|
||||||
|
_splendidPath = Path.GetDirectoryName(path) + "\\AsusSplendid.exe";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _splendidPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null)
|
||||||
|
{
|
||||||
|
var splendid = GetSplendidPath();
|
||||||
|
bool isGameVisual = Directory.Exists("C:\\ProgramData\\ASUS\\GameVisual");
|
||||||
|
bool isSplenddid = File.Exists(splendid);
|
||||||
|
|
||||||
|
if (isSplenddid)
|
||||||
|
{
|
||||||
|
if (command == SplendidCommand.DimmingVisual && !isGameVisual) command = SplendidCommand.DimmingAsus;
|
||||||
|
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
|
||||||
|
if (result.Contains("file not exist") || (result.Length == 0 && isGameVisual)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void BrightnessTimerTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
brightnessTimer.Stop();
|
||||||
|
|
||||||
|
|
||||||
|
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
|
||||||
|
|
||||||
|
if (_init)
|
||||||
|
{
|
||||||
|
_init = false;
|
||||||
|
RunSplendid(SplendidCommand.Init);
|
||||||
|
RunSplendid(SplendidCommand.Init, 4);
|
||||||
|
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GammaRamp Fallback
|
||||||
|
SetGamma(_brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AutoScreen(bool force = false)
|
||||||
{
|
{
|
||||||
if (force || AppConfig.Is("screen_auto"))
|
if (force || AppConfig.Is("screen_auto"))
|
||||||
{
|
{
|
||||||
@@ -24,8 +183,67 @@ namespace GHelper.Display
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int SetBrightness(int brightness = -1, int delta = 0)
|
||||||
|
{
|
||||||
|
if (!AppConfig.IsOLED()) return -1;
|
||||||
|
|
||||||
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
|
if (brightness < 0) brightness = AppConfig.Get("brightness", 100);
|
||||||
|
|
||||||
|
_brightness = Math.Max(0, Math.Min(100, brightness + delta));
|
||||||
|
AppConfig.Set("brightness", _brightness);
|
||||||
|
|
||||||
|
brightnessTimer.Start();
|
||||||
|
|
||||||
|
Program.settingsForm.VisualiseBrightness();
|
||||||
|
|
||||||
|
return _brightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void SetGamma(int brightness = 100)
|
||||||
|
{
|
||||||
|
var bright = Math.Round((float)brightness / 200 + 0.5, 2);
|
||||||
|
|
||||||
|
var screenName = ScreenNative.FindLaptopScreen();
|
||||||
|
if (screenName is null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var handle = ScreenNative.CreateDC(screenName, screenName, null, IntPtr.Zero);
|
||||||
|
if (gammaRamp is null)
|
||||||
|
{
|
||||||
|
var gammaDump = new GammaRamp();
|
||||||
|
if (ScreenNative.GetDeviceGammaRamp(handle, ref gammaDump))
|
||||||
|
{
|
||||||
|
gammaRamp = new DisplayGammaRamp(gammaDump);
|
||||||
|
//Logger.WriteLine("Gamma R: " + string.Join("-", gammaRamp.Red));
|
||||||
|
//Logger.WriteLine("Gamma G: " + string.Join("-", gammaRamp.Green));
|
||||||
|
//Logger.WriteLine("Gamma B: " + string.Join("-", gammaRamp.Blue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gammaRamp is null || !gammaRamp.IsOriginal())
|
||||||
|
{
|
||||||
|
Logger.WriteLine("Not default Gamma");
|
||||||
|
gammaRamp = new DisplayGammaRamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
var ramp = gammaRamp.AsBrightnessRamp(bright);
|
||||||
|
bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp);
|
||||||
|
|
||||||
|
Logger.WriteLine("Gamma " + bright.ToString() + ": " + result);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WriteLine(ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//ScreenBrightness.Set(60 + (int)(40 * bright));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
|
||||||
{
|
{
|
||||||
var laptopScreen = ScreenNative.FindLaptopScreen(true);
|
var laptopScreen = ScreenNative.FindLaptopScreen(true);
|
||||||
|
|
||||||
@@ -62,7 +280,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);
|
||||||
@@ -90,7 +308,7 @@ namespace GHelper.Display
|
|||||||
return miniled;
|
return miniled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitScreen()
|
public static void InitScreen()
|
||||||
{
|
{
|
||||||
var laptopScreen = ScreenNative.FindLaptopScreen();
|
var laptopScreen = ScreenNative.FindLaptopScreen();
|
||||||
|
|
||||||
|
|||||||
@@ -1,245 +0,0 @@
|
|||||||
using GHelper.Helpers;
|
|
||||||
using System.Management;
|
|
||||||
|
|
||||||
namespace GHelper.Display
|
|
||||||
{
|
|
||||||
public enum SplendidGamut : int
|
|
||||||
{
|
|
||||||
Native = 50,
|
|
||||||
sRGB = 51,
|
|
||||||
DCIP3 = 53,
|
|
||||||
DisplayP3 = 54
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum SplendidCommand : int
|
|
||||||
{
|
|
||||||
Init = 10,
|
|
||||||
DimmingAsus = 9,
|
|
||||||
DimmingVisual = 19,
|
|
||||||
GamutMode = 200,
|
|
||||||
|
|
||||||
Default = 11,
|
|
||||||
Racing = 21,
|
|
||||||
Scenery = 22,
|
|
||||||
RTS = 23,
|
|
||||||
FPS = 24,
|
|
||||||
Cinema = 25,
|
|
||||||
Vivid = 13,
|
|
||||||
Eyecare = 17,
|
|
||||||
}
|
|
||||||
public static class VisualControl
|
|
||||||
{
|
|
||||||
public static DisplayGammaRamp? gammaRamp;
|
|
||||||
|
|
||||||
private static int _brightness = 100;
|
|
||||||
private static bool _init = true;
|
|
||||||
private static string? _splendidPath = null;
|
|
||||||
|
|
||||||
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(100);
|
|
||||||
|
|
||||||
|
|
||||||
static VisualControl()
|
|
||||||
{
|
|
||||||
brightnessTimer.Elapsed += BrightnessTimerTimer_Elapsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetGameVisualPath()
|
|
||||||
{
|
|
||||||
return Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\ASUS\\GameVisual";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dictionary<SplendidGamut, string> GetGamutModes()
|
|
||||||
{
|
|
||||||
Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>();
|
|
||||||
|
|
||||||
string gameVisualPath = GetGameVisualPath();
|
|
||||||
if (!Directory.Exists(gameVisualPath))
|
|
||||||
{
|
|
||||||
Logger.WriteLine(gameVisualPath + "doesn't exit");
|
|
||||||
return _modes;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DirectoryInfo d = new DirectoryInfo(GetGameVisualPath());
|
|
||||||
FileInfo[] icms = d.GetFiles("*.icm");
|
|
||||||
if (icms.Length == 0) return _modes;
|
|
||||||
|
|
||||||
_modes.Add(SplendidGamut.Native, "Gamut: Native");
|
|
||||||
foreach (FileInfo icm in icms)
|
|
||||||
{
|
|
||||||
if (icm.Name.Contains("sRGB")) _modes.Add(SplendidGamut.sRGB, "Gamut: sRGB");
|
|
||||||
if (icm.Name.Contains("DCIP3")) _modes.Add(SplendidGamut.DCIP3, "Gamut: DCIP3");
|
|
||||||
if (icm.Name.Contains("DisplayP3")) _modes.Add(SplendidGamut.DisplayP3, "Gamut: DisplayP3");
|
|
||||||
}
|
|
||||||
return _modes;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return _modes;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dictionary<SplendidCommand, string> GetVisualModes()
|
|
||||||
{
|
|
||||||
return new Dictionary<SplendidCommand, string>
|
|
||||||
{
|
|
||||||
{ SplendidCommand.Default, "Default"},
|
|
||||||
{ SplendidCommand.Racing, "Racing"},
|
|
||||||
{ SplendidCommand.Scenery, "Scenery"},
|
|
||||||
{ SplendidCommand.RTS, "RTS/RPG"},
|
|
||||||
{ SplendidCommand.FPS, "FPS"},
|
|
||||||
{ SplendidCommand.Cinema, "Cinema"},
|
|
||||||
{ SplendidCommand.Vivid, "Vivid" },
|
|
||||||
{ SplendidCommand.Eyecare, "Eyecare"}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetGamut(int mode = 50)
|
|
||||||
{
|
|
||||||
if (RunSplendid(SplendidCommand.GamutMode, 0, mode)) return;
|
|
||||||
|
|
||||||
if (_init)
|
|
||||||
{
|
|
||||||
_init = false;
|
|
||||||
RunSplendid(SplendidCommand.Init);
|
|
||||||
RunSplendid(SplendidCommand.GamutMode, 0, mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = 50)
|
|
||||||
{
|
|
||||||
int balance = mode == SplendidCommand.Eyecare ? 2 : whiteBalance;
|
|
||||||
if (RunSplendid(mode, 0, balance)) return;
|
|
||||||
|
|
||||||
if (_init)
|
|
||||||
{
|
|
||||||
_init = false;
|
|
||||||
RunSplendid(SplendidCommand.Init);
|
|
||||||
RunSplendid(mode, 0, balance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetSplendidPath()
|
|
||||||
{
|
|
||||||
if (_splendidPath == null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_SystemDriver WHERE Name='ATKWMIACPIIO'"))
|
|
||||||
{
|
|
||||||
foreach (var driver in searcher.Get())
|
|
||||||
{
|
|
||||||
string path = driver["PathName"].ToString();
|
|
||||||
_splendidPath = Path.GetDirectoryName(path) + "\\AsusSplendid.exe";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.WriteLine(ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _splendidPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null)
|
|
||||||
{
|
|
||||||
var splendid = GetSplendidPath();
|
|
||||||
bool isGameVisual = Directory.Exists(GetGameVisualPath());
|
|
||||||
bool isSplenddid = File.Exists(splendid);
|
|
||||||
|
|
||||||
if (isSplenddid)
|
|
||||||
{
|
|
||||||
if (command == SplendidCommand.DimmingVisual && !isGameVisual) command = SplendidCommand.DimmingAsus;
|
|
||||||
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
|
|
||||||
if (result.Contains("file not exist") || (result.Length == 0 && isGameVisual)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void BrightnessTimerTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
|
||||||
{
|
|
||||||
brightnessTimer.Stop();
|
|
||||||
|
|
||||||
|
|
||||||
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
|
|
||||||
|
|
||||||
if (_init)
|
|
||||||
{
|
|
||||||
_init = false;
|
|
||||||
RunSplendid(SplendidCommand.Init);
|
|
||||||
RunSplendid(SplendidCommand.Init, 4);
|
|
||||||
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GammaRamp Fallback
|
|
||||||
SetGamma(_brightness);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int SetBrightness(int brightness = -1, int delta = 0)
|
|
||||||
{
|
|
||||||
if (!AppConfig.IsOLED()) return -1;
|
|
||||||
|
|
||||||
if (brightness < 0) brightness = AppConfig.Get("brightness", 100);
|
|
||||||
|
|
||||||
_brightness = Math.Max(0, Math.Min(100, brightness + delta));
|
|
||||||
AppConfig.Set("brightness", _brightness);
|
|
||||||
|
|
||||||
brightnessTimer.Start();
|
|
||||||
|
|
||||||
Program.settingsForm.VisualiseBrightness();
|
|
||||||
|
|
||||||
return _brightness;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void SetGamma(int brightness = 100)
|
|
||||||
{
|
|
||||||
var bright = Math.Round((float)brightness / 200 + 0.5, 2);
|
|
||||||
|
|
||||||
var screenName = ScreenNative.FindLaptopScreen();
|
|
||||||
if (screenName is null) return;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var handle = ScreenNative.CreateDC(screenName, screenName, null, IntPtr.Zero);
|
|
||||||
if (gammaRamp is null)
|
|
||||||
{
|
|
||||||
var gammaDump = new GammaRamp();
|
|
||||||
if (ScreenNative.GetDeviceGammaRamp(handle, ref gammaDump))
|
|
||||||
{
|
|
||||||
gammaRamp = new DisplayGammaRamp(gammaDump);
|
|
||||||
//Logger.WriteLine("Gamma R: " + string.Join("-", gammaRamp.Red));
|
|
||||||
//Logger.WriteLine("Gamma G: " + string.Join("-", gammaRamp.Green));
|
|
||||||
//Logger.WriteLine("Gamma B: " + string.Join("-", gammaRamp.Blue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gammaRamp is null || !gammaRamp.IsOriginal())
|
|
||||||
{
|
|
||||||
Logger.WriteLine("Not default Gamma");
|
|
||||||
gammaRamp = new DisplayGammaRamp();
|
|
||||||
}
|
|
||||||
|
|
||||||
var ramp = gammaRamp.AsBrightnessRamp(bright);
|
|
||||||
bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp);
|
|
||||||
|
|
||||||
Logger.WriteLine("Gamma " + bright.ToString() + ": " + result);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
//ScreenBrightness.Set(60 + (int)(40 * bright));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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 = "--------------";
|
||||||
@@ -684,7 +683,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.158</AssemblyVersion>
|
<AssemblyVersion>0.157</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ namespace GHelper.Helpers
|
|||||||
ToggleLidAction();
|
ToggleLidAction();
|
||||||
|
|
||||||
if (Program.settingsForm.Visible)
|
if (Program.settingsForm.Visible)
|
||||||
Program.screenControl.InitScreen();
|
ScreenControl.InitScreen();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 = VisualControl.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":
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -276,7 +275,7 @@ namespace GHelper
|
|||||||
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
|
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gamuts = VisualControl.GetGamutModes();
|
var gamuts = ScreenControl.GetGamutModes();
|
||||||
if (gamuts.Count < 1) return;
|
if (gamuts.Count < 1) return;
|
||||||
|
|
||||||
if (!dimming) labelGammaTitle.Text = "Visual Mode";
|
if (!dimming) labelGammaTitle.Text = "Visual Mode";
|
||||||
@@ -286,7 +285,7 @@ namespace GHelper
|
|||||||
tableVisual.Visible = true;
|
tableVisual.Visible = true;
|
||||||
|
|
||||||
comboVisual.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboVisual.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboVisual.DataSource = new BindingSource(VisualControl.GetVisualModes(), null);
|
comboVisual.DataSource = new BindingSource(ScreenControl.GetVisualModes(), null);
|
||||||
comboVisual.DisplayMember = "Value";
|
comboVisual.DisplayMember = "Value";
|
||||||
comboVisual.ValueMember = "Key";
|
comboVisual.ValueMember = "Key";
|
||||||
comboVisual.SelectedValue = (SplendidCommand)AppConfig.Get("visual", (int)SplendidCommand.Default);
|
comboVisual.SelectedValue = (SplendidCommand)AppConfig.Get("visual", (int)SplendidCommand.Default);
|
||||||
@@ -310,13 +309,13 @@ namespace GHelper
|
|||||||
private void ComboGamut_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboGamut_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("gamut", (int)comboGamut.SelectedValue);
|
AppConfig.Set("gamut", (int)comboGamut.SelectedValue);
|
||||||
VisualControl.SetGamut((int)comboGamut.SelectedValue);
|
ScreenControl.SetGamut((int)comboGamut.SelectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboVisual_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboVisual_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("visual", (int)comboVisual.SelectedValue);
|
AppConfig.Set("visual", (int)comboVisual.SelectedValue);
|
||||||
VisualControl.SetVisual((SplendidCommand)comboVisual.SelectedValue);
|
ScreenControl.SetVisual((SplendidCommand)comboVisual.SelectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void VisualiseBrightness()
|
public void VisualiseBrightness()
|
||||||
@@ -333,7 +332,7 @@ namespace GHelper
|
|||||||
private void SliderGamma_ValueChanged(object? sender, EventArgs e)
|
private void SliderGamma_ValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sliderGammaIgnore) return;
|
if (sliderGammaIgnore) return;
|
||||||
VisualControl.SetBrightness(sliderGamma.Value);
|
ScreenControl.SetBrightness(sliderGamma.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonOverlay_Click(object? sender, EventArgs e)
|
private void ButtonOverlay_Click(object? sender, EventArgs e)
|
||||||
@@ -475,7 +474,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);
|
||||||
@@ -754,7 +753,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1054,19 +1053,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user