Compare commits

..

1 Commits

Author SHA1 Message Date
Serge
04afbea26f Restrict fan curve points 2024-10-06 12:03:42 +02:00
30 changed files with 479 additions and 697 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1,2 +0,0 @@
# These are supported funding model platforms
custom: https://g-helper.com/support

View File

@@ -648,7 +648,7 @@ namespace GHelper.Ally
if (init) if (init)
{ {
WakeUp(); WakeUp();
InputDispatcher.SetBacklightAuto(); InputDispatcher.SetBacklightAuto(true);
} }
AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD1, 0x01, 0x01, (byte)_applyMode], "Controller"); AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD1, 0x01, 0x01, (byte)_applyMode], "Controller");

View File

@@ -36,7 +36,6 @@ namespace GHelper.AnimeMatrix
public AniMatrixControl(SettingsForm settingsForm) public AniMatrixControl(SettingsForm settingsForm)
{ {
settings = settingsForm; settings = settingsForm;
if (!AppConfig.IsSlash() && !AppConfig.IsAnimeMatrix()) return;
try try
{ {
@@ -214,7 +213,7 @@ namespace GHelper.AnimeMatrix
switch (running) switch (running)
{ {
case 2: case 2:
SetMatrixPicture(AppConfig.GetString("matrix_picture"), false); SetMatrixPicture(AppConfig.GetString("matrix_picture"));
break; break;
case 3: case 3:
SetMatrixClock(); SetMatrixClock();

View File

@@ -410,7 +410,7 @@ namespace GHelper.AnimeMatrix
if (DateTime.Now.Second % 2 != 0) timeFormat = timeFormat.Replace(":", " "); if (DateTime.Now.Second % 2 != 0) timeFormat = timeFormat.Replace(":", " ");
Clear(); Clear();
Text(DateTime.Now.ToString(timeFormat), 15, 7 - FullRows / 2, 25); Text(DateTime.Now.ToString(timeFormat), 15, 2, 25);
Text(DateTime.Now.ToString(dateFormat), 11.5F, 0, 14); Text(DateTime.Now.ToString(dateFormat), 11.5F, 0, 14);
Present(); Present();

View File

@@ -413,7 +413,7 @@ public static class AppConfig
public static bool IsDUO() public static bool IsDUO()
{ {
return ContainsModel("Duo") || ContainsModel("GX550") || ContainsModel("GX650") || ContainsModel("UX840"); return ContainsModel("Duo") || ContainsModel("GX550") || ContainsModel("GX650");
} }
// G14 2020 has no aura, but media keys instead // G14 2020 has no aura, but media keys instead
@@ -432,11 +432,6 @@ public static class AppConfig
return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("FA617N") || ContainsModel("FA617X") || NoAura(); return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("FA617N") || ContainsModel("FA617X") || NoAura();
} }
public static bool IsAnimeMatrix()
{
return ContainsModel("GA401") || ContainsModel("GA402") || ContainsModel("GU604V");
}
public static bool IsSlash() public static bool IsSlash()
{ {
return ContainsModel("GA403") || ContainsModel("GU605") || ContainsModel("GA605"); return ContainsModel("GA403") || ContainsModel("GU605") || ContainsModel("GA605");
@@ -459,7 +454,7 @@ public static class AppConfig
public static bool IsOLED() public static bool IsOLED()
{ {
return ContainsModel("OLED") || IsSlash() || ContainsModel("M7600") || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150") || ContainsModel("M350") || ContainsModel("K650") || ContainsModel("UM53") || ContainsModel("K660") || ContainsModel("UX84") || ContainsModel("M650") || ContainsModel("M550") || ContainsModel("K340") || ContainsModel("K350") || ContainsModel("M140") || ContainsModel("UM340") || ContainsModel("S540") || ContainsModel("M7400") || ContainsModel("N650") || ContainsModel("HN7306") || ContainsModel("H7606") || ContainsModel("UX5406") || ContainsModel("M5606"); return ContainsModel("OLED") || IsSlash() || ContainsModel("M7600") || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150") || ContainsModel("M350") || ContainsModel("K650") || ContainsModel("UM53") || ContainsModel("K660") || ContainsModel("UX84") || ContainsModel("M650") || ContainsModel("M550") || ContainsModel("K340") || ContainsModel("K350") || ContainsModel("M140") || ContainsModel("UM340") || ContainsModel("S540") || ContainsModel("M7400") || ContainsModel("N650") || ContainsModel("HN7306") || ContainsModel("H7606") || ContainsModel("UX5406") || ContainsModel("UM5606");
} }
public static bool IsNoOverdrive() public static bool IsNoOverdrive()
@@ -509,7 +504,7 @@ public static class AppConfig
public static bool NoWMI() public static bool NoWMI()
{ {
return ContainsModel("GL704G") || ContainsModel("GM501G") || ContainsModel("GX501G"); return ContainsModel("GL704G") || ContainsModel("GM501G");
} }
public static bool IsNoDirectRGB() public static bool IsNoDirectRGB()
@@ -653,11 +648,6 @@ public static class AppConfig
return ContainsModel("GV301RA") || ContainsModel("GV302XA") || IsAlly(); return ContainsModel("GV301RA") || ContainsModel("GV302XA") || IsAlly();
} }
public static bool NoGpu()
{
return Is("no_gpu") || ContainsModel("UX540");
}
public static bool IsHardwareTouchpadToggle() public static bool IsHardwareTouchpadToggle()
{ {
return ContainsModel("FA507"); return ContainsModel("FA507");
@@ -701,22 +691,17 @@ public static class AppConfig
// 2024 Models support Dynamic Lighting // 2024 Models support Dynamic Lighting
public static bool IsDynamicLighting() public static bool IsDynamicLighting()
{ {
return IsSlash() || IsIntelHX() || IsTUF(); return IsSlash() || IsIntelHX() || ContainsModel("FA607P") || ContainsModel("FX607J") || ContainsModel("FA507U");
} }
public static bool IsForceMiniled() public static bool IsForceMiniled()
{ {
return ContainsModel("G834JYR") || ContainsModel("G834JZR") || Is("force_miniled"); return ContainsModel("G834JYR") || Is("force_miniled");
} }
public static bool SaveDimming() public static bool SaveDimming()
{ {
return Is("save_dimming"); return Is("save_dimming");
} }
public static bool IsAutoStatusLed()
{
return Is("auto_status_led");
}
} }

View File

@@ -129,7 +129,6 @@ public class AsusACPI
public const int ScreenPadToggle = 0x00050031; public const int ScreenPadToggle = 0x00050031;
public const int ScreenPadBrightness = 0x00050032; public const int ScreenPadBrightness = 0x00050032;
public const int CameraShutter = 0x00060078;
public const int CameraLed = 0x00060079; public const int CameraLed = 0x00060079;
public const int StatusLed = 0x000600C2; public const int StatusLed = 0x000600C2;
@@ -584,7 +583,7 @@ public class AsusACPI
} }
//Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result)); //Logger.WriteLine($"GetFan {device} :" + BitConverter.ToString(result));
if (IsInvalidCurve(result)) result = AppConfig.GetDefaultCurve(device);
return result; return result;
} }
@@ -599,43 +598,20 @@ public class AsusACPI
return curve.All(singleByte => singleByte == 0); return curve.All(singleByte => singleByte == 0);
} }
public static int FixTemp(int temp, int index)
{
var dxMin = 30 + 10 * index;
var dxMax = dxMin + 9;
return Math.Min(dxMax, Math.Max(dxMin, temp));
}
public static byte[] FixFanCurve(byte[] curve) public static byte[] FixFanCurve(byte[] curve)
{ {
if (curve.Length != 16) throw new Exception("Incorrect curve"); if (curve.Length != 16) throw new Exception("Incorrect curve");
var points = new Dictionary<byte, byte>();
byte old = 0;
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
if (curve[i] <= old) curve[i] = (byte)Math.Min(100, old + 6); // preventing 2 points in same spot from default asus profiles curve[i] = (byte)FixTemp(curve[i], i);
points[curve[i]] = curve[i + 8];
old = curve[i];
}
var pointsFixed = new Dictionary<byte, byte>();
bool fix = false;
int count = 0;
foreach (var pair in points.OrderBy(x => x.Key))
{
if (count == 0 && pair.Key >= 40)
{
fix = true;
pointsFixed.Add(30, 0);
}
if (count != 3 || !fix)
pointsFixed.Add(pair.Key, pair.Value);
count++;
}
count = 0;
foreach (var pair in pointsFixed.OrderBy(x => x.Key))
{
curve[count] = pair.Key;
curve[count + 8] = pair.Value;
count++;
} }
return curve; return curve;

View File

@@ -2,46 +2,31 @@
namespace GHelper.Battery namespace GHelper.Battery
{ {
public static class BatteryControl internal class BatteryControl
{ {
static bool _chargeFull = AppConfig.Is("charge_full");
public static bool chargeFull
{
get
{
return _chargeFull;
}
set
{
AppConfig.Set("charge_full", value ? 1 : 0);
_chargeFull = value;
}
}
public static void ToggleBatteryLimitFull() public static void ToggleBatteryLimitFull()
{ {
if (chargeFull) SetBatteryChargeLimit(); if (AppConfig.Is("charge_full")) SetBatteryChargeLimit();
else SetBatteryLimitFull(); else SetBatteryLimitFull();
} }
public static void SetBatteryLimitFull() public static void SetBatteryLimitFull()
{ {
chargeFull = true; AppConfig.Set("charge_full", 1);
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, 100, "BatteryLimit"); Program.acpi.DeviceSet(AsusACPI.BatteryLimit, 100, "BatteryLimit");
Program.settingsForm.VisualiseBatteryFull(); Program.settingsForm.VisualiseBatteryFull();
} }
public static void UnSetBatteryLimitFull() public static void UnSetBatteryLimitFull()
{ {
chargeFull = false; AppConfig.Set("charge_full", 0);
Logger.WriteLine("Battery fully charged");
Program.settingsForm.Invoke(Program.settingsForm.VisualiseBatteryFull); Program.settingsForm.Invoke(Program.settingsForm.VisualiseBatteryFull);
} }
public static void AutoBattery(bool init = false) public static void AutoBattery(bool init = false)
{ {
if (chargeFull && !init) SetBatteryLimitFull(); if (AppConfig.Is("charge_full") && !init) SetBatteryLimitFull();
else SetBatteryChargeLimit(); else SetBatteryChargeLimit();
} }
@@ -61,7 +46,7 @@ namespace GHelper.Battery
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit"); Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit");
AppConfig.Set("charge_limit", limit); AppConfig.Set("charge_limit", limit);
chargeFull = false; AppConfig.Set("charge_full", 0);
Program.settingsForm.VisualiseBattery(limit); Program.settingsForm.VisualiseBattery(limit);
} }

View File

@@ -6,14 +6,7 @@ namespace GHelper.Display
{ {
public const int MAX_REFRESH = 1000; public const int MAX_REFRESH = 1000;
public static int MIN_RATE = AppConfig.Get("min_rate", 60);
public static int MAX_RATE = AppConfig.Get("max_rate");
public static int GetMaxRate(string? laptopScreen)
{
if (MAX_RATE > 0) return MAX_RATE;
else return ScreenNative.GetMaxRefreshRate(laptopScreen);
}
public void AutoScreen(bool force = false) public void AutoScreen(bool force = false)
{ {
@@ -22,7 +15,7 @@ namespace GHelper.Display
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online) if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online)
SetScreen(MAX_REFRESH, 1); SetScreen(MAX_REFRESH, 1);
else else
SetScreen(MIN_RATE, 0); SetScreen(60, 0);
} }
else else
{ {
@@ -36,7 +29,7 @@ namespace GHelper.Display
var refreshRate = ScreenNative.GetRefreshRate(laptopScreen); var refreshRate = ScreenNative.GetRefreshRate(laptopScreen);
if (refreshRate < 0) return; if (refreshRate < 0) return;
ScreenNative.SetRefreshRate(laptopScreen, refreshRate > MIN_RATE ? MIN_RATE : GetMaxRate(laptopScreen)); ScreenNative.SetRefreshRate(laptopScreen, refreshRate > 60 ? 60 : ScreenNative.GetMaxRefreshRate(laptopScreen));
InitScreen(); InitScreen();
} }
@@ -50,7 +43,7 @@ namespace GHelper.Display
if (frequency >= MAX_REFRESH) if (frequency >= MAX_REFRESH)
{ {
frequency = GetMaxRate(laptopScreen); frequency = ScreenNative.GetMaxRefreshRate(laptopScreen);
} }
if (frequency > 0 && frequency != refreshRate) if (frequency > 0 && frequency != refreshRate)
@@ -158,7 +151,7 @@ namespace GHelper.Display
{ {
var laptopScreen = ScreenNative.FindLaptopScreen(); var laptopScreen = ScreenNative.FindLaptopScreen();
int frequency = ScreenNative.GetRefreshRate(laptopScreen); int frequency = ScreenNative.GetRefreshRate(laptopScreen);
int maxFrequency = GetMaxRate(laptopScreen); int maxFrequency = ScreenNative.GetMaxRefreshRate(laptopScreen);
if (maxFrequency > 0) AppConfig.Set("max_frequency", maxFrequency); if (maxFrequency > 0) AppConfig.Set("max_frequency", maxFrequency);
else maxFrequency = AppConfig.Get("max_frequency"); else maxFrequency = AppConfig.Get("max_frequency");

View File

@@ -1,5 +1,4 @@
using GHelper.Helpers; using GHelper.Helpers;
using Microsoft.Win32;
using System.Management; using System.Management;
namespace GHelper.Display namespace GHelper.Display
@@ -38,7 +37,6 @@ 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
{ {
@@ -177,8 +175,7 @@ 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"}
}; };
} }
@@ -208,20 +205,6 @@ 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;
@@ -252,7 +235,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.Disabled || mode == SplendidCommand.Default || mode == SplendidCommand.VivoNormal) && init) return; // Skip default setting on init if ((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;
@@ -262,16 +245,12 @@ namespace GHelper.Display
if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin(); if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin();
int? balance = null; int? balance;
int command = 0;
switch (mode) switch (mode)
{ {
case SplendidCommand.Disabled:
command = 2;
break;
case SplendidCommand.Eyecare: case SplendidCommand.Eyecare:
balance = 4; balance = 2;
break; break;
case SplendidCommand.VivoNormal: case SplendidCommand.VivoNormal:
case SplendidCommand.VivoVivid: case SplendidCommand.VivoVivid:
@@ -285,7 +264,7 @@ namespace GHelper.Display
break; break;
} }
int result = RunSplendid(mode, command, balance); var result = RunSplendid(mode, 0, balance);
if (result == 0) return; if (result == 0) return;
if (result == -1) if (result == -1)
{ {
@@ -342,11 +321,6 @@ 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;

615
app/Extra.Designer.cs generated

File diff suppressed because it is too large Load Diff

View File

@@ -37,7 +37,6 @@ namespace GHelper
{"brightness_up", Properties.Strings.BrightnessUp}, {"brightness_up", Properties.Strings.BrightnessUp},
{"visual", Properties.Strings.VisualMode}, {"visual", Properties.Strings.VisualMode},
{"touchscreen", Properties.Strings.ToggleTouchscreen }, {"touchscreen", Properties.Strings.ToggleTouchscreen },
{"micmute", Properties.Strings.MuteMic},
{"ghelper", Properties.Strings.OpenGHelper}, {"ghelper", Properties.Strings.OpenGHelper},
{"custom", Properties.Strings.Custom} {"custom", Properties.Strings.Custom}
}; };
@@ -63,7 +62,6 @@ namespace GHelper
break; break;
case "m3": case "m3":
customActions[""] = Properties.Strings.MuteMic; customActions[""] = Properties.Strings.MuteMic;
customActions.Remove("micmute");
break; break;
case "m4": case "m4":
customActions[""] = Properties.Strings.OpenGHelper; customActions[""] = Properties.Strings.OpenGHelper;
@@ -423,7 +421,7 @@ namespace GHelper
var statusLed = Program.acpi.DeviceGet(AsusACPI.StatusLed); var statusLed = Program.acpi.DeviceGet(AsusACPI.StatusLed);
checkStatusLed.Visible = statusLed >= 0; checkStatusLed.Visible = statusLed >= 0;
checkStatusLed.Checked = (statusLed > 0); checkStatusLed.Checked = (statusLed > 0);
checkStatusLed.CheckedChanged += CheckLEDStatus_CheckedChanged; checkStatusLed.CheckedChanged += CheckLEDStatus_CheckedChanged; ;
checkBWIcon.Checked = AppConfig.IsBWIcon(); checkBWIcon.Checked = AppConfig.IsBWIcon();
@@ -460,7 +458,7 @@ namespace GHelper
private void CheckLEDStatus_CheckedChanged(object? sender, EventArgs e) private void CheckLEDStatus_CheckedChanged(object? sender, EventArgs e)
{ {
InputDispatcher.SetStatusLED(checkStatusLed.Checked); Program.acpi.DeviceSet(AsusACPI.StatusLed, (checkStatusLed.Checked ? 7 : 0), "StatusLED");
} }
private void CheckBWIcon_CheckedChanged(object? sender, EventArgs e) private void CheckBWIcon_CheckedChanged(object? sender, EventArgs e)

View File

@@ -757,8 +757,8 @@ namespace GHelper
chart.Titles[0].Text = title; chart.Titles[0].Text = title;
chart.ChartAreas[0].AxisX.Minimum = 10; chart.ChartAreas[0].AxisX.Minimum = 20;
chart.ChartAreas[0].AxisX.Maximum = 100; chart.ChartAreas[0].AxisX.Maximum = 110;
chart.ChartAreas[0].AxisX.Interval = 10; chart.ChartAreas[0].AxisX.Interval = 10;
chart.ChartAreas[0].AxisY.Minimum = 0; chart.ChartAreas[0].AxisY.Minimum = 0;
@@ -1019,7 +1019,7 @@ namespace GHelper
int chartCount = 2; int chartCount = 2;
// Middle / system fan check // Middle / system fan check
if (!AsusACPI.IsEmptyCurve(Program.acpi.GetFanCurve(AsusFan.Mid)) || Program.acpi.GetFan(AsusFan.Mid) >= 0) if (Program.acpi.GetFan(AsusFan.Mid) >= 0)
{ {
AppConfig.Set("mid_fan", 1); AppConfig.Set("mid_fan", 1);
chartCount++; chartCount++;
@@ -1082,15 +1082,10 @@ namespace GHelper
if (reset || AsusACPI.IsInvalidCurve(curve)) if (reset || AsusACPI.IsInvalidCurve(curve))
{ {
curve = Program.acpi.GetFanCurve(device, Modes.GetCurrentBase()); curve = Program.acpi.GetFanCurve(device, Modes.GetCurrentBase());
Logger.WriteLine($"Default {device}:" + BitConverter.ToString(curve));
if (AsusACPI.IsInvalidCurve(curve))
curve = AppConfig.GetDefaultCurve(device);
curve = AsusACPI.FixFanCurve(curve);
} }
//Debug.WriteLine(BitConverter.ToString(curve)); curve = AsusACPI.FixFanCurve(curve);
byte old = 0; byte old = 0;
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
@@ -1245,8 +1240,7 @@ namespace GHelper
dx = ax.PixelPositionToValue(e.X); dx = ax.PixelPositionToValue(e.X);
dy = ay.PixelPositionToValue(e.Y); dy = ay.PixelPositionToValue(e.Y);
if (dx < 20) dx = 20; dx = AsusACPI.FixTemp((int)dx, curIndex);
if (dx > 100) dx = 100;
if (dy < 0) dy = 0; if (dy < 0) dy = 0;
if (dy > fansMax) dy = fansMax; if (dy > fansMax) dy = fansMax;

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.199</AssemblyVersion> <AssemblyVersion>0.195</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -62,7 +62,8 @@ public class AmdGpuControl : IGpuControl
public AmdGpuControl() public AmdGpuControl()
{ {
if (AppConfig.NoGpu() || !Adl2.Load()) return; if (!Adl2.Load())
return;
try try
{ {

View File

@@ -22,12 +22,6 @@ namespace GHelper.Gpu
public void InitGPUMode() public void InitGPUMode()
{ {
if (AppConfig.NoGpu())
{
settings.HideGPUModes(false);
return;
}
int eco = Program.acpi.DeviceGet(AsusACPI.GPUEco); int eco = Program.acpi.DeviceGet(AsusACPI.GPUEco);
int mux = Program.acpi.DeviceGet(AsusACPI.GPUMux); int mux = Program.acpi.DeviceGet(AsusACPI.GPUMux);

View File

@@ -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,20 +34,6 @@ 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
@@ -240,17 +226,11 @@ 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.chargeFull) BatteryControl.UnSetBatteryLimitFull(); if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
if (chargeWatt)
{
batteryCharge = Math.Round((decimal)chargeCapacity / 1000, 1).ToString() + "Wh";
}
else
{
batteryCharge = Math.Round(batteryCapacity, 1) + "%";
}
} }
} }
public static bool IsUsedGPU(int threshold = 10) public static bool IsUsedGPU(int threshold = 10)
@@ -285,7 +265,6 @@ public static class HardwareControl
public static void RecreateGpuControl() public static void RecreateGpuControl()
{ {
if (AppConfig.NoGpu()) return;
try try
{ {
GpuControl?.Dispose(); GpuControl?.Dispose();

View File

@@ -106,7 +106,7 @@ public class Startup
{ {
td.RegistrationInfo.Description = "G-Helper Auto Start"; td.RegistrationInfo.Description = "G-Helper Auto Start";
td.Triggers.Add(new LogonTrigger { UserId = WindowsIdentity.GetCurrent().Name, Delay = TimeSpan.FromSeconds(2) }); td.Triggers.Add(new LogonTrigger { UserId = WindowsIdentity.GetCurrent().Name, Delay = TimeSpan.FromSeconds(1) });
td.Actions.Add(strExeFilePath); td.Actions.Add(strExeFilePath);
if (ProcessHelper.IsUserAdministrator()) if (ProcessHelper.IsUserAdministrator())

View File

@@ -14,16 +14,9 @@ namespace GHelper.Input
{ {
System.Timers.Timer timer = new System.Timers.Timer(1000); System.Timers.Timer timer = new System.Timers.Timer(1000);
public static bool backlightActivity = true; public static bool backlightActivity = true;
public static bool lidClose = false;
public static Keys keyProfile = (Keys)AppConfig.Get("keybind_profile", (int)Keys.F5); public static Keys keyProfile = Keys.F5;
public static Keys keyApp = (Keys)AppConfig.Get("keybind_app", (int)Keys.F12); public static Keys keyApp = Keys.F12;
public static Keys keyProfile0 = (Keys)AppConfig.Get("keybind_profile_0", (int)Keys.F17);
public static Keys keyProfile1 = (Keys)AppConfig.Get("keybind_profile_1", (int)Keys.F18);
public static Keys keyProfile2 = (Keys)AppConfig.Get("keybind_profile_2", (int)Keys.F16);
public static Keys keyProfile3 = (Keys)AppConfig.Get("keybind_profile_3", (int)Keys.F19);
public static Keys keyProfile4 = (Keys)AppConfig.Get("keybind_profile_4", (int)Keys.F20);
static ModeControl modeControl = Program.modeControl; static ModeControl modeControl = Program.modeControl;
static ScreenControl screenControl = new ScreenControl(); static ScreenControl screenControl = new ScreenControl();
@@ -86,14 +79,9 @@ namespace GHelper.Input
Program.acpi.DeviceInit(); Program.acpi.DeviceInit();
if (!OptimizationService.IsRunning()) if (!OptimizationService.IsRunning())
{
Program.acpi.DeviceGet(AsusACPI.CameraShutter);
listener = new KeyboardListener(HandleEvent); listener = new KeyboardListener(HandleEvent);
}
else else
{
Logger.WriteLine("Optimization service is running"); Logger.WriteLine("Optimization service is running");
}
InitBacklightTimer(); InitBacklightTimer();
@@ -113,6 +101,10 @@ namespace GHelper.Input
{ {
hook.UnregisterAll(); hook.UnregisterAll();
// CTRL + SHIFT + F5 to cycle profiles
if (AppConfig.Get("keybind_profile") != -1) keyProfile = (Keys)AppConfig.Get("keybind_profile");
if (AppConfig.Get("keybind_app") != -1) keyApp = (Keys)AppConfig.Get("keybind_app");
string actionM1 = AppConfig.GetString("m1"); string actionM1 = AppConfig.GetString("m1");
string actionM2 = AppConfig.GetString("m2"); string actionM2 = AppConfig.GetString("m2");
@@ -126,24 +118,18 @@ namespace GHelper.Input
if (!AppConfig.Is("skip_hotkeys")) if (!AppConfig.Is("skip_hotkeys"))
{ {
if (AppConfig.IsDUO())
{
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F7);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F8);
}
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F13); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F13);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F21);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F22);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile0); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F16);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile1); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F17);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile2); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F18);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile3); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F19);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile4); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F20);
hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeDown); hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeDown);
hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeUp); hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeUp);
@@ -435,12 +421,6 @@ namespace GHelper.Input
{ {
if (e.Key == keyProfile) modeControl.CyclePerformanceMode(true); if (e.Key == keyProfile) modeControl.CyclePerformanceMode(true);
if (e.Key == keyProfile0) modeControl.SetPerformanceMode(0, true);
if (e.Key == keyProfile1) modeControl.SetPerformanceMode(1, true);
if (e.Key == keyProfile2) modeControl.SetPerformanceMode(2, true);
if (e.Key == keyProfile3) modeControl.SetPerformanceMode(3, true);
if (e.Key == keyProfile4) modeControl.SetPerformanceMode(4, true);
switch (e.Key) switch (e.Key)
{ {
case Keys.F1: case Keys.F1:
@@ -455,30 +435,29 @@ namespace GHelper.Input
case Keys.F4: case Keys.F4:
Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey); Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey);
break; break;
case Keys.F7:
SetScreenpad(-10);
break;
case Keys.F8:
SetScreenpad(10);
break;
case Keys.F13: case Keys.F13:
ToggleScreenRate(); ToggleScreenRate();
break; break;
case Keys.F14: case Keys.F14:
Program.toast.RunToast(Properties.Strings.EcoMode);
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
break; break;
case Keys.F15: case Keys.F15:
Program.toast.RunToast(Properties.Strings.StandardMode);
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeStandard); Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeStandard);
break; break;
case Keys.F21: case Keys.F16:
Program.toast.RunToast("Activating XGM"); modeControl.SetPerformanceMode(2, true);
Program.settingsForm.gpuControl.ToggleXGM(true);
break; break;
case Keys.F22: case Keys.F17:
Program.toast.RunToast("Deactivating XGM"); modeControl.SetPerformanceMode(0, true);
Program.settingsForm.gpuControl.ToggleXGM(false); break;
case Keys.F18:
modeControl.SetPerformanceMode(1, true);
break;
case Keys.F19:
modeControl.SetPerformanceMode(3, true);
break;
case Keys.F20:
modeControl.SetPerformanceMode(4, true);
break; break;
} }
} }
@@ -756,8 +735,6 @@ namespace GHelper.Input
KeyProcess("fne"); KeyProcess("fne");
return; return;
case 174: // FN+F5 case 174: // FN+F5
case 153: // FN+F5 OLD MODELS
case 157: // Zenbook DUO FN+F
modeControl.CyclePerformanceMode(Control.ModifierKeys == Keys.Shift); modeControl.CyclePerformanceMode(Control.ModifierKeys == Keys.Shift);
return; return;
case 179: // FN+F4 case 179: // FN+F4
@@ -888,22 +865,10 @@ namespace GHelper.Input
return Math.Max(Math.Min(3, backlight), 0); return Math.Max(Math.Min(3, backlight), 0);
} }
public static void AutoKeyboard() public static void SetBacklightAuto(bool init = false)
{ {
if (AppConfig.HasTabletMode()) TabletMode(); if (init) Aura.Init();
if (lidClose || AppConfig.Is("skip_aura")) return; Aura.ApplyBrightness(GetBacklight(), "Auto", init);
Aura.Init();
Aura.ApplyPower();
Aura.ApplyAura();
SetBacklightAuto();
}
public static void SetBacklightAuto()
{
if (lidClose) return;
Aura.ApplyBrightness(GetBacklight(), "Auto");
} }
public static void SetBacklight(int delta, bool force = false) public static void SetBacklight(int delta, bool force = false)
@@ -959,55 +924,33 @@ namespace GHelper.Input
public static void ToggleCamera() public static void ToggleCamera()
{ {
int cameraShutter = Program.acpi.DeviceGet(AsusACPI.CameraShutter); if (!ProcessHelper.IsUserAdministrator()) return;
if (cameraShutter == 0) string CameraRegistryKeyPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam";
{ string CameraRegistryValueName = "Value";
Program.acpi.DeviceSet(AsusACPI.CameraShutter, 1, "CameraShutterOn");
Program.toast.RunToast($"Camera Off");
}
else if (cameraShutter == 1)
{
Program.acpi.DeviceSet(AsusACPI.CameraShutter, 0, "CameraShutterOff");
Program.toast.RunToast($"Camera On");
}
else if (cameraShutter == 262144)
{
Program.toast.RunToast($"Camera Off");
}
else if (cameraShutter == 262145)
{
Program.toast.RunToast($"Camera On");
}
else
{
if (!ProcessHelper.IsUserAdministrator()) return;
string CameraRegistryKeyPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam"; try
string CameraRegistryValueName = "Value"; {
var status = (string?)Registry.GetValue(CameraRegistryKeyPath, CameraRegistryValueName, "");
try if (status == "Allow") status = "Deny";
else if (status == "Deny") status = "Allow";
else
{ {
var status = (string?)Registry.GetValue(CameraRegistryKeyPath, CameraRegistryValueName, ""); Logger.WriteLine("Unknown camera status");
return;
if (status == "Allow") status = "Deny";
else if (status == "Deny") status = "Allow";
else
{
Logger.WriteLine("Unknown camera status");
return;
}
Registry.SetValue(CameraRegistryKeyPath, CameraRegistryValueName, status, RegistryValueKind.String);
Program.acpi.DeviceSet(AsusACPI.CameraLed, (status == "Deny" ? 1 : 0), "Camera");
Program.toast.RunToast($"Camera " + (status == "Deny" ? "Off" : "On"));
}
catch (Exception ex)
{
Logger.WriteLine(ex.ToString());
} }
Registry.SetValue(CameraRegistryKeyPath, CameraRegistryValueName, status, RegistryValueKind.String);
Program.acpi.DeviceSet(AsusACPI.CameraLed, (status == "Deny" ? 1 : 0), "Camera");
Program.toast.RunToast($"Camera " + (status == "Deny" ? "Off" : "On"));
} }
catch (Exception ex)
{
Logger.WriteLine(ex.ToString());
}
} }
private static System.Threading.Timer screenpadActionTimer; private static System.Threading.Timer screenpadActionTimer;
@@ -1025,7 +968,7 @@ namespace GHelper.Input
if (b < 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 0, "ScreenpadOff"); if (b < 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 0, "ScreenpadOff");
}; };
if (delay <= 0 || instant) //instant action if(delay <= 0 || instant) //instant action
{ {
action(brightness); action(brightness);
} }
@@ -1069,28 +1012,6 @@ namespace GHelper.Input
Program.toast.RunToast($"Screen Pad {toast}", delta > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); Program.toast.RunToast($"Screen Pad {toast}", delta > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
} }
public static void InitScreenpad()
{
if (!AppConfig.IsDUO()) return;
int brightness = AppConfig.Get("screenpad");
if (brightness >= 0) ApplyScreenpadAction(brightness);
}
public static void SetStatusLED(bool status)
{
Program.acpi.DeviceSet(AsusACPI.StatusLed, status ? 7 : 0, "StatusLED");
}
public static void InitStatusLed()
{
if (AppConfig.IsAutoStatusLed()) SetStatusLED(true);
}
public static void ShutdownStatusLed()
{
if (AppConfig.IsAutoStatusLed()) SetStatusLED(false);
}
static void LaunchProcess(string command = "") static void LaunchProcess(string command = "")
{ {
if (string.IsNullOrEmpty(command)) return; if (string.IsNullOrEmpty(command)) return;

View File

@@ -10,8 +10,6 @@ namespace GHelper.Input
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
Action<int> _handler; Action<int> _handler;
static int retry = 0;
public KeyboardListener(Action<int> KeyHandler) public KeyboardListener(Action<int> KeyHandler)
{ {
_handler = KeyHandler; _handler = KeyHandler;
@@ -56,7 +54,6 @@ namespace GHelper.Input
input.ReadTimeout = int.MaxValue; input.ReadTimeout = int.MaxValue;
var data = input.Read(); var data = input.Read();
if (cancellationTokenSource.Token.IsCancellationRequested) break;
if (data.Length > 1 && data[0] == AsusHid.INPUT_ID && data[1] > 0 && data[1] != 236) if (data.Length > 1 && data[0] == AsusHid.INPUT_ID && data[1] > 0 && data[1] != 236)
{ {
Logger.WriteLine($"Key: {data[1]}"); Logger.WriteLine($"Key: {data[1]}");
@@ -70,12 +67,6 @@ namespace GHelper.Input
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine($"Listener exited: {ex.Message}"); Logger.WriteLine($"Listener exited: {ex.Message}");
if (retry++ < 2)
{
Thread.Sleep(300);
Logger.WriteLine($"Restarting listener {retry}");
Listen();
}
} }
} }

View File

@@ -81,7 +81,7 @@ namespace GHelper
{ {
AppConfig.Set("matrix_contrast", trackContrast.Value); AppConfig.Set("matrix_contrast", trackContrast.Value);
AppConfig.Set("matrix_gamma", trackGamma.Value); AppConfig.Set("matrix_gamma", trackGamma.Value);
SetMatrixPicture(false); SetMatrixPicture();
} }

View File

@@ -110,24 +110,30 @@ namespace GHelper.Mode
if (notify) Toast(); if (notify) Toast();
if (!AppConfig.Is("skip_powermode")) // Power plan from config or defaulting to balanced
{ if (AppConfig.GetModeString("scheme") is not null)
// Power plan from config or defaulting to balanced PowerNative.SetPowerPlan(AppConfig.GetModeString("scheme"));
if (AppConfig.GetModeString("scheme") is not null) else
PowerNative.SetPowerPlan(AppConfig.GetModeString("scheme")); PowerNative.SetBalancedPowerPlan();
else
PowerNative.SetBalancedPowerPlan();
// Windows power mode // Windows power mode
if (AppConfig.GetModeString("powermode") is not null) if (AppConfig.GetModeString("powermode") is not null)
PowerNative.SetPowerMode(AppConfig.GetModeString("powermode")); PowerNative.SetPowerMode(AppConfig.GetModeString("powermode"));
else else
PowerNative.SetPowerMode(Modes.GetBase(mode)); PowerNative.SetPowerMode(Modes.GetBase(mode));
}
// CPU Boost setting override // CPU Boost setting override
if (AppConfig.GetMode("auto_boost") != -1) if (AppConfig.GetMode("auto_boost") != -1)
PowerNative.SetCPUBoost(AppConfig.GetMode("auto_boost")); PowerNative.SetCPUBoost(AppConfig.GetMode("auto_boost"));
//BatteryControl.SetBatteryChargeLimit();
/*
if (NativeMethods.PowerGetEffectiveOverlayScheme(out Guid activeScheme) == 0)
{
Debug.WriteLine("Effective :" + activeScheme);
}
*/
settings.FansInit(); settings.FansInit();
} }
@@ -156,8 +162,7 @@ namespace GHelper.Mode
modeToggleTimer.Start(); modeToggleTimer.Start();
Modes.SetCurrent(Modes.GetNext(back)); Modes.SetCurrent(Modes.GetNext(back));
Toast(); Toast();
} } else
else
{ {
SetPerformanceMode(Modes.GetNext(back), true); SetPerformanceMode(Modes.GetNext(back), true);
} }

View File

@@ -175,7 +175,6 @@ namespace GHelper.Mode
if (activeSchemeGuid.ToString() != balanced && !AppConfig.Is("skip_power_plan")) if (activeSchemeGuid.ToString() != balanced && !AppConfig.Is("skip_power_plan"))
{ {
Logger.WriteLine($"Changing power plan from {activeSchemeGuid.ToString()} to Balanced");
SetPowerPlan(balanced); SetPowerPlan(balanced);
} }
} }

View File

@@ -481,8 +481,9 @@ namespace GHelper.Peripherals.Mouse
{ {
try try
{ {
return HidSharp.DeviceList.Local.GetHidDevices(VendorID(), ProductID()) HidSharp.DeviceList.Local.GetHidDevices(VendorID(), ProductID())
.FirstOrDefault(x => x.DevicePath.Contains(path)) != null; .First(x => x.DevicePath.Contains(path));
return true;
} }
catch catch
{ {

View File

@@ -6,7 +6,6 @@ using GHelper.Helpers;
using GHelper.Input; using GHelper.Input;
using GHelper.Mode; using GHelper.Mode;
using GHelper.Peripherals; using GHelper.Peripherals;
using GHelper.USB;
using Microsoft.Win32; using Microsoft.Win32;
using Ryzen; using Ryzen;
using System.Diagnostics; using System.Diagnostics;
@@ -173,7 +172,6 @@ namespace GHelper
{ {
gpuControl.StandardModeFix(); gpuControl.StandardModeFix();
BatteryControl.AutoBattery(); BatteryControl.AutoBattery();
InputDispatcher.ShutdownStatusLed();
} }
private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
@@ -233,10 +231,7 @@ namespace GHelper
Logger.WriteLine("AutoSetting for " + isPlugged.ToString()); Logger.WriteLine("AutoSetting for " + isPlugged.ToString());
BatteryControl.AutoBattery(init); BatteryControl.AutoBattery(init);
if (init) if (init) screenControl.InitMiniled();
{
InputDispatcher.InitScreenpad();
}
inputDispatcher.Init(); inputDispatcher.Init();
@@ -258,12 +253,9 @@ namespace GHelper
} }
else else
{ {
InputDispatcher.AutoKeyboard(); settingsForm.AutoKeyboard();
} }
screenControl.InitMiniled();
InputDispatcher.InitStatusLed();
XGM.InitLight();
VisualControl.InitBrightness(); VisualControl.InitBrightness();
return true; return true;
@@ -276,7 +268,6 @@ namespace GHelper
{ {
Logger.WriteLine("Power Mode Changed:" + e.Mode.ToString()); Logger.WriteLine("Power Mode Changed:" + e.Mode.ToString());
gpuControl.StandardModeFix(); gpuControl.StandardModeFix();
InputDispatcher.ShutdownStatusLed();
} }
int delay = AppConfig.Get("charger_delay"); int delay = AppConfig.Get("charger_delay");

View File

@@ -151,7 +151,7 @@
<value>Animationsgeschwindigkeit</value> <value>Animationsgeschwindigkeit</value>
</data> </data>
<data name="AnimeMatrix" xml:space="preserve"> <data name="AnimeMatrix" xml:space="preserve">
<value>AniMe Matrix</value> <value>AniMeMatrix</value>
</data> </data>
<data name="AppAlreadyRunning" xml:space="preserve"> <data name="AppAlreadyRunning" xml:space="preserve">
<value>Die Anwendung läuft bereits</value> <value>Die Anwendung läuft bereits</value>

View File

@@ -235,7 +235,6 @@ 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;
@@ -273,8 +272,7 @@ namespace GHelper
buttonDonate.Click += ButtonDonate_Click; buttonDonate.Click += ButtonDonate_Click;
int click = AppConfig.Get("donate_click"); if (AppConfig.Get("start_count") > 10 && !AppConfig.Is("donate_click"))
if (AppConfig.Get("start_count") >= ((click < 10) ? 10 : click + 50))
{ {
buttonDonate.BorderColor = colorTurbo; buttonDonate.BorderColor = colorTurbo;
buttonDonate.Badge = true; buttonDonate.Badge = true;
@@ -286,17 +284,11 @@ 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", AppConfig.Get("start_count")); AppConfig.Set("donate_click", 1);
buttonDonate.Badge = false; buttonDonate.Badge = false;
Process.Start(new ProcessStartInfo("https://g-helper.com/support") { UseShellExecute = true }); Process.Start(new ProcessStartInfo("https://github.com/seerge/g-helper/wiki/Support-Project") { UseShellExecute = true });
} }
private void LabelDynamicLighting_Click(object? sender, EventArgs e) private void LabelDynamicLighting_Click(object? sender, EventArgs e)
@@ -675,14 +667,14 @@ namespace GHelper
{ {
case 0: case 0:
Logger.WriteLine("Lid Closed"); Logger.WriteLine("Lid Closed");
InputDispatcher.lidClose = AniMatrixControl.lidClose = true;
Aura.ApplyBrightness(0, "Lid"); Aura.ApplyBrightness(0, "Lid");
AniMatrixControl.lidClose = true;
matrixControl.SetLidMode(); matrixControl.SetLidMode();
break; break;
case 1: case 1:
Logger.WriteLine("Lid Open"); Logger.WriteLine("Lid Open");
InputDispatcher.lidClose = AniMatrixControl.lidClose = false;
Aura.ApplyBrightness(InputDispatcher.GetBacklight(), "Lid"); Aura.ApplyBrightness(InputDispatcher.GetBacklight(), "Lid");
AniMatrixControl.lidClose = false;
matrixControl.SetLidMode(); matrixControl.SetLidMode();
break; break;
} }
@@ -851,7 +843,7 @@ namespace GHelper
private void Button60Hz_MouseHover(object? sender, EventArgs e) private void Button60Hz_MouseHover(object? sender, EventArgs e)
{ {
labelTipScreen.Text = Properties.Strings.MinRefreshTooltip.Replace("60", ScreenControl.MIN_RATE.ToString()); labelTipScreen.Text = Properties.Strings.MinRefreshTooltip;
} }
private void ButtonScreen_MouseLeave(object? sender, EventArgs e) private void ButtonScreen_MouseLeave(object? sender, EventArgs e)
@@ -861,7 +853,7 @@ namespace GHelper
private void ButtonScreenAuto_MouseHover(object? sender, EventArgs e) private void ButtonScreenAuto_MouseHover(object? sender, EventArgs e)
{ {
labelTipScreen.Text = Properties.Strings.AutoRefreshTooltip.Replace("60", ScreenControl.MIN_RATE.ToString()); labelTipScreen.Text = Properties.Strings.AutoRefreshTooltip;
} }
private void ButtonUltimate_MouseHover(object? sender, EventArgs e) private void ButtonUltimate_MouseHover(object? sender, EventArgs e)
@@ -1216,7 +1208,7 @@ namespace GHelper
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(ScreenControl.MIN_RATE, 0); screenControl.SetScreen(60, 0);
} }
@@ -1247,18 +1239,16 @@ namespace GHelper
{ {
buttonScreenAuto.Activated = true; buttonScreenAuto.Activated = true;
} }
else if (frequency == ScreenControl.MIN_RATE) else if (frequency == 60)
{ {
button60Hz.Activated = true; button60Hz.Activated = true;
} }
else if (frequency > ScreenControl.MIN_RATE) else if (frequency > 60)
{ {
button120Hz.Activated = true; button120Hz.Activated = true;
} }
button60Hz.Text = ScreenControl.MIN_RATE + "Hz"; if (maxFrequency > 60)
if (maxFrequency > ScreenControl.MIN_RATE)
{ {
button120Hz.Text = maxFrequency.ToString() + "Hz" + (overdriveSetting ? " + OD" : ""); button120Hz.Text = maxFrequency.ToString() + "Hz" + (overdriveSetting ? " + OD" : "");
panelScreen.Visible = true; panelScreen.Visible = true;
@@ -1430,9 +1420,7 @@ 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";
@@ -1542,6 +1530,24 @@ namespace GHelper
} }
public void AutoKeyboard()
{
InputDispatcher.SetBacklightAuto(true);
if (!AppConfig.Is("skip_aura"))
{
Aura.ApplyPower();
Aura.ApplyAura();
}
if (Program.acpi.IsXGConnected())
XGM.Light(AppConfig.Is("xmg_light"));
if (AppConfig.HasTabletMode()) InputDispatcher.TabletMode();
}
public void VisualizeXGM(int GPUMode = -1) public void VisualizeXGM(int GPUMode = -1)
{ {
@@ -1769,7 +1775,7 @@ namespace GHelper
public void VisualiseBatteryFull() public void VisualiseBatteryFull()
{ {
if (BatteryControl.chargeFull) if (AppConfig.Is("charge_full"))
{ {
buttonBatteryFull.BackColor = colorStandard; buttonBatteryFull.BackColor = colorStandard;
buttonBatteryFull.ForeColor = SystemColors.ControlLightLight; buttonBatteryFull.ForeColor = SystemColors.ControlLightLight;

View File

@@ -361,11 +361,6 @@ namespace GHelper.USB
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x09, 0x01, power }, "Aura"); AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x09, 0x01, power }, "Aura");
} }
public static void ApplyPowerOff()
{
AsusHid.Write(AuraPowerMessage(new AuraPower()));
}
public static void ApplyPower() public static void ApplyPower()
{ {

View File

@@ -52,10 +52,6 @@ namespace GHelper.USB
Write(new byte[] { 0x5e, 0xc5, status ? (byte)0x50 : (byte)0 }); Write(new byte[] { 0x5e, 0xc5, status ? (byte)0x50 : (byte)0 });
} }
public static void InitLight()
{
if (Program.acpi.IsXGConnected()) Light(AppConfig.Is("xmg_light"));
}
public static void Reset() public static void Reset()
{ {

View File

@@ -3,9 +3,11 @@
[![GitHub release](https://img.shields.io/github/release/seerge/g-helper)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub release](https://img.shields.io/github/release/seerge/g-helper)](https://GitHub.com/seerge/g-helper/releases/)
[![Github all releases](https://img.shields.io/github/downloads/seerge/g-helper/total)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub stars](https://img.shields.io/github/stars/seerge/g-helper.svg?style=social)](https://GitHub.com/seerge/g-helper/stargazers/) <sup>[中文版点这里](https://github.com/seerge/g-helper/blob/main/docs/README.zh-CN.md)</sup> <sup>[日本語はこちら](https://github.com/seerge/g-helper/blob/main/docs/README.ja-JP.md)</sup> [![Github all releases](https://img.shields.io/github/downloads/seerge/g-helper/total)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub stars](https://img.shields.io/github/stars/seerge/g-helper.svg?style=social)](https://GitHub.com/seerge/g-helper/stargazers/) <sup>[中文版点这里](https://github.com/seerge/g-helper/blob/main/docs/README.zh-CN.md)</sup> <sup>[日本語はこちら](https://github.com/seerge/g-helper/blob/main/docs/README.ja-JP.md)</sup>
Small and lightweight Armoury Crate alternative for Asus laptops offering almost same functionality with a much smaller footprint. Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, DUO, TUF Series, Strix or Scar Series, ProArt, Vivobook, Zenbook, ROG Ally or Ally X and many more! Small and lightweight Armoury Crate alternative for Asus laptops offering almost same functionality without extra load and unnecessary services.
# [:floppy_disk: Download](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip) Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, DUO, TUF Series, Strix or Scar Series, ProArt, Vivobook, Zenbook, ROG Ally or Ally X and many more!
# [:floppy_disk:Download](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip)
**⭐ If you like the app - please spread the word about it online** **⭐ If you like the app - please spread the word about it online**
<table> <table>