From 6fe8ff65b16469dc6f8d7bc3122a14b4a8c13d19 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 11 Aug 2024 11:08:32 +0200 Subject: [PATCH] Pro Art Hotkeys and visual modes support (#2962) * Init * Update AsusACPI.cs * Visual modes and gamuts * Emoji popup * Emojis Popup * ProArt F12 * Softwar FN-Lock for ProArt * Cleanup * Cleanup --- app/AppConfig.cs | 5 +++++ app/AsusACPI.cs | 5 +++-- app/Display/VisualControl.cs | 10 ++++----- app/Input/InputDispatcher.cs | 43 +++++++++++++++++++++++++++++++++++- app/USB/Aura.cs | 2 +- 5 files changed, 56 insertions(+), 9 deletions(-) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index f888e6d3..fcd9f167 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -377,6 +377,11 @@ public static class AppConfig return ContainsModel("Vivobook") || ContainsModel("Zenbook"); } + public static bool IsVivoZenPro() + { + return ContainsModel("Vivobook") || ContainsModel("Zenbook") || ContainsModel("ProArt"); + } + // Devices with bugged bios command to change brightness public static bool SwappedBrightness() { diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index 804d5388..73265de4 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -46,6 +46,7 @@ public class AsusACPI public const int KB_TouchpadToggle = 0x6b; public const int KB_MuteToggle = 0x7c; + public const int KB_NumlockToggle = 0x4e; public const int KB_DUO_PgUpDn = 0x4B; public const int KB_DUO_SecondDisplay = 0x6A; @@ -171,8 +172,8 @@ public class AsusACPI private bool? _allAMD = null; private bool? _overdrive = null; - public static uint GPUEco => (AppConfig.IsVivoZenbook() || AppConfig.IsProArt()) ? GPUEcoVivo : GPUEcoROG; - public static uint GPUMux => AppConfig.IsVivoZenbook() ? GPUMuxVivo : GPUMuxROG; + public static uint GPUEco => AppConfig.IsVivoZenPro() ? GPUEcoVivo : GPUEcoROG; + public static uint GPUMux => AppConfig.IsVivoZenPro() ? GPUMuxVivo : GPUMuxROG; [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] private static extern IntPtr CreateFile( diff --git a/app/Display/VisualControl.cs b/app/Display/VisualControl.cs index 15199dce..c01ee006 100644 --- a/app/Display/VisualControl.cs +++ b/app/Display/VisualControl.cs @@ -70,13 +70,13 @@ namespace GHelper.Display public static SplendidGamut GetDefaultGamut() { - return AppConfig.IsVivoZenbook() ? SplendidGamut.VivoNative : SplendidGamut.Native; + return AppConfig.IsVivoZenPro() ? SplendidGamut.VivoNative : SplendidGamut.Native; } public static Dictionary GetGamutModes() { - bool isVivo = AppConfig.IsVivoZenbook(); + bool isVivo = AppConfig.IsVivoZenPro(); Dictionary _modes = new Dictionary(); @@ -148,13 +148,13 @@ namespace GHelper.Display public static SplendidCommand GetDefaultVisualMode() { - return AppConfig.IsVivoZenbook() ? SplendidCommand.VivoNormal : SplendidCommand.Default; + return AppConfig.IsVivoZenPro() ? SplendidCommand.VivoNormal : SplendidCommand.Default; } public static Dictionary GetVisualModes() { - if (AppConfig.IsVivoZenbook()) + if (AppConfig.IsVivoZenPro()) { return new Dictionary { @@ -291,7 +291,7 @@ namespace GHelper.Display private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null) { var splendid = GetSplendidPath(); - bool isVivo = AppConfig.IsVivoZenbook(); + bool isVivo = AppConfig.IsVivoZenPro(); bool isSplenddid = File.Exists(splendid); if (isSplenddid) diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 154baac3..e14d155e 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -281,6 +281,43 @@ namespace GHelper.Input } } + if (AppConfig.IsProArt()) + { + switch (e.Key) + { + case Keys.F2: + KeyboardHook.KeyPress(Keys.VolumeDown); + return; + case Keys.F3: + KeyboardHook.KeyPress(Keys.VolumeUp); + return; + case Keys.F4: + HandleEvent(199); // Backlight cycle + return; + case Keys.F5: + SetBrightness(-10); + return; + case Keys.F6: + SetBrightness(+10); + return; + case Keys.F7: + KeyboardHook.KeyKeyPress(Keys.LWin, Keys.P); + return; + case Keys.F8: + HandleEvent(126); // Emojis + return; + case Keys.F9: + KeyProcess("m3"); // MicMute + return; + case Keys.F10: + HandleEvent(133); // Camera Toggle + return; + case Keys.F11: + KeyboardHook.KeyPress(Keys.Snapshot); // PrintScreen + return; + } + } + if (AppConfig.IsZ13() || AppConfig.IsDUO()) { switch (e.Key) @@ -658,6 +695,7 @@ namespace GHelper.Input switch (EventID) { case 134: // FN + F12 ON OLD DEVICES + case 139: // ProArt F12 KeyProcess("m4"); return; case 124: // M3 @@ -691,7 +729,7 @@ namespace GHelper.Input case 78: // Fn + ESC ToggleFnLock(); return; - case 75: // Fn + ESC + case 75: // Fn + Arrow Lock ToggleArrowLock(); return; case 189: // Tablet mode @@ -780,6 +818,9 @@ namespace GHelper.Input case 53: // Fn+F6 on GA-502DU model NativeMethods.TurnOffScreen(); return; + case 126: // Fn+F8 emojis popup + KeyboardHook.KeyKeyPress(Keys.LWin, Keys.OemSemicolon); + return; } diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index f5abb49a..f5bf44c3 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -79,7 +79,7 @@ namespace GHelper.USB public static Color Color1 = Color.White; public static Color Color2 = Color.Black; - static bool isACPI = AppConfig.IsTUF() || AppConfig.IsVivoZenbook() || AppConfig.IsProArt(); + static bool isACPI = AppConfig.IsTUF() || AppConfig.IsVivoZenPro(); static bool isStrix = AppConfig.IsAdvancedRGB() && !AppConfig.IsNoDirectRGB(); static bool isStrix4Zone = AppConfig.Is4ZoneRGB();