mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a31303624a | ||
|
|
e593fa3a76 | ||
|
|
f419cb8eed | ||
|
|
0ecca82652 | ||
|
|
5cf10a4aab | ||
|
|
152a4e04c5 | ||
|
|
39d9f9b465 | ||
|
|
4167096617 | ||
|
|
4d8c2b5f6a |
@@ -92,6 +92,9 @@ public class AsusACPI
|
||||
public const int TabletState = 0x00060077;
|
||||
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_Tablet = 1;
|
||||
public const int Tablet_Tent = 2;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace GHelper.Helpers
|
||||
namespace GHelper.Display
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@@ -24,8 +24,8 @@ namespace GHelper.Display
|
||||
|
||||
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
|
||||
{
|
||||
|
||||
var laptopScreen = ScreenNative.FindLaptopScreen(true);
|
||||
|
||||
if (laptopScreen is null) return;
|
||||
|
||||
if (ScreenNative.GetRefreshRate(laptopScreen) < 0) return;
|
||||
@@ -66,7 +66,6 @@ namespace GHelper.Display
|
||||
|
||||
public void InitScreen()
|
||||
{
|
||||
|
||||
var laptopScreen = ScreenNative.FindLaptopScreen();
|
||||
|
||||
int frequency = ScreenNative.GetRefreshRate(laptopScreen);
|
||||
|
||||
@@ -118,14 +118,34 @@ namespace GHelper.Display
|
||||
public const int ENUM_CURRENT_SETTINGS = -1;
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
var devices = GetAllDevices().ToArray();
|
||||
var screens = Screen.AllScreens;
|
||||
|
||||
int count = 0, displayNum = -1;
|
||||
|
||||
@@ -147,11 +167,7 @@ namespace GHelper.Display
|
||||
count = 0;
|
||||
foreach (var screen in screens)
|
||||
{
|
||||
if (count == displayNum)
|
||||
{
|
||||
laptopScreen = screen.DeviceName;
|
||||
}
|
||||
//if (log) Logger.WriteLine(screen.DeviceName);
|
||||
if (count == displayNum) laptopScreen = screen.DeviceName;
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,12 @@ namespace GHelper
|
||||
|
||||
Text = Properties.Strings.ExtraSettings;
|
||||
|
||||
if (AppConfig.ContainsModel("Duo"))
|
||||
{
|
||||
customActions.Add("screenpad_down", Properties.Strings.ScreenPadDown);
|
||||
customActions.Add("screenpad_up", Properties.Strings.ScreenPadUp);
|
||||
}
|
||||
|
||||
InitTheme();
|
||||
|
||||
SetKeyCombo(comboM1, textM1, "m1");
|
||||
|
||||
10
app/Fans.cs
10
app/Fans.cs
@@ -285,6 +285,16 @@ namespace GHelper
|
||||
|
||||
private void VisualiseAdvanced()
|
||||
{
|
||||
if (!RyzenControl.IsSupportedUV())
|
||||
{
|
||||
panelUV.Visible = panelUViGPU.Visible = false;
|
||||
}
|
||||
|
||||
if (!RyzenControl.IsSupportedUV())
|
||||
{
|
||||
panelUViGPU.Visible = false;
|
||||
}
|
||||
|
||||
labelUV.Text = trackUV.Value.ToString();
|
||||
labelUViGPU.Text = trackUViGPU.Value.ToString();
|
||||
labelTemp.Text = (trackTemp.Value < RyzenControl.MaxTemp) ? trackTemp.Value.ToString() + "°C" : "Default";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.97</AssemblyVersion>
|
||||
<AssemblyVersion>0.98</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace GHelper.Gpu
|
||||
else
|
||||
GpuMode = AsusACPI.GPUModeStandard;
|
||||
|
||||
// Ultimate mode not suported
|
||||
// Ultimate mode not supported
|
||||
if (mux != 1) settings.HideUltimateMode();
|
||||
// GPU mode not supported
|
||||
if (eco < 0 && mux < 0) settings.HideGPUModes();
|
||||
|
||||
@@ -138,6 +138,11 @@ namespace GHelper.Input
|
||||
|
||||
}
|
||||
|
||||
static bool IsManualBrightness()
|
||||
{
|
||||
return AppConfig.ContainsModel("TUF") && !AppConfig.ContainsModel("FA506");
|
||||
}
|
||||
|
||||
public void KeyPressed(object sender, KeyPressedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -209,11 +214,11 @@ namespace GHelper.Input
|
||||
KeyboardHook.KeyPress(Keys.Snapshot);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
case Keys.F9:
|
||||
@@ -310,6 +315,12 @@ namespace GHelper.Input
|
||||
case "brightness_down":
|
||||
HandleOptimizationEvent(16);
|
||||
break;
|
||||
case "screenpad_up":
|
||||
SetScreenpad(10);
|
||||
break;
|
||||
case "screenpad_down":
|
||||
SetScreenpad(-10);
|
||||
break;
|
||||
case "custom":
|
||||
CustomKey(name);
|
||||
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 = "")
|
||||
{
|
||||
|
||||
|
||||
@@ -366,6 +366,8 @@ namespace GHelper.Mode
|
||||
|
||||
public void SetUV(int cpuUV)
|
||||
{
|
||||
if (!RyzenControl.IsSupportedUV()) return;
|
||||
|
||||
if (cpuUV >= RyzenControl.MinCPUUV && cpuUV <= RyzenControl.MaxCPUUV)
|
||||
{
|
||||
var uvResult = SendCommand.set_coall(cpuUV);
|
||||
@@ -376,6 +378,8 @@ namespace GHelper.Mode
|
||||
|
||||
public void SetUViGPU(int igpuUV)
|
||||
{
|
||||
if (!RyzenControl.IsSupportedUViGPU()) return;
|
||||
|
||||
if (igpuUV >= RyzenControl.MinIGPUUV && igpuUV <= RyzenControl.MaxIGPUUV)
|
||||
{
|
||||
var iGPUResult = SendCommand.set_cogfx(igpuUV);
|
||||
|
||||
18
app/Properties/Strings.Designer.cs
generated
18
app/Properties/Strings.Designer.cs
generated
@@ -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>
|
||||
/// Looks up a localized string similar to Shutdown.
|
||||
/// </summary>
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
<value>Zastosuj limity</value>
|
||||
</data>
|
||||
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
|
||||
<value>Automatycznie dostosuj Plan Zasilania Windows</value>
|
||||
<value>Dostosuj systemowy Tryb Zasilania</value>
|
||||
</data>
|
||||
<data name="AsusServicesRunning" xml:space="preserve">
|
||||
<value>Uruchomione usługi Asus</value>
|
||||
|
||||
@@ -446,6 +446,12 @@ Do you still want to continue?</value>
|
||||
<data name="RunOnStartup" xml:space="preserve">
|
||||
<value>Run on Startup</value>
|
||||
</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">
|
||||
<value>Shutdown</value>
|
||||
</data>
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
<value>唤醒时</value>
|
||||
</data>
|
||||
<data name="BacklightTimeout" xml:space="preserve">
|
||||
<value>背光超时时间 (0表示长亮)</value>
|
||||
<value>插电/电池时背光时间 (0表示长亮)</value>
|
||||
</data>
|
||||
<data name="Balanced" xml:space="preserve">
|
||||
<value>平衡模式</value>
|
||||
@@ -336,7 +336,7 @@
|
||||
<value>当切换到集显模式时,停止所有正在使用独显的应用</value>
|
||||
</data>
|
||||
<data name="LaptopBacklight" xml:space="preserve">
|
||||
<value>笔记本背光</value>
|
||||
<value>背光</value>
|
||||
</data>
|
||||
<data name="LaptopKeyboard" xml:space="preserve">
|
||||
<value>笔记本键盘</value>
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
public static bool IsRyzen9()
|
||||
public static bool IsSupportedUV()
|
||||
{
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user