mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
6 Commits
FixedCurve
...
v0.196
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d3332faf3 | ||
|
|
aa74730e12 | ||
|
|
9b5e2acf90 | ||
|
|
3fafe63c42 | ||
|
|
6c0252156c | ||
|
|
3a750c08b5 |
@@ -696,7 +696,7 @@ public static class AppConfig
|
|||||||
|
|
||||||
public static bool IsForceMiniled()
|
public static bool IsForceMiniled()
|
||||||
{
|
{
|
||||||
return ContainsModel("G834JYR") || Is("force_miniled");
|
return ContainsModel("G834JYR") || ContainsModel("G834JZR") || Is("force_miniled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool SaveDimming()
|
public static bool SaveDimming()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GHelper.Helpers;
|
using GHelper.Helpers;
|
||||||
|
using Microsoft.Win32;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
|
|
||||||
namespace GHelper.Display
|
namespace GHelper.Display
|
||||||
@@ -37,6 +38,7 @@ namespace GHelper.Display
|
|||||||
Cinema = 25,
|
Cinema = 25,
|
||||||
Vivid = 13,
|
Vivid = 13,
|
||||||
Eyecare = 17,
|
Eyecare = 17,
|
||||||
|
Disabled = 18,
|
||||||
}
|
}
|
||||||
public static class VisualControl
|
public static class VisualControl
|
||||||
{
|
{
|
||||||
@@ -99,7 +101,7 @@ namespace GHelper.Display
|
|||||||
foreach (FileInfo icm in icms)
|
foreach (FileInfo icm in icms)
|
||||||
{
|
{
|
||||||
//Logger.WriteLine(icm.FullName);
|
//Logger.WriteLine(icm.FullName);
|
||||||
|
|
||||||
if (icm.Name.Contains("sRGB"))
|
if (icm.Name.Contains("sRGB"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -107,7 +109,7 @@ namespace GHelper.Display
|
|||||||
_modes.Add(isVivo ? SplendidGamut.VivoSRGB : SplendidGamut.sRGB, "Gamut: sRGB");
|
_modes.Add(isVivo ? SplendidGamut.VivoSRGB : SplendidGamut.sRGB, "Gamut: sRGB");
|
||||||
Logger.WriteLine(icm.FullName + " sRGB");
|
Logger.WriteLine(icm.FullName + " sRGB");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,7 +177,8 @@ namespace GHelper.Display
|
|||||||
{ SplendidCommand.FPS, "FPS"},
|
{ SplendidCommand.FPS, "FPS"},
|
||||||
{ SplendidCommand.Cinema, "Cinema"},
|
{ SplendidCommand.Cinema, "Cinema"},
|
||||||
{ SplendidCommand.Vivid, "Vivid" },
|
{ SplendidCommand.Vivid, "Vivid" },
|
||||||
{ SplendidCommand.Eyecare, "Eyecare"}
|
{ SplendidCommand.Eyecare, "Eyecare"},
|
||||||
|
{ SplendidCommand.Disabled, "Disabled"}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +208,20 @@ namespace GHelper.Display
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const string GameVisualKey = @"HKEY_CURRENT_USER\Software\ASUS\ARMOURY CRATE Service\GameVisual";
|
||||||
|
const string GameVisualValue = "ActiveGVStatus";
|
||||||
|
|
||||||
|
public static bool IsEnabled()
|
||||||
|
{
|
||||||
|
var status = (int?)Registry.GetValue(GameVisualKey, GameVisualValue, 1);
|
||||||
|
return status > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetRegStatus(int status = 1)
|
||||||
|
{
|
||||||
|
Registry.SetValue(GameVisualKey, GameVisualValue, status, RegistryValueKind.DWord);
|
||||||
|
}
|
||||||
|
|
||||||
public static void SetGamut(int mode = -1)
|
public static void SetGamut(int mode = -1)
|
||||||
{
|
{
|
||||||
if (skipGamut) return;
|
if (skipGamut) return;
|
||||||
@@ -235,7 +252,7 @@ namespace GHelper.Display
|
|||||||
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = DefaultColorTemp, bool init = false)
|
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = DefaultColorTemp, bool init = false)
|
||||||
{
|
{
|
||||||
if (mode == SplendidCommand.None) return;
|
if (mode == SplendidCommand.None) return;
|
||||||
if ((mode == SplendidCommand.Default || mode == SplendidCommand.VivoNormal) && init) return; // Skip default setting on init
|
if ((mode == SplendidCommand.Disabled || mode == SplendidCommand.Default || mode == SplendidCommand.VivoNormal) && init) return; // Skip default setting on init
|
||||||
|
|
||||||
if (!forceVisual && ScreenCCD.GetHDRStatus(true)) return;
|
if (!forceVisual && ScreenCCD.GetHDRStatus(true)) return;
|
||||||
if (!forceVisual && ScreenNative.GetRefreshRate(ScreenNative.FindLaptopScreen(true)) < 0) return;
|
if (!forceVisual && ScreenNative.GetRefreshRate(ScreenNative.FindLaptopScreen(true)) < 0) return;
|
||||||
@@ -245,12 +262,16 @@ namespace GHelper.Display
|
|||||||
|
|
||||||
if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin();
|
if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin();
|
||||||
|
|
||||||
int? balance;
|
int? balance = null;
|
||||||
|
int command = 0;
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
case SplendidCommand.Disabled:
|
||||||
|
command = 2;
|
||||||
|
break;
|
||||||
case SplendidCommand.Eyecare:
|
case SplendidCommand.Eyecare:
|
||||||
balance = 2;
|
balance = 4;
|
||||||
break;
|
break;
|
||||||
case SplendidCommand.VivoNormal:
|
case SplendidCommand.VivoNormal:
|
||||||
case SplendidCommand.VivoVivid:
|
case SplendidCommand.VivoVivid:
|
||||||
@@ -264,7 +285,7 @@ namespace GHelper.Display
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = RunSplendid(mode, 0, balance);
|
int result = RunSplendid(mode, command, balance);
|
||||||
if (result == 0) return;
|
if (result == 0) return;
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
{
|
{
|
||||||
@@ -321,6 +342,11 @@ namespace GHelper.Display
|
|||||||
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
|
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
|
||||||
if (result.Contains("file not exist") || (result.Length == 0 && !isVivo)) return 1;
|
if (result.Contains("file not exist") || (result.Length == 0 && !isVivo)) return 1;
|
||||||
if (result.Contains("return code: -1")) return -1;
|
if (result.Contains("return code: -1")) return -1;
|
||||||
|
if (result.Contains("Visual is disabled"))
|
||||||
|
{
|
||||||
|
SetRegStatus(1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.195</AssemblyVersion>
|
<AssemblyVersion>0.196</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public static class HardwareControl
|
|||||||
public static decimal? fullCapacity;
|
public static decimal? fullCapacity;
|
||||||
public static decimal? chargeCapacity;
|
public static decimal? chargeCapacity;
|
||||||
|
|
||||||
|
public static string? batteryCharge;
|
||||||
|
|
||||||
public static string? cpuFan;
|
public static string? cpuFan;
|
||||||
public static string? gpuFan;
|
public static string? gpuFan;
|
||||||
@@ -34,6 +34,20 @@ public static class HardwareControl
|
|||||||
|
|
||||||
static long lastUpdate;
|
static long lastUpdate;
|
||||||
|
|
||||||
|
static bool _chargeWatt = AppConfig.Is("charge_watt");
|
||||||
|
public static bool chargeWatt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _chargeWatt;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
AppConfig.Set("charge_watt", value ? 1 : 0);
|
||||||
|
_chargeWatt = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static int GetGpuUse()
|
private static int GetGpuUse()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -226,8 +240,16 @@ public static class HardwareControl
|
|||||||
|
|
||||||
if (fullCapacity > 0 && chargeCapacity > 0)
|
if (fullCapacity > 0 && chargeCapacity > 0)
|
||||||
{
|
{
|
||||||
batteryCapacity = Math.Min(100, ((decimal)chargeCapacity / (decimal)fullCapacity) * 100);
|
batteryCapacity = Math.Min(100, (decimal)chargeCapacity / (decimal)fullCapacity * 100);
|
||||||
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
|
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
|
||||||
|
if (chargeWatt)
|
||||||
|
{
|
||||||
|
batteryCharge = Math.Round((decimal)chargeCapacity / 1000, 1).ToString() + "Wh";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
batteryCharge = Math.Round(batteryCapacity, 1) + "%";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -235,6 +235,7 @@ namespace GHelper
|
|||||||
|
|
||||||
labelCharge.MouseEnter += PanelBattery_MouseEnter;
|
labelCharge.MouseEnter += PanelBattery_MouseEnter;
|
||||||
labelCharge.MouseLeave += PanelBattery_MouseLeave;
|
labelCharge.MouseLeave += PanelBattery_MouseLeave;
|
||||||
|
labelBattery.Click += LabelBattery_Click;
|
||||||
|
|
||||||
buttonPeripheral1.Click += ButtonPeripheral_Click;
|
buttonPeripheral1.Click += ButtonPeripheral_Click;
|
||||||
buttonPeripheral2.Click += ButtonPeripheral_Click;
|
buttonPeripheral2.Click += ButtonPeripheral_Click;
|
||||||
@@ -284,6 +285,12 @@ namespace GHelper
|
|||||||
InitVisual();
|
InitVisual();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LabelBattery_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
HardwareControl.chargeWatt = !HardwareControl.chargeWatt;
|
||||||
|
RefreshSensors(true);
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonDonate_Click(object? sender, EventArgs e)
|
private void ButtonDonate_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("donate_click", 1);
|
AppConfig.Set("donate_click", 1);
|
||||||
@@ -1420,7 +1427,9 @@ namespace GHelper
|
|||||||
cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C";
|
cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C";
|
||||||
|
|
||||||
if (HardwareControl.batteryCapacity > 0)
|
if (HardwareControl.batteryCapacity > 0)
|
||||||
charge = Properties.Strings.BatteryCharge + ": " + Math.Round(HardwareControl.batteryCapacity, 1) + "% ";
|
{
|
||||||
|
charge = Properties.Strings.BatteryCharge + ": " + HardwareControl.batteryCharge;
|
||||||
|
}
|
||||||
|
|
||||||
if (HardwareControl.batteryRate < 0)
|
if (HardwareControl.batteryRate < 0)
|
||||||
battery = Properties.Strings.Discharging + ": " + Math.Round(-(decimal)HardwareControl.batteryRate, 1).ToString() + "W";
|
battery = Properties.Strings.Discharging + ": " + Math.Round(-(decimal)HardwareControl.batteryRate, 1).ToString() + "W";
|
||||||
|
|||||||
Reference in New Issue
Block a user