From a985cc5bbb156eb143ab9f25609c8163d0d7c247 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 15 Aug 2023 13:59:07 +0200 Subject: [PATCH] Darktheme fix https://github.com/seerge/g-helper/issues/1092 ACPI modes support for Vivobook https://github.com/seerge/g-helper/issues/1089 --- app/AsusACPI.cs | 3 ++- app/Display/ScreenNative.cs | 15 ++++++++++++++- app/Extra.cs | 5 ++++- app/Mode/ModeControl.cs | 8 +++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index cf5985d9..4a5dc454 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -55,7 +55,8 @@ public class AsusACPI public const uint GPU_Fan = 0x00110014; public const uint Mid_Fan = 0x00110031; - public const uint PerformanceMode = 0x00120075; // Thermal Control + public const uint PerformanceMode = 0x00120075; // Performance modes + public const uint VivoBookMode = 0x00110019; // Vivobook performance modes public const uint GPUEco = 0x00090020; public const uint GPUXGConnected = 0x00090018; diff --git a/app/Display/ScreenNative.cs b/app/Display/ScreenNative.cs index 4379796d..39b256a5 100644 --- a/app/Display/ScreenNative.cs +++ b/app/Display/ScreenNative.cs @@ -1,8 +1,19 @@ -using System.Runtime.InteropServices; +using System.Collections; +using System.Runtime.InteropServices; using static GHelper.Display.ScreenInterrogatory; namespace GHelper.Display { + + class ScreenComparer : IComparer + { + public int Compare(object x, object y) + { + int displayX = Int32.Parse(((Screen)x).DeviceName.Replace(@"\\.\DISPLAY", "")); + int displayY = Int32.Parse(((Screen)y).DeviceName.Replace(@"\\.\DISPLAY", "")); + return (new CaseInsensitiveComparer()).Compare(displayX, displayY); + } + } internal class ScreenNative { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] @@ -166,6 +177,8 @@ namespace GHelper.Display count++; } + Array.Sort(screens, new ScreenComparer()); + count = 0; foreach (var screen in screens) { diff --git a/app/Extra.cs b/app/Extra.cs index 103740e4..969312e5 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -183,7 +183,6 @@ namespace GHelper SetKeyCombo(comboFNF4, textFNF4, "paddle"); } - else { SetKeyCombo(comboM1, textM1, "m1"); @@ -197,6 +196,10 @@ namespace GHelper SetKeyCombo(comboFNE, textFNE, "fne"); } + if (AppConfig.IsStrix()) + { + labelM4.Text = "M5/ROG"; + } InitTheme(); diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index 88c22870..5909177b 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -70,7 +70,13 @@ namespace GHelper.Mode Modes.SetCurrent(mode); - Program.acpi.DeviceSet(AsusACPI.PerformanceMode, AppConfig.IsManualModeRequired() ? AsusACPI.PerformanceManual : Modes.GetBase(mode), "Mode"); + int status = Program.acpi.DeviceSet(AsusACPI.PerformanceMode, AppConfig.IsManualModeRequired() ? AsusACPI.PerformanceManual : Modes.GetBase(mode), "Mode"); + + // Vivobook fallback + if (status != 1) + { + Program.acpi.DeviceSet(AsusACPI.VivoBookMode, Modes.GetBase(mode), "VivoMode"); + } if (AppConfig.Is("xgm_fan") && Program.acpi.IsXGConnected()) AsusUSB.ResetXGM();