Compare commits

...

9 Commits
v0.97 ... v0.98

Author SHA1 Message Date
Serge
a31303624a Removed Undervolting sliders for not supported models 2023-07-16 17:04:15 +02:00
Serge
e593fa3a76 ScreenPad brightness control 2023-07-16 14:48:21 +02:00
Serge
f419cb8eed Merge branch 'main' of https://github.com/seerge/g-helper 2023-07-15 20:13:02 +02:00
Serge
0ecca82652 Internal screen detection 2023-07-15 20:13:00 +02:00
Serge
5cf10a4aab Merge pull request #784 from seerge/l10n_main
New Crowdin updates
2023-07-15 13:13:41 +02:00
Serge
152a4e04c5 Brightness hotkeys fix 2023-07-15 13:11:38 +02:00
Serge
39d9f9b465 New translations Strings.resx (Chinese Simplified) 2023-07-15 04:20:27 +02:00
Serge
4167096617 New translations Strings.resx (Polish) 2023-07-15 01:37:10 +02:00
Serge
4d8c2b5f6a New translations Strings.resx (Polish) 2023-07-15 00:20:17 +02:00
15 changed files with 112 additions and 18 deletions

View File

@@ -92,6 +92,9 @@ public class AsusACPI
public const int TabletState = 0x00060077; public const int TabletState = 0x00060077;
public const int FnLock = 0x00100023; public const int FnLock = 0x00100023;
public const int ScreenPadToggle = 0x00050031;
public const int ScreenPadBrightness = 0x00050032;
public const int Tablet_Notebook = 0; public const int Tablet_Notebook = 0;
public const int Tablet_Tablet = 1; public const int Tablet_Tablet = 1;
public const int Tablet_Tent = 2; public const int Tablet_Tent = 2;

View File

@@ -1,4 +1,4 @@
namespace GHelper.Helpers namespace GHelper.Display
{ {
using System; using System;
using System.Diagnostics; using System.Diagnostics;

View File

@@ -24,8 +24,8 @@ namespace GHelper.Display
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1) public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
{ {
var laptopScreen = ScreenNative.FindLaptopScreen(true); var laptopScreen = ScreenNative.FindLaptopScreen(true);
if (laptopScreen is null) return; if (laptopScreen is null) return;
if (ScreenNative.GetRefreshRate(laptopScreen) < 0) return; if (ScreenNative.GetRefreshRate(laptopScreen) < 0) return;
@@ -66,7 +66,6 @@ namespace GHelper.Display
public void InitScreen() public void InitScreen()
{ {
var laptopScreen = ScreenNative.FindLaptopScreen(); var laptopScreen = ScreenNative.FindLaptopScreen();
int frequency = ScreenNative.GetRefreshRate(laptopScreen); int frequency = ScreenNative.GetRefreshRate(laptopScreen);

View File

@@ -118,14 +118,34 @@ namespace GHelper.Display
public const int ENUM_CURRENT_SETTINGS = -1; public const int ENUM_CURRENT_SETTINGS = -1;
public const string defaultDevice = @"\\.\DISPLAY1"; public const string defaultDevice = @"\\.\DISPLAY1";
static bool? _ultimate = null;
static bool isUltimate
{
get
{
if (_ultimate is null) _ultimate = (Program.acpi.DeviceGet(AsusACPI.GPUMux) == 0);
return (bool)_ultimate;
}
}
public static string? FindLaptopScreen(bool log = false) public static string? FindLaptopScreen(bool log = false)
{ {
string? laptopScreen = null; string? laptopScreen = null;
var screens = Screen.AllScreens;
if (!isUltimate)
{
foreach (var screen in screens )
{
if (log) Logger.WriteLine(screen.DeviceName);
if (screen.DeviceName == defaultDevice) return defaultDevice;
}
}
try try
{ {
var devices = GetAllDevices().ToArray(); var devices = GetAllDevices().ToArray();
var screens = Screen.AllScreens;
int count = 0, displayNum = -1; int count = 0, displayNum = -1;
@@ -147,11 +167,7 @@ namespace GHelper.Display
count = 0; count = 0;
foreach (var screen in screens) foreach (var screen in screens)
{ {
if (count == displayNum) if (count == displayNum) laptopScreen = screen.DeviceName;
{
laptopScreen = screen.DeviceName;
}
//if (log) Logger.WriteLine(screen.DeviceName);
count++; count++;
} }

View File

@@ -116,6 +116,12 @@ namespace GHelper
Text = Properties.Strings.ExtraSettings; Text = Properties.Strings.ExtraSettings;
if (AppConfig.ContainsModel("Duo"))
{
customActions.Add("screenpad_down", Properties.Strings.ScreenPadDown);
customActions.Add("screenpad_up", Properties.Strings.ScreenPadUp);
}
InitTheme(); InitTheme();
SetKeyCombo(comboM1, textM1, "m1"); SetKeyCombo(comboM1, textM1, "m1");

View File

@@ -285,6 +285,16 @@ namespace GHelper
private void VisualiseAdvanced() private void VisualiseAdvanced()
{ {
if (!RyzenControl.IsSupportedUV())
{
panelUV.Visible = panelUViGPU.Visible = false;
}
if (!RyzenControl.IsSupportedUV())
{
panelUViGPU.Visible = false;
}
labelUV.Text = trackUV.Value.ToString(); labelUV.Text = trackUV.Value.ToString();
labelUViGPU.Text = trackUViGPU.Value.ToString(); labelUViGPU.Text = trackUViGPU.Value.ToString();
labelTemp.Text = (trackTemp.Value < RyzenControl.MaxTemp) ? trackTemp.Value.ToString() + "°C" : "Default"; labelTemp.Text = (trackTemp.Value < RyzenControl.MaxTemp) ? trackTemp.Value.ToString() + "°C" : "Default";

View File

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

View File

@@ -36,7 +36,7 @@ namespace GHelper.Gpu
else else
GpuMode = AsusACPI.GPUModeStandard; GpuMode = AsusACPI.GPUModeStandard;
// Ultimate mode not suported // Ultimate mode not supported
if (mux != 1) settings.HideUltimateMode(); if (mux != 1) settings.HideUltimateMode();
// GPU mode not supported // GPU mode not supported
if (eco < 0 && mux < 0) settings.HideGPUModes(); if (eco < 0 && mux < 0) settings.HideGPUModes();

View File

@@ -138,6 +138,11 @@ namespace GHelper.Input
} }
static bool IsManualBrightness()
{
return AppConfig.ContainsModel("TUF") && !AppConfig.ContainsModel("FA506");
}
public void KeyPressed(object sender, KeyPressedEventArgs e) public void KeyPressed(object sender, KeyPressedEventArgs e)
{ {
@@ -209,11 +214,11 @@ namespace GHelper.Input
KeyboardHook.KeyPress(Keys.Snapshot); KeyboardHook.KeyPress(Keys.Snapshot);
break; break;
case Keys.F7: case Keys.F7:
//if (AppConfig.ContainsModel("TUF")) Program.toast.RunToast(ScreenBrightness.Adjust(-10) + "%", ToastIcon.BrightnessDown); if (IsManualBrightness()) Program.toast.RunToast(ScreenBrightness.Adjust(-10) + "%", ToastIcon.BrightnessDown);
HandleOptimizationEvent(16); HandleOptimizationEvent(16);
break; break;
case Keys.F8: case Keys.F8:
// if (AppConfig.ContainsModel("TUF")) Program.toast.RunToast(ScreenBrightness.Adjust(+10) + "%", ToastIcon.BrightnessUp); if (IsManualBrightness()) Program.toast.RunToast(ScreenBrightness.Adjust(+10) + "%", ToastIcon.BrightnessUp);
HandleOptimizationEvent(32); HandleOptimizationEvent(32);
break; break;
case Keys.F9: case Keys.F9:
@@ -310,6 +315,12 @@ namespace GHelper.Input
case "brightness_down": case "brightness_down":
HandleOptimizationEvent(16); HandleOptimizationEvent(16);
break; break;
case "screenpad_up":
SetScreenpad(10);
break;
case "screenpad_down":
SetScreenpad(-10);
break;
case "custom": case "custom":
CustomKey(name); CustomKey(name);
break; break;
@@ -474,6 +485,21 @@ namespace GHelper.Input
} }
public static void SetScreenpad(int delta)
{
int brightness = AppConfig.Get("screenpad", 100);
brightness = Math.Max(Math.Min(100, brightness + delta), 0);
AppConfig.Set("screenpad", brightness);
Program.acpi.DeviceSet(AsusACPI.ScreenPadBrightness, (brightness*255/100), "Screenpad");
if (brightness == 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, brightness, "ScreenpadToggle");
Program.toast.RunToast($"Screen Pad {brightness}", delta > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
}
static void LaunchProcess(string command = "") static void LaunchProcess(string command = "")
{ {

View File

@@ -366,6 +366,8 @@ namespace GHelper.Mode
public void SetUV(int cpuUV) public void SetUV(int cpuUV)
{ {
if (!RyzenControl.IsSupportedUV()) return;
if (cpuUV >= RyzenControl.MinCPUUV && cpuUV <= RyzenControl.MaxCPUUV) if (cpuUV >= RyzenControl.MinCPUUV && cpuUV <= RyzenControl.MaxCPUUV)
{ {
var uvResult = SendCommand.set_coall(cpuUV); var uvResult = SendCommand.set_coall(cpuUV);
@@ -376,6 +378,8 @@ namespace GHelper.Mode
public void SetUViGPU(int igpuUV) public void SetUViGPU(int igpuUV)
{ {
if (!RyzenControl.IsSupportedUViGPU()) return;
if (igpuUV >= RyzenControl.MinIGPUUV && igpuUV <= RyzenControl.MaxIGPUUV) if (igpuUV >= RyzenControl.MinIGPUUV && igpuUV <= RyzenControl.MaxIGPUUV)
{ {
var iGPUResult = SendCommand.set_cogfx(igpuUV); var iGPUResult = SendCommand.set_cogfx(igpuUV);

View File

@@ -1043,6 +1043,24 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Screenpad Brightness Down.
/// </summary>
internal static string ScreenPadDown {
get {
return ResourceManager.GetString("ScreenPadDown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Screenpad Brightness Up.
/// </summary>
internal static string ScreenPadUp {
get {
return ResourceManager.GetString("ScreenPadUp", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Shutdown. /// Looks up a localized string similar to Shutdown.
/// </summary> /// </summary>

View File

@@ -157,7 +157,7 @@
<value>Zastosuj limity</value> <value>Zastosuj limity</value>
</data> </data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve"> <data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Automatycznie dostosuj Plan Zasilania Windows</value> <value>Dostosuj systemowy Tryb Zasilania</value>
</data> </data>
<data name="AsusServicesRunning" xml:space="preserve"> <data name="AsusServicesRunning" xml:space="preserve">
<value>Uruchomione usługi Asus</value> <value>Uruchomione usługi Asus</value>

View File

@@ -446,6 +446,12 @@ Do you still want to continue?</value>
<data name="RunOnStartup" xml:space="preserve"> <data name="RunOnStartup" xml:space="preserve">
<value>Run on Startup</value> <value>Run on Startup</value>
</data> </data>
<data name="ScreenPadDown" xml:space="preserve">
<value>Screenpad Brightness Down</value>
</data>
<data name="ScreenPadUp" xml:space="preserve">
<value>Screenpad Brightness Up</value>
</data>
<data name="Shutdown" xml:space="preserve"> <data name="Shutdown" xml:space="preserve">
<value>Shutdown</value> <value>Shutdown</value>
</data> </data>

View File

@@ -199,7 +199,7 @@
<value>唤醒时</value> <value>唤醒时</value>
</data> </data>
<data name="BacklightTimeout" xml:space="preserve"> <data name="BacklightTimeout" xml:space="preserve">
<value>背光超时时间 (0表示长亮)</value> <value>插电/电池时背光时间 (0表示长亮)</value>
</data> </data>
<data name="Balanced" xml:space="preserve"> <data name="Balanced" xml:space="preserve">
<value>平衡模式</value> <value>平衡模式</value>
@@ -336,7 +336,7 @@
<value>当切换到集显模式时,停止所有正在使用独显的应用</value> <value>当切换到集显模式时,停止所有正在使用独显的应用</value>
</data> </data>
<data name="LaptopBacklight" xml:space="preserve"> <data name="LaptopBacklight" xml:space="preserve">
<value>笔记本背光</value> <value>背光</value>
</data> </data>
<data name="LaptopKeyboard" xml:space="preserve"> <data name="LaptopKeyboard" xml:space="preserve">
<value>笔记本键盘</value> <value>笔记本键盘</value>

View File

@@ -130,10 +130,16 @@ namespace Ryzen
return CPUName.Contains("AMD") || CPUName.Contains("Ryzen") || CPUName.Contains("Athlon") || CPUName.Contains("Radeon") || CPUName.Contains("AMD Custom APU 0405"); return CPUName.Contains("AMD") || CPUName.Contains("Ryzen") || CPUName.Contains("Athlon") || CPUName.Contains("Radeon") || CPUName.Contains("AMD Custom APU 0405");
} }
public static bool IsRyzen9() public static bool IsSupportedUV()
{ {
if (CPUName.Length == 0) Init(); if (CPUName.Length == 0) Init();
return CPUName.Contains("Ryzen 9"); return CPUName.Contains("Ryzen 9") || CPUName.Contains("4900H") || CPUName.Contains("4800H") || CPUName.Contains("4600H");
}
public static bool IsSupportedUViGPU()
{
if (CPUName.Length == 0) Init();
return CPUName.Contains("6900H") || CPUName.Contains("7945H") || CPUName.Contains("7845H");
} }
public static void SetAddresses() public static void SetAddresses()