From 772bd8e7a5ec2784fc807d17bcdd1a974a2eb840 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sat, 13 Jan 2024 11:38:37 +0100 Subject: [PATCH 001/107] Fixes for Auto Update (#1908) * Automatically restart audio capture when device changes. * Wait for process to terminate instead of waiting a fixed amount of time. * Application.Exit might not exit if there is a child process running. Environment.Exit(0) do though. --- app/AutoUpdate/AutoUpdateControl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/AutoUpdate/AutoUpdateControl.cs b/app/AutoUpdate/AutoUpdateControl.cs index 42093c87..32757cfc 100644 --- a/app/AutoUpdate/AutoUpdateControl.cs +++ b/app/AutoUpdate/AutoUpdateControl.cs @@ -120,7 +120,7 @@ namespace GHelper.AutoUpdate Logger.WriteLine(zipName); Logger.WriteLine(exeName); - string command = $"Start-Sleep -Seconds 1; $ErrorActionPreference = \"Stop\"; Expand-Archive \"{zipName}\" -DestinationPath . -Force; Remove-Item \"{zipName}\" -Force; \".\\{exeName}\"; "; + string command = $"$ErrorActionPreference = \"Stop\"; Wait-Process -Name \"GHelper\"; Expand-Archive \"{zipName}\" -DestinationPath . -Force; Remove-Item \"{zipName}\" -Force; \".\\{exeName}\"; "; Logger.WriteLine(command); try @@ -139,7 +139,7 @@ namespace GHelper.AutoUpdate Logger.WriteLine(ex.Message); } - Application.Exit(); + Environment.Exit(0); } } From 6eba7dadeaa28832fe2f214c9d292804d6763c9d Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 13:24:30 +0100 Subject: [PATCH 002/107] Auto controller mode detection for Ally --- app/Ally/AllyControl.cs | 82 ++++++++++++++++++++++++++++++------ app/Gpu/AMD/AmdAdl2.cs | 41 ++++++++++++++++++ app/Gpu/AMD/AmdGpuControl.cs | 27 ++++++++++++ app/Program.cs | 6 +-- app/Settings.Designer.cs | 1 + app/Settings.cs | 18 +++++--- 6 files changed, 150 insertions(+), 25 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index ce404457..4a2c1dad 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,49 +1,103 @@ -using GHelper.USB; +using GHelper.Gpu.AMD; +using GHelper.USB; namespace GHelper.Ally { public enum ControllerMode : int { + Auto = 0, Gamepad = 1, - WASD = 2, Mouse = 3, } public class AllyControl { + System.Timers.Timer timer = default!; + AmdGpuControl amdControl; + SettingsForm settings; - ControllerMode mode = ControllerMode.Gamepad; + + ControllerMode mode = ControllerMode.Auto; + + ControllerMode _autoMode = ControllerMode.Gamepad; + int _autoCount = 0; + public AllyControl(SettingsForm settingsForm) { + if (!AppConfig.IsAlly()) return; + settings = settingsForm; + + amdControl = new AmdGpuControl(); + + timer = new System.Timers.Timer(500); + timer.Elapsed += Timer_Elapsed; + + } + + private void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e) + { + float fps = amdControl.GetFPS(); + + ControllerMode _newMode = (fps > 0) ? ControllerMode.Gamepad : ControllerMode.Mouse; + + if (_autoMode != _newMode) _autoCount++; + else _autoCount = 0; + + if (_autoCount > 2) + { + _autoMode = _newMode; + _autoCount = 0; + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)_autoMode }, "ControllerAuto " + _autoMode); + Logger.WriteLine(fps.ToString()); + } + } public void Init() { - if (!AppConfig.IsAlly()) - { - settings.VisualiseAlly(false); - return; - } + if (AppConfig.IsAlly()) settings.VisualiseAlly(true); + else return; - mode = (ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Gamepad); + mode = (ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto); SetMode(mode); } private void SetMode(ControllerMode mode) { + if (mode == ControllerMode.Auto) + { + amdControl.StartFPS(); + timer.Start(); + } else + { + timer.Stop(); + amdControl.StopFPS(); + + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)mode }, "ControllerMode"); + } + + AppConfig.Set("controller_mode", (int)mode); - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)mode }, "ControllerMode"); settings.VisualiseController(mode); } public void ToggleMode() { - if (mode == ControllerMode.Mouse) - mode = ControllerMode.Gamepad; - else - mode++; + + switch (mode) + { + case ControllerMode.Auto: + mode = ControllerMode.Gamepad; + break; + case ControllerMode.Gamepad: + mode = ControllerMode.Mouse; + break; + case ControllerMode.Mouse: + mode = ControllerMode.Auto; + break; + } SetMode(mode); } diff --git a/app/Gpu/AMD/AmdAdl2.cs b/app/Gpu/AMD/AmdAdl2.cs index d76504f8..c9fc2918 100644 --- a/app/Gpu/AMD/AmdAdl2.cs +++ b/app/Gpu/AMD/AmdAdl2.cs @@ -551,6 +551,47 @@ public class Adl2 int iAdapterIndex, int iEnabled); + // FPS + + [DllImport(Atiadlxx_FileName)] + public static extern int ADL2_Adapter_FrameMetrics_Start( + IntPtr context, + int iAdapterIndex, + int VidPnSourceId + ); + + [DllImport(Atiadlxx_FileName)] + public static extern int ADL2_Adapter_FrameMetrics_Stop( + IntPtr context, + int iAdapterIndex, + int VidPnSourceId + ); + + [DllImport(Atiadlxx_FileName)] + public static extern int ADL2_Adapter_FrameMetrics_Get( + IntPtr context, + int iAdapterIndex, + int VidPnSourceId, + out float iFramesPerSecond + ); + + [DllImport(Atiadlxx_FileName)] + public static extern int ADL2_FPS_Settings_Get(IntPtr context, int iAdapterIndex, out ADLFPSSettingsOutput lpFPSSettings); + + [StructLayout(LayoutKind.Sequential)] + public struct ADLFPSSettingsOutput + { + public int ulSize; + public int bACFPSEnabled; + public int bDCFPSEnabled; + public int ulACFPSCurrent; + public int ulDCFPSCurrent; + public int ulACFPSMaximum; + public int ulACFPSMinimum; + public int ulDCFPSMaximum; + public int ulDCFPSMinimum; + } + // Clocks [StructLayout(LayoutKind.Sequential)] diff --git a/app/Gpu/AMD/AmdGpuControl.cs b/app/Gpu/AMD/AmdGpuControl.cs index 2d0b1f38..011a0282 100644 --- a/app/Gpu/AMD/AmdGpuControl.cs +++ b/app/Gpu/AMD/AmdGpuControl.cs @@ -9,7 +9,9 @@ public class AmdGpuControl : IGpuControl { private bool _isReady; private nint _adlContextHandle; + private readonly ADLAdapterInfo _internalDiscreteAdapter; + private readonly ADLAdapterInfo? _iGPU; public bool IsNvidia => false; @@ -74,6 +76,8 @@ public class AmdGpuControl : IGpuControl _isReady = true; } + _iGPU = FindByType(ADLAsicFamilyType.Integrated); + } public bool IsValid => _isReady && _adlContextHandle != nint.Zero; @@ -139,6 +143,29 @@ public class AmdGpuControl : IGpuControl return true; } + public void StartFPS() + { + if (_adlContextHandle == nint.Zero || _iGPU == null) return; + ADL2_Adapter_FrameMetrics_Start(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, 0); + } + + public void StopFPS() + { + if (_adlContextHandle == nint.Zero || _iGPU == null) return; + ADL2_Adapter_FrameMetrics_Stop(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, 0); + } + + public float GetFPS() + { + if (_adlContextHandle == nint.Zero || _iGPU == null) return 0; + float fps; + + if (ADL2_Adapter_FrameMetrics_Get(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, 0, out fps) != Adl2.ADL_SUCCESS) return 0; + + return fps; + + } + public ADLODNPerformanceLevels? GetGPUClocks() { if (!IsValid) return null; diff --git a/app/Program.cs b/app/Program.cs index b94b1620..e280e9bc 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -6,8 +6,6 @@ using GHelper.Helpers; using GHelper.Input; using GHelper.Mode; using GHelper.Peripherals; -using GHelper.USB; -using Microsoft.VisualBasic.Logging; using Microsoft.Win32; using Ryzen; using System.Diagnostics; @@ -33,7 +31,7 @@ namespace GHelper public static ModeControl modeControl = new ModeControl(); public static GPUModeControl gpuControl = new GPUModeControl(settingsForm); - public static AllyControl controllerControl = new AllyControl(settingsForm); + public static AllyControl allyControl = new AllyControl(settingsForm); public static ScreenControl screenControl = new ScreenControl(); public static ClamshellModeControl clamshellControl = new ClamshellModeControl(); @@ -230,7 +228,7 @@ namespace GHelper settingsForm.AutoKeyboard(); settingsForm.matrixControl.SetMatrix(true); - controllerControl.Init(); + allyControl.Init(); } private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 8295764d..52a63f3c 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -1418,6 +1418,7 @@ namespace GHelper panelAlly.Size = new Size(827, 176); panelAlly.TabIndex = 8; panelAlly.TabStop = true; + panelAlly.Visible = false; // // label1 // diff --git a/app/Settings.cs b/app/Settings.cs index e117393c..d2273c14 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -24,7 +24,7 @@ namespace GHelper public GPUModeControl gpuControl; ScreenControl screenControl = new ScreenControl(); - AllyControl controllerControl; + AllyControl allyControl; AutoUpdateControl updateControl; AsusMouseSettings? mouseSettings; @@ -56,7 +56,7 @@ namespace GHelper gpuControl = new GPUModeControl(this); updateControl = new AutoUpdateControl(this); matrixControl = new AniMatrixControl(this); - controllerControl = new AllyControl(this); + allyControl = new AllyControl(this); buttonSilent.Text = Properties.Strings.Silent; buttonBalanced.Text = Properties.Strings.Balanced; @@ -247,12 +247,16 @@ namespace GHelper private void ButtonController_Click(object? sender, EventArgs e) { - controllerControl.ToggleMode(); + allyControl.ToggleMode(); } public void VisualiseAlly(bool visible = false) { - panelAlly.Visible = visible; + if (!visible) return; + + panelAlly.Visible = true; + labelKeyboard.Text = "Backlight"; + buttonFnLock.Visible = false; } public void VisualiseController(ControllerMode mode) @@ -262,12 +266,12 @@ namespace GHelper case ControllerMode.Gamepad: buttonController.Text = "Gamepad"; break; - case ControllerMode.WASD: - buttonController.Text = "WASD"; - break; case ControllerMode.Mouse: buttonController.Text = "Mouse"; break; + default: + buttonController.Text = "Auto"; + break; } } From 0a3256eb44703e63e88197c38547a557d97e2aa9 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 13:30:07 +0100 Subject: [PATCH 003/107] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 37d95fcd..d396fc29 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -61,7 +61,7 @@ body: - type: checkboxes id: asus attributes: - label: Asus Software + label: Asus Software Running description: Please check what Asus/Armoury Services do you have installed and running options: - label: Armoury Crate From 0217b2a99357eaca87d6f0bcaaef3ef35f42e5f3 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 13:36:19 +0100 Subject: [PATCH 004/107] UI Tweaks --- app/Settings.Designer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 52a63f3c..285cf8ee 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -1481,7 +1481,7 @@ namespace GHelper // pictureAlly // pictureAlly.BackgroundImage = Properties.Resources.icons8_controller_32; - pictureAlly.BackgroundImageLayout = ImageLayout.Center; + pictureAlly.BackgroundImageLayout = ImageLayout.Zoom; pictureAlly.Location = new Point(5, 0); pictureAlly.Margin = new Padding(4); pictureAlly.Name = "pictureAlly"; @@ -1493,7 +1493,7 @@ namespace GHelper // labelAlly.AutoSize = true; labelAlly.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelAlly.Location = new Point(45, 0); + labelAlly.Location = new Point(42, -2); labelAlly.Margin = new Padding(8, 0, 8, 0); labelAlly.Name = "labelAlly"; labelAlly.Size = new Size(58, 32); From 6a9d80583817c49219763f842780f94566b0eaba Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 15:23:43 +0100 Subject: [PATCH 005/107] Removed unsupported GPU modes for Ally --- app/Settings.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Settings.cs b/app/Settings.cs index d2273c14..16aa19fc 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1249,6 +1249,12 @@ namespace GHelper public void VisualiseGPUMode(int GPUMode = -1) { + if (AppConfig.IsAlly() && !Program.acpi.IsXGConnected()) + { + tableGPU.Visible = false; + GPUMode = AsusACPI.GPUModeEco; + } + ButtonEnabled(buttonOptimized, true); ButtonEnabled(buttonEco, true); ButtonEnabled(buttonStandard, true); From 1464a39eb4add506aeab5c1fd9e99280240fc1fd Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 15:48:48 +0100 Subject: [PATCH 006/107] Ally Backlight Button --- app/Ally/AllyControl.cs | 14 ++++++--- app/Settings.Designer.cs | 61 +++++++++++++++++++++++++--------------- app/Settings.cs | 15 ++++++++-- 3 files changed, 61 insertions(+), 29 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 4a2c1dad..be651c89 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,4 +1,5 @@ using GHelper.Gpu.AMD; +using GHelper.Input; using GHelper.USB; namespace GHelper.Ally @@ -19,7 +20,6 @@ namespace GHelper.Ally SettingsForm settings; ControllerMode mode = ControllerMode.Auto; - ControllerMode _autoMode = ControllerMode.Gamepad; int _autoCount = 0; @@ -60,8 +60,15 @@ namespace GHelper.Ally if (AppConfig.IsAlly()) settings.VisualiseAlly(true); else return; - mode = (ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto); - SetMode(mode); + SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto)); + settings.VisualiseBacklight(InputDispatcher.GetBacklight()); + + } + + public void ToggleBacklight() + { + InputDispatcher.SetBacklight(4, true); + settings.VisualiseBacklight(InputDispatcher.GetBacklight()); } private void SetMode(ControllerMode mode) @@ -78,7 +85,6 @@ namespace GHelper.Ally AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)mode }, "ControllerMode"); } - AppConfig.Set("controller_mode", (int)mode); settings.VisualiseController(mode); } diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 285cf8ee..7f5902b1 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -109,12 +109,12 @@ namespace GHelper picturePeripherals = new PictureBox(); labelPeripherals = new Label(); panelAlly = new Panel(); - label1 = new Label(); tableLayoutAlly = new TableLayoutPanel(); buttonController = new RButton(); panelAllyTitle = new Panel(); pictureAlly = new PictureBox(); labelAlly = new Label(); + buttonBacklight = new RButton(); panelMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); panelMatrixTitle.SuspendLayout(); @@ -293,7 +293,7 @@ namespace GHelper panelBattery.Controls.Add(sliderBattery); panelBattery.Controls.Add(panelBatteryTitle); panelBattery.Dock = DockStyle.Top; - panelBattery.Location = new Point(11, 1441); + panelBattery.Location = new Point(11, 1405); panelBattery.Margin = new Padding(0); panelBattery.Name = "panelBattery"; panelBattery.Padding = new Padding(20, 20, 20, 10); @@ -385,7 +385,7 @@ namespace GHelper panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelFooter.Controls.Add(tableButtons); panelFooter.Dock = DockStyle.Top; - panelFooter.Location = new Point(11, 1616); + panelFooter.Location = new Point(11, 1580); panelFooter.Margin = new Padding(0); panelFooter.Name = "panelFooter"; panelFooter.Padding = new Padding(20); @@ -1067,7 +1067,7 @@ namespace GHelper panelKeyboard.Controls.Add(tableLayoutKeyboard); panelKeyboard.Controls.Add(panelKeyboardTitle); panelKeyboard.Dock = DockStyle.Top; - panelKeyboard.Location = new Point(11, 923); + panelKeyboard.Location = new Point(11, 1063); panelKeyboard.Margin = new Padding(0); panelKeyboard.Name = "panelKeyboard"; panelKeyboard.Padding = new Padding(20); @@ -1243,7 +1243,7 @@ namespace GHelper panelVersion.Controls.Add(labelCharge); panelVersion.Controls.Add(checkStartup); panelVersion.Dock = DockStyle.Top; - panelVersion.Location = new Point(11, 1560); + panelVersion.Location = new Point(11, 1524); panelVersion.Margin = new Padding(4); panelVersion.Name = "panelVersion"; panelVersion.Size = new Size(827, 56); @@ -1268,7 +1268,7 @@ namespace GHelper panelPeripherals.Controls.Add(tableLayoutPeripherals); panelPeripherals.Controls.Add(panelPeripheralsTile); panelPeripherals.Dock = DockStyle.Top; - panelPeripherals.Location = new Point(11, 1243); + panelPeripherals.Location = new Point(11, 1207); panelPeripherals.Margin = new Padding(0); panelPeripherals.Name = "panelPeripherals"; panelPeripherals.Padding = new Padding(20, 20, 20, 10); @@ -1407,29 +1407,18 @@ namespace GHelper panelAlly.AccessibleRole = AccessibleRole.Grouping; panelAlly.AutoSize = true; panelAlly.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panelAlly.Controls.Add(label1); panelAlly.Controls.Add(tableLayoutAlly); panelAlly.Controls.Add(panelAllyTitle); panelAlly.Dock = DockStyle.Top; - panelAlly.Location = new Point(11, 1067); + panelAlly.Location = new Point(11, 923); panelAlly.Margin = new Padding(0); panelAlly.Name = "panelAlly"; panelAlly.Padding = new Padding(20, 20, 20, 0); - panelAlly.Size = new Size(827, 176); + panelAlly.Size = new Size(827, 140); panelAlly.TabIndex = 8; panelAlly.TabStop = true; panelAlly.Visible = false; // - // label1 - // - label1.Dock = DockStyle.Top; - label1.ForeColor = SystemColors.GrayText; - label1.Location = new Point(20, 140); - label1.Margin = new Padding(4, 0, 4, 0); - label1.Name = "label1"; - label1.Size = new Size(787, 36); - label1.TabIndex = 24; - // // tableLayoutAlly // tableLayoutAlly.AutoSize = true; @@ -1438,6 +1427,7 @@ namespace GHelper tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + tableLayoutAlly.Controls.Add(buttonBacklight, 0, 0); tableLayoutAlly.Controls.Add(buttonController, 0, 0); tableLayoutAlly.Dock = DockStyle.Top; tableLayoutAlly.Location = new Point(20, 60); @@ -1458,6 +1448,8 @@ namespace GHelper buttonController.FlatAppearance.BorderSize = 0; buttonController.FlatStyle = FlatStyle.Flat; buttonController.ForeColor = SystemColors.ControlText; + buttonController.Image = Properties.Resources.icons8_game_controller_48; + buttonController.ImageAlign = ContentAlignment.MiddleRight; buttonController.Location = new Point(4, 4); buttonController.Margin = new Padding(4); buttonController.Name = "buttonController"; @@ -1465,6 +1457,7 @@ namespace GHelper buttonController.Size = new Size(254, 72); buttonController.TabIndex = 9; buttonController.Text = Properties.Strings.AutoMode; + buttonController.TextImageRelation = TextImageRelation.ImageBeforeText; buttonController.UseVisualStyleBackColor = false; // // panelAllyTitle @@ -1496,9 +1489,31 @@ namespace GHelper labelAlly.Location = new Point(42, -2); labelAlly.Margin = new Padding(8, 0, 8, 0); labelAlly.Name = "labelAlly"; - labelAlly.Size = new Size(58, 32); + labelAlly.Size = new Size(181, 32); labelAlly.TabIndex = 26; - labelAlly.Text = "Ally"; + labelAlly.Text = "Ally Controller"; + // + // buttonBacklight + // + buttonBacklight.Activated = false; + buttonBacklight.BackColor = SystemColors.ControlLightLight; + buttonBacklight.BorderColor = Color.Transparent; + buttonBacklight.BorderRadius = 5; + buttonBacklight.Dock = DockStyle.Fill; + buttonBacklight.FlatAppearance.BorderSize = 0; + buttonBacklight.FlatStyle = FlatStyle.Flat; + buttonBacklight.ForeColor = SystemColors.ControlText; + buttonBacklight.Image = Properties.Resources.backlight; + buttonBacklight.ImageAlign = ContentAlignment.MiddleRight; + buttonBacklight.Location = new Point(266, 4); + buttonBacklight.Margin = new Padding(4); + buttonBacklight.Name = "buttonBacklight"; + buttonBacklight.Secondary = false; + buttonBacklight.Size = new Size(254, 72); + buttonBacklight.TabIndex = 10; + buttonBacklight.Text = "100%"; + buttonBacklight.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonBacklight.UseVisualStyleBackColor = false; // // SettingsForm // @@ -1511,8 +1526,8 @@ namespace GHelper Controls.Add(panelVersion); Controls.Add(panelBattery); Controls.Add(panelPeripherals); - Controls.Add(panelAlly); Controls.Add(panelKeyboard); + Controls.Add(panelAlly); Controls.Add(panelMatrix); Controls.Add(panelScreen); Controls.Add(panelGPU); @@ -1665,11 +1680,11 @@ namespace GHelper private RButton buttonFnLock; private RButton buttonBatteryFull; private Panel panelAlly; - private Label label1; private TableLayoutPanel tableLayoutAlly; private RButton buttonController; private Panel panelAllyTitle; private Label labelAlly; private PictureBox pictureAlly; + private RButton buttonBacklight; } } diff --git a/app/Settings.cs b/app/Settings.cs index 16aa19fc..3149d5d1 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -231,6 +231,7 @@ namespace GHelper buttonBatteryFull.Click += ButtonBatteryFull_Click; buttonController.Click += ButtonController_Click; + buttonBacklight.Click += ButtonBacklight_Click; Text = "G-Helper " + (ProcessHelper.IsUserAdministrator() ? "—" : "-") + " " + AppConfig.GetModelShort(); TopMost = AppConfig.Is("topmost"); @@ -245,6 +246,11 @@ namespace GHelper panelPerformance.Focus(); } + private void ButtonBacklight_Click(object? sender, EventArgs e) + { + allyControl.ToggleBacklight(); + } + private void ButtonController_Click(object? sender, EventArgs e) { allyControl.ToggleMode(); @@ -255,8 +261,8 @@ namespace GHelper if (!visible) return; panelAlly.Visible = true; - labelKeyboard.Text = "Backlight"; - buttonFnLock.Visible = false; + panelKeyboardTitle.Visible = false; + panelKeyboard.Padding = new Padding(20, 0, 20, 20); } public void VisualiseController(ControllerMode mode) @@ -275,6 +281,11 @@ namespace GHelper } } + public void VisualiseBacklight(int backlight) + { + buttonBacklight.Text = Math.Round((double)backlight*33.33).ToString() + "%"; + } + private void SettingsForm_LostFocus(object? sender, EventArgs e) { lastLostFocus = DateTimeOffset.Now.ToUnixTimeMilliseconds(); From b1b187f098412ed7b65eb44b93e89f5df973c412 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 15:57:59 +0100 Subject: [PATCH 007/107] Dimmer minimum backlight brightness for Ally --- app/USB/Aura.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 80eeba43..05fb3f63 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -264,6 +264,16 @@ namespace GHelper.USB if (isACPI) Program.acpi.TUFKeyboardBrightness(brightness); AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log); + + if (AppConfig.IsAlly()) + { + switch (brightness) + { + case 1: ApplyAura(0.1); break; + case 2: ApplyAura(0.2); break; + } + } + if (AppConfig.ContainsModel("GA503")) AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log); }); @@ -558,7 +568,7 @@ namespace GHelper.USB } - public static void ApplyAura() + public static void ApplyAura(double colorDim = 1) { Mode = (AuraMode)AppConfig.Get("aura_mode"); @@ -566,6 +576,13 @@ namespace GHelper.USB SetColor(AppConfig.Get("aura_color")); SetColor2(AppConfig.Get("aura_color2")); + if (colorDim < 1) + { + Color1 = Color.FromArgb((int)(Color1.R * colorDim), (int)(Color1.G * colorDim), (int)(Color1.B * colorDim)); + Color2 = Color.FromArgb((int)(Color2.R * colorDim), (int)(Color2.G * colorDim), (int)(Color2.B * colorDim)); + } + + timer.Enabled = false; Logger.WriteLine($"AuraMode: {Mode}"); From 3bd35074fe89b72d7f0eebac4d21a07206c984ca Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 16:10:46 +0100 Subject: [PATCH 008/107] Hide unsupported options for Ally at Extra screen --- app/Extra.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Extra.cs b/app/Extra.cs index e098e00f..1747124f 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -226,6 +226,8 @@ namespace GHelper SetKeyCombo(comboM4, textM4, "m4"); SetKeyCombo(comboFNF4, textFNF4, "paddle"); + checkGpuApps.Visible = false; + checkUSBC.Visible = false; int apuMem = Program.acpi.GetAPUMem(); if (apuMem >= 0) From 5986707f90614125db3a983e6216b7e99dddd7f1 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 16:34:45 +0100 Subject: [PATCH 009/107] Ally Aura Tweaks --- app/USB/Aura.cs | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 05fb3f63..1abcd531 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -105,6 +105,14 @@ namespace GHelper.USB { AuraMode.AMBIENT, "Ambient"}, }; + private static Dictionary _modesAlly = new Dictionary + { + { AuraMode.AuraStatic, Properties.Strings.AuraStatic }, + { AuraMode.AuraBreathe, Properties.Strings.AuraBreathe }, + { AuraMode.AuraColorCycle, Properties.Strings.AuraColorCycle }, + { AuraMode.AuraStrobe, Properties.Strings.AuraStrobe }, + }; + private static Dictionary _modesStrix = new Dictionary { { AuraMode.AuraStatic, Properties.Strings.AuraStatic }, @@ -161,6 +169,11 @@ namespace GHelper.USB return _modesSingleColor; } + if (AppConfig.IsAlly()) + { + return _modesAlly; + } + if (AppConfig.IsAdvantageEdition()) { return _modes; @@ -265,14 +278,7 @@ namespace GHelper.USB AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log); - if (AppConfig.IsAlly()) - { - switch (brightness) - { - case 1: ApplyAura(0.1); break; - case 2: ApplyAura(0.2); break; - } - } + if (AppConfig.IsAlly()) ApplyAura(); if (AppConfig.ContainsModel("GA503")) AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log); @@ -576,12 +582,24 @@ namespace GHelper.USB SetColor(AppConfig.Get("aura_color")); SetColor2(AppConfig.Get("aura_color2")); - if (colorDim < 1) - { - Color1 = Color.FromArgb((int)(Color1.R * colorDim), (int)(Color1.G * colorDim), (int)(Color1.B * colorDim)); - Color2 = Color.FromArgb((int)(Color2.R * colorDim), (int)(Color2.G * colorDim), (int)(Color2.B * colorDim)); - } + Color _Color1 = Color1; + Color _Color2 = Color2; + // Ally lower brightness fix + if (AppConfig.IsAlly()) + { + switch (InputDispatcher.GetBacklight()) + { + case 1: colorDim = 0.1; break; + case 2: colorDim = 0.3; break; + } + + if (colorDim < 1) + { + _Color1 = Color.FromArgb((int)(Color1.R * colorDim), (int)(Color1.G * colorDim), (int)(Color1.B * colorDim)); + _Color2 = Color.FromArgb((int)(Color2.R * colorDim), (int)(Color2.G * colorDim), (int)(Color2.B * colorDim)); + } + } timer.Enabled = false; @@ -611,7 +629,7 @@ namespace GHelper.USB int _speed = (Speed == AuraSpeed.Normal) ? 0xeb : (Speed == AuraSpeed.Fast) ? 0xf5 : 0xe1; - AsusHid.Write(new List { AuraMessage(Mode, Color1, Color2, _speed, isSingleColor), MESSAGE_APPLY, MESSAGE_SET }); + AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_APPLY, MESSAGE_SET }); if (isACPI) Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed); From a29cd7e1be5963fecb8b138660861c6971dab335 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 16:36:53 +0100 Subject: [PATCH 010/107] GPU mode fix for TUF https://github.com/seerge/g-helper/discussions/1912 --- app/USB/Aura.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 1abcd531..2ded23a6 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -659,6 +659,8 @@ namespace GHelper.USB break; } + if (isACPI) Program.acpi.TUFKeyboardRGB(AuraMode.AuraStatic, color, 0xeb); + AsusHid.Write(new List { AuraMessage(AuraMode.AuraStatic, color, color, 0xeb, isSingleColor), MESSAGE_APPLY, MESSAGE_SET }); } From bc79784b2f9e32a40dbf7054914e3578d8cdca5b Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sat, 13 Jan 2024 19:33:47 +0100 Subject: [PATCH 011/107] Support for ROG Spatha (#1914) * Added support for ROG Chakram Core (P511) * Add support for the TUF M3 Gen II * Support for Gladius II and Gladius II Origin (P502 and P504) * Support for ROG Spatha Mouse --- app/Peripherals/Mouse/Models/SpathaX.cs | 106 ++++++++++++++++++++++++ app/Peripherals/PeripheralsProvider.cs | 1 + 2 files changed, 107 insertions(+) create mode 100644 app/Peripherals/Mouse/Models/SpathaX.cs diff --git a/app/Peripherals/Mouse/Models/SpathaX.cs b/app/Peripherals/Mouse/Models/SpathaX.cs new file mode 100644 index 00000000..9655ffef --- /dev/null +++ b/app/Peripherals/Mouse/Models/SpathaX.cs @@ -0,0 +1,106 @@ + +namespace GHelper.Peripherals.Mouse.Models +{ + //SPATHA_WIRELESS + public class SpathaX : AsusMouse + { + public SpathaX() : base(0x0B05, 0x1979, "mi_00", true) + { + } + + protected SpathaX(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_00", wireless) + { + } + + public override string GetDisplayName() + { + return "ROG Spatha X (Wireless)"; + } + + public override PollingRate[] SupportedPollingrates() + { + return new PollingRate[] { + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; + } + + public override bool HasAngleSnapping() + { + return true; + } + + public override int ProfileCount() + { + return 5; + } + + public override int DPIProfileCount() + { + return 4; + } + + public override int MaxDPI() + { + return 19_000; + } + + public override bool HasXYDPI() + { + return false; + } + + public override bool HasDebounceSetting() + { + return false; + } + + public override bool HasLiftOffSetting() + { + return true; + } + + public override bool HasRGB() + { + return true; + } + + public override LightingZone[] SupportedLightingZones() + { + return new LightingZone[] { LightingZone.Logo, LightingZone.Scrollwheel, LightingZone.Underglow }; + } + + public override bool HasAutoPowerOff() + { + return true; + } + + public override bool HasAngleTuning() + { + return false; + } + + public override bool HasLowBatteryWarning() + { + return true; + } + + public override bool HasDPIColors() + { + return true; + } + } + + public class SpathaXWired : SpathaX + { + public SpathaXWired() : base(0x1977, false) + { + } + + public override string GetDisplayName() + { + return "ROG Spatha X (Wired)"; + } + } +} diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 3f72b611..4619a261 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -212,6 +212,7 @@ namespace GHelper.Peripherals DetectMouse(new Chakram()); DetectMouse(new ChakramWired()); DetectMouse(new ChakramCore()); + DetectMouse(new SpathaX()); } public static void DetectMouse(AsusMouse am) From e125afde1ab0d12bfb15d9a8c3a9e7e2aa9d5e8c Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 21:37:47 +0100 Subject: [PATCH 012/107] FPS Limit for Ally --- app/Ally/AllyControl.cs | 46 +++++++++++++++++++++---- app/Gpu/AMD/AmdAdl2.cs | 18 ++++++++++ app/Gpu/AMD/AmdGpuControl.cs | 24 +++++++++++-- app/Settings.Designer.cs | 67 +++++++++++++++++++++++++----------- app/Settings.cs | 11 ++++++ 5 files changed, 136 insertions(+), 30 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index be651c89..207a2602 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -15,13 +15,15 @@ namespace GHelper.Ally public class AllyControl { System.Timers.Timer timer = default!; - AmdGpuControl amdControl; + static AmdGpuControl amdControl = new AmdGpuControl(); SettingsForm settings; - ControllerMode mode = ControllerMode.Auto; - ControllerMode _autoMode = ControllerMode.Gamepad; - int _autoCount = 0; + static ControllerMode mode = ControllerMode.Auto; + static ControllerMode _autoMode = ControllerMode.Gamepad; + static int _autoCount = 0; + + static int fpsLimit = -1; public AllyControl(SettingsForm settingsForm) { @@ -29,8 +31,6 @@ namespace GHelper.Ally settings = settingsForm; - amdControl = new AmdGpuControl(); - timer = new System.Timers.Timer(500); timer.Elapsed += Timer_Elapsed; @@ -63,8 +63,39 @@ namespace GHelper.Ally SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto)); settings.VisualiseBacklight(InputDispatcher.GetBacklight()); + fpsLimit = amdControl.GetFPSLimit(); + Logger.WriteLine($"FPS Limit: {fpsLimit}"); + settings.VisualiseFPSLimit(fpsLimit); + + } + public void ToggleFPSLimit() + { + switch (fpsLimit) + { + case 30: + fpsLimit = 40; + break; + case 40: + fpsLimit = 60; + break; + case 60: + fpsLimit = 120; + break; + default: + fpsLimit = 30; + break; + } + + int result = amdControl.SetFPSLimit(fpsLimit); + Logger.WriteLine($"FPS Limit {fpsLimit}: {result}"); + + settings.VisualiseFPSLimit(fpsLimit); + + } + + public void ToggleBacklight() { InputDispatcher.SetBacklight(4, true); @@ -77,7 +108,8 @@ namespace GHelper.Ally { amdControl.StartFPS(); timer.Start(); - } else + } + else { timer.Stop(); amdControl.StopFPS(); diff --git a/app/Gpu/AMD/AmdAdl2.cs b/app/Gpu/AMD/AmdAdl2.cs index c9fc2918..d42dfa53 100644 --- a/app/Gpu/AMD/AmdAdl2.cs +++ b/app/Gpu/AMD/AmdAdl2.cs @@ -578,6 +578,12 @@ public class Adl2 [DllImport(Atiadlxx_FileName)] public static extern int ADL2_FPS_Settings_Get(IntPtr context, int iAdapterIndex, out ADLFPSSettingsOutput lpFPSSettings); + [DllImport(Atiadlxx_FileName)] + public static extern int ADL2_FPS_Settings_Set(IntPtr context, int iAdapterIndex, ADLFPSSettingsInput lpFPSSettings); + + [DllImport(Atiadlxx_FileName)] + public static extern int ADL2_FPS_Settings_Reset(IntPtr context, int iAdapterIndex); + [StructLayout(LayoutKind.Sequential)] public struct ADLFPSSettingsOutput { @@ -592,6 +598,18 @@ public class Adl2 public int ulDCFPSMinimum; } + [StructLayout(LayoutKind.Sequential)] + public struct ADLFPSSettingsInput + { + public int ulSize; + public int bGlobalSettings; + public int ulACFPSCurrent; + public int ulDCFPSCurrent; + + // Assuming ulReserved is an array of 6 integers + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public int[] ulReserved; + } // Clocks [StructLayout(LayoutKind.Sequential)] diff --git a/app/Gpu/AMD/AmdGpuControl.cs b/app/Gpu/AMD/AmdGpuControl.cs index 011a0282..45c2c6e2 100644 --- a/app/Gpu/AMD/AmdGpuControl.cs +++ b/app/Gpu/AMD/AmdGpuControl.cs @@ -159,11 +159,31 @@ public class AmdGpuControl : IGpuControl { if (_adlContextHandle == nint.Zero || _iGPU == null) return 0; float fps; - if (ADL2_Adapter_FrameMetrics_Get(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, 0, out fps) != Adl2.ADL_SUCCESS) return 0; - return fps; + } + public int GetFPSLimit() + { + if (_adlContextHandle == nint.Zero || _iGPU == null) return -1; + ADLFPSSettingsOutput settings; + if (ADL2_FPS_Settings_Get(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, out settings) != Adl2.ADL_SUCCESS) return -1; + return settings.ulACFPSCurrent; + } + + public int SetFPSLimit(int limit) + { + if (_adlContextHandle == nint.Zero || _iGPU == null) return -1; + + ADLFPSSettingsInput settings = new ADLFPSSettingsInput(); + + settings.ulACFPSCurrent = limit; + settings.ulDCFPSCurrent = limit; + settings.bGlobalSettings = 1; + + if (ADL2_FPS_Settings_Set(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, settings) != Adl2.ADL_SUCCESS) return 0; + + return 1; } public ADLODNPerformanceLevels? GetGPUClocks() diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 7f5902b1..10cfaf66 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -110,11 +110,12 @@ namespace GHelper labelPeripherals = new Label(); panelAlly = new Panel(); tableLayoutAlly = new TableLayoutPanel(); + buttonBacklight = new RButton(); buttonController = new RButton(); panelAllyTitle = new Panel(); pictureAlly = new PictureBox(); labelAlly = new Label(); - buttonBacklight = new RButton(); + buttonFPS = new RButton(); panelMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); panelMatrixTitle.SuspendLayout(); @@ -1427,6 +1428,7 @@ namespace GHelper tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + tableLayoutAlly.Controls.Add(buttonFPS, 0, 0); tableLayoutAlly.Controls.Add(buttonBacklight, 0, 0); tableLayoutAlly.Controls.Add(buttonController, 0, 0); tableLayoutAlly.Dock = DockStyle.Top; @@ -1438,6 +1440,28 @@ namespace GHelper tableLayoutAlly.Size = new Size(787, 80); tableLayoutAlly.TabIndex = 23; // + // buttonBacklight + // + buttonBacklight.Activated = false; + buttonBacklight.BackColor = SystemColors.ControlLightLight; + buttonBacklight.BorderColor = Color.Transparent; + buttonBacklight.BorderRadius = 5; + buttonBacklight.Dock = DockStyle.Fill; + buttonBacklight.FlatAppearance.BorderSize = 0; + buttonBacklight.FlatStyle = FlatStyle.Flat; + buttonBacklight.ForeColor = SystemColors.ControlText; + buttonBacklight.Image = Properties.Resources.backlight; + buttonBacklight.ImageAlign = ContentAlignment.MiddleRight; + buttonBacklight.Location = new Point(266, 4); + buttonBacklight.Margin = new Padding(4); + buttonBacklight.Name = "buttonBacklight"; + buttonBacklight.Secondary = false; + buttonBacklight.Size = new Size(254, 72); + buttonBacklight.TabIndex = 10; + buttonBacklight.Text = "100%"; + buttonBacklight.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonBacklight.UseVisualStyleBackColor = false; + // // buttonController // buttonController.Activated = false; @@ -1493,27 +1517,27 @@ namespace GHelper labelAlly.TabIndex = 26; labelAlly.Text = "Ally Controller"; // - // buttonBacklight + // buttonFPS // - buttonBacklight.Activated = false; - buttonBacklight.BackColor = SystemColors.ControlLightLight; - buttonBacklight.BorderColor = Color.Transparent; - buttonBacklight.BorderRadius = 5; - buttonBacklight.Dock = DockStyle.Fill; - buttonBacklight.FlatAppearance.BorderSize = 0; - buttonBacklight.FlatStyle = FlatStyle.Flat; - buttonBacklight.ForeColor = SystemColors.ControlText; - buttonBacklight.Image = Properties.Resources.backlight; - buttonBacklight.ImageAlign = ContentAlignment.MiddleRight; - buttonBacklight.Location = new Point(266, 4); - buttonBacklight.Margin = new Padding(4); - buttonBacklight.Name = "buttonBacklight"; - buttonBacklight.Secondary = false; - buttonBacklight.Size = new Size(254, 72); - buttonBacklight.TabIndex = 10; - buttonBacklight.Text = "100%"; - buttonBacklight.TextImageRelation = TextImageRelation.ImageBeforeText; - buttonBacklight.UseVisualStyleBackColor = false; + buttonFPS.Activated = false; + buttonFPS.BackColor = SystemColors.ControlLightLight; + buttonFPS.BorderColor = Color.Transparent; + buttonFPS.BorderRadius = 5; + buttonFPS.Dock = DockStyle.Fill; + buttonFPS.FlatAppearance.BorderSize = 0; + buttonFPS.FlatStyle = FlatStyle.Flat; + buttonFPS.ForeColor = SystemColors.ControlText; + buttonFPS.Image = Properties.Resources.icons8_video_48; + buttonFPS.ImageAlign = ContentAlignment.MiddleRight; + buttonFPS.Location = new Point(528, 4); + buttonFPS.Margin = new Padding(4); + buttonFPS.Name = "buttonFPS"; + buttonFPS.Secondary = false; + buttonFPS.Size = new Size(255, 72); + buttonFPS.TabIndex = 11; + buttonFPS.Text = "FPS Limit OFF"; + buttonFPS.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonFPS.UseVisualStyleBackColor = false; // // SettingsForm // @@ -1686,5 +1710,6 @@ namespace GHelper private Label labelAlly; private PictureBox pictureAlly; private RButton buttonBacklight; + private RButton buttonFPS; } } diff --git a/app/Settings.cs b/app/Settings.cs index 3149d5d1..1b98e955 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -232,6 +232,7 @@ namespace GHelper buttonController.Click += ButtonController_Click; buttonBacklight.Click += ButtonBacklight_Click; + buttonFPS.Click += ButtonFPS_Click; Text = "G-Helper " + (ProcessHelper.IsUserAdministrator() ? "—" : "-") + " " + AppConfig.GetModelShort(); TopMost = AppConfig.Is("topmost"); @@ -246,6 +247,11 @@ namespace GHelper panelPerformance.Focus(); } + private void ButtonFPS_Click(object? sender, EventArgs e) + { + allyControl.ToggleFPSLimit(); + } + private void ButtonBacklight_Click(object? sender, EventArgs e) { allyControl.ToggleBacklight(); @@ -286,6 +292,11 @@ namespace GHelper buttonBacklight.Text = Math.Round((double)backlight*33.33).ToString() + "%"; } + public void VisualiseFPSLimit(int limit) + { + buttonFPS.Text = "FPS Limit " + ((limit > 0 && limit < 120) ? limit : "OFF"); + } + private void SettingsForm_LostFocus(object? sender, EventArgs e) { lastLostFocus = DateTimeOffset.Now.ToUnixTimeMilliseconds(); From 83fed695e483dbc2ec730703af7c5df5a8b58a51 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:38:12 +0100 Subject: [PATCH 013/107] Ally controller tweaks --- app/Ally/AllyControl.cs | 11 +++++++++-- app/Input/KeyboardListener.cs | 18 ++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 207a2602..5ffeb670 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -20,7 +20,7 @@ namespace GHelper.Ally SettingsForm settings; static ControllerMode mode = ControllerMode.Auto; - static ControllerMode _autoMode = ControllerMode.Gamepad; + static ControllerMode _autoMode = ControllerMode.Auto; static int _autoCount = 0; static int fpsLimit = -1; @@ -60,14 +60,15 @@ namespace GHelper.Ally if (AppConfig.IsAlly()) settings.VisualiseAlly(true); else return; + Deadzones(); SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto)); + settings.VisualiseBacklight(InputDispatcher.GetBacklight()); fpsLimit = amdControl.GetFPSLimit(); Logger.WriteLine($"FPS Limit: {fpsLimit}"); settings.VisualiseFPSLimit(fpsLimit); - } public void ToggleFPSLimit() @@ -102,10 +103,16 @@ namespace GHelper.Ally settings.VisualiseBacklight(InputDispatcher.GetBacklight()); } + private void Deadzones() + { + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4, 0, 100, 0, 100 }, "ControllerDeadzone"); + } + private void SetMode(ControllerMode mode) { if (mode == ControllerMode.Auto) { + _autoMode = ControllerMode.Auto; amdControl.StartFPS(); timer.Start(); } diff --git a/app/Input/KeyboardListener.cs b/app/Input/KeyboardListener.cs index 72ae6441..b7b1468a 100644 --- a/app/Input/KeyboardListener.cs +++ b/app/Input/KeyboardListener.cs @@ -7,17 +7,27 @@ namespace GHelper.Input { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); + Action _handler; public KeyboardListener(Action KeyHandler) { + _handler = KeyHandler; + Listen(); + } + + private void Listen () { + HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID); - + // Fallback - if (input == null) + + int count = 0; + + while (input == null && count++ < 60) { Aura.Init(); Thread.Sleep(1000); - input = input = AsusHid.FindHidStream(AsusHid.INPUT_ID); + input = AsusHid.FindHidStream(AsusHid.INPUT_ID); } if (input == null) @@ -48,7 +58,7 @@ namespace GHelper.Input if (data.Length > 1 && data[0] == AsusHid.INPUT_ID && data[1] > 0 && data[1] != 236) { Logger.WriteLine($"Key: {data[1]}"); - KeyHandler(data[1]); + _handler(data[1]); } } From 0da6540de462cb8dfeab10286f05bcd72938556f Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 14 Jan 2024 20:40:30 +0100 Subject: [PATCH 014/107] Support for Strix Carry (P508) (#1922) --- app/Peripherals/Mouse/Models/StrixCarry.cs | 179 +++++++++++++++++++++ app/Peripherals/PeripheralsProvider.cs | 1 + 2 files changed, 180 insertions(+) create mode 100644 app/Peripherals/Mouse/Models/StrixCarry.cs diff --git a/app/Peripherals/Mouse/Models/StrixCarry.cs b/app/Peripherals/Mouse/Models/StrixCarry.cs new file mode 100644 index 00000000..5fcb906d --- /dev/null +++ b/app/Peripherals/Mouse/Models/StrixCarry.cs @@ -0,0 +1,179 @@ +namespace GHelper.Peripherals.Mouse.Models +{ + //P508 + public class StrixCarry : AsusMouse + { + public StrixCarry() : base(0x0B05, 0x18B4, "mi_01", true) + { + } + + public override int DPIProfileCount() + { + return 2; + } + + public override string GetDisplayName() + { + return "ROG Strix Carry (Wireless)"; + } + + public override PollingRate[] SupportedPollingrates() + { + return new PollingRate[] { + PollingRate.PR125Hz, + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; + } + + public override int ProfileCount() + { + return 3; + } + public override int MaxDPI() + { + return 7_200; + } + public override int DPIIncrements() + { + return 100; + } + + public override bool HasDebounceSetting() + { + return true; + } + + public override bool HasLiftOffSetting() + { + //Potentially does nothing. AC does not show the setting, but the mouse responds to it and stores it. + return true; + } + + public override bool HasRGB() + { + return false; + } + + public override bool HasAutoPowerOff() + { + return true; + } + + public override bool HasAngleSnapping() + { + return true; + } + public override bool HasXYDPI() + { + return false; + } + + public override bool CanChangeDPIProfile() + { + return false; + } + + //Has 25% increments only. + protected override int ParseBattery(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x07) + { + return packet[7] * 25; + } + + return -1; + } + + protected override PowerOffSetting ParsePowerOffSetting(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x07) + { + return (PowerOffSetting)packet[5]; + } + + return PowerOffSetting.Never; + } + + protected override PollingRate ParsePollingRate(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return (PollingRate)packet[9]; + } + + return PollingRate.PR125Hz; + } + + protected override byte[] GetUpdatePollingRatePacket(PollingRate pollingRate) + { + return new byte[] { reportId, 0x51, 0x31, 0x02, 0x00, (byte)pollingRate }; + } + + protected override bool ParseAngleSnapping(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return packet[13] == 0x01; + } + + return false; + } + + protected override byte[] GetUpdateAngleSnappingPacket(bool angleSnapping) + { + return new byte[] { reportId, 0x51, 0x31, 0x04, 0x00, (byte)(angleSnapping ? 0x01 : 0x00) }; + } + + protected override DebounceTime ParseDebounce(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x04 || packet[3] != 0x00) + { + return DebounceTime.MS12; + } + + if (packet[11] < 0x02) + { + return DebounceTime.MS12; + } + + if (packet[11] > 0x07) + { + return DebounceTime.MS32; + } + + return (DebounceTime)packet[11]; + } + + protected override byte[] GetUpdateDebouncePacket(DebounceTime debounce) + { + return new byte[] { reportId, 0x51, 0x31, 0x03, 0x00, ((byte)debounce) }; + } + + protected override int ParseProfile(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x00 && packet[3] == 0x00) + { + return packet[10]; + } + Logger.WriteLine(GetDisplayName() + ": Failed to decode active profile"); + return 0; + } + + protected override int ParseDPIProfile(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x00 && packet[3] == 0x00) + { + return packet[11]; + } + Logger.WriteLine(GetDisplayName() + ": Failed to decode active profile"); + return 1; + } + + protected override byte[] GetUpdateEnergySettingsPacket(int lowBatteryWarning, PowerOffSetting powerOff) + { + return new byte[] { 0x00, 0x51, 0x37, 0x00, 0x00, (byte)powerOff, 0x00, (byte)lowBatteryWarning }; + } + } +} diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 4619a261..28b5c3af 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -213,6 +213,7 @@ namespace GHelper.Peripherals DetectMouse(new ChakramWired()); DetectMouse(new ChakramCore()); DetectMouse(new SpathaX()); + DetectMouse(new StrixCarry()); } public static void DetectMouse(AsusMouse am) From 384a70c51c41e16e7fbbbfe3c57f8a78aad6206a Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 14 Jan 2024 21:29:24 +0100 Subject: [PATCH 015/107] UI tweaks for Ally --- app/AsusACPI.cs | 2 +- app/Settings.Designer.cs | 49 +++++++++++++++++++++++++++++----------- app/Settings.cs | 2 ++ 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index effd6c04..d281c7f4 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -513,7 +513,7 @@ public class AsusACPI for (int i = 0; i < 8; i++) { - if (curve[i] == old) curve[i]++; // preventing 2 points in same spot from default asus profiles + if (curve[i] <= old) curve[i] = (byte)Math.Min(100, old + 6); // preventing 2 points in same spot from default asus profiles points[curve[i]] = curve[i + 8]; old = curve[i]; } diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 10cfaf66..b5fade15 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -115,6 +115,7 @@ namespace GHelper panelAllyTitle = new Panel(); pictureAlly = new PictureBox(); labelAlly = new Label(); + tableAMD = new TableLayoutPanel(); buttonFPS = new RButton(); panelMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); @@ -153,6 +154,7 @@ namespace GHelper tableLayoutAlly.SuspendLayout(); panelAllyTitle.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit(); + tableAMD.SuspendLayout(); SuspendLayout(); // // panelMatrix @@ -164,7 +166,7 @@ namespace GHelper panelMatrix.Controls.Add(panelMatrixTitle); panelMatrix.Controls.Add(checkMatrix); panelMatrix.Dock = DockStyle.Top; - panelMatrix.Location = new Point(11, 747); + panelMatrix.Location = new Point(11, 827); panelMatrix.Margin = new Padding(0); panelMatrix.Name = "panelMatrix"; panelMatrix.Padding = new Padding(20, 20, 20, 10); @@ -294,7 +296,7 @@ namespace GHelper panelBattery.Controls.Add(sliderBattery); panelBattery.Controls.Add(panelBatteryTitle); panelBattery.Dock = DockStyle.Top; - panelBattery.Location = new Point(11, 1405); + panelBattery.Location = new Point(11, 1485); panelBattery.Margin = new Padding(0); panelBattery.Name = "panelBattery"; panelBattery.Padding = new Padding(20, 20, 20, 10); @@ -386,7 +388,7 @@ namespace GHelper panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelFooter.Controls.Add(tableButtons); panelFooter.Dock = DockStyle.Top; - panelFooter.Location = new Point(11, 1580); + panelFooter.Location = new Point(11, 1660); panelFooter.Margin = new Padding(0); panelFooter.Name = "panelFooter"; panelFooter.Padding = new Padding(20); @@ -661,6 +663,7 @@ namespace GHelper panelGPU.AutoSize = true; panelGPU.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelGPU.Controls.Add(labelTipGPU); + panelGPU.Controls.Add(tableAMD); panelGPU.Controls.Add(tableGPU); panelGPU.Controls.Add(panelGPUTitle); panelGPU.Dock = DockStyle.Top; @@ -668,7 +671,7 @@ namespace GHelper panelGPU.Margin = new Padding(0); panelGPU.Name = "panelGPU"; panelGPU.Padding = new Padding(20, 20, 20, 0); - panelGPU.Size = new Size(827, 352); + panelGPU.Size = new Size(827, 432); panelGPU.TabIndex = 1; panelGPU.TabStop = true; // @@ -676,7 +679,7 @@ namespace GHelper // labelTipGPU.Dock = DockStyle.Top; labelTipGPU.ForeColor = SystemColors.GrayText; - labelTipGPU.Location = new Point(20, 316); + labelTipGPU.Location = new Point(20, 396); labelTipGPU.Margin = new Padding(4, 0, 4, 0); labelTipGPU.Name = "labelTipGPU"; labelTipGPU.Size = new Size(787, 36); @@ -897,7 +900,7 @@ namespace GHelper panelScreen.Controls.Add(tableScreen); panelScreen.Controls.Add(panelScreenTitle); panelScreen.Dock = DockStyle.Top; - panelScreen.Location = new Point(11, 571); + panelScreen.Location = new Point(11, 651); panelScreen.Margin = new Padding(0); panelScreen.Name = "panelScreen"; panelScreen.Padding = new Padding(20, 20, 20, 0); @@ -1068,7 +1071,7 @@ namespace GHelper panelKeyboard.Controls.Add(tableLayoutKeyboard); panelKeyboard.Controls.Add(panelKeyboardTitle); panelKeyboard.Dock = DockStyle.Top; - panelKeyboard.Location = new Point(11, 1063); + panelKeyboard.Location = new Point(11, 1143); panelKeyboard.Margin = new Padding(0); panelKeyboard.Name = "panelKeyboard"; panelKeyboard.Padding = new Padding(20); @@ -1244,7 +1247,7 @@ namespace GHelper panelVersion.Controls.Add(labelCharge); panelVersion.Controls.Add(checkStartup); panelVersion.Dock = DockStyle.Top; - panelVersion.Location = new Point(11, 1524); + panelVersion.Location = new Point(11, 1604); panelVersion.Margin = new Padding(4); panelVersion.Name = "panelVersion"; panelVersion.Size = new Size(827, 56); @@ -1269,7 +1272,7 @@ namespace GHelper panelPeripherals.Controls.Add(tableLayoutPeripherals); panelPeripherals.Controls.Add(panelPeripheralsTile); panelPeripherals.Dock = DockStyle.Top; - panelPeripherals.Location = new Point(11, 1207); + panelPeripherals.Location = new Point(11, 1287); panelPeripherals.Margin = new Padding(0); panelPeripherals.Name = "panelPeripherals"; panelPeripherals.Padding = new Padding(20, 20, 20, 10); @@ -1411,7 +1414,7 @@ namespace GHelper panelAlly.Controls.Add(tableLayoutAlly); panelAlly.Controls.Add(panelAllyTitle); panelAlly.Dock = DockStyle.Top; - panelAlly.Location = new Point(11, 923); + panelAlly.Location = new Point(11, 1003); panelAlly.Margin = new Padding(0); panelAlly.Name = "panelAlly"; panelAlly.Padding = new Padding(20, 20, 20, 0); @@ -1428,7 +1431,6 @@ namespace GHelper tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); tableLayoutAlly.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); - tableLayoutAlly.Controls.Add(buttonFPS, 0, 0); tableLayoutAlly.Controls.Add(buttonBacklight, 0, 0); tableLayoutAlly.Controls.Add(buttonController, 0, 0); tableLayoutAlly.Dock = DockStyle.Top; @@ -1517,6 +1519,25 @@ namespace GHelper labelAlly.TabIndex = 26; labelAlly.Text = "Ally Controller"; // + // tableAMD + // + tableAMD.AutoSize = true; + tableAMD.AutoSizeMode = AutoSizeMode.GrowAndShrink; + tableAMD.ColumnCount = 3; + tableAMD.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + tableAMD.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + tableAMD.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + tableAMD.Controls.Add(buttonFPS, 0, 0); + tableAMD.Dock = DockStyle.Top; + tableAMD.Location = new Point(20, 316); + tableAMD.Margin = new Padding(8, 4, 8, 4); + tableAMD.Name = "tableAMD"; + tableAMD.RowCount = 1; + tableAMD.RowStyles.Add(new RowStyle(SizeType.Absolute, 80F)); + tableAMD.Size = new Size(787, 80); + tableAMD.TabIndex = 24; + tableAMD.Visible = false; + // // buttonFPS // buttonFPS.Activated = false; @@ -1529,11 +1550,11 @@ namespace GHelper buttonFPS.ForeColor = SystemColors.ControlText; buttonFPS.Image = Properties.Resources.icons8_video_48; buttonFPS.ImageAlign = ContentAlignment.MiddleRight; - buttonFPS.Location = new Point(528, 4); + buttonFPS.Location = new Point(4, 4); buttonFPS.Margin = new Padding(4); buttonFPS.Name = "buttonFPS"; buttonFPS.Secondary = false; - buttonFPS.Size = new Size(255, 72); + buttonFPS.Size = new Size(254, 72); buttonFPS.TabIndex = 11; buttonFPS.Text = "FPS Limit OFF"; buttonFPS.TextImageRelation = TextImageRelation.ImageBeforeText; @@ -1620,6 +1641,7 @@ namespace GHelper panelAllyTitle.ResumeLayout(false); panelAllyTitle.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit(); + tableAMD.ResumeLayout(false); ResumeLayout(false); PerformLayout(); } @@ -1710,6 +1732,7 @@ namespace GHelper private Label labelAlly; private PictureBox pictureAlly; private RButton buttonBacklight; + private TableLayoutPanel tableAMD; private RButton buttonFPS; } } diff --git a/app/Settings.cs b/app/Settings.cs index 1b98e955..b4ac1fca 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -269,6 +269,8 @@ namespace GHelper panelAlly.Visible = true; panelKeyboardTitle.Visible = false; panelKeyboard.Padding = new Padding(20, 0, 20, 20); + + tableAMD.Visible = true; } public void VisualiseController(ControllerMode mode) From 0270a453b8c252cadd88768ba8931f3e42aa442b Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 15 Jan 2024 09:06:08 +0100 Subject: [PATCH 016/107] Input listener fix https://github.com/seerge/g-helper/issues/1924 --- app/Input/KeyboardListener.cs | 52 ++++++++++++++++------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/app/Input/KeyboardListener.cs b/app/Input/KeyboardListener.cs index b7b1468a..aec31600 100644 --- a/app/Input/KeyboardListener.cs +++ b/app/Input/KeyboardListener.cs @@ -12,7 +12,7 @@ namespace GHelper.Input public KeyboardListener(Action KeyHandler) { _handler = KeyHandler; - Listen(); + var task = Task.Run(Listen); } private void Listen () { @@ -23,10 +23,10 @@ namespace GHelper.Input int count = 0; - while (input == null && count++ < 60) + while (input == null && count++ < 5) { Aura.Init(); - Thread.Sleep(1000); + Thread.Sleep(2000); input = AsusHid.FindHidStream(AsusHid.INPUT_ID); } @@ -38,39 +38,35 @@ namespace GHelper.Input Logger.WriteLine($"Input: {input.Device.DevicePath}"); - var task = Task.Run(() => + try { - try + while (!cancellationTokenSource.Token.IsCancellationRequested) { - while (!cancellationTokenSource.Token.IsCancellationRequested) + + // Emergency break + if (input == null || !input.CanRead) { - - // Emergency break - if (input == null || !input.CanRead) - { - Logger.WriteLine("Listener terminated"); - break; - } - - input.ReadTimeout = int.MaxValue; - - var data = input.Read(); - if (data.Length > 1 && data[0] == AsusHid.INPUT_ID && data[1] > 0 && data[1] != 236) - { - Logger.WriteLine($"Key: {data[1]}"); - _handler(data[1]); - } + Logger.WriteLine("Listener terminated"); + break; } - Logger.WriteLine("Listener stopped"); + input.ReadTimeout = int.MaxValue; + var data = input.Read(); + if (data.Length > 1 && data[0] == AsusHid.INPUT_ID && data[1] > 0 && data[1] != 236) + { + Logger.WriteLine($"Key: {data[1]}"); + _handler(data[1]); + } } - catch (Exception ex) - { - Logger.WriteLine(ex.ToString()); - } - }); + Logger.WriteLine("Listener stopped"); + + } + catch (Exception ex) + { + Logger.WriteLine(ex.ToString()); + } } From e161a76e6651610738a1157affe9c7ac04f2e929 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 15 Jan 2024 09:48:30 +0100 Subject: [PATCH 017/107] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index d396fc29..f57be4b5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,5 @@ name: Bug Report description: Something isn't working correctly -labels: ["bug"] body: - type: markdown attributes: From abd28efb61581599e95eeafd23ab9b9ad6cd2f37 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:56:44 +0100 Subject: [PATCH 018/107] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f57be4b5..066bef48 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -57,15 +57,21 @@ body: attributes: label: Additional information. description: If applicable, add screenshots or other relevant information to help explain your problem. - - type: checkboxes + - type: dropdown + id: armoury + attributes: + label: Armoury Crate + description: Do you have Armoury Crate installed? + options: + - label: Installed + - label: Uninstalled + - label: Never installed + - type: input id: asus attributes: - label: Asus Software Running - description: Please check what Asus/Armoury Services do you have installed and running - options: - - label: Armoury Crate - - label: MyAsus - - label: Other Asus Services + label: Asus Services + description: How many Asus services running do you have? (check ``Extra`` section in G-Helper)? + placeholder: e.g. None - type: input id: version attributes: From 8552eab36721b51dc508b2c6efe295b9067ae17c Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:58:52 +0100 Subject: [PATCH 019/107] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 066bef48..09a76a3d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -63,9 +63,9 @@ body: label: Armoury Crate description: Do you have Armoury Crate installed? options: - - label: Installed - - label: Uninstalled - - label: Never installed + - Uninstalled + - Installed + - Never installed - type: input id: asus attributes: From cf46ed7eff6a576d1de545811e1f0f76d60d81d8 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:59:52 +0100 Subject: [PATCH 020/107] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 09a76a3d..60edffa2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -66,6 +66,7 @@ body: - Uninstalled - Installed - Never installed + default: 0 - type: input id: asus attributes: From 2c8f14f78300233f9fe91b45fc57c7651ef05c6d Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 15 Jan 2024 11:15:22 +0100 Subject: [PATCH 021/107] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 60edffa2..d23646b0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -71,7 +71,7 @@ body: id: asus attributes: label: Asus Services - description: How many Asus services running do you have? (check ``Extra`` section in G-Helper)? + description: How many Asus services do you have running (check ``Extra`` section in G-Helper)? placeholder: e.g. None - type: input id: version From 4e1aa01fae4854d8c5e31ee698f9576acb3165d9 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 15 Jan 2024 21:40:08 +0100 Subject: [PATCH 022/107] Ally Controller Settings --- app/Ally/AllyControl.cs | 22 +- app/Handheld.Designer.cs | 631 ++++++++++++++++++++++++++ app/Handheld.cs | 132 ++++++ app/Handheld.resx | 120 +++++ app/Properties/Resources.Designer.cs | 10 + app/Properties/Resources.resx | 15 +- app/Resources/icons8-soonvibes-32.png | Bin 0 -> 773 bytes app/Settings.Designer.cs | 156 ++++--- app/Settings.cs | 32 +- app/Updates.cs | 1 - 10 files changed, 1039 insertions(+), 80 deletions(-) create mode 100644 app/Handheld.Designer.cs create mode 100644 app/Handheld.cs create mode 100644 app/Handheld.resx create mode 100644 app/Resources/icons8-soonvibes-32.png diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 5ffeb670..26261900 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -103,9 +103,27 @@ namespace GHelper.Ally settings.VisualiseBacklight(InputDispatcher.GetBacklight()); } - private void Deadzones() + static public void Deadzones() { - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4, 0, 100, 0, 100 }, "ControllerDeadzone"); + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4, + (byte)AppConfig.Get("ls_min", 0), + (byte)AppConfig.Get("ls_max", 100), + (byte)AppConfig.Get("rs_min", 0), + (byte)AppConfig.Get("rs_max", 100) }, + "StickDeadzone"); + + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 5, 4, + (byte)AppConfig.Get("lt_min", 0), + (byte)AppConfig.Get("lt_max", 100), + (byte)AppConfig.Get("rt_min", 0), + (byte)AppConfig.Get("rt_max", 100) }, + "TriggerDeadzone"); + + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 6, 2, + (byte)AppConfig.Get("vibra", 100), + (byte)AppConfig.Get("vibra", 100) }, + "Vibration"); + } private void SetMode(ControllerMode mode) diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs new file mode 100644 index 00000000..dcbbd8d9 --- /dev/null +++ b/app/Handheld.Designer.cs @@ -0,0 +1,631 @@ +namespace GHelper +{ + partial class Handheld + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + panelController = new Panel(); + buttonReset = new UI.RButton(); + panelVibra = new Panel(); + labelVibra = new Label(); + labelVibraTitle = new Label(); + trackVibra = new TrackBar(); + panelVibrationTitle = new Panel(); + pictureVibration = new PictureBox(); + labelVibraHeader = new Label(); + panelRT = new Panel(); + trackRTMax = new TrackBar(); + labelRT = new Label(); + trackRTMin = new TrackBar(); + labelRTTitle = new Label(); + panelLT = new Panel(); + trackLTMax = new TrackBar(); + labelLT = new Label(); + trackLTMin = new TrackBar(); + labelLTTitle = new Label(); + panelTDeadzone = new Panel(); + pictureTDeadzone = new PictureBox(); + labelTDeadzone = new Label(); + panelRS = new Panel(); + trackRSMax = new TrackBar(); + labelRS = new Label(); + trackRSMin = new TrackBar(); + labelRSTitle = new Label(); + panelLS = new Panel(); + trackLSMax = new TrackBar(); + labelLS = new Label(); + trackLSMin = new TrackBar(); + labelLSTitle = new Label(); + panelSDeadzone = new Panel(); + pictureSDeadzone = new PictureBox(); + labelSDeadzone = new Label(); + panelController.SuspendLayout(); + panelVibra.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)trackVibra).BeginInit(); + panelVibrationTitle.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureVibration).BeginInit(); + panelRT.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)trackRTMax).BeginInit(); + ((System.ComponentModel.ISupportInitialize)trackRTMin).BeginInit(); + panelLT.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)trackLTMax).BeginInit(); + ((System.ComponentModel.ISupportInitialize)trackLTMin).BeginInit(); + panelTDeadzone.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureTDeadzone).BeginInit(); + panelRS.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)trackRSMax).BeginInit(); + ((System.ComponentModel.ISupportInitialize)trackRSMin).BeginInit(); + panelLS.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)trackLSMax).BeginInit(); + ((System.ComponentModel.ISupportInitialize)trackLSMin).BeginInit(); + panelSDeadzone.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).BeginInit(); + SuspendLayout(); + // + // panelController + // + panelController.AutoSize = true; + panelController.Controls.Add(buttonReset); + panelController.Controls.Add(panelVibra); + panelController.Controls.Add(panelVibrationTitle); + panelController.Controls.Add(panelRT); + panelController.Controls.Add(panelLT); + panelController.Controls.Add(panelTDeadzone); + panelController.Controls.Add(panelRS); + panelController.Controls.Add(panelLS); + panelController.Controls.Add(panelSDeadzone); + panelController.Dock = DockStyle.Left; + panelController.Location = new Point(10, 10); + panelController.Margin = new Padding(4); + panelController.MinimumSize = new Size(560, 800); + panelController.Name = "panelController"; + panelController.Padding = new Padding(0, 0, 0, 18); + panelController.Size = new Size(560, 920); + panelController.TabIndex = 45; + // + // buttonReset + // + buttonReset.Activated = false; + buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonReset.BackColor = SystemColors.ControlLight; + buttonReset.BorderColor = Color.Transparent; + buttonReset.BorderRadius = 2; + buttonReset.FlatStyle = FlatStyle.Flat; + buttonReset.Location = new Point(20, 850); + buttonReset.Margin = new Padding(4, 2, 4, 2); + buttonReset.Name = "buttonReset"; + buttonReset.Secondary = true; + buttonReset.Size = new Size(224, 50); + buttonReset.TabIndex = 54; + buttonReset.Text = "Reset"; + buttonReset.UseVisualStyleBackColor = false; + // + // panelVibra + // + panelVibra.AutoSize = true; + panelVibra.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelVibra.Controls.Add(labelVibra); + panelVibra.Controls.Add(labelVibraTitle); + panelVibra.Controls.Add(trackVibra); + panelVibra.Dock = DockStyle.Top; + panelVibra.Location = new Point(0, 676); + panelVibra.Margin = new Padding(4); + panelVibra.MaximumSize = new Size(0, 124); + panelVibra.Name = "panelVibra"; + panelVibra.Size = new Size(560, 124); + panelVibra.TabIndex = 46; + // + // labelVibra + // + labelVibra.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelVibra.Location = new Point(408, 14); + labelVibra.Margin = new Padding(4, 0, 4, 0); + labelVibra.Name = "labelVibra"; + labelVibra.Size = new Size(124, 32); + labelVibra.TabIndex = 44; + labelVibra.Text = "100%"; + labelVibra.TextAlign = ContentAlignment.TopRight; + // + // labelVibraTitle + // + labelVibraTitle.AutoSize = true; + labelVibraTitle.Location = new Point(10, 14); + labelVibraTitle.Margin = new Padding(4, 0, 4, 0); + labelVibraTitle.Name = "labelVibraTitle"; + labelVibraTitle.Size = new Size(209, 32); + labelVibraTitle.TabIndex = 43; + labelVibraTitle.Text = "Vibration Strength"; + // + // trackVibra + // + trackVibra.Location = new Point(6, 48); + trackVibra.Margin = new Padding(4, 2, 4, 2); + trackVibra.Maximum = 100; + trackVibra.Name = "trackVibra"; + trackVibra.Size = new Size(546, 90); + trackVibra.TabIndex = 42; + trackVibra.TickFrequency = 5; + trackVibra.TickStyle = TickStyle.TopLeft; + trackVibra.Value = 100; + // + // panelVibrationTitle + // + panelVibrationTitle.AutoSize = true; + panelVibrationTitle.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelVibrationTitle.Controls.Add(pictureVibration); + panelVibrationTitle.Controls.Add(labelVibraHeader); + panelVibrationTitle.Dock = DockStyle.Top; + panelVibrationTitle.Location = new Point(0, 616); + panelVibrationTitle.Margin = new Padding(4); + panelVibrationTitle.Name = "panelVibrationTitle"; + panelVibrationTitle.Size = new Size(560, 60); + panelVibrationTitle.TabIndex = 53; + // + // pictureVibration + // + pictureVibration.BackgroundImage = Properties.Resources.icons8_soonvibes_32; + pictureVibration.BackgroundImageLayout = ImageLayout.Zoom; + pictureVibration.ErrorImage = null; + pictureVibration.InitialImage = null; + pictureVibration.Location = new Point(10, 18); + pictureVibration.Margin = new Padding(4, 2, 4, 10); + pictureVibration.Name = "pictureVibration"; + pictureVibration.Size = new Size(32, 32); + pictureVibration.TabIndex = 41; + pictureVibration.TabStop = false; + // + // labelVibraHeader + // + labelVibraHeader.AutoSize = true; + labelVibraHeader.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelVibraHeader.Location = new Point(45, 17); + labelVibraHeader.Margin = new Padding(4, 0, 4, 0); + labelVibraHeader.Name = "labelVibraHeader"; + labelVibraHeader.Size = new Size(121, 32); + labelVibraHeader.TabIndex = 40; + labelVibraHeader.Text = "Vibration"; + // + // panelRT + // + panelRT.AutoSize = true; + panelRT.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelRT.Controls.Add(trackRTMax); + panelRT.Controls.Add(labelRT); + panelRT.Controls.Add(trackRTMin); + panelRT.Controls.Add(labelRTTitle); + panelRT.Dock = DockStyle.Top; + panelRT.Location = new Point(0, 492); + panelRT.Margin = new Padding(4); + panelRT.MaximumSize = new Size(0, 124); + panelRT.Name = "panelRT"; + panelRT.Size = new Size(560, 124); + panelRT.TabIndex = 50; + // + // trackRTMax + // + trackRTMax.Location = new Point(272, 48); + trackRTMax.Margin = new Padding(4, 2, 4, 2); + trackRTMax.Maximum = 100; + trackRTMax.Minimum = 50; + trackRTMax.Name = "trackRTMax"; + trackRTMax.RightToLeft = RightToLeft.No; + trackRTMax.Size = new Size(280, 90); + trackRTMax.TabIndex = 30; + trackRTMax.TickFrequency = 5; + trackRTMax.TickStyle = TickStyle.TopLeft; + trackRTMax.Value = 100; + // + // labelRT + // + labelRT.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelRT.Location = new Point(363, 13); + labelRT.Margin = new Padding(4, 0, 4, 0); + labelRT.Name = "labelRT"; + labelRT.Size = new Size(176, 32); + labelRT.TabIndex = 29; + labelRT.Text = "0 - 100%"; + labelRT.TextAlign = ContentAlignment.TopRight; + // + // trackRTMin + // + trackRTMin.LargeChange = 100; + trackRTMin.Location = new Point(6, 48); + trackRTMin.Margin = new Padding(4, 2, 4, 2); + trackRTMin.Maximum = 50; + trackRTMin.Name = "trackRTMin"; + trackRTMin.RightToLeft = RightToLeft.No; + trackRTMin.Size = new Size(280, 90); + trackRTMin.SmallChange = 10; + trackRTMin.TabIndex = 18; + trackRTMin.TickFrequency = 5; + trackRTMin.TickStyle = TickStyle.TopLeft; + // + // labelRTTitle + // + labelRTTitle.AutoSize = true; + labelRTTitle.Location = new Point(10, 16); + labelRTTitle.Margin = new Padding(4, 0, 4, 0); + labelRTTitle.Name = "labelRTTitle"; + labelRTTitle.Size = new Size(151, 32); + labelRTTitle.TabIndex = 17; + labelRTTitle.Text = "Right Trigger"; + // + // panelLT + // + panelLT.AutoSize = true; + panelLT.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelLT.Controls.Add(trackLTMax); + panelLT.Controls.Add(labelLT); + panelLT.Controls.Add(trackLTMin); + panelLT.Controls.Add(labelLTTitle); + panelLT.Dock = DockStyle.Top; + panelLT.Location = new Point(0, 368); + panelLT.Margin = new Padding(4); + panelLT.MaximumSize = new Size(0, 124); + panelLT.Name = "panelLT"; + panelLT.Size = new Size(560, 124); + panelLT.TabIndex = 51; + // + // trackLTMax + // + trackLTMax.Location = new Point(272, 48); + trackLTMax.Margin = new Padding(4, 2, 4, 2); + trackLTMax.Maximum = 100; + trackLTMax.Minimum = 50; + trackLTMax.Name = "trackLTMax"; + trackLTMax.RightToLeft = RightToLeft.No; + trackLTMax.Size = new Size(280, 90); + trackLTMax.TabIndex = 30; + trackLTMax.TickFrequency = 5; + trackLTMax.TickStyle = TickStyle.TopLeft; + trackLTMax.Value = 100; + // + // labelLT + // + labelLT.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelLT.Location = new Point(363, 13); + labelLT.Margin = new Padding(4, 0, 4, 0); + labelLT.Name = "labelLT"; + labelLT.Size = new Size(176, 32); + labelLT.TabIndex = 29; + labelLT.Text = "0 - 100%"; + labelLT.TextAlign = ContentAlignment.TopRight; + // + // trackLTMin + // + trackLTMin.LargeChange = 100; + trackLTMin.Location = new Point(6, 48); + trackLTMin.Margin = new Padding(4, 2, 4, 2); + trackLTMin.Maximum = 50; + trackLTMin.Name = "trackLTMin"; + trackLTMin.RightToLeft = RightToLeft.No; + trackLTMin.Size = new Size(280, 90); + trackLTMin.SmallChange = 10; + trackLTMin.TabIndex = 18; + trackLTMin.TickFrequency = 5; + trackLTMin.TickStyle = TickStyle.TopLeft; + // + // labelLTTitle + // + labelLTTitle.AutoSize = true; + labelLTTitle.Location = new Point(10, 16); + labelLTTitle.Margin = new Padding(4, 0, 4, 0); + labelLTTitle.Name = "labelLTTitle"; + labelLTTitle.Size = new Size(135, 32); + labelLTTitle.TabIndex = 17; + labelLTTitle.Text = "Left Trigger"; + // + // panelTDeadzone + // + panelTDeadzone.AutoSize = true; + panelTDeadzone.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelTDeadzone.Controls.Add(pictureTDeadzone); + panelTDeadzone.Controls.Add(labelTDeadzone); + panelTDeadzone.Dock = DockStyle.Top; + panelTDeadzone.Location = new Point(0, 308); + panelTDeadzone.Margin = new Padding(4); + panelTDeadzone.Name = "panelTDeadzone"; + panelTDeadzone.Size = new Size(560, 60); + panelTDeadzone.TabIndex = 52; + // + // pictureTDeadzone + // + pictureTDeadzone.BackgroundImage = Properties.Resources.icons8_controller_32; + pictureTDeadzone.BackgroundImageLayout = ImageLayout.Zoom; + pictureTDeadzone.ErrorImage = null; + pictureTDeadzone.InitialImage = null; + pictureTDeadzone.Location = new Point(10, 18); + pictureTDeadzone.Margin = new Padding(4, 2, 4, 10); + pictureTDeadzone.Name = "pictureTDeadzone"; + pictureTDeadzone.Size = new Size(32, 32); + pictureTDeadzone.TabIndex = 41; + pictureTDeadzone.TabStop = false; + // + // labelTDeadzone + // + labelTDeadzone.AutoSize = true; + labelTDeadzone.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelTDeadzone.Location = new Point(45, 17); + labelTDeadzone.Margin = new Padding(4, 0, 4, 0); + labelTDeadzone.Name = "labelTDeadzone"; + labelTDeadzone.Size = new Size(228, 32); + labelTDeadzone.TabIndex = 40; + labelTDeadzone.Text = "Trigger Deadzones"; + // + // panelRS + // + panelRS.AutoSize = true; + panelRS.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelRS.Controls.Add(trackRSMax); + panelRS.Controls.Add(labelRS); + panelRS.Controls.Add(trackRSMin); + panelRS.Controls.Add(labelRSTitle); + panelRS.Dock = DockStyle.Top; + panelRS.Location = new Point(0, 184); + panelRS.Margin = new Padding(4); + panelRS.MaximumSize = new Size(0, 124); + panelRS.Name = "panelRS"; + panelRS.Size = new Size(560, 124); + panelRS.TabIndex = 49; + // + // trackRSMax + // + trackRSMax.Location = new Point(272, 48); + trackRSMax.Margin = new Padding(4, 2, 4, 2); + trackRSMax.Maximum = 100; + trackRSMax.Minimum = 50; + trackRSMax.Name = "trackRSMax"; + trackRSMax.RightToLeft = RightToLeft.No; + trackRSMax.Size = new Size(280, 90); + trackRSMax.TabIndex = 30; + trackRSMax.TickFrequency = 5; + trackRSMax.TickStyle = TickStyle.TopLeft; + trackRSMax.Value = 100; + // + // labelRS + // + labelRS.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelRS.Location = new Point(363, 13); + labelRS.Margin = new Padding(4, 0, 4, 0); + labelRS.Name = "labelRS"; + labelRS.Size = new Size(176, 32); + labelRS.TabIndex = 29; + labelRS.Text = "0 - 100%"; + labelRS.TextAlign = ContentAlignment.TopRight; + // + // trackRSMin + // + trackRSMin.LargeChange = 100; + trackRSMin.Location = new Point(6, 48); + trackRSMin.Margin = new Padding(4, 2, 4, 2); + trackRSMin.Maximum = 50; + trackRSMin.Name = "trackRSMin"; + trackRSMin.RightToLeft = RightToLeft.No; + trackRSMin.Size = new Size(280, 90); + trackRSMin.SmallChange = 10; + trackRSMin.TabIndex = 18; + trackRSMin.TickFrequency = 5; + trackRSMin.TickStyle = TickStyle.TopLeft; + // + // labelRSTitle + // + labelRSTitle.AutoSize = true; + labelRSTitle.Location = new Point(10, 16); + labelRSTitle.Margin = new Padding(4, 0, 4, 0); + labelRSTitle.Name = "labelRSTitle"; + labelRSTitle.Size = new Size(126, 32); + labelRSTitle.TabIndex = 17; + labelRSTitle.Text = "Right Stick"; + // + // panelLS + // + panelLS.AutoSize = true; + panelLS.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelLS.Controls.Add(trackLSMax); + panelLS.Controls.Add(labelLS); + panelLS.Controls.Add(trackLSMin); + panelLS.Controls.Add(labelLSTitle); + panelLS.Dock = DockStyle.Top; + panelLS.Location = new Point(0, 60); + panelLS.Margin = new Padding(4); + panelLS.MaximumSize = new Size(0, 124); + panelLS.Name = "panelLS"; + panelLS.Size = new Size(560, 124); + panelLS.TabIndex = 48; + // + // trackLSMax + // + trackLSMax.Location = new Point(272, 48); + trackLSMax.Margin = new Padding(4, 2, 4, 2); + trackLSMax.Maximum = 100; + trackLSMax.Minimum = 50; + trackLSMax.Name = "trackLSMax"; + trackLSMax.RightToLeft = RightToLeft.No; + trackLSMax.Size = new Size(280, 90); + trackLSMax.TabIndex = 30; + trackLSMax.TickFrequency = 5; + trackLSMax.TickStyle = TickStyle.TopLeft; + trackLSMax.Value = 100; + // + // labelLS + // + labelLS.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelLS.Location = new Point(363, 13); + labelLS.Margin = new Padding(4, 0, 4, 0); + labelLS.Name = "labelLS"; + labelLS.Size = new Size(176, 32); + labelLS.TabIndex = 29; + labelLS.Text = "0 - 100%"; + labelLS.TextAlign = ContentAlignment.TopRight; + // + // trackLSMin + // + trackLSMin.LargeChange = 100; + trackLSMin.Location = new Point(6, 48); + trackLSMin.Margin = new Padding(4, 2, 4, 2); + trackLSMin.Maximum = 50; + trackLSMin.Name = "trackLSMin"; + trackLSMin.RightToLeft = RightToLeft.No; + trackLSMin.Size = new Size(280, 90); + trackLSMin.SmallChange = 10; + trackLSMin.TabIndex = 18; + trackLSMin.TickFrequency = 5; + trackLSMin.TickStyle = TickStyle.TopLeft; + // + // labelLSTitle + // + labelLSTitle.AutoSize = true; + labelLSTitle.Location = new Point(10, 16); + labelLSTitle.Margin = new Padding(4, 0, 4, 0); + labelLSTitle.Name = "labelLSTitle"; + labelLSTitle.Size = new Size(110, 32); + labelLSTitle.TabIndex = 17; + labelLSTitle.Text = "Left Stick"; + // + // panelSDeadzone + // + panelSDeadzone.AutoSize = true; + panelSDeadzone.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelSDeadzone.Controls.Add(pictureSDeadzone); + panelSDeadzone.Controls.Add(labelSDeadzone); + panelSDeadzone.Dock = DockStyle.Top; + panelSDeadzone.Location = new Point(0, 0); + panelSDeadzone.Margin = new Padding(4); + panelSDeadzone.Name = "panelSDeadzone"; + panelSDeadzone.Size = new Size(560, 60); + panelSDeadzone.TabIndex = 43; + // + // pictureSDeadzone + // + pictureSDeadzone.BackgroundImage = Properties.Resources.icons8_controller_32; + pictureSDeadzone.BackgroundImageLayout = ImageLayout.Zoom; + pictureSDeadzone.ErrorImage = null; + pictureSDeadzone.InitialImage = null; + pictureSDeadzone.Location = new Point(10, 18); + pictureSDeadzone.Margin = new Padding(4, 2, 4, 10); + pictureSDeadzone.Name = "pictureSDeadzone"; + pictureSDeadzone.Size = new Size(32, 32); + pictureSDeadzone.TabIndex = 41; + pictureSDeadzone.TabStop = false; + // + // labelSDeadzone + // + labelSDeadzone.AutoSize = true; + labelSDeadzone.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelSDeadzone.Location = new Point(45, 17); + labelSDeadzone.Margin = new Padding(4, 0, 4, 0); + labelSDeadzone.Name = "labelSDeadzone"; + labelSDeadzone.Size = new Size(199, 32); + labelSDeadzone.TabIndex = 40; + labelSDeadzone.Text = "Stick Deadzones"; + // + // Handheld + // + AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1293, 940); + Controls.Add(panelController); + MaximizeBox = false; + MinimizeBox = false; + Name = "Handheld"; + Padding = new Padding(10); + ShowIcon = false; + ShowInTaskbar = false; + Text = "Controller"; + panelController.ResumeLayout(false); + panelController.PerformLayout(); + panelVibra.ResumeLayout(false); + panelVibra.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)trackVibra).EndInit(); + panelVibrationTitle.ResumeLayout(false); + panelVibrationTitle.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureVibration).EndInit(); + panelRT.ResumeLayout(false); + panelRT.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)trackRTMax).EndInit(); + ((System.ComponentModel.ISupportInitialize)trackRTMin).EndInit(); + panelLT.ResumeLayout(false); + panelLT.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)trackLTMax).EndInit(); + ((System.ComponentModel.ISupportInitialize)trackLTMin).EndInit(); + panelTDeadzone.ResumeLayout(false); + panelTDeadzone.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureTDeadzone).EndInit(); + panelRS.ResumeLayout(false); + panelRS.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)trackRSMax).EndInit(); + ((System.ComponentModel.ISupportInitialize)trackRSMin).EndInit(); + panelLS.ResumeLayout(false); + panelLS.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)trackLSMax).EndInit(); + ((System.ComponentModel.ISupportInitialize)trackLSMin).EndInit(); + panelSDeadzone.ResumeLayout(false); + panelSDeadzone.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Panel panelController; + private Panel panelVibra; + private Label labelVibra; + private Label labelVibraTitle; + private TrackBar trackVibra; + private Panel panelLS; + private TrackBar trackLSMax; + private Label labelLS; + private TrackBar trackLSMin; + private Label labelLSTitle; + private Panel panelSDeadzone; + private PictureBox pictureSDeadzone; + private Label labelSDeadzone; + private Panel panelRS; + private TrackBar trackRSMax; + private Label labelRS; + private TrackBar trackRSMin; + private Label labelRSTitle; + private Panel panelRT; + private TrackBar trackRTMax; + private Label labelRT; + private TrackBar trackRTMin; + private Label labelRTTitle; + private Panel panelLT; + private TrackBar trackLTMax; + private Label labelLT; + private TrackBar trackLTMin; + private Label labelLTTitle; + private Panel panelTDeadzone; + private PictureBox pictureTDeadzone; + private Label labelTDeadzone; + private Panel panelVibrationTitle; + private PictureBox pictureVibration; + private Label labelVibraHeader; + private UI.RButton buttonReset; + } +} \ No newline at end of file diff --git a/app/Handheld.cs b/app/Handheld.cs new file mode 100644 index 00000000..5d881b4d --- /dev/null +++ b/app/Handheld.cs @@ -0,0 +1,132 @@ +using GHelper.UI; +using GHelper.Ally; + +namespace GHelper +{ + public partial class Handheld : RForm + { + public Handheld() + { + InitializeComponent(); + InitTheme(true); + + Shown += Handheld_Shown; + + Init(); + + trackLSMin.Scroll += Controller_Scroll; + trackLSMax.Scroll += Controller_Scroll; + trackRSMin.Scroll += Controller_Scroll; + trackRSMax.Scroll += Controller_Scroll; + + trackLTMin.Scroll += Controller_Scroll; + trackLTMax.Scroll += Controller_Scroll; + trackRTMin.Scroll += Controller_Scroll; + trackRTMax.Scroll += Controller_Scroll; + + trackVibra.Scroll += Controller_Scroll; + + buttonReset.Click += ButtonReset_Click; + + trackLSMin.ValueChanged += Controller_Complete; ; + trackLSMax.ValueChanged += Controller_Complete; + trackRSMin.ValueChanged += Controller_Complete; + trackRSMax.ValueChanged += Controller_Complete; + + trackLTMin.ValueChanged += Controller_Complete; + trackLTMax.ValueChanged += Controller_Complete; + trackRTMin.ValueChanged += Controller_Complete; + trackRTMax.ValueChanged += Controller_Complete; + + trackVibra.ValueChanged += Controller_Complete; + + } + + private void Controller_Complete(object? sender, EventArgs e) + { + AllyControl.Deadzones(); + } + + private void ButtonReset_Click(object? sender, EventArgs e) + { + trackLSMin.Value = 0; + trackLSMax.Value = 100; + trackRSMin.Value = 0; + trackRSMax.Value = 100; + + trackLTMin.Value = 0; + trackLTMax.Value = 100; + trackRTMin.Value = 0; + trackRTMax.Value = 100; + + trackVibra.Value = 100; + + AppConfig.Remove("ls_min"); + AppConfig.Remove("ls_max"); + AppConfig.Remove("rs_min"); + AppConfig.Remove("rs_max"); + + AppConfig.Remove("lt_min"); + AppConfig.Remove("lt_max"); + AppConfig.Remove("rt_min"); + AppConfig.Remove("rt_max"); + AppConfig.Remove("vibra"); + + VisualiseController(); + + } + + private void Init() + { + trackLSMin.Value = AppConfig.Get("ls_min", 0); + trackLSMax.Value = AppConfig.Get("ls_max", 100); + trackRSMin.Value = AppConfig.Get("rs_min", 0); + trackRSMax.Value = AppConfig.Get("rs_max", 100); + + trackLTMin.Value = AppConfig.Get("lt_min", 0); + trackLTMax.Value = AppConfig.Get("lt_max", 100); + trackRTMin.Value = AppConfig.Get("rt_min", 0); + trackRTMax.Value = AppConfig.Get("rt_max", 100); + + trackVibra.Value = AppConfig.Get("vibra", 100); + + VisualiseController(); + } + + private void VisualiseController() + { + labelLS.Text = $"{trackLSMin.Value} - {trackLSMax.Value}%"; + labelRS.Text = $"{trackRSMin.Value} - {trackRSMax.Value}%"; + + labelLT.Text = $"{trackLTMin.Value} - {trackLTMax.Value}%"; + labelRT.Text = $"{trackRTMin.Value} - {trackRTMax.Value}%"; + + labelVibra.Text = $"{trackVibra.Value}%"; + } + + private void Controller_Scroll(object? sender, EventArgs e) + { + AppConfig.Set("ls_min", trackLSMin.Value); + AppConfig.Set("ls_max", trackLSMax.Value); + AppConfig.Set("rs_min", trackRSMin.Value); + AppConfig.Set("rs_max", trackRSMax.Value); + + AppConfig.Set("lt_min", trackLTMin.Value); + AppConfig.Set("lt_max", trackLTMax.Value); + AppConfig.Set("rt_min", trackRTMin.Value); + AppConfig.Set("rt_max", trackRTMax.Value); + + AppConfig.Set("vibra", trackVibra.Value); + + VisualiseController(); + + } + + private void Handheld_Shown(object? sender, EventArgs e) + { + Height = Program.settingsForm.Height; + Top = Program.settingsForm.Top; + Left = Program.settingsForm.Left - Width - 5; + } + } +} diff --git a/app/Handheld.resx b/app/Handheld.resx new file mode 100644 index 00000000..af32865e --- /dev/null +++ b/app/Handheld.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 4fe184b7..63e17c92 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -560,6 +560,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_soonvibes_32 { + get { + object obj = ResourceManager.GetObject("icons8-soonvibes-32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 83108d59..f46881bd 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -118,6 +118,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\icons8-charging-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\brightness-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -151,8 +154,8 @@ ..\Resources\icons8-project-management-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-controller-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -205,8 +208,8 @@ ..\Resources\icons8-batterie-voll-geladen-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-charging-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot-standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -301,7 +304,7 @@ ..\Resources\icons8-rocket-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-controller-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/app/Resources/icons8-soonvibes-32.png b/app/Resources/icons8-soonvibes-32.png new file mode 100644 index 0000000000000000000000000000000000000000..046f9b1ff56a6f222a22492233bc203f86e794be GIT binary patch literal 773 zcmV+g1N!`lP)GrV2a!_uHk_qPbQM`z>}9LQs&L5(ec0#Glno3t@>|1pS|}v``G7UR;~Kh z+W)owYp?y?HViTu3M>Zp0jGf5QXB6D77CNPOara~AAo@Z`d--DG>FFmmw_Ke5c_H| z7lB-<(Uy>Uahwa?01T3SB?hd zL>z``{X-AConWiDMw6!l=o03cgP8{$aO`IJ0^6`?>+Mjk8s!c!yW9endDXW74`u%Z zMgzBG+oT%~+;d{?%GV>?uwxWEpj<7=9l8vw3fy*Va&FQ1954d-oP<&za>A9OU8P*h1F25o$HeB< zf6G+hs(!l)5qInKn?e~R11!)1 Date: Tue, 16 Jan 2024 00:50:13 +0100 Subject: [PATCH 023/107] Ally M1/M2 bindings --- app/Ally/AllyControl.cs | 217 +++++++++++++++++++++++++-- app/AnimeMatrix/AnimeMatrixDevice.cs | 2 +- app/Handheld.Designer.cs | 129 +++++++++++++++- app/Handheld.cs | 31 +++- app/Properties/Resources.Designer.cs | 10 ++ app/Properties/Resources.resx | 29 ++-- app/Resources/icons8-next-32.png | Bin 0 -> 248 bytes app/USB/AsusHid.cs | 2 +- 8 files changed, 381 insertions(+), 39 deletions(-) create mode 100644 app/Resources/icons8-next-32.png diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 26261900..8e54ddc9 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -25,6 +25,143 @@ namespace GHelper.Ally static int fpsLimit = -1; + const int CodeM1 = 0x028f; + const int CodeM2 = 0x028e; + + public static Dictionary BindingCodes = new Dictionary + { + { 0x028f, "M1" }, + { 0x028e, "M2" }, + { 0x0000, "-------" }, + { 0x0101, "A" }, + { 0x0102, "B" }, + { 0x0103, "X" }, + { 0x0104, "Y" }, + { 0x0105, "left bumper" }, + { 0x0106, "right bumper" }, + { 0x0107, "left stick click" }, + { 0x0108, "right stick click" }, + { 0x0109, "dpad up" }, + { 0x010A, "dpad down" }, + { 0x010B, "dpad left" }, + { 0x010C, "dpad right" }, + { 0x0111, "view button" }, + { 0x0112, "menu button" }, + { 0x0113, "XBox/Steam" }, + { 0x0276, "Esc" }, + { 0x0250, "F1" }, + { 0x0260, "F2" }, + { 0x0240, "F3" }, + { 0x020C, "F4" }, + { 0x0203, "F5" }, + { 0x020b, "F6" }, + { 0x0280, "F7" }, + { 0x020a, "F8" }, + { 0x0201, "F9" }, + { 0x0209, "F10" }, + { 0x0278, "F11" }, + { 0x0207, "F12" }, + { 0x020E, "`" }, + { 0x0216, "1" }, + { 0x021E, "2" }, + { 0x0226, "3" }, + { 0x0225, "4" }, + { 0x022E, "5" }, + { 0x0236, "6" }, + { 0x023D, "7" }, + { 0x023E, "8" }, + { 0x0246, "9" }, + { 0x0245, "0" }, + { 0x024E, "-" }, + { 0x0255, "=" }, + { 0x0266, "Backspace" }, + { 0x020D, "Tab" }, + { 0x0215, "Q" }, + { 0x021D, "W" }, + { 0x0224, "E" }, + { 0x022D, "R" }, + { 0x022C, "T" }, + { 0x0235, "Y" }, + { 0x023C, "U" }, + { 0x0244, "O" }, + { 0x024D, "P" }, + { 0x0254, "[" }, + { 0x025B, "]" }, + { 0x025D, "|" }, + { 0x0258, "Caps" }, + { 0x021C, "A" }, + { 0x021B, "S" }, + { 0x0223, "D" }, + { 0x022B, "F" }, + { 0x0234, "G" }, + { 0x0233, "H" }, + { 0x023B, "J" }, + { 0x0242, "k" }, + { 0x024b, "l" }, + { 0x024c, ";" }, + { 0x0252, "'" }, + { 0x025A, "Enter" }, + { 0x0288, "LShift" }, + { 0x0222, "X" }, + { 0x021A, "Z" }, + { 0x0221, "C" }, + { 0x022A, "V" }, + { 0x0232, "B" }, + { 0x0231, "N" }, + { 0x023A, "M" }, + { 0x0241, "," }, + { 0x0249, "." }, + { 0x0289, "RShift" }, + { 0x028C, "LCtl" }, + { 0x0282, "Meta" }, + { 0x028A, "LAlt" }, + { 0x0229, "Space" }, + { 0x028B, "RAlt" }, + { 0x0284, "App menu" }, + { 0x028D, "RCtl" }, + { 0x02C3, "PrntScn" }, + { 0x027E, "ScrLk" }, + { 0x02C2, "Insert" }, + { 0x0294, "Home" }, + { 0x0296, "PgUp" }, + { 0x02C0, "Delete" }, + { 0x0295, "End" }, + { 0x0297, "PgDwn" }, + { 0x0298, "UpArrow" }, + { 0x0299, "DownArrow" }, + { 0x0291, "LeftArrow" }, + { 0x029B, "RightArrow" }, + { 0x0277, "NumLock" }, + { 0x0290, "NumSlash" }, + { 0x027C, "NumStar" }, + { 0x027B, "NumHyphen" }, + { 0x0270, "Num0" }, + { 0x0269, "Num1" }, + { 0x0272, "Num2" }, + { 0x027A, "Num3" }, + { 0x026B, "Num4" }, + { 0x0273, "Num5" }, + { 0x0274, "Num6" }, + { 0x026C, "Num7" }, + { 0x0275, "Num8" }, + { 0x027D, "Num9" }, + { 0x0279, "NumPlus" }, + { 0x0281, "NumEnter" }, + { 0x0271, "NumPeriod" }, + { 0x0301, "Mouse left click" }, + { 0x0302, "Mouse right click" }, + { 0x0303, "Mouse middle click" }, + { 0x0304, "Mouse scroll up" }, + { 0x0305, "Mouse scroll down" }, + { 0x0516, "Screenshot" }, + { 0x0519, "Show keyboard" }, + { 0x051c, "Show desktop" }, + { 0x051e, "Begin recording" }, + { 0x0501, "Mic off" }, + { 0x0502, "Vol Down" }, + { 0x0503, "Vol Up" } + }; + public AllyControl(SettingsForm settingsForm) { if (!AppConfig.IsAlly()) return; @@ -49,7 +186,7 @@ namespace GHelper.Ally { _autoMode = _newMode; _autoCount = 0; - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)_autoMode }, "ControllerAuto " + _autoMode); + ApplyMode(_autoMode, "ControllerAuto"); Logger.WriteLine(fps.ToString()); } @@ -60,9 +197,9 @@ namespace GHelper.Ally if (AppConfig.IsAlly()) settings.VisualiseAlly(true); else return; - Deadzones(); + SetDeadzones(); SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto)); - + settings.VisualiseBacklight(InputDispatcher.GetBacklight()); fpsLimit = amdControl.GetFPSLimit(); @@ -103,29 +240,78 @@ namespace GHelper.Ally settings.VisualiseBacklight(InputDispatcher.GetBacklight()); } - static public void Deadzones() + static private byte[] DecodeBinding(int binding) { - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4, - (byte)AppConfig.Get("ls_min", 0), - (byte)AppConfig.Get("ls_max", 100), - (byte)AppConfig.Get("rs_min", 0), - (byte)AppConfig.Get("rs_max", 100) }, - "StickDeadzone"); + byte command = (byte)(binding & 0xFF); + byte device = (byte)((binding >> 8) & 0xFF); + + byte[] code = new byte[10]; + code[0] = device; + switch (device) + { + case 0x02: + code[2] = command; + break; + case 0x03: + code[4] = command; + break; + case 0x05: + code[3] = command; + break; + default: + code[1] = command; + break; + } + + return code; + } + + static public void SetBindings() + { + int M1 = AppConfig.Get("bind_m1", CodeM1); + int M2 = AppConfig.Get("bind_m2", CodeM2); + + byte[] bindings = new byte[50]; + byte[] init = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x02, 0x08, 0x2c }; + + init.CopyTo(bindings, 0); + DecodeBinding(M2).CopyTo(bindings, 5); + if (M2 == CodeM2) DecodeBinding(M2).CopyTo(bindings, 16); + DecodeBinding(M1).CopyTo(bindings, 27); + if (M1 == CodeM1) DecodeBinding(M2).CopyTo(bindings, 16); + + AsusHid.WriteInput(bindings, "Bind"); + } + + static public void SetDeadzones() + { + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4, + (byte)AppConfig.Get("ls_min", 0), + (byte)AppConfig.Get("ls_max", 100), + (byte)AppConfig.Get("rs_min", 0), + (byte)AppConfig.Get("rs_max", 100) + }, "StickDeadzone"); AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 5, 4, (byte)AppConfig.Get("lt_min", 0), (byte)AppConfig.Get("lt_max", 100), (byte)AppConfig.Get("rt_min", 0), - (byte)AppConfig.Get("rt_max", 100) }, - "TriggerDeadzone"); + (byte)AppConfig.Get("rt_max", 100) + }, "TriggerDeadzone"); AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 6, 2, (byte)AppConfig.Get("vibra", 100), - (byte)AppConfig.Get("vibra", 100) }, - "Vibration"); + (byte)AppConfig.Get("vibra", 100) + }, "Vibration"); } + private void ApplyMode(ControllerMode applyMode, string log = "ControllerMode") + { + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)applyMode }, log); + SetBindings(); + } + private void SetMode(ControllerMode mode) { if (mode == ControllerMode.Auto) @@ -138,8 +324,7 @@ namespace GHelper.Ally { timer.Stop(); amdControl.StopFPS(); - - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)mode }, "ControllerMode"); + ApplyMode(mode); } AppConfig.Set("controller_mode", (int)mode); diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index c6a90ab8..93666a3f 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -452,7 +452,7 @@ namespace Starlight.AnimeMatrix } } - SetBitmapDiagonal(bmp, (width - textWidth), height); + SetBitmapDiagonal(bmp, 5 , height); } } diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs index dcbbd8d9..0a477669 100644 --- a/app/Handheld.Designer.cs +++ b/app/Handheld.Designer.cs @@ -63,6 +63,14 @@ panelSDeadzone = new Panel(); pictureSDeadzone = new PictureBox(); labelSDeadzone = new Label(); + panelBindings = new Panel(); + labelM2 = new Label(); + comboM2 = new UI.RComboBox(); + labelM1 = new Label(); + comboM1 = new UI.RComboBox(); + panel1 = new Panel(); + pictureBindings = new PictureBox(); + labelBindings = new Label(); panelController.SuspendLayout(); panelVibra.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)trackVibra).BeginInit(); @@ -84,6 +92,9 @@ ((System.ComponentModel.ISupportInitialize)trackLSMin).BeginInit(); panelSDeadzone.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).BeginInit(); + panelBindings.SuspendLayout(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBindings).BeginInit(); SuspendLayout(); // // panelController @@ -104,7 +115,7 @@ panelController.MinimumSize = new Size(560, 800); panelController.Name = "panelController"; panelController.Padding = new Padding(0, 0, 0, 18); - panelController.Size = new Size(560, 920); + panelController.Size = new Size(560, 912); panelController.TabIndex = 45; // // buttonReset @@ -115,11 +126,11 @@ buttonReset.BorderColor = Color.Transparent; buttonReset.BorderRadius = 2; buttonReset.FlatStyle = FlatStyle.Flat; - buttonReset.Location = new Point(20, 850); + buttonReset.Location = new Point(20, 842); buttonReset.Margin = new Padding(4, 2, 4, 2); buttonReset.Name = "buttonReset"; buttonReset.Secondary = true; - buttonReset.Size = new Size(224, 50); + buttonReset.Size = new Size(239, 50); buttonReset.TabIndex = 54; buttonReset.Text = "Reset"; buttonReset.UseVisualStyleBackColor = false; @@ -543,11 +554,108 @@ labelSDeadzone.TabIndex = 40; labelSDeadzone.Text = "Stick Deadzones"; // + // panelBindings + // + panelBindings.Controls.Add(labelM2); + panelBindings.Controls.Add(comboM2); + panelBindings.Controls.Add(labelM1); + panelBindings.Controls.Add(comboM1); + panelBindings.Controls.Add(panel1); + panelBindings.Dock = DockStyle.Left; + panelBindings.Location = new Point(570, 10); + panelBindings.MinimumSize = new Size(500, 0); + panelBindings.Name = "panelBindings"; + panelBindings.Size = new Size(500, 912); + panelBindings.TabIndex = 46; + // + // labelM2 + // + labelM2.AutoSize = true; + labelM2.Location = new Point(19, 146); + labelM2.Margin = new Padding(4, 0, 4, 0); + labelM2.Name = "labelM2"; + labelM2.Size = new Size(49, 32); + labelM2.TabIndex = 48; + labelM2.Text = "M2"; + // + // comboM2 + // + comboM2.BorderColor = Color.White; + comboM2.ButtonColor = Color.FromArgb(255, 255, 255); + comboM2.FormattingEnabled = true; + comboM2.Items.AddRange(new object[] { Properties.Strings.Default, Properties.Strings.VolumeMute, Properties.Strings.PlayPause, Properties.Strings.PrintScreen, Properties.Strings.ToggleAura, Properties.Strings.Custom }); + comboM2.Location = new Point(82, 144); + comboM2.Margin = new Padding(4, 3, 4, 3); + comboM2.Name = "comboM2"; + comboM2.Size = new Size(374, 40); + comboM2.TabIndex = 47; + // + // labelM1 + // + labelM1.AutoSize = true; + labelM1.Location = new Point(19, 87); + labelM1.Margin = new Padding(4, 0, 4, 0); + labelM1.Name = "labelM1"; + labelM1.Size = new Size(49, 32); + labelM1.TabIndex = 46; + labelM1.Text = "M1"; + // + // comboM1 + // + comboM1.BorderColor = Color.White; + comboM1.ButtonColor = Color.FromArgb(255, 255, 255); + comboM1.FormattingEnabled = true; + comboM1.Items.AddRange(new object[] { Properties.Strings.Default, Properties.Strings.VolumeMute, Properties.Strings.PlayPause, Properties.Strings.PrintScreen, Properties.Strings.ToggleAura, Properties.Strings.Custom }); + comboM1.Location = new Point(82, 85); + comboM1.Margin = new Padding(4, 3, 4, 3); + comboM1.Name = "comboM1"; + comboM1.Size = new Size(374, 40); + comboM1.TabIndex = 45; + // + // panel1 + // + panel1.AutoSize = true; + panel1.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panel1.Controls.Add(pictureBindings); + panel1.Controls.Add(labelBindings); + panel1.Dock = DockStyle.Top; + panel1.Location = new Point(0, 0); + panel1.Margin = new Padding(4); + panel1.Name = "panel1"; + panel1.Size = new Size(500, 60); + panel1.TabIndex = 44; + // + // pictureBindings + // + pictureBindings.BackgroundImage = Properties.Resources.icons8_next_32; + pictureBindings.BackgroundImageLayout = ImageLayout.Zoom; + pictureBindings.ErrorImage = null; + pictureBindings.InitialImage = null; + pictureBindings.Location = new Point(10, 18); + pictureBindings.Margin = new Padding(4, 2, 4, 10); + pictureBindings.Name = "pictureBindings"; + pictureBindings.Size = new Size(32, 32); + pictureBindings.TabIndex = 41; + pictureBindings.TabStop = false; + // + // labelBindings + // + labelBindings.AutoSize = true; + labelBindings.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelBindings.Location = new Point(45, 17); + labelBindings.Margin = new Padding(4, 0, 4, 0); + labelBindings.Name = "labelBindings"; + labelBindings.Size = new Size(114, 32); + labelBindings.TabIndex = 40; + labelBindings.Text = "Bindings"; + // // Handheld // AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1293, 940); + AutoSize = true; + ClientSize = new Size(1082, 932); + Controls.Add(panelBindings); Controls.Add(panelController); MaximizeBox = false; MinimizeBox = false; @@ -586,6 +694,11 @@ panelSDeadzone.ResumeLayout(false); panelSDeadzone.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).EndInit(); + panelBindings.ResumeLayout(false); + panelBindings.PerformLayout(); + panel1.ResumeLayout(false); + panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBindings).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -627,5 +740,13 @@ private PictureBox pictureVibration; private Label labelVibraHeader; private UI.RButton buttonReset; + private Panel panelBindings; + private Panel panel1; + private PictureBox pictureBindings; + private Label labelBindings; + private Label labelM2; + private UI.RComboBox comboM2; + private Label labelM1; + private UI.RComboBox comboM1; } } \ No newline at end of file diff --git a/app/Handheld.cs b/app/Handheld.cs index 5d881b4d..ddf22101 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -3,12 +3,12 @@ using GHelper.Ally; namespace GHelper { - public partial class Handheld : RForm + public partial class Handheld : Form { public Handheld() { InitializeComponent(); - InitTheme(true); + //InitTheme(true); Shown += Handheld_Shown; @@ -28,7 +28,7 @@ namespace GHelper buttonReset.Click += ButtonReset_Click; - trackLSMin.ValueChanged += Controller_Complete; ; + trackLSMin.ValueChanged += Controller_Complete; trackLSMax.ValueChanged += Controller_Complete; trackRSMin.ValueChanged += Controller_Complete; trackRSMax.ValueChanged += Controller_Complete; @@ -40,11 +40,34 @@ namespace GHelper trackVibra.ValueChanged += Controller_Complete; + comboM1.DropDownStyle = ComboBoxStyle.DropDownList; + comboM1.DataSource = new BindingSource(AllyControl.BindingCodes, null); + comboM1.DisplayMember = "Value"; + comboM1.ValueMember = "Key"; + + comboM2.DropDownStyle = ComboBoxStyle.DropDownList; + comboM2.DataSource = new BindingSource(AllyControl.BindingCodes, null); + comboM2.DisplayMember = "Value"; + comboM2.ValueMember = "Key"; + + comboM1.SelectedValue = AppConfig.Get("bind_m1", 0x028f); + comboM2.SelectedValue = AppConfig.Get("bind_m2", 0x028e); + + comboM1.SelectedValueChanged += Binding_SelectedValueChanged; + comboM2.SelectedValueChanged += Binding_SelectedValueChanged; + + } + + private void Binding_SelectedValueChanged(object? sender, EventArgs e) + { + AppConfig.Set("bind_m1", (int)comboM1.SelectedValue); + AppConfig.Set("bind_m2", (int)comboM2.SelectedValue); + AllyControl.SetBindings(); } private void Controller_Complete(object? sender, EventArgs e) { - AllyControl.Deadzones(); + AllyControl.SetDeadzones(); } private void ButtonReset_Click(object? sender, EventArgs e) diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 63e17c92..23999cab 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -440,6 +440,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_next_32 { + get { + object obj = ResourceManager.GetObject("icons8-next-32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index f46881bd..76a2d0f8 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -118,9 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\icons8-charging-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\brightness-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -154,8 +151,8 @@ ..\Resources\icons8-project-management-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-controller-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot-standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -175,6 +172,9 @@ ..\Resources\icons8-help-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-settings-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons8-software-32-white.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -208,8 +208,8 @@ ..\Resources\icons8-batterie-voll-geladen-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-charging-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -241,8 +241,8 @@ ..\Resources\icons8-log-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-controller-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-keyboard-32 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -274,6 +274,9 @@ ..\Resources\icons8-gauge-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons8-leaf-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -286,8 +289,8 @@ ..\Resources\backlight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-settings-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\dot-eco.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -304,7 +307,7 @@ ..\Resources\icons8-rocket-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-next-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/app/Resources/icons8-next-32.png b/app/Resources/icons8-next-32.png new file mode 100644 index 0000000000000000000000000000000000000000..a32a93ef8003850b986318757f9ea380a7e75031 GIT binary patch literal 248 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?3oVGw3ym^DWND7ebg z#WAE}&f95*T!$P4T;mmDZ&h%ujybWpg128_anDj$u9CgpKdMHE#G!j+W5%d6Nen4*8*M5;OXk;vd$@?2>|0bTIm1) literal 0 HcmV?d00001 diff --git a/app/USB/AsusHid.cs b/app/USB/AsusHid.cs index 62838bd5..31c20ea5 100644 --- a/app/USB/AsusHid.cs +++ b/app/USB/AsusHid.cs @@ -68,7 +68,7 @@ public static class AsusHid var payload = new byte[device.GetMaxFeatureReportLength()]; Array.Copy(data, payload, data.Length); stream.SetFeature(payload); - Logger.WriteLine($"{log} Feature {device.ProductID.ToString("X")}|{device.GetMaxFeatureReportLength()}: {BitConverter.ToString(data)}"); + Logger.WriteLine($"{log} {device.ProductID.ToString("X")}|{device.GetMaxFeatureReportLength()}: {BitConverter.ToString(data)}"); } } catch (Exception ex) From ef442f3f11880eb423097562fc736381848b8d71 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 16 Jan 2024 11:54:31 +0100 Subject: [PATCH 024/107] Restored extra backlight checkboxes for Z13 https://github.com/seerge/g-helper/issues/1930 --- app/Extra.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/Extra.cs b/app/Extra.cs index 1747124f..ba2d8fde 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -313,7 +313,7 @@ namespace GHelper checkSleepLogo.CheckedChanged += CheckPower_CheckedChanged; checkShutdownLogo.CheckedChanged += CheckPower_CheckedChanged; - if (!AppConfig.IsStrix()) + if ((!AppConfig.IsStrix() && !AppConfig.IsZ13()) || AppConfig.IsStrixLimitedRGB() || AppConfig.IsARCNM()) { labelBacklightBar.Visible = false; checkAwakeBar.Visible = false; @@ -321,10 +321,6 @@ namespace GHelper checkSleepBar.Visible = false; checkShutdownBar.Visible = false; - } - - if ((!AppConfig.IsStrix() && !AppConfig.IsZ13()) || AppConfig.IsStrixLimitedRGB() || AppConfig.IsARCNM()) - { labelBacklightLid.Visible = false; checkAwakeLid.Visible = false; checkBootLid.Visible = false; @@ -336,7 +332,6 @@ namespace GHelper checkBootLogo.Visible = false; checkSleepLogo.Visible = false; checkShutdownLogo.Visible = false; - } if (!AppConfig.IsStrix() && !AppConfig.IsZ13()) From 30fb32c3d5e930364f2f4a1d3023e1494aa1232e Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:03:11 +0100 Subject: [PATCH 025/107] Reste GPU clock limit when it's not set in new profile https://github.com/seerge/g-helper/issues/1915 --- app/Gpu/GPUModeControl.cs | 12 ------------ app/Mode/ModeControl.cs | 3 +-- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/app/Gpu/GPUModeControl.cs b/app/Gpu/GPUModeControl.cs index 81610140..8ab985ef 100644 --- a/app/Gpu/GPUModeControl.cs +++ b/app/Gpu/GPUModeControl.cs @@ -145,18 +145,6 @@ namespace GHelper.Gpu if (eco == 1) { - /* - if (NvidiaSmi.GetDisplayActiveStatus()) - { - DialogResult dialogResult = MessageBox.Show(Properties.Strings.EnableOptimusText, Properties.Strings.EnableOptimusTitle, MessageBoxButtons.YesNo); - if (dialogResult == DialogResult.No) - { - InitGPUMode(); - return; - } - } - */ - HardwareControl.KillGPUApps(); } diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index bd17bd56..a3fe3f6c 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -318,8 +318,7 @@ namespace GHelper.Mode int memory = AppConfig.GetMode("gpu_memory"); int clock_limit = AppConfig.GetMode("gpu_clock_limit"); - if (core == -1 && memory == -1 && clock_limit == -1) return; - + //if (core == -1 && memory == -1 && clock_limit == -1) return; //if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false; if (Program.acpi.DeviceGet(AsusACPI.GPUEco) == 1) { Logger.WriteLine("Clocks: Eco"); return; } From 5e7a2e8cedf366db73df7d525dda1abd319792b5 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:11:46 +0100 Subject: [PATCH 026/107] New translations strings.resx (Romanian) (#1932) --- app/Properties/Strings.ro.resx | 62 +++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/app/Properties/Strings.ro.resx b/app/Properties/Strings.ro.resx index 3bb9fe9b..b2edf736 100644 --- a/app/Properties/Strings.ro.resx +++ b/app/Properties/Strings.ro.resx @@ -118,16 +118,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Acceleration + Accelerare Nu se poate conecta la ASUS ACPI. Aplicația nu poate funcționa fără aceasta. Încercați să instalați Asus System Control Interface - Restart your device to apply changes + Reporniți dispozitivul pentru a aplica modificările - Restart now? + Reporniți acum? Se pare că GPU-ul este folosit intens, dezactivați? @@ -169,34 +169,34 @@ Reglare automată a modului de alimentare Windows - Memory Assigned to GPU + Memorie alocată GPU-ului Servicii Asus în derulare - Battery State + Starea bateriei Respirație - Clockwise + În sensul acelor de ceas Ciclu de culori - Comet + Cometă - Counterclockwise + În sens invers acelor de ceas Rapid - Lighting Mode + Mod iluminare Normal @@ -205,10 +205,10 @@ Curcubeu - Random + Aleatoriu - React + Reacție Încet @@ -220,7 +220,7 @@ Stroboscop - All + Toate Dock @@ -229,7 +229,7 @@ Logo - Scrollwheel + Rotiță scroll Underglow @@ -268,7 +268,7 @@ Sănătatea bateriei - One time charge to 100% + Încarcă o dată la 100% Actualizări BIOS și Driver @@ -277,7 +277,7 @@ Pornire - Boot Sound + Sunet la pornire Luminozitate @@ -289,7 +289,7 @@ Mărirea luminozității - Calibrate + Calibrează Se încarcă @@ -304,7 +304,7 @@ Personalizat - Deceleration + Decelerare Implicit @@ -316,7 +316,7 @@ Se descarcă - Download + Descarcă Drivers și Aplicații @@ -336,7 +336,7 @@ NVIDIA Display Mode nu este setat la modul Optimus - Energy Settings + Setări energie Extra @@ -405,7 +405,7 @@ Temperatura țintă - Minutes till Hibernation in sleep on battery (0 - OFF) + Minute până la Hibernare în mod repaus pe baterie (0 - Oprit) High @@ -435,7 +435,7 @@ Lightbar - Lighting + Iluminare Logo-ul @@ -477,10 +477,10 @@ 60Hz refresh rate pentru a economisi bateria - Minute + Minut - Minutes + Minute Angle Snapping @@ -495,13 +495,13 @@ Lift Off Distance - Low Battery Warning at + Avertizare baterie scăzută la - Performance + Performanță - Synchronize with mouse + Sincronizare cu mouse-ul Multizone @@ -510,7 +510,7 @@ Oprire microfon - Never + Niciodată Actualizări noi @@ -519,7 +519,7 @@ Nu există actualizări noi - Not Connected + Neconectat Deschide fereastra G-Helper @@ -543,7 +543,7 @@ Mod - Peripherals + Periferice Poză / Gif @@ -552,7 +552,7 @@ Redare / Pauză - Polling Rate + Rată sondaj Limite de putere @@ -564,7 +564,7 @@ PrintScreen - Profile + Profil Închide From 21ad10ce4e3b3c986351d342b1efc78d7d0269a5 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Tue, 16 Jan 2024 15:07:02 +0100 Subject: [PATCH 027/107] Fix for Gladius II Origin (#1936) * Support for Strix Carry (P508) * Fixes polling rate, angle snapping and debounce for Gladius II Origin. --- app/Peripherals/Mouse/Models/GladiusII.cs | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/app/Peripherals/Mouse/Models/GladiusII.cs b/app/Peripherals/Mouse/Models/GladiusII.cs index 638d4a65..6f89201a 100644 --- a/app/Peripherals/Mouse/Models/GladiusII.cs +++ b/app/Peripherals/Mouse/Models/GladiusII.cs @@ -221,6 +221,63 @@ LightingSetting[i] = ls; } } + + + + protected override PollingRate ParsePollingRate(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return (PollingRate)packet[9]; + } + + return PollingRate.PR125Hz; + } + + protected override byte[] GetUpdatePollingRatePacket(PollingRate pollingRate) + { + return new byte[] { reportId, 0x51, 0x31, 0x02, 0x00, (byte)pollingRate }; + } + + protected override bool ParseAngleSnapping(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return packet[13] == 0x01; + } + + return false; + } + + protected override byte[] GetUpdateAngleSnappingPacket(bool angleSnapping) + { + return new byte[] { reportId, 0x51, 0x31, 0x04, 0x00, (byte)(angleSnapping ? 0x01 : 0x00) }; + } + + protected override DebounceTime ParseDebounce(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x04 || packet[3] != 0x00) + { + return DebounceTime.MS12; + } + + if (packet[11] < 0x02) + { + return DebounceTime.MS12; + } + + if (packet[11] > 0x07) + { + return DebounceTime.MS32; + } + + return (DebounceTime)packet[11]; + } + + protected override byte[] GetUpdateDebouncePacket(DebounceTime debounce) + { + return new byte[] { reportId, 0x51, 0x31, 0x03, 0x00, ((byte)debounce) }; + } } //P502 From 745deef642bfb0bbcc93ebc5e8247de6d89e93d7 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 16 Jan 2024 15:07:51 +0100 Subject: [PATCH 028/107] New translations strings.resx (Romanian) (#1934) --- app/Properties/Strings.ro.resx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/Properties/Strings.ro.resx b/app/Properties/Strings.ro.resx index b2edf736..baabbe6b 100644 --- a/app/Properties/Strings.ro.resx +++ b/app/Properties/Strings.ro.resx @@ -232,7 +232,7 @@ Rotiță scroll - Underglow + Iluminare de jos Aplicare automată @@ -250,16 +250,16 @@ Timeout conectat / folosind bateria (0 - ON) - Backlight Timeout when on battery + Timp oprire iluminare pe baterie - Backlight Timeout when plugged + Timp oprire iluminare când e conectat Echilibrat - Charge + Încărcare Limita de încărcare a bateriei @@ -408,7 +408,7 @@ Minute până la Hibernare în mod repaus pe baterie (0 - Oprit) - High + Ridicat Asocieri taste @@ -429,7 +429,7 @@ Ecran Laptop - Lid + Capac Lightbar @@ -441,7 +441,7 @@ Logo-ul - Low + Scăzut Vizualizator audio @@ -471,10 +471,10 @@ Imagine - Valoare maximă refresh rate pentru latență mai mică + Rata maximă de reîmprospătare pentru latență mai mică - 60Hz refresh rate pentru a economisi bateria + 60Hz rată de reîmprospătare pentru a economisi bateria Minut @@ -483,16 +483,16 @@ Minute - Angle Snapping + Fixare mișcare la unghi - Auto Power Off After + Oprire automată după - Button Response + Răspuns buton - Lift Off Distance + Distanța de oprire Avertizare baterie scăzută la @@ -570,7 +570,7 @@ Închide - Something is using dGPU and preventing Eco mode. Let G-Helper try to restart dGPU in device manager? (Please proceed at your own risk) + Ceva folosește dGPU și previne modul Eco. Permiteți G-Helper să repornească dGPU în managerul de dispozitive? (Continuați pe propriul risc) RPM From 1657e89599edad036e894393c1298a0e36f5ac3e Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:31:20 +0100 Subject: [PATCH 029/107] Ally Bindings --- app/Ally/AllyControl.cs | 145 +++++++++-- app/AppConfig.cs | 2 +- app/Handheld.Designer.cs | 116 +++------ app/Handheld.cs | 77 ++++-- app/Properties/Resources.Designer.cs | 20 ++ app/Properties/Resources.resx | 348 ++++++++++++++------------- app/Resources/icons8-joystick-32.png | Bin 0 -> 288 bytes app/Resources/icons8-xbox-lt-32.png | Bin 0 -> 458 bytes 8 files changed, 417 insertions(+), 291 deletions(-) create mode 100644 app/Resources/icons8-joystick-32.png create mode 100644 app/Resources/icons8-xbox-lt-32.png diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 8e54ddc9..601d4749 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,6 +1,7 @@ using GHelper.Gpu.AMD; using GHelper.Input; using GHelper.USB; +using System.Text; namespace GHelper.Ally { @@ -9,9 +10,23 @@ namespace GHelper.Ally { Auto = 0, Gamepad = 1, + WASD = 2, Mouse = 3, } + public enum BindingZone : byte + { + DPadUpDown = 1, + DPadLeftRight = 2, + StickClick = 3, + Bumper = 4, + AB = 5, + XY = 6, + ViewMenu = 7, + M1M2 = 8, + Trigger = 9 + } + public class AllyControl { System.Timers.Timer timer = default!; @@ -25,28 +40,62 @@ namespace GHelper.Ally static int fpsLimit = -1; - const int CodeM1 = 0x028f; - const int CodeM2 = 0x028e; + public const int CodeM1 = 0x028f; + public const int CodeM2 = 0x028e; + + private byte[] commitReset1of4 = new byte[64] + { + 0x5A, 0xD1, 0x0F, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + }; + + private byte[] commitReset2of4 = new byte[64] + { + 0x5A, 0xD1, 0x06, 0x02, 0x64, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + private byte[] commitReset3of4 = new byte[64] + { + 0x5A, 0xD1, 0x04, 0x04, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + private byte[] commitReset4of4 = new byte[64] + { + 0x5A, 0xD1, 0x05, 0x04, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; public static Dictionary BindingCodes = new Dictionary { + { -1, "--------" }, + { 0x0000, "[ Disabled ]" }, { 0x028f, "M1" }, { 0x028e, "M2" }, - { 0x0000, "-------" }, { 0x0101, "A" }, { 0x0102, "B" }, { 0x0103, "X" }, { 0x0104, "Y" }, - { 0x0105, "left bumper" }, - { 0x0106, "right bumper" }, - { 0x0107, "left stick click" }, - { 0x0108, "right stick click" }, - { 0x0109, "dpad up" }, - { 0x010A, "dpad down" }, - { 0x010B, "dpad left" }, - { 0x010C, "dpad right" }, - { 0x0111, "view button" }, - { 0x0112, "menu button" }, + { 0x0105, "Left Bumper" }, + { 0x0106, "Right Bumper" }, + { 0x0107, "Left Stick Click" }, + { 0x0108, "Right Stick Click" }, + { 0x0109, "DPad Up" }, + { 0x010A, "DPad Down" }, + { 0x010B, "DPad Left" }, + { 0x010C, "DPad Right" }, + { 0x0111, "View Button" }, + { 0x0112, "Menu Button" }, { 0x0113, "XBox/Steam" }, { 0x0276, "Esc" }, { 0x0250, "F1" }, @@ -242,6 +291,9 @@ namespace GHelper.Ally static private byte[] DecodeBinding(int binding) { + + if (binding < 0) return new byte[2]; + byte command = (byte)(binding & 0xFF); byte device = (byte)((binding >> 8) & 0xFF); @@ -266,21 +318,65 @@ namespace GHelper.Ally return code; } - static public void SetBindings() - { - int M1 = AppConfig.Get("bind_m1", CodeM1); - int M2 = AppConfig.Get("bind_m2", CodeM2); - byte[] bindings = new byte[50]; - byte[] init = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x02, 0x08, 0x2c }; + static private void ApplyBindings(BindingZone zone) + { + int Key1, Key2; + switch (zone) + { + case BindingZone.DPadUpDown: + Key1 = AppConfig.Get("bind_dpu"); + Key2 = AppConfig.Get("bind_dpd"); + break; + case BindingZone.DPadLeftRight: + Key1 = AppConfig.Get("bind_dpl"); + Key2 = AppConfig.Get("bind_dpr"); + break; + case BindingZone.AB: + Key1 = AppConfig.Get("bind_a"); + Key2 = AppConfig.Get("bind_b"); + break; + case BindingZone.XY: + Key1 = AppConfig.Get("bind_x"); + Key2 = AppConfig.Get("bind_y"); + break; + default: + Key1 = AppConfig.Get("bind_m2"); + Key2 = AppConfig.Get("bind_m1"); + break; + } + + if (Key1 == -1 && Key2 == -1) return; + + byte[] bindings = new byte[64]; + byte[] init = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x02, (byte)zone, 0x2c }; init.CopyTo(bindings, 0); - DecodeBinding(M2).CopyTo(bindings, 5); - if (M2 == CodeM2) DecodeBinding(M2).CopyTo(bindings, 16); - DecodeBinding(M1).CopyTo(bindings, 27); - if (M1 == CodeM1) DecodeBinding(M2).CopyTo(bindings, 16); + + DecodeBinding(Key1).CopyTo(bindings, 5); + DecodeBinding(Key1).CopyTo(bindings, 16); + + DecodeBinding(Key2).CopyTo(bindings, 27); + DecodeBinding(Key2).CopyTo(bindings, 38); + + //AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc."), "Init"); + + AsusHid.WriteInput(bindings, $"Bind{zone}"); + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }); + + + + } + + static public void SetBindings() + { + ApplyBindings(BindingZone.DPadUpDown); + ApplyBindings(BindingZone.DPadLeftRight); + ApplyBindings(BindingZone.AB); + ApplyBindings(BindingZone.M1M2); + ApplyBindings(BindingZone.XY); + - AsusHid.WriteInput(bindings, "Bind"); } static public void SetDeadzones() @@ -309,6 +405,7 @@ namespace GHelper.Ally private void ApplyMode(ControllerMode applyMode, string log = "ControllerMode") { AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)applyMode }, log); + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }); SetBindings(); } diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 887d305d..f111d7a4 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -384,7 +384,7 @@ public static class AppConfig public static bool IsStrixLimitedRGB() { - return (ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC") || ContainsModel("G513QM")) && !Is("per_key_rgb"); + return (ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC") || ContainsModel("G513QM") || ContainsModel("G531G")) && !Is("per_key_rgb"); } public static bool IsNoDirectRGB() diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs index 0a477669..ef6dd6ca 100644 --- a/app/Handheld.Designer.cs +++ b/app/Handheld.Designer.cs @@ -64,11 +64,8 @@ pictureSDeadzone = new PictureBox(); labelSDeadzone = new Label(); panelBindings = new Panel(); - labelM2 = new Label(); - comboM2 = new UI.RComboBox(); - labelM1 = new Label(); - comboM1 = new UI.RComboBox(); - panel1 = new Panel(); + tableBindings = new TableLayoutPanel(); + panelBindingsTitle = new Panel(); pictureBindings = new PictureBox(); labelBindings = new Label(); panelController.SuspendLayout(); @@ -93,7 +90,7 @@ panelSDeadzone.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).BeginInit(); panelBindings.SuspendLayout(); - panel1.SuspendLayout(); + panelBindingsTitle.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBindings).BeginInit(); SuspendLayout(); // @@ -126,7 +123,7 @@ buttonReset.BorderColor = Color.Transparent; buttonReset.BorderRadius = 2; buttonReset.FlatStyle = FlatStyle.Flat; - buttonReset.Location = new Point(20, 842); + buttonReset.Location = new Point(20, 840); buttonReset.Margin = new Padding(4, 2, 4, 2); buttonReset.Name = "buttonReset"; buttonReset.Secondary = true; @@ -365,7 +362,7 @@ // // pictureTDeadzone // - pictureTDeadzone.BackgroundImage = Properties.Resources.icons8_controller_32; + pictureTDeadzone.BackgroundImage = Properties.Resources.icons8_xbox_lt_32; pictureTDeadzone.BackgroundImageLayout = ImageLayout.Zoom; pictureTDeadzone.ErrorImage = null; pictureTDeadzone.InitialImage = null; @@ -532,7 +529,7 @@ // // pictureSDeadzone // - pictureSDeadzone.BackgroundImage = Properties.Resources.icons8_controller_32; + pictureSDeadzone.BackgroundImage = Properties.Resources.icons8_joystick_32; pictureSDeadzone.BackgroundImageLayout = ImageLayout.Zoom; pictureSDeadzone.ErrorImage = null; pictureSDeadzone.InitialImage = null; @@ -556,74 +553,42 @@ // // panelBindings // - panelBindings.Controls.Add(labelM2); - panelBindings.Controls.Add(comboM2); - panelBindings.Controls.Add(labelM1); - panelBindings.Controls.Add(comboM1); - panelBindings.Controls.Add(panel1); + panelBindings.Controls.Add(tableBindings); + panelBindings.Controls.Add(panelBindingsTitle); panelBindings.Dock = DockStyle.Left; panelBindings.Location = new Point(570, 10); - panelBindings.MinimumSize = new Size(500, 0); + panelBindings.MinimumSize = new Size(600, 0); panelBindings.Name = "panelBindings"; - panelBindings.Size = new Size(500, 912); + panelBindings.Size = new Size(600, 912); panelBindings.TabIndex = 46; // - // labelM2 + // tableBindings // - labelM2.AutoSize = true; - labelM2.Location = new Point(19, 146); - labelM2.Margin = new Padding(4, 0, 4, 0); - labelM2.Name = "labelM2"; - labelM2.Size = new Size(49, 32); - labelM2.TabIndex = 48; - labelM2.Text = "M2"; + tableBindings.AutoSize = true; + tableBindings.ColumnCount = 3; + tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); + tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); + tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40F)); + tableBindings.Location = new Point(0, 60); + tableBindings.Name = "tableBindings"; + tableBindings.Padding = new Padding(5); + tableBindings.RowCount = 1; + tableBindings.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); + tableBindings.Size = new Size(500, 10); + tableBindings.TabIndex = 49; // - // comboM2 + // panelBindingsTitle // - comboM2.BorderColor = Color.White; - comboM2.ButtonColor = Color.FromArgb(255, 255, 255); - comboM2.FormattingEnabled = true; - comboM2.Items.AddRange(new object[] { Properties.Strings.Default, Properties.Strings.VolumeMute, Properties.Strings.PlayPause, Properties.Strings.PrintScreen, Properties.Strings.ToggleAura, Properties.Strings.Custom }); - comboM2.Location = new Point(82, 144); - comboM2.Margin = new Padding(4, 3, 4, 3); - comboM2.Name = "comboM2"; - comboM2.Size = new Size(374, 40); - comboM2.TabIndex = 47; - // - // labelM1 - // - labelM1.AutoSize = true; - labelM1.Location = new Point(19, 87); - labelM1.Margin = new Padding(4, 0, 4, 0); - labelM1.Name = "labelM1"; - labelM1.Size = new Size(49, 32); - labelM1.TabIndex = 46; - labelM1.Text = "M1"; - // - // comboM1 - // - comboM1.BorderColor = Color.White; - comboM1.ButtonColor = Color.FromArgb(255, 255, 255); - comboM1.FormattingEnabled = true; - comboM1.Items.AddRange(new object[] { Properties.Strings.Default, Properties.Strings.VolumeMute, Properties.Strings.PlayPause, Properties.Strings.PrintScreen, Properties.Strings.ToggleAura, Properties.Strings.Custom }); - comboM1.Location = new Point(82, 85); - comboM1.Margin = new Padding(4, 3, 4, 3); - comboM1.Name = "comboM1"; - comboM1.Size = new Size(374, 40); - comboM1.TabIndex = 45; - // - // panel1 - // - panel1.AutoSize = true; - panel1.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panel1.Controls.Add(pictureBindings); - panel1.Controls.Add(labelBindings); - panel1.Dock = DockStyle.Top; - panel1.Location = new Point(0, 0); - panel1.Margin = new Padding(4); - panel1.Name = "panel1"; - panel1.Size = new Size(500, 60); - panel1.TabIndex = 44; + panelBindingsTitle.AutoSize = true; + panelBindingsTitle.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelBindingsTitle.Controls.Add(pictureBindings); + panelBindingsTitle.Controls.Add(labelBindings); + panelBindingsTitle.Dock = DockStyle.Top; + panelBindingsTitle.Location = new Point(0, 0); + panelBindingsTitle.Margin = new Padding(4); + panelBindingsTitle.Name = "panelBindingsTitle"; + panelBindingsTitle.Size = new Size(500, 60); + panelBindingsTitle.TabIndex = 44; // // pictureBindings // @@ -654,7 +619,7 @@ AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; AutoSize = true; - ClientSize = new Size(1082, 932); + ClientSize = new Size(1277, 932); Controls.Add(panelBindings); Controls.Add(panelController); MaximizeBox = false; @@ -696,8 +661,8 @@ ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).EndInit(); panelBindings.ResumeLayout(false); panelBindings.PerformLayout(); - panel1.ResumeLayout(false); - panel1.PerformLayout(); + panelBindingsTitle.ResumeLayout(false); + panelBindingsTitle.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBindings).EndInit(); ResumeLayout(false); PerformLayout(); @@ -741,12 +706,9 @@ private Label labelVibraHeader; private UI.RButton buttonReset; private Panel panelBindings; - private Panel panel1; + private Panel panelBindingsTitle; private PictureBox pictureBindings; private Label labelBindings; - private Label labelM2; - private UI.RComboBox comboM2; - private Label labelM1; - private UI.RComboBox comboM1; + private TableLayoutPanel tableBindings; } } \ No newline at end of file diff --git a/app/Handheld.cs b/app/Handheld.cs index ddf22101..9943c0d4 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -1,14 +1,15 @@ -using GHelper.UI; -using GHelper.Ally; +using GHelper.Ally; +using GHelper.UI; namespace GHelper { - public partial class Handheld : Form + public partial class Handheld : RForm { + public Handheld() { InitializeComponent(); - //InitTheme(true); + InitTheme(true); Shown += Handheld_Shown; @@ -40,28 +41,68 @@ namespace GHelper trackVibra.ValueChanged += Controller_Complete; - comboM1.DropDownStyle = ComboBoxStyle.DropDownList; - comboM1.DataSource = new BindingSource(AllyControl.BindingCodes, null); - comboM1.DisplayMember = "Value"; - comboM1.ValueMember = "Key"; + FillBinding("m1", "M1", AllyControl.CodeM1); + FillBinding("m2", "M2", AllyControl.CodeM2); - comboM2.DropDownStyle = ComboBoxStyle.DropDownList; - comboM2.DataSource = new BindingSource(AllyControl.BindingCodes, null); - comboM2.DisplayMember = "Value"; - comboM2.ValueMember = "Key"; + FillBinding("a", "A"); + FillBinding("b", "B"); + FillBinding("x", "X"); + FillBinding("y", "Y"); - comboM1.SelectedValue = AppConfig.Get("bind_m1", 0x028f); - comboM2.SelectedValue = AppConfig.Get("bind_m2", 0x028e); + FillBinding("dpu", "DPad Up"); + FillBinding("dpd", "DPad Down"); + FillBinding("dpl", "DPad Left"); + FillBinding("dpr", "DPad Right"); - comboM1.SelectedValueChanged += Binding_SelectedValueChanged; - comboM2.SelectedValueChanged += Binding_SelectedValueChanged; + } + + + + private void FillBinding(string name, string label, int defaultValue = -1) + { + tableBindings.RowStyles.Add(new RowStyle(SizeType.AutoSize)); + tableBindings.Controls.Add(new Label { Text = label + ":", Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, tableBindings.RowCount - 1); + + name = "bind_" + name; + + var combo = new RComboBox(); + + combo.BorderColor = Color.White; + combo.ButtonColor = Color.FromArgb(255, 255, 255); + combo.Dock = DockStyle.Fill; + combo.Name = name; + combo.Margin = new Padding(5, 5, 5, 5); + + combo.DropDownStyle = ComboBoxStyle.DropDownList; + combo.DisplayMember = "Value"; + combo.ValueMember = "Key"; + + int value = AppConfig.Get(name, defaultValue); + + foreach (var item in AllyControl.BindingCodes) + { + combo.Items.Add(new KeyValuePair(item.Key, item.Value)); + if (item.Key == value) combo.SelectedItem = item; + } + + combo.SelectedValueChanged += Binding_SelectedValueChanged; + + tableBindings.Controls.Add(combo, 1, tableBindings.RowCount - 1); + tableBindings.RowCount++; } private void Binding_SelectedValueChanged(object? sender, EventArgs e) { - AppConfig.Set("bind_m1", (int)comboM1.SelectedValue); - AppConfig.Set("bind_m2", (int)comboM2.SelectedValue); + + if (sender is null) return; + RComboBox combo = (RComboBox)sender; + + int value = ((KeyValuePair)combo.SelectedItem).Key; + + if (value >= 0) AppConfig.Set(combo.Name, value); + else AppConfig.Remove(combo.Name); + AllyControl.SetBindings(); } diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 23999cab..a8811e09 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -320,6 +320,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_joystick_32 { + get { + object obj = ResourceManager.GetObject("icons8-joystick-32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -640,6 +650,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_xbox_lt_32 { + get { + object obj = ResourceManager.GetObject("icons8-xbox-lt-32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 76a2d0f8..2ed46cbb 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -118,196 +118,202 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\brightness-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-temperature-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-mute-unmute-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-hibernate-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Font.otf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\icons8-quit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-fiat-500-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-microphone-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-voltage-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-project-management-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\lighting_dot_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-touchpad-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-automation-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-maus-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-help-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-settings-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-software-32-white.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-add-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-game-controller-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-refresh-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\lighting_dot_24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-charged-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\lighting_dot_24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\brightness-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-batterie-voll-geladen-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-charging-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-video-card-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\lighting_dot_48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-ultimate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\icons8-edit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\backlight-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-video-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-save-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-log-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-controller-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-keyboard-32 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-microphone-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-maus-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-mauszeiger-50.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-matrix-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-mute-unmute-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-keyboard-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-batterie-voll-geladen-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-fan-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\lighting_dot_48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-software-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-quit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-gauge-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-leaf-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-spa-flower-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\backlight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-eco.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-processor-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-laptop-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-ladende-batterie-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-rocket-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-controller-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-next-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-automation-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\brightness-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-processor-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-fiat-500-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-touchpad-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-game-controller-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-help-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-matrix-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-laptop-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-joystick-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-keyboard-32 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-spa-flower-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-video-card-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\backlight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-refresh-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-hibernate-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-keyboard-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-settings-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-maus-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-charging-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot-ultimate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\brightness-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\backlight-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot-standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-rocket-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-project-management-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-mauszeiger-50.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-save-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-ladende-batterie-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-video-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Font.otf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\dot-eco.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-gauge-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-fan-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-voltage-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-software-32-white.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-log-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-temperature-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-leaf-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-add-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-software-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\lighting_dot_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-xbox-lt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/app/Resources/icons8-joystick-32.png b/app/Resources/icons8-joystick-32.png new file mode 100644 index 0000000000000000000000000000000000000000..748d0b04ecc52f5f9253b597e72c3bec822fe03d GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?3oVGw3ym^DWND0s=! z#WAE}&fBSuTulxlZTp?KY;jH7@-Rb#r2)1uJq%f=<`8c|QwHnbWV98xgyUAX?h z&j;-fIp5cQkYVkAZhg#wNyN%JLC^9JTS)JUCRCt{2mbps#!?Uk zZN)~g6vX>%1q%zs&PE7gXJwaoVk4*w%t9Py-Yn5ckSNhl)dN?+ zSD^R+@(9WYEFQ(2t9Tu7AGmlCXmJ6IRAKdt()Mo!F8&F$OWR)x3~(*2zQ>Vt0X#d# z3c$W2j(|tQKQ94HTMC@%u}KF&N}3RuGW`9LdBsxTz;ij5fl(c8+S{$4bHJtH?~nl2 zD*z~uG40(GJk1iowk6?Ej}6BF7}wri!BZ;%tW^OZEdeZ964Xsr8j1m+&Rl6n@MI)_ zoF(D-j{$lmfQ$ez7z1EJxJyyY;8DRyIMMH0%RaX#Rx1Ed_e0dIk#H_}Q-)VHGNn@i z;0b7u0MfvVr5oB>?Tz7k)ot5%R0FV!Z literal 0 HcmV?d00001 From acef2407c7967162f6806e74d4798a2907381dc4 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:53:09 +0100 Subject: [PATCH 030/107] Ally Mappings --- app/Ally/AllyControl.cs | 63 +++++++++++++---------------------------- app/Handheld.cs | 2 +- 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 601d4749..de631f39 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -43,38 +43,8 @@ namespace GHelper.Ally public const int CodeM1 = 0x028f; public const int CodeM2 = 0x028e; - private byte[] commitReset1of4 = new byte[64] - { - 0x5A, 0xD1, 0x0F, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - }; - - private byte[] commitReset2of4 = new byte[64] - { - 0x5A, 0xD1, 0x06, 0x02, 0x64, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - - private byte[] commitReset3of4 = new byte[64] - { - 0x5A, 0xD1, 0x04, 0x04, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - - private byte[] commitReset4of4 = new byte[64] - { - 0x5A, 0xD1, 0x05, 0x04, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + static byte[] MappingReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; + static byte[] MappingSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 }; public static Dictionary BindingCodes = new Dictionary { @@ -319,7 +289,7 @@ namespace GHelper.Ally } - static private void ApplyBindings(BindingZone zone) + static private void MappingZone(BindingZone zone) { int Key1, Key2; switch (zone) @@ -361,21 +331,26 @@ namespace GHelper.Ally //AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc."), "Init"); + AsusHid.WriteInput(MappingReady); AsusHid.WriteInput(bindings, $"Bind{zone}"); - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }); } - static public void SetBindings() + static public void SetMapping() { - ApplyBindings(BindingZone.DPadUpDown); - ApplyBindings(BindingZone.DPadLeftRight); - ApplyBindings(BindingZone.AB); - ApplyBindings(BindingZone.M1M2); - ApplyBindings(BindingZone.XY); + MappingZone(BindingZone.DPadUpDown); + MappingZone(BindingZone.DPadLeftRight); + MappingZone(BindingZone.StickClick); + MappingZone(BindingZone.Bumper); + MappingZone(BindingZone.AB); + MappingZone(BindingZone.XY); + MappingZone(BindingZone.ViewMenu); + MappingZone(BindingZone.M1M2); + MappingZone(BindingZone.Trigger); + AsusHid.WriteInput(MappingSave); } @@ -404,9 +379,11 @@ namespace GHelper.Ally private void ApplyMode(ControllerMode applyMode, string log = "ControllerMode") { - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 1, 1, (byte)applyMode }, log); - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }); - SetBindings(); + //AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0b, 0x01, (byte)applyMode }, log); + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)applyMode }, log); + AsusHid.WriteInput(MappingSave); + + SetMapping(); } private void SetMode(ControllerMode mode) diff --git a/app/Handheld.cs b/app/Handheld.cs index 9943c0d4..93929471 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -103,7 +103,7 @@ namespace GHelper if (value >= 0) AppConfig.Set(combo.Name, value); else AppConfig.Remove(combo.Name); - AllyControl.SetBindings(); + AllyControl.SetMapping(); } private void Controller_Complete(object? sender, EventArgs e) From 31e52dbf0004e7dfc5a34a38a5b206839c85ba86 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 16 Jan 2024 21:00:51 +0100 Subject: [PATCH 031/107] Ally Mappings --- app/Ally/AllyControl.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index de631f39..fe4e43f2 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -302,6 +302,14 @@ namespace GHelper.Ally Key1 = AppConfig.Get("bind_dpl"); Key2 = AppConfig.Get("bind_dpr"); break; + case BindingZone.StickClick: + Key1 = AppConfig.Get("bind_stl"); + Key2 = AppConfig.Get("bind_str"); + break; + case BindingZone.Bumper: + Key1 = AppConfig.Get("bind_bul"); + Key2 = AppConfig.Get("bind_bur"); + break; case BindingZone.AB: Key1 = AppConfig.Get("bind_a"); Key2 = AppConfig.Get("bind_b"); @@ -310,10 +318,18 @@ namespace GHelper.Ally Key1 = AppConfig.Get("bind_x"); Key2 = AppConfig.Get("bind_y"); break; - default: + case BindingZone.ViewMenu: + Key1 = AppConfig.Get("bind_menu"); + Key2 = AppConfig.Get("bind_select"); + break; + case BindingZone.M1M2: Key1 = AppConfig.Get("bind_m2"); Key2 = AppConfig.Get("bind_m1"); break; + default: + Key1 = AppConfig.Get("bind_trl"); + Key2 = AppConfig.Get("bind_trr"); + break; } if (Key1 == -1 && Key2 == -1) return; From adcbe33fbb2e6fffa26cffba08cbb41f07e116d9 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 16 Jan 2024 23:49:28 +0100 Subject: [PATCH 032/107] Ally bindings --- app/Ally/AllyControl.cs | 108 ++++++++++++++++++++++++++-------------- app/Handheld.cs | 27 ++++++---- 2 files changed, 89 insertions(+), 46 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index fe4e43f2..92eb95a6 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -40,8 +40,32 @@ namespace GHelper.Ally static int fpsLimit = -1; - public const int CodeM1 = 0x028f; - public const int CodeM2 = 0x028e; + public const int MappingA = 0x0101; + public const int MappingB = 0x0102; + + public const int MappingX = 0x0103; + public const int MappingY = 0x0104; + + public const int MappingLB = 0x0105; + public const int MappingRB = 0x0106; + + public const int MappingLS = 0x0107; + public const int MappingRS = 0x0108; + + public const int MappingDU = 0x0109; + public const int MappingDD = 0x010A; + + public const int MappingDL = 0x010B; + public const int MappingDR = 0x010C; + + public const int MappingVB = 0x0111; + public const int MappingMB = 0x0112; + + public const int MappingM1 = 0x028f; + public const int MappingM2 = 0x028e; + + public const int MappingLT = 0x010d; + public const int MappingRT = 0x010e; static byte[] MappingReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; static byte[] MappingSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 }; @@ -50,23 +74,33 @@ namespace GHelper.Ally { { -1, "--------" }, { 0x0000, "[ Disabled ]" }, - { 0x028f, "M1" }, - { 0x028e, "M2" }, - { 0x0101, "A" }, - { 0x0102, "B" }, - { 0x0103, "X" }, - { 0x0104, "Y" }, - { 0x0105, "Left Bumper" }, - { 0x0106, "Right Bumper" }, - { 0x0107, "Left Stick Click" }, - { 0x0108, "Right Stick Click" }, - { 0x0109, "DPad Up" }, - { 0x010A, "DPad Down" }, - { 0x010B, "DPad Left" }, - { 0x010C, "DPad Right" }, - { 0x0111, "View Button" }, - { 0x0112, "Menu Button" }, + + { MappingM1, "M1" }, + { MappingM2, "M2" }, + + { MappingA, "A" }, + { MappingB, "B" }, + + { MappingX, "X" }, + { MappingY, "Y" }, + + { MappingLB, "Left Bumper" }, + { MappingRB, "Right Bumper" }, + + { MappingLS, "Left Stick Click" }, + { MappingRS, "Right Stick Click" }, + + { MappingDU, "DPad Up" }, + { MappingDD, "DPad Down" }, + + { MappingDL, "DPad Left" }, + { MappingDR, "DPad Right" }, + + { MappingVB, "View Button" }, + { MappingMB, "Menu Button" }, + { 0x0113, "XBox/Steam" }, + { 0x0276, "Esc" }, { 0x0250, "F1" }, { 0x0260, "F2" }, @@ -167,11 +201,13 @@ namespace GHelper.Ally { 0x0279, "NumPlus" }, { 0x0281, "NumEnter" }, { 0x0271, "NumPeriod" }, + { 0x0301, "Mouse left click" }, { 0x0302, "Mouse right click" }, { 0x0303, "Mouse middle click" }, { 0x0304, "Mouse scroll up" }, { 0x0305, "Mouse scroll down" }, + { 0x0516, "Screenshot" }, { 0x0519, "Show keyboard" }, { 0x051c, "Show desktop" }, @@ -295,40 +331,40 @@ namespace GHelper.Ally switch (zone) { case BindingZone.DPadUpDown: - Key1 = AppConfig.Get("bind_dpu"); - Key2 = AppConfig.Get("bind_dpd"); + Key1 = AppConfig.Get("bind_du", MappingDU); + Key2 = AppConfig.Get("bind_dd", MappingDD); break; case BindingZone.DPadLeftRight: - Key1 = AppConfig.Get("bind_dpl"); - Key2 = AppConfig.Get("bind_dpr"); + Key1 = AppConfig.Get("bind_dl", MappingDL); + Key2 = AppConfig.Get("bind_dr", MappingDR); break; case BindingZone.StickClick: - Key1 = AppConfig.Get("bind_stl"); - Key2 = AppConfig.Get("bind_str"); + Key1 = AppConfig.Get("bind_ls", MappingLS); + Key2 = AppConfig.Get("bind_rs", MappingRS); break; case BindingZone.Bumper: - Key1 = AppConfig.Get("bind_bul"); - Key2 = AppConfig.Get("bind_bur"); + Key1 = AppConfig.Get("bind_lb", MappingLB); + Key2 = AppConfig.Get("bind_rb", MappingRB); break; case BindingZone.AB: - Key1 = AppConfig.Get("bind_a"); - Key2 = AppConfig.Get("bind_b"); + Key1 = AppConfig.Get("bind_a", MappingA); + Key2 = AppConfig.Get("bind_b", MappingB); break; case BindingZone.XY: - Key1 = AppConfig.Get("bind_x"); - Key2 = AppConfig.Get("bind_y"); + Key1 = AppConfig.Get("bind_x", MappingX); + Key2 = AppConfig.Get("bind_y", MappingY); break; case BindingZone.ViewMenu: - Key1 = AppConfig.Get("bind_menu"); - Key2 = AppConfig.Get("bind_select"); + Key1 = AppConfig.Get("bind_vb", MappingVB); + Key2 = AppConfig.Get("bind_mv", MappingMB); break; case BindingZone.M1M2: - Key1 = AppConfig.Get("bind_m2"); - Key2 = AppConfig.Get("bind_m1"); + Key1 = AppConfig.Get("bind_m2", MappingM2); + Key2 = AppConfig.Get("bind_m1", MappingM1); break; default: - Key1 = AppConfig.Get("bind_trl"); - Key2 = AppConfig.Get("bind_trr"); + Key1 = AppConfig.Get("bind_trl", MappingLT); + Key2 = AppConfig.Get("bind_trr", MappingRT); break; } diff --git a/app/Handheld.cs b/app/Handheld.cs index 93929471..148e67e1 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -41,18 +41,25 @@ namespace GHelper trackVibra.ValueChanged += Controller_Complete; - FillBinding("m1", "M1", AllyControl.CodeM1); - FillBinding("m2", "M2", AllyControl.CodeM2); + FillBinding("m1", "M1", AllyControl.MappingM1); + FillBinding("m2", "M2", AllyControl.MappingM2); - FillBinding("a", "A"); - FillBinding("b", "B"); - FillBinding("x", "X"); - FillBinding("y", "Y"); + FillBinding("a", "A", AllyControl.MappingA); + FillBinding("b", "B", AllyControl.MappingB); + FillBinding("x", "X", AllyControl.MappingX); + FillBinding("y", "Y", AllyControl.MappingY); - FillBinding("dpu", "DPad Up"); - FillBinding("dpd", "DPad Down"); - FillBinding("dpl", "DPad Left"); - FillBinding("dpr", "DPad Right"); + FillBinding("du", "DPad Up", AllyControl.MappingDU); + FillBinding("dd", "DPad Down", AllyControl.MappingDD); + + FillBinding("dl", "DPad Left", AllyControl.MappingDL); + FillBinding("dr", "DPad Right", AllyControl.MappingDR); + + FillBinding("rb", "Right Bumper", AllyControl.MappingRB); + FillBinding("lb", "Left Bumper", AllyControl.MappingLB); + + FillBinding("rs", "Right Stick", AllyControl.MappingRS); + FillBinding("ll", "Left Stick", AllyControl.MappingLS); } From c2aa4da1db2369cfd2f61337560e115eab8c4e0b Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 12:18:59 +0100 Subject: [PATCH 033/107] Ally Mappings --- app/Ally/AllyControl.cs | 57 ++++++++++++++++++++--------------------- app/Handheld.cs | 2 +- app/USB/AsusHid.cs | 4 +-- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 92eb95a6..1cab2627 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,7 +1,6 @@ using GHelper.Gpu.AMD; using GHelper.Input; using GHelper.USB; -using System.Text; namespace GHelper.Ally { @@ -35,7 +34,7 @@ namespace GHelper.Ally SettingsForm settings; static ControllerMode mode = ControllerMode.Auto; - static ControllerMode _autoMode = ControllerMode.Auto; + static ControllerMode _applyMode = ControllerMode.Auto; static int _autoCount = 0; static int fpsLimit = -1; @@ -232,16 +231,16 @@ namespace GHelper.Ally { float fps = amdControl.GetFPS(); - ControllerMode _newMode = (fps > 0) ? ControllerMode.Gamepad : ControllerMode.Mouse; + ControllerMode newMode = (fps > 0) ? ControllerMode.Gamepad : ControllerMode.Mouse; - if (_autoMode != _newMode) _autoCount++; + if (_applyMode != newMode) _autoCount++; else _autoCount = 0; if (_autoCount > 2) { - _autoMode = _newMode; + _applyMode = newMode; _autoCount = 0; - ApplyMode(_autoMode, "ControllerAuto"); + ApplyMode(_applyMode); Logger.WriteLine(fps.ToString()); } @@ -374,7 +373,7 @@ namespace GHelper.Ally byte[] init = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x02, (byte)zone, 0x2c }; init.CopyTo(bindings, 0); - + DecodeBinding(Key1).CopyTo(bindings, 5); DecodeBinding(Key1).CopyTo(bindings, 16); @@ -388,22 +387,6 @@ namespace GHelper.Ally - } - - static public void SetMapping() - { - MappingZone(BindingZone.DPadUpDown); - MappingZone(BindingZone.DPadLeftRight); - MappingZone(BindingZone.StickClick); - MappingZone(BindingZone.Bumper); - MappingZone(BindingZone.AB); - MappingZone(BindingZone.XY); - MappingZone(BindingZone.ViewMenu); - MappingZone(BindingZone.M1M2); - MappingZone(BindingZone.Trigger); - - AsusHid.WriteInput(MappingSave); - } static public void SetDeadzones() @@ -429,20 +412,36 @@ namespace GHelper.Ally } - private void ApplyMode(ControllerMode applyMode, string log = "ControllerMode") + public static void ApplyMode(ControllerMode? applyMode = null) { - //AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0b, 0x01, (byte)applyMode }, log); - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)applyMode }, log); + + if (applyMode is not null) _applyMode = (ControllerMode)applyMode; + + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); + AsusHid.WriteInput(MappingSave); + + if (_applyMode == ControllerMode.Gamepad) + { + MappingZone(BindingZone.DPadUpDown); + MappingZone(BindingZone.DPadLeftRight); + MappingZone(BindingZone.StickClick); + MappingZone(BindingZone.Bumper); + MappingZone(BindingZone.AB); + MappingZone(BindingZone.XY); + MappingZone(BindingZone.ViewMenu); + } + + MappingZone(BindingZone.M1M2); + MappingZone(BindingZone.Trigger); + AsusHid.WriteInput(MappingSave); - - SetMapping(); } private void SetMode(ControllerMode mode) { if (mode == ControllerMode.Auto) { - _autoMode = ControllerMode.Auto; + _applyMode = ControllerMode.Auto; amdControl.StartFPS(); timer.Start(); } diff --git a/app/Handheld.cs b/app/Handheld.cs index 148e67e1..2b34ef0f 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -110,7 +110,7 @@ namespace GHelper if (value >= 0) AppConfig.Set(combo.Name, value); else AppConfig.Remove(combo.Name); - AllyControl.SetMapping(); + AllyControl.ApplyMode(); } private void Controller_Complete(object? sender, EventArgs e) diff --git a/app/USB/AsusHid.cs b/app/USB/AsusHid.cs index 31c20ea5..7aac7f6c 100644 --- a/app/USB/AsusHid.cs +++ b/app/USB/AsusHid.cs @@ -57,7 +57,7 @@ public static class AsusHid return null; } - public static void WriteInput(byte[] data, string log = "USB") + public static void WriteInput(byte[] data, string? log = "USB") { foreach (var device in FindDevices(INPUT_ID)) { @@ -68,7 +68,7 @@ public static class AsusHid var payload = new byte[device.GetMaxFeatureReportLength()]; Array.Copy(data, payload, data.Length); stream.SetFeature(payload); - Logger.WriteLine($"{log} {device.ProductID.ToString("X")}|{device.GetMaxFeatureReportLength()}: {BitConverter.ToString(data)}"); + if (log is not null) Logger.WriteLine($"{log} {device.ProductID.ToString("X")}|{device.GetMaxFeatureReportLength()}: {BitConverter.ToString(data)}"); } } catch (Exception ex) From fd1d929d0d71b37b5a9bb442bcf98c99ff31c90e Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 12:28:23 +0100 Subject: [PATCH 034/107] Ally Mappings --- app/Ally/AllyControl.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 1cab2627..063bfe0c 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -33,7 +33,7 @@ namespace GHelper.Ally SettingsForm settings; - static ControllerMode mode = ControllerMode.Auto; + static ControllerMode _mode = ControllerMode.Auto; static ControllerMode _applyMode = ControllerMode.Auto; static int _autoCount = 0; @@ -420,6 +420,8 @@ namespace GHelper.Ally AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); AsusHid.WriteInput(MappingSave); + MappingZone(BindingZone.M1M2); + if (_applyMode == ControllerMode.Gamepad) { MappingZone(BindingZone.DPadUpDown); @@ -429,11 +431,9 @@ namespace GHelper.Ally MappingZone(BindingZone.AB); MappingZone(BindingZone.XY); MappingZone(BindingZone.ViewMenu); + MappingZone(BindingZone.Trigger); } - MappingZone(BindingZone.M1M2); - MappingZone(BindingZone.Trigger); - AsusHid.WriteInput(MappingSave); } @@ -452,6 +452,7 @@ namespace GHelper.Ally ApplyMode(mode); } + _mode = mode; AppConfig.Set("controller_mode", (int)mode); settings.VisualiseController(mode); } @@ -459,20 +460,20 @@ namespace GHelper.Ally public void ToggleMode() { - switch (mode) + switch (_mode) { case ControllerMode.Auto: - mode = ControllerMode.Gamepad; + _mode = ControllerMode.Gamepad; break; case ControllerMode.Gamepad: - mode = ControllerMode.Mouse; + _mode = ControllerMode.Mouse; break; case ControllerMode.Mouse: - mode = ControllerMode.Auto; + _mode = ControllerMode.Auto; break; } - SetMode(mode); + SetMode(_mode); } } From 737c83ec22e4e603ae6192de1cb8f5074998951f Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 13:33:19 +0100 Subject: [PATCH 035/107] Ally mappings --- app/Ally/AllyControl.cs | 80 +++++++++++++++++++++++++--------------- app/Handheld.Designer.cs | 48 ++++++++++++++++++++---- app/Handheld.cs | 54 ++++++++++++++------------- 3 files changed, 119 insertions(+), 63 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 063bfe0c..3bddfd26 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -222,7 +222,7 @@ namespace GHelper.Ally settings = settingsForm; - timer = new System.Timers.Timer(500); + timer = new System.Timers.Timer(300); timer.Elapsed += Timer_Elapsed; } @@ -236,6 +236,8 @@ namespace GHelper.Ally if (_applyMode != newMode) _autoCount++; else _autoCount = 0; + if (_mode != ControllerMode.Auto) return; + if (_autoCount > 2) { _applyMode = newMode; @@ -326,63 +328,81 @@ namespace GHelper.Ally static private void MappingZone(BindingZone zone) { - int Key1, Key2; + int KeyL1, KeyR1; + int KeyL2, KeyR2; + switch (zone) { case BindingZone.DPadUpDown: - Key1 = AppConfig.Get("bind_du", MappingDU); - Key2 = AppConfig.Get("bind_dd", MappingDD); + KeyL1 = AppConfig.Get("bind_du", MappingDU); + KeyR1 = AppConfig.Get("bind_dd", MappingDD); + KeyL2 = AppConfig.Get("bind2_du"); + KeyR2 = AppConfig.Get("bind2_dd"); break; case BindingZone.DPadLeftRight: - Key1 = AppConfig.Get("bind_dl", MappingDL); - Key2 = AppConfig.Get("bind_dr", MappingDR); + KeyL1 = AppConfig.Get("bind_dl", MappingDL); + KeyR1 = AppConfig.Get("bind_dr", MappingDR); + KeyL2 = AppConfig.Get("bind2_dl"); + KeyR2 = AppConfig.Get("bind2_dr"); break; case BindingZone.StickClick: - Key1 = AppConfig.Get("bind_ls", MappingLS); - Key2 = AppConfig.Get("bind_rs", MappingRS); + KeyL1 = AppConfig.Get("bind_ls", MappingLS); + KeyR1 = AppConfig.Get("bind_rs", MappingRS); + KeyL2 = AppConfig.Get("bind2_ls"); + KeyR2 = AppConfig.Get("bind2_rs"); break; case BindingZone.Bumper: - Key1 = AppConfig.Get("bind_lb", MappingLB); - Key2 = AppConfig.Get("bind_rb", MappingRB); + KeyL1 = AppConfig.Get("bind_lb", MappingLB); + KeyR1 = AppConfig.Get("bind_rb", MappingRB); + KeyL2 = AppConfig.Get("bind2_lb"); + KeyR2 = AppConfig.Get("bind2_rb"); break; case BindingZone.AB: - Key1 = AppConfig.Get("bind_a", MappingA); - Key2 = AppConfig.Get("bind_b", MappingB); + KeyL1 = AppConfig.Get("bind_a", MappingA); + KeyR1 = AppConfig.Get("bind_b", MappingB); + KeyL2 = AppConfig.Get("bind2_a"); + KeyR2 = AppConfig.Get("bind2_b"); break; case BindingZone.XY: - Key1 = AppConfig.Get("bind_x", MappingX); - Key2 = AppConfig.Get("bind_y", MappingY); + KeyL1 = AppConfig.Get("bind_x", MappingX); + KeyR1 = AppConfig.Get("bind_y", MappingY); + KeyL2 = AppConfig.Get("bind2_x"); + KeyR2 = AppConfig.Get("bind2_y"); break; case BindingZone.ViewMenu: - Key1 = AppConfig.Get("bind_vb", MappingVB); - Key2 = AppConfig.Get("bind_mv", MappingMB); + KeyL1 = AppConfig.Get("bind_vb", MappingVB); + KeyR1 = AppConfig.Get("bind_mb", MappingMB); + KeyL2 = AppConfig.Get("bind2_vb"); + KeyR2 = AppConfig.Get("bind2_mb"); break; case BindingZone.M1M2: - Key1 = AppConfig.Get("bind_m2", MappingM2); - Key2 = AppConfig.Get("bind_m1", MappingM1); + KeyL1 = AppConfig.Get("bind_m2", MappingM2); + KeyR1 = AppConfig.Get("bind_m1", MappingM1); + KeyL2 = AppConfig.Get("bind2_m2", MappingM2); + KeyR2 = AppConfig.Get("bind2_m1", MappingM1); break; default: - Key1 = AppConfig.Get("bind_trl", MappingLT); - Key2 = AppConfig.Get("bind_trr", MappingRT); + KeyL1 = AppConfig.Get("bind_trl", MappingLT); + KeyR1 = AppConfig.Get("bind_trr", MappingRT); + KeyL2 = AppConfig.Get("bind2_trl"); + KeyR2 = AppConfig.Get("bind2_trr"); break; } - if (Key1 == -1 && Key2 == -1) return; + if (KeyL1 == -1 && KeyR1 == -1) return; byte[] bindings = new byte[64]; byte[] init = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x02, (byte)zone, 0x2c }; init.CopyTo(bindings, 0); - DecodeBinding(Key1).CopyTo(bindings, 5); - DecodeBinding(Key1).CopyTo(bindings, 16); + DecodeBinding(KeyL1).CopyTo(bindings, 5); + DecodeBinding(KeyL2).CopyTo(bindings, 16); - DecodeBinding(Key2).CopyTo(bindings, 27); - DecodeBinding(Key2).CopyTo(bindings, 38); + DecodeBinding(KeyR1).CopyTo(bindings, 27); + DecodeBinding(KeyR2).CopyTo(bindings, 38); - //AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc."), "Init"); - - AsusHid.WriteInput(MappingReady); + AsusHid.WriteInput(MappingReady, null); AsusHid.WriteInput(bindings, $"Bind{zone}"); @@ -418,7 +438,7 @@ namespace GHelper.Ally if (applyMode is not null) _applyMode = (ControllerMode)applyMode; AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); - AsusHid.WriteInput(MappingSave); + AsusHid.WriteInput(MappingSave, null); MappingZone(BindingZone.M1M2); @@ -434,7 +454,7 @@ namespace GHelper.Ally MappingZone(BindingZone.Trigger); } - AsusHid.WriteInput(MappingSave); + AsusHid.WriteInput(MappingSave, null); } private void SetMode(ControllerMode mode) diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs index ef6dd6ca..3a429467 100644 --- a/app/Handheld.Designer.cs +++ b/app/Handheld.Designer.cs @@ -68,6 +68,8 @@ panelBindingsTitle = new Panel(); pictureBindings = new PictureBox(); labelBindings = new Label(); + labelPrimary = new Label(); + labelSecondary = new Label(); panelController.SuspendLayout(); panelVibra.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)trackVibra).BeginInit(); @@ -90,6 +92,7 @@ panelSDeadzone.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).BeginInit(); panelBindings.SuspendLayout(); + tableBindings.SuspendLayout(); panelBindingsTitle.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBindings).BeginInit(); SuspendLayout(); @@ -557,9 +560,9 @@ panelBindings.Controls.Add(panelBindingsTitle); panelBindings.Dock = DockStyle.Left; panelBindings.Location = new Point(570, 10); - panelBindings.MinimumSize = new Size(600, 0); + panelBindings.MinimumSize = new Size(700, 0); panelBindings.Name = "panelBindings"; - panelBindings.Size = new Size(600, 912); + panelBindings.Size = new Size(700, 912); panelBindings.TabIndex = 46; // // tableBindings @@ -568,13 +571,16 @@ tableBindings.ColumnCount = 3; tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); - tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40F)); + tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); + tableBindings.Controls.Add(labelPrimary, 1, 0); + tableBindings.Controls.Add(labelSecondary, 2, 0); + tableBindings.Dock = DockStyle.Top; tableBindings.Location = new Point(0, 60); tableBindings.Name = "tableBindings"; tableBindings.Padding = new Padding(5); tableBindings.RowCount = 1; - tableBindings.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); - tableBindings.Size = new Size(500, 10); + tableBindings.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + tableBindings.Size = new Size(700, 52); tableBindings.TabIndex = 49; // // panelBindingsTitle @@ -587,7 +593,7 @@ panelBindingsTitle.Location = new Point(0, 0); panelBindingsTitle.Margin = new Padding(4); panelBindingsTitle.Name = "panelBindingsTitle"; - panelBindingsTitle.Size = new Size(500, 60); + panelBindingsTitle.Size = new Size(700, 60); panelBindingsTitle.TabIndex = 44; // // pictureBindings @@ -614,12 +620,36 @@ labelBindings.TabIndex = 40; labelBindings.Text = "Bindings"; // + // labelPrimary + // + labelPrimary.AutoSize = true; + labelPrimary.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelPrimary.Location = new Point(147, 5); + labelPrimary.Margin = new Padding(4, 0, 4, 0); + labelPrimary.Name = "labelPrimary"; + labelPrimary.Padding = new Padding(5); + labelPrimary.Size = new Size(115, 42); + labelPrimary.TabIndex = 41; + labelPrimary.Text = "Primary"; + // + // labelSecondary + // + labelSecondary.AutoSize = true; + labelSecondary.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelSecondary.Location = new Point(423, 5); + labelSecondary.Margin = new Padding(4, 0, 4, 0); + labelSecondary.Name = "labelSecondary"; + labelSecondary.Padding = new Padding(5); + labelSecondary.Size = new Size(144, 42); + labelSecondary.TabIndex = 42; + labelSecondary.Text = "Secondary"; + // // Handheld // AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; AutoSize = true; - ClientSize = new Size(1277, 932); + ClientSize = new Size(1286, 932); Controls.Add(panelBindings); Controls.Add(panelController); MaximizeBox = false; @@ -661,6 +691,8 @@ ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).EndInit(); panelBindings.ResumeLayout(false); panelBindings.PerformLayout(); + tableBindings.ResumeLayout(false); + tableBindings.PerformLayout(); panelBindingsTitle.ResumeLayout(false); panelBindingsTitle.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBindings).EndInit(); @@ -710,5 +742,7 @@ private PictureBox pictureBindings; private Label labelBindings; private TableLayoutPanel tableBindings; + private Label labelPrimary; + private Label labelSecondary; } } \ No newline at end of file diff --git a/app/Handheld.cs b/app/Handheld.cs index 2b34ef0f..1cbd698d 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -44,36 +44,30 @@ namespace GHelper FillBinding("m1", "M1", AllyControl.MappingM1); FillBinding("m2", "M2", AllyControl.MappingM2); - FillBinding("a", "A", AllyControl.MappingA); - FillBinding("b", "B", AllyControl.MappingB); - FillBinding("x", "X", AllyControl.MappingX); - FillBinding("y", "Y", AllyControl.MappingY); + FillBinding("a", "A"); + FillBinding("b", "B"); + FillBinding("x", "X"); + FillBinding("y", "Y"); - FillBinding("du", "DPad Up", AllyControl.MappingDU); - FillBinding("dd", "DPad Down", AllyControl.MappingDD); + FillBinding("du", "DPad Up"); + FillBinding("dd", "DPad Down"); - FillBinding("dl", "DPad Left", AllyControl.MappingDL); - FillBinding("dr", "DPad Right", AllyControl.MappingDR); + FillBinding("dl", "DPad Left"); + FillBinding("dr", "DPad Right"); - FillBinding("rb", "Right Bumper", AllyControl.MappingRB); - FillBinding("lb", "Left Bumper", AllyControl.MappingLB); + FillBinding("rb", "RBumper"); + FillBinding("lb", "LBumper"); - FillBinding("rs", "Right Stick", AllyControl.MappingRS); - FillBinding("ll", "Left Stick", AllyControl.MappingLS); + FillBinding("rs", "RStick"); + FillBinding("ll", "LStick"); + FillBinding("vb", "View"); + FillBinding("mb", "Menu"); } - - - private void FillBinding(string name, string label, int defaultValue = -1) + private RComboBox ComboBinding(string name, int value) { - tableBindings.RowStyles.Add(new RowStyle(SizeType.AutoSize)); - tableBindings.Controls.Add(new Label { Text = label + ":", Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, tableBindings.RowCount - 1); - - name = "bind_" + name; - var combo = new RComboBox(); - combo.BorderColor = Color.White; combo.ButtonColor = Color.FromArgb(255, 255, 255); combo.Dock = DockStyle.Fill; @@ -83,18 +77,26 @@ namespace GHelper combo.DropDownStyle = ComboBoxStyle.DropDownList; combo.DisplayMember = "Value"; combo.ValueMember = "Key"; - - int value = AppConfig.Get(name, defaultValue); - foreach (var item in AllyControl.BindingCodes) { combo.Items.Add(new KeyValuePair(item.Key, item.Value)); if (item.Key == value) combo.SelectedItem = item; } - combo.SelectedValueChanged += Binding_SelectedValueChanged; - tableBindings.Controls.Add(combo, 1, tableBindings.RowCount - 1); + return combo; + + } + + + private void FillBinding(string binding, string label, int defaultValue = -1) + { + tableBindings.RowStyles.Add(new RowStyle(SizeType.AutoSize)); + tableBindings.Controls.Add(new Label { Text = label, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, tableBindings.RowCount); + + tableBindings.Controls.Add(ComboBinding("bind_" + binding, AppConfig.Get("bind_" + binding, defaultValue)), 1, tableBindings.RowCount); + tableBindings.Controls.Add(ComboBinding("bind2_" + binding, AppConfig.Get("bind2_" + binding)), 2, tableBindings.RowCount); + tableBindings.RowCount++; } From c0b5ef93d3d61b0894df659305778e618671cc7a Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 13:50:08 +0100 Subject: [PATCH 036/107] Version Bump --- app/Ally/AllyControl.cs | 141 ++++++++++++++++++++-------------------- app/GHelper.csproj | 2 +- app/Handheld.cs | 6 +- 3 files changed, 74 insertions(+), 75 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 3bddfd26..a375ad24 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -39,64 +39,64 @@ namespace GHelper.Ally static int fpsLimit = -1; - public const int MappingA = 0x0101; - public const int MappingB = 0x0102; + public const int BindA = 0x0101; + public const int BindB = 0x0102; - public const int MappingX = 0x0103; - public const int MappingY = 0x0104; + public const int BindX = 0x0103; + public const int BindY = 0x0104; - public const int MappingLB = 0x0105; - public const int MappingRB = 0x0106; + public const int BindLB = 0x0105; + public const int BindRB = 0x0106; - public const int MappingLS = 0x0107; - public const int MappingRS = 0x0108; + public const int BindLS = 0x0107; + public const int BindRS = 0x0108; - public const int MappingDU = 0x0109; - public const int MappingDD = 0x010A; + public const int BindDU = 0x0109; + public const int BindDD = 0x010A; - public const int MappingDL = 0x010B; - public const int MappingDR = 0x010C; + public const int BindDL = 0x010B; + public const int BindDR = 0x010C; - public const int MappingVB = 0x0111; - public const int MappingMB = 0x0112; + public const int BindVB = 0x0111; + public const int BindMB = 0x0112; - public const int MappingM1 = 0x028f; - public const int MappingM2 = 0x028e; + public const int BindM1 = 0x028f; + public const int BindM2 = 0x028e; - public const int MappingLT = 0x010d; - public const int MappingRT = 0x010e; + public const int BindLT = 0x010d; + public const int BindRT = 0x010e; - static byte[] MappingReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; - static byte[] MappingSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 }; + static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; + static byte[] CommandSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 }; - public static Dictionary BindingCodes = new Dictionary + public static Dictionary BindCodes = new Dictionary { { -1, "--------" }, { 0x0000, "[ Disabled ]" }, - { MappingM1, "M1" }, - { MappingM2, "M2" }, + { BindM1, "M1" }, + { BindM2, "M2" }, - { MappingA, "A" }, - { MappingB, "B" }, + { BindA, "A" }, + { BindB, "B" }, - { MappingX, "X" }, - { MappingY, "Y" }, + { BindX, "X" }, + { BindY, "Y" }, - { MappingLB, "Left Bumper" }, - { MappingRB, "Right Bumper" }, + { BindLB, "Left Bumper" }, + { BindRB, "Right Bumper" }, - { MappingLS, "Left Stick Click" }, - { MappingRS, "Right Stick Click" }, + { BindLS, "Left Stick Click" }, + { BindRS, "Right Stick Click" }, - { MappingDU, "DPad Up" }, - { MappingDD, "DPad Down" }, + { BindDU, "DPad Up" }, + { BindDD, "DPad Down" }, - { MappingDL, "DPad Left" }, - { MappingDR, "DPad Right" }, + { BindDL, "DPad Left" }, + { BindDR, "DPad Right" }, - { MappingVB, "View Button" }, - { MappingMB, "Menu Button" }, + { BindVB, "View Button" }, + { BindMB, "Menu Button" }, { 0x0113, "XBox/Steam" }, @@ -325,8 +325,7 @@ namespace GHelper.Ally return code; } - - static private void MappingZone(BindingZone zone) + static private void BindZone(BindingZone zone) { int KeyL1, KeyR1; int KeyL2, KeyR2; @@ -334,56 +333,56 @@ namespace GHelper.Ally switch (zone) { case BindingZone.DPadUpDown: - KeyL1 = AppConfig.Get("bind_du", MappingDU); - KeyR1 = AppConfig.Get("bind_dd", MappingDD); + KeyL1 = AppConfig.Get("bind_du", BindDU); + KeyR1 = AppConfig.Get("bind_dd", BindDD); KeyL2 = AppConfig.Get("bind2_du"); KeyR2 = AppConfig.Get("bind2_dd"); break; case BindingZone.DPadLeftRight: - KeyL1 = AppConfig.Get("bind_dl", MappingDL); - KeyR1 = AppConfig.Get("bind_dr", MappingDR); + KeyL1 = AppConfig.Get("bind_dl", BindDL); + KeyR1 = AppConfig.Get("bind_dr", BindDR); KeyL2 = AppConfig.Get("bind2_dl"); KeyR2 = AppConfig.Get("bind2_dr"); break; case BindingZone.StickClick: - KeyL1 = AppConfig.Get("bind_ls", MappingLS); - KeyR1 = AppConfig.Get("bind_rs", MappingRS); + KeyL1 = AppConfig.Get("bind_ls", BindLS); + KeyR1 = AppConfig.Get("bind_rs", BindRS); KeyL2 = AppConfig.Get("bind2_ls"); KeyR2 = AppConfig.Get("bind2_rs"); break; case BindingZone.Bumper: - KeyL1 = AppConfig.Get("bind_lb", MappingLB); - KeyR1 = AppConfig.Get("bind_rb", MappingRB); + KeyL1 = AppConfig.Get("bind_lb", BindLB); + KeyR1 = AppConfig.Get("bind_rb", BindRB); KeyL2 = AppConfig.Get("bind2_lb"); KeyR2 = AppConfig.Get("bind2_rb"); break; case BindingZone.AB: - KeyL1 = AppConfig.Get("bind_a", MappingA); - KeyR1 = AppConfig.Get("bind_b", MappingB); + KeyL1 = AppConfig.Get("bind_a", BindA); + KeyR1 = AppConfig.Get("bind_b", BindB); KeyL2 = AppConfig.Get("bind2_a"); KeyR2 = AppConfig.Get("bind2_b"); break; case BindingZone.XY: - KeyL1 = AppConfig.Get("bind_x", MappingX); - KeyR1 = AppConfig.Get("bind_y", MappingY); + KeyL1 = AppConfig.Get("bind_x", BindX); + KeyR1 = AppConfig.Get("bind_y", BindY); KeyL2 = AppConfig.Get("bind2_x"); KeyR2 = AppConfig.Get("bind2_y"); break; case BindingZone.ViewMenu: - KeyL1 = AppConfig.Get("bind_vb", MappingVB); - KeyR1 = AppConfig.Get("bind_mb", MappingMB); + KeyL1 = AppConfig.Get("bind_vb", BindVB); + KeyR1 = AppConfig.Get("bind_mb", BindMB); KeyL2 = AppConfig.Get("bind2_vb"); KeyR2 = AppConfig.Get("bind2_mb"); break; case BindingZone.M1M2: - KeyL1 = AppConfig.Get("bind_m2", MappingM2); - KeyR1 = AppConfig.Get("bind_m1", MappingM1); - KeyL2 = AppConfig.Get("bind2_m2", MappingM2); - KeyR2 = AppConfig.Get("bind2_m1", MappingM1); + KeyL1 = AppConfig.Get("bind_m2", BindM2); + KeyR1 = AppConfig.Get("bind_m1", BindM1); + KeyL2 = AppConfig.Get("bind2_m2", BindM2); + KeyR2 = AppConfig.Get("bind2_m1", BindM1); break; default: - KeyL1 = AppConfig.Get("bind_trl", MappingLT); - KeyR1 = AppConfig.Get("bind_trr", MappingRT); + KeyL1 = AppConfig.Get("bind_trl", BindLT); + KeyR1 = AppConfig.Get("bind_trr", BindRT); KeyL2 = AppConfig.Get("bind2_trl"); KeyR2 = AppConfig.Get("bind2_trr"); break; @@ -402,7 +401,7 @@ namespace GHelper.Ally DecodeBinding(KeyR1).CopyTo(bindings, 27); DecodeBinding(KeyR2).CopyTo(bindings, 38); - AsusHid.WriteInput(MappingReady, null); + AsusHid.WriteInput(CommandReady, null); AsusHid.WriteInput(bindings, $"Bind{zone}"); @@ -438,23 +437,23 @@ namespace GHelper.Ally if (applyMode is not null) _applyMode = (ControllerMode)applyMode; AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); - AsusHid.WriteInput(MappingSave, null); + AsusHid.WriteInput(CommandSave, null); - MappingZone(BindingZone.M1M2); + BindZone(BindingZone.M1M2); if (_applyMode == ControllerMode.Gamepad) { - MappingZone(BindingZone.DPadUpDown); - MappingZone(BindingZone.DPadLeftRight); - MappingZone(BindingZone.StickClick); - MappingZone(BindingZone.Bumper); - MappingZone(BindingZone.AB); - MappingZone(BindingZone.XY); - MappingZone(BindingZone.ViewMenu); - MappingZone(BindingZone.Trigger); + BindZone(BindingZone.DPadUpDown); + BindZone(BindingZone.DPadLeftRight); + BindZone(BindingZone.StickClick); + BindZone(BindingZone.Bumper); + BindZone(BindingZone.AB); + BindZone(BindingZone.XY); + BindZone(BindingZone.ViewMenu); + BindZone(BindingZone.Trigger); } - AsusHid.WriteInput(MappingSave, null); + AsusHid.WriteInput(CommandSave, null); } private void SetMode(ControllerMode mode) diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 8f54d835..e84d896f 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.147 + 0.148 diff --git a/app/Handheld.cs b/app/Handheld.cs index 1cbd698d..f0e68b92 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -41,8 +41,8 @@ namespace GHelper trackVibra.ValueChanged += Controller_Complete; - FillBinding("m1", "M1", AllyControl.MappingM1); - FillBinding("m2", "M2", AllyControl.MappingM2); + FillBinding("m1", "M1", AllyControl.BindM1); + FillBinding("m2", "M2", AllyControl.BindM2); FillBinding("a", "A"); FillBinding("b", "B"); @@ -77,7 +77,7 @@ namespace GHelper combo.DropDownStyle = ComboBoxStyle.DropDownList; combo.DisplayMember = "Value"; combo.ValueMember = "Key"; - foreach (var item in AllyControl.BindingCodes) + foreach (var item in AllyControl.BindCodes) { combo.Items.Add(new KeyValuePair(item.Key, item.Value)); if (item.Key == value) combo.SelectedItem = item; From 70e2e2e06e9c7b860d707e016de3905b8b9efd16 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 13:56:17 +0100 Subject: [PATCH 037/107] Label tweaks --- app/Handheld.Designer.cs | 56 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs index 3a429467..ba4974be 100644 --- a/app/Handheld.Designer.cs +++ b/app/Handheld.Designer.cs @@ -65,11 +65,11 @@ labelSDeadzone = new Label(); panelBindings = new Panel(); tableBindings = new TableLayoutPanel(); + labelPrimary = new Label(); + labelSecondary = new Label(); panelBindingsTitle = new Panel(); pictureBindings = new PictureBox(); labelBindings = new Label(); - labelPrimary = new Label(); - labelSecondary = new Label(); panelController.SuspendLayout(); panelVibra.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)trackVibra).BeginInit(); @@ -583,6 +583,30 @@ tableBindings.Size = new Size(700, 52); tableBindings.TabIndex = 49; // + // labelPrimary + // + labelPrimary.AutoSize = true; + labelPrimary.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelPrimary.Location = new Point(147, 5); + labelPrimary.Margin = new Padding(4, 0, 4, 0); + labelPrimary.Name = "labelPrimary"; + labelPrimary.Padding = new Padding(5); + labelPrimary.Size = new Size(115, 42); + labelPrimary.TabIndex = 41; + labelPrimary.Text = "Primary"; + // + // labelSecondary + // + labelSecondary.AutoSize = true; + labelSecondary.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelSecondary.Location = new Point(423, 5); + labelSecondary.Margin = new Padding(4, 0, 4, 0); + labelSecondary.Name = "labelSecondary"; + labelSecondary.Padding = new Padding(5); + labelSecondary.Size = new Size(144, 42); + labelSecondary.TabIndex = 42; + labelSecondary.Text = "Secondary"; + // // panelBindingsTitle // panelBindingsTitle.AutoSize = true; @@ -616,33 +640,9 @@ labelBindings.Location = new Point(45, 17); labelBindings.Margin = new Padding(4, 0, 4, 0); labelBindings.Name = "labelBindings"; - labelBindings.Size = new Size(114, 32); + labelBindings.Size = new Size(558, 32); labelBindings.TabIndex = 40; - labelBindings.Text = "Bindings"; - // - // labelPrimary - // - labelPrimary.AutoSize = true; - labelPrimary.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelPrimary.Location = new Point(147, 5); - labelPrimary.Margin = new Padding(4, 0, 4, 0); - labelPrimary.Name = "labelPrimary"; - labelPrimary.Padding = new Padding(5); - labelPrimary.Size = new Size(115, 42); - labelPrimary.TabIndex = 41; - labelPrimary.Text = "Primary"; - // - // labelSecondary - // - labelSecondary.AutoSize = true; - labelSecondary.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelSecondary.Location = new Point(423, 5); - labelSecondary.Margin = new Padding(4, 0, 4, 0); - labelSecondary.Name = "labelSecondary"; - labelSecondary.Padding = new Padding(5); - labelSecondary.Size = new Size(144, 42); - labelSecondary.TabIndex = 42; - labelSecondary.Text = "Secondary"; + labelBindings.Text = "Bindings for Gamepad or Auto (in-game) Mode"; // // Handheld // From fcfa1821a6cf7ac7c5dd40cba405a0b4d7187ac5 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 14:02:05 +0100 Subject: [PATCH 038/107] DarkTheme fix --- app/Program.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Program.cs b/app/Program.cs index e280e9bc..701cb46f 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -196,6 +196,10 @@ namespace GHelper if (settingsForm.matrixForm is not null && settingsForm.matrixForm.Text != "") settingsForm.matrixForm.InitTheme(); + + if (settingsForm.handheldForm is not null && settingsForm.handheldForm.Text != "") + settingsForm.handheldForm.InitTheme(); + break; } } From 2462bc92de513fa05a58ace053dbe68efb8837a3 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 14:10:47 +0100 Subject: [PATCH 039/107] Labels fix --- app/Handheld.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Handheld.cs b/app/Handheld.cs index f0e68b92..9996639e 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -49,11 +49,11 @@ namespace GHelper FillBinding("x", "X"); FillBinding("y", "Y"); - FillBinding("du", "DPad Up"); - FillBinding("dd", "DPad Down"); + FillBinding("du", "DPadUp"); + FillBinding("dd", "DPadDown"); - FillBinding("dl", "DPad Left"); - FillBinding("dr", "DPad Right"); + FillBinding("dl", "DPadLeft"); + FillBinding("dr", "DPadRight"); FillBinding("rb", "RBumper"); FillBinding("lb", "LBumper"); From b3b0b512d2504c79a54cedf353df39f38b54ebc5 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:02:58 +0100 Subject: [PATCH 040/107] Sleeing controller fix --- app/Ally/AllyControl.cs | 9 +++++++++ app/Input/KeyboardListener.cs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index a375ad24..04fa5ce7 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,6 +1,7 @@ using GHelper.Gpu.AMD; using GHelper.Input; using GHelper.USB; +using System.Text; namespace GHelper.Ally { @@ -408,8 +409,15 @@ namespace GHelper.Ally } + static void WakeUp() + { + AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc."), "Init"); + } + static public void SetDeadzones() { + WakeUp(); + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4, (byte)AppConfig.Get("ls_min", 0), (byte)AppConfig.Get("ls_max", 100), @@ -436,6 +444,7 @@ namespace GHelper.Ally if (applyMode is not null) _applyMode = (ControllerMode)applyMode; + WakeUp(); AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); AsusHid.WriteInput(CommandSave, null); diff --git a/app/Input/KeyboardListener.cs b/app/Input/KeyboardListener.cs index aec31600..03e7791f 100644 --- a/app/Input/KeyboardListener.cs +++ b/app/Input/KeyboardListener.cs @@ -1,5 +1,6 @@ using HidSharp; using GHelper.USB; +using GHelper.Ally; namespace GHelper.Input { @@ -38,6 +39,8 @@ namespace GHelper.Input Logger.WriteLine($"Input: {input.Device.DevicePath}"); + if (AppConfig.IsAlly()) AllyControl.ApplyMode(); + try { while (!cancellationTokenSource.Token.IsCancellationRequested) From 736cad7ff5ea3ab11c1e3e01959562691cd74b3b Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 17:22:32 +0100 Subject: [PATCH 041/107] Ally controller wake up tweaks --- app/Ally/AllyControl.cs | 85 ++++++++++++++++++++--------------- app/Gpu/AMD/AmdGpuControl.cs | 3 ++ app/Input/KeyboardListener.cs | 3 -- 3 files changed, 53 insertions(+), 38 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 04fa5ce7..8c55bfe5 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,6 +1,7 @@ using GHelper.Gpu.AMD; using GHelper.Input; using GHelper.USB; +using HidSharp; using System.Text; namespace GHelper.Ally @@ -35,7 +36,7 @@ namespace GHelper.Ally SettingsForm settings; static ControllerMode _mode = ControllerMode.Auto; - static ControllerMode _applyMode = ControllerMode.Auto; + static ControllerMode _applyMode = ControllerMode.Mouse; static int _autoCount = 0; static int fpsLimit = -1; @@ -241,9 +242,8 @@ namespace GHelper.Ally if (_autoCount > 2) { - _applyMode = newMode; _autoCount = 0; - ApplyMode(_applyMode); + ApplyMode(newMode); Logger.WriteLine(fps.ToString()); } @@ -254,14 +254,10 @@ namespace GHelper.Ally if (AppConfig.IsAlly()) settings.VisualiseAlly(true); else return; - SetDeadzones(); SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto)); settings.VisualiseBacklight(InputDispatcher.GetBacklight()); - - fpsLimit = amdControl.GetFPSLimit(); - Logger.WriteLine($"FPS Limit: {fpsLimit}"); - settings.VisualiseFPSLimit(fpsLimit); + settings.VisualiseFPSLimit(amdControl.GetFPSLimit()); } @@ -439,37 +435,60 @@ namespace GHelper.Ally } - public static void ApplyMode(ControllerMode? applyMode = null) + public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto) { + Task.Run(() => { - if (applyMode is not null) _applyMode = (ControllerMode)applyMode; + HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID); + int count = 0; - WakeUp(); - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); - AsusHid.WriteInput(CommandSave, null); + while (input == null && count++ < 5) + { + input = AsusHid.FindHidStream(AsusHid.INPUT_ID); + Thread.Sleep(2000); + } - BindZone(BindingZone.M1M2); + if (input == null) + { + Logger.WriteLine($"Controller not found"); + return; + } - if (_applyMode == ControllerMode.Gamepad) - { - BindZone(BindingZone.DPadUpDown); - BindZone(BindingZone.DPadLeftRight); - BindZone(BindingZone.StickClick); - BindZone(BindingZone.Bumper); - BindZone(BindingZone.AB); - BindZone(BindingZone.XY); - BindZone(BindingZone.ViewMenu); - BindZone(BindingZone.Trigger); - } + if (applyMode != ControllerMode.Auto) _applyMode = applyMode; - AsusHid.WriteInput(CommandSave, null); + WakeUp(); + + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); + AsusHid.WriteInput(CommandSave, null); + + BindZone(BindingZone.M1M2); + + if (_applyMode == ControllerMode.Gamepad) + { + BindZone(BindingZone.DPadUpDown); + BindZone(BindingZone.DPadLeftRight); + BindZone(BindingZone.StickClick); + BindZone(BindingZone.Bumper); + BindZone(BindingZone.AB); + BindZone(BindingZone.XY); + BindZone(BindingZone.ViewMenu); + BindZone(BindingZone.Trigger); + } + + AsusHid.WriteInput(CommandSave, null); + SetDeadzones(); + }); } private void SetMode(ControllerMode mode) { + + _mode = mode; + ApplyMode(mode); + AppConfig.Set("controller_mode", (int)mode); + if (mode == ControllerMode.Auto) { - _applyMode = ControllerMode.Auto; amdControl.StartFPS(); timer.Start(); } @@ -477,11 +496,8 @@ namespace GHelper.Ally { timer.Stop(); amdControl.StopFPS(); - ApplyMode(mode); } - - _mode = mode; - AppConfig.Set("controller_mode", (int)mode); + settings.VisualiseController(mode); } @@ -491,17 +507,16 @@ namespace GHelper.Ally switch (_mode) { case ControllerMode.Auto: - _mode = ControllerMode.Gamepad; + SetMode(ControllerMode.Gamepad); break; case ControllerMode.Gamepad: - _mode = ControllerMode.Mouse; + SetMode(ControllerMode.Mouse); break; case ControllerMode.Mouse: - _mode = ControllerMode.Auto; + SetMode(ControllerMode.Auto); break; } - SetMode(_mode); } } diff --git a/app/Gpu/AMD/AmdGpuControl.cs b/app/Gpu/AMD/AmdGpuControl.cs index 45c2c6e2..bae8716c 100644 --- a/app/Gpu/AMD/AmdGpuControl.cs +++ b/app/Gpu/AMD/AmdGpuControl.cs @@ -168,6 +168,9 @@ public class AmdGpuControl : IGpuControl if (_adlContextHandle == nint.Zero || _iGPU == null) return -1; ADLFPSSettingsOutput settings; if (ADL2_FPS_Settings_Get(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, out settings) != Adl2.ADL_SUCCESS) return -1; + + Logger.WriteLine($"FPS Limit: {settings.ulACFPSCurrent}"); + return settings.ulACFPSCurrent; } diff --git a/app/Input/KeyboardListener.cs b/app/Input/KeyboardListener.cs index 03e7791f..776ac43e 100644 --- a/app/Input/KeyboardListener.cs +++ b/app/Input/KeyboardListener.cs @@ -21,7 +21,6 @@ namespace GHelper.Input HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID); // Fallback - int count = 0; while (input == null && count++ < 5) @@ -39,8 +38,6 @@ namespace GHelper.Input Logger.WriteLine($"Input: {input.Device.DevicePath}"); - if (AppConfig.IsAlly()) AllyControl.ApplyMode(); - try { while (!cancellationTokenSource.Token.IsCancellationRequested) From 99dfcbb95c51270314a6a8830b2641051f8cd787 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 17:33:16 +0100 Subject: [PATCH 042/107] Clock reset revert --- app/Mode/ModeControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index a3fe3f6c..c7406ed9 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -318,7 +318,7 @@ namespace GHelper.Mode int memory = AppConfig.GetMode("gpu_memory"); int clock_limit = AppConfig.GetMode("gpu_clock_limit"); - //if (core == -1 && memory == -1 && clock_limit == -1) return; + if (core == -1 && memory == -1 && clock_limit == -1) return; //if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false; if (Program.acpi.DeviceGet(AsusACPI.GPUEco) == 1) { Logger.WriteLine("Clocks: Eco"); return; } From db3804414e33cd5387ddb8f52289f4a3d342e5bb Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 17:42:42 +0100 Subject: [PATCH 043/107] Reset clock limit https://github.com/seerge/g-helper/issues/1915 --- app/Gpu/NVidia/NvidiaGpuControl.cs | 2 ++ app/Mode/ModeControl.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Gpu/NVidia/NvidiaGpuControl.cs b/app/Gpu/NVidia/NvidiaGpuControl.cs index 6a362b6e..08e3e88e 100644 --- a/app/Gpu/NVidia/NvidiaGpuControl.cs +++ b/app/Gpu/NVidia/NvidiaGpuControl.cs @@ -152,6 +152,8 @@ public class NvidiaGpuControl : IGpuControl int _clockLimit = GetMaxGPUCLock(); + if (_clockLimit < 0 && clock == 0) return 0; + if (_clockLimit != clock) { if (clock > 0) RunPowershellCommand($"nvidia-smi -lgc 0,{clock}"); diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index c7406ed9..a3fe3f6c 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -318,7 +318,7 @@ namespace GHelper.Mode int memory = AppConfig.GetMode("gpu_memory"); int clock_limit = AppConfig.GetMode("gpu_clock_limit"); - if (core == -1 && memory == -1 && clock_limit == -1) return; + //if (core == -1 && memory == -1 && clock_limit == -1) return; //if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false; if (Program.acpi.DeviceGet(AsusACPI.GPUEco) == 1) { Logger.WriteLine("Clocks: Eco"); return; } From 6479079212d75aa788ecc5f3be39b7fe80d1df0e Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 17:53:35 +0100 Subject: [PATCH 044/107] Hotkeys for switching modes https://github.com/seerge/g-helper/issues/1931 --- app/Input/InputDispatcher.cs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 68aaaa39..5fffeb9b 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -116,11 +116,19 @@ namespace GHelper.Input if (keyApp != Keys.None) hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control, keyApp); - hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14); - hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15); - if (!AppConfig.Is("skip_hotkeys")) { + + 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.F16); + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F17); + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F18); + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F19); + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F20); + + hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeDown); hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeUp); hook.RegisterHotKey(ModifierKeys.Shift, Keys.VolumeDown); @@ -357,6 +365,21 @@ namespace GHelper.Input case Keys.F15: Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeStandard); break; + case Keys.F16: + modeControl.SetPerformanceMode(2, true); + break; + case Keys.F17: + modeControl.SetPerformanceMode(0, true); + 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; } } From 8eb920313d968b1895e2d1109dba33e91215e405 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 18:04:29 +0100 Subject: [PATCH 045/107] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 126f75f3..39537edc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,7 +6,7 @@ Small and lightweight Armoury Crate alternative for Asus laptops offering almost same functionality without extra bloat and unnecessary services. Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, TUF Series, Strix / Scar Series, ProArt, VivoBook and many more! -# [:floppy_disk:Download](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip) +# [:floppy_disk:Download](https://github.com/seerge/g-helper/releases/download/v0.148/GHelper.zip) - [FAQ](https://github.com/seerge/g-helper/wiki/FAQ) - [Setup and Requirements](https://github.com/seerge/g-helper/wiki/Requirements) From 5607e4faecd772de8c4434c8456e0da9233b25a4 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 22:57:13 +0100 Subject: [PATCH 046/107] Update README.md --- docs/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/README.md b/docs/README.md index 39537edc..e195c111 100644 --- a/docs/README.md +++ b/docs/README.md @@ -93,14 +93,16 @@ Role of G-Helper for your laptop is similar to a role of a remote control for yo ### :mouse: Asus Mouse and other peripherals support [Currently supported models](https://github.com/seerge/g-helper/discussions/900) -- ROG Harpe Ace Aim Lab Edition -- ROG Keris Wireless - ROG Chakram X (P708) - ROG Chakram Core (P511) -- ROG Strix III Gladius III Aimpoint Wireless (P711) - ROG Gladius II and Gladius II Origin (P502 and P504) - ROG Gladius III - ROG Gladius III Wireless +- ROG Harpe Ace Aim Lab Edition +- ROG Keris Wireless +- ROG Strix Carry (P508) +- ROG Strix III Gladius III Aimpoint Wireless (P711) +- ROG Spatha - ROG Strix Impact II Wireless - TUF Gaming M4 Wireless (P306) - TUF Gaming M3 From c4ccdbe7370dec584db885c2eb999de91c7ccf50 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:02:20 +0100 Subject: [PATCH 047/107] Update README.md --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index e195c111..4a16a64e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -139,6 +139,7 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio - [NvAPIWrapper](https://github.com/falahati/NvAPIWrapper) for accessing Nvidia API - [Starlight](https://github.com/vddCore/Starlight) for anime matrix communication protocol - [UXTU](https://github.com/JamesCJ60/Universal-x86-Tuning-Utility) for undervolting using Ryzen System Management Unit +- [AsusCtrl](https://gitlab.com/asus-linux/asusctl) for inspiration and some reverse engineering **Disclaimers** "ROG", "TUF", and "Armoury Crate" are trademarked by and belong to AsusTek Computer, Inc. I make no claims to these or any assets belonging to AsusTek Computer and use them purely for informational purposes only. From f0d89878066b924cddbcbdc16cda3ca94f2d285b Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:02:49 +0100 Subject: [PATCH 048/107] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 4a16a64e..6e8f53bd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -139,7 +139,7 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio - [NvAPIWrapper](https://github.com/falahati/NvAPIWrapper) for accessing Nvidia API - [Starlight](https://github.com/vddCore/Starlight) for anime matrix communication protocol - [UXTU](https://github.com/JamesCJ60/Universal-x86-Tuning-Utility) for undervolting using Ryzen System Management Unit -- [AsusCtrl](https://gitlab.com/asus-linux/asusctl) for inspiration and some reverse engineering +- [AsusCtl](https://gitlab.com/asus-linux/asusctl) for inspiration and some reverse engineering **Disclaimers** "ROG", "TUF", and "Armoury Crate" are trademarked by and belong to AsusTek Computer, Inc. I make no claims to these or any assets belonging to AsusTek Computer and use them purely for informational purposes only. From 6d56bc12318b9af1d0f07ecd25fc9eccf3a124b4 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:09:40 +0100 Subject: [PATCH 049/107] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 6e8f53bd..9d8824f8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,7 +6,7 @@ Small and lightweight Armoury Crate alternative for Asus laptops offering almost same functionality without extra bloat and unnecessary services. Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, TUF Series, Strix / Scar Series, ProArt, VivoBook and many more! -# [:floppy_disk:Download](https://github.com/seerge/g-helper/releases/download/v0.148/GHelper.zip) +# [:floppy_disk:Download](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip) - [FAQ](https://github.com/seerge/g-helper/wiki/FAQ) - [Setup and Requirements](https://github.com/seerge/g-helper/wiki/Requirements) From dedb2123f0e4f82aedddb590cd944d49df7c07cb Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 18 Jan 2024 15:08:13 +0100 Subject: [PATCH 050/107] Battery Discharge reader --- app/AsusACPI.cs | 20 ++++++++++++++++++++ app/Gpu/NVidia/NvidiaGpuControl.cs | 8 ++++---- app/HardwareControl.cs | 19 +++++++++++++------ 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index d281c7f4..b1b638b4 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -58,6 +58,8 @@ public class AsusACPI public const uint GPU_Fan = 0x00110014; public const uint Mid_Fan = 0x00110031; + public const uint BatteryDischarge = 0x0012005A; + public const uint PerformanceMode = 0x00120075; // Performance modes public const uint VivoBookMode = 0x00110019; // Vivobook performance modes @@ -372,6 +374,23 @@ public class AsusACPI return CallMethod(DSTS, args); } + + public decimal? GetBatteryDischarge() + { + var buffer = DeviceGetBuffer(BatteryDischarge); + + if (buffer[2] > 0) + { + buffer[2] = 0; + return (decimal)BitConverter.ToInt16(buffer, 0) / 100; + } + else + { + return null; + } + + + } public int SetGPUEco(int eco) { int ecoFlag = DeviceGet(GPUEco); @@ -412,6 +431,7 @@ public class AsusACPI return fan; } + public int SetFanRange(AsusFan device, byte[] curve) { diff --git a/app/Gpu/NVidia/NvidiaGpuControl.cs b/app/Gpu/NVidia/NvidiaGpuControl.cs index 08e3e88e..878d9a7a 100644 --- a/app/Gpu/NVidia/NvidiaGpuControl.cs +++ b/app/Gpu/NVidia/NvidiaGpuControl.cs @@ -180,10 +180,10 @@ public class NvidiaGpuControl : IGpuControl if (core < MinCoreOffset || core > MaxCoreOffset) return 0; if (memory < MinMemoryOffset || memory > MaxMemoryOffset) return 0; - if (GetClocks(out int currentCore, out int currentMemory)) - { - if (Math.Abs(core - currentCore) < 5 && Math.Abs(memory - currentMemory) < 5) return 0; - } + GetClocks(out int currentCore, out int currentMemory); + + // Nothing to set + if (Math.Abs(core - currentCore) < 5 && Math.Abs(memory - currentMemory) < 5) return 0; PhysicalGPU internalGpu = _internalGpu!; diff --git a/app/HardwareControl.cs b/app/HardwareControl.cs index 86c1c462..e707e9cb 100644 --- a/app/HardwareControl.cs +++ b/app/HardwareControl.cs @@ -1,13 +1,12 @@ using GHelper; +using GHelper.Battery; using GHelper.Fan; using GHelper.Gpu; -using GHelper.Gpu.NVidia; using GHelper.Gpu.AMD; - +using GHelper.Gpu.NVidia; using GHelper.Helpers; using System.Diagnostics; using System.Management; -using GHelper.Battery; public static class HardwareControl { @@ -68,9 +67,16 @@ public static class HardwareControl chargeCapacity = Convert.ToDecimal(obj["RemainingCapacity"]); + decimal? discharge = Program.acpi.GetBatteryDischarge(); + if (discharge is not null) + { + batteryRate = discharge; + return; + } + decimal chargeRate = Convert.ToDecimal(obj["ChargeRate"]); decimal dischargeRate = Convert.ToDecimal(obj["DischargeRate"]); - + if (chargeRate > 0) batteryRate = chargeRate / 1000; else @@ -155,7 +161,8 @@ public static class HardwareControl return health; } - public static float? GetCPUTemp() { + public static float? GetCPUTemp() + { var last = DateTimeOffset.Now.ToUnixTimeSeconds(); if (Math.Abs(last - lastUpdate) < 2) return cpuTemp; @@ -255,7 +262,7 @@ public static class HardwareControl GpuControl?.Dispose(); IGpuControl _gpuControl = new NvidiaGpuControl(); - + if (_gpuControl.IsValid) { GpuControl = _gpuControl; From 97f2cc4332b9fa304b7dd2db4cf99448f0a18c02 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:44:39 +0100 Subject: [PATCH 051/107] New Crowdin updates (#1945) * New translations strings.resx (Chinese Traditional) * New translations strings.resx (Chinese Traditional) --- app/Properties/Strings.zh-TW.resx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Properties/Strings.zh-TW.resx b/app/Properties/Strings.zh-TW.resx index 9b734eea..de0a553b 100644 --- a/app/Properties/Strings.zh-TW.resx +++ b/app/Properties/Strings.zh-TW.resx @@ -250,10 +250,10 @@ 閒置幾秒後關閉燈光:插電時 / 使用電池 (0 = 不關閉) - Backlight Timeout when on battery + 閒置時關閉燈光(電池模式) - Backlight Timeout when plugged + 閒置時關閉燈光(充電模式) 平衡模式 @@ -271,7 +271,7 @@ 僅本次將電力充滿 - BIOS與驅動程式更新 Updates + BIOS與驅動程式更新 開機時 From f1ef397adabf899dc1d8a4cddf29f0bde91f1fcd Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 19 Jan 2024 11:45:33 +0100 Subject: [PATCH 052/107] Backlight checkboxes fix for some Strix models https://github.com/seerge/g-helper/issues/1943 --- app/Extra.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Extra.cs b/app/Extra.cs index ba2d8fde..8dfd85d2 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -315,11 +315,15 @@ namespace GHelper if ((!AppConfig.IsStrix() && !AppConfig.IsZ13()) || AppConfig.IsStrixLimitedRGB() || AppConfig.IsARCNM()) { - labelBacklightBar.Visible = false; - checkAwakeBar.Visible = false; - checkBootBar.Visible = false; - checkSleepBar.Visible = false; - checkShutdownBar.Visible = false; + + if (!AppConfig.IsStrixLimitedRGB()) + { + labelBacklightBar.Visible = false; + checkAwakeBar.Visible = false; + checkBootBar.Visible = false; + checkSleepBar.Visible = false; + checkShutdownBar.Visible = false; + } labelBacklightLid.Visible = false; checkAwakeLid.Visible = false; From 8b26e9aeba72e473cd71805a0f4455118cda6c7f Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 19 Jan 2024 18:26:20 +0100 Subject: [PATCH 053/107] Ally bindings --- app/Ally/AllyControl.cs | 442 +++++++++++---------- app/GHelper.csproj | 2 +- app/Handheld.Designer.cs | 4 +- app/Handheld.cs | 18 +- app/Input/InputDispatcher.cs | 13 +- app/Settings.cs | 3 + app/UI/{CustomControls.cs => RForm.cs} | 14 +- app/UI/{CustomControls.resx => RForm.resx} | 0 app/USB/Aura.cs | 6 +- 9 files changed, 287 insertions(+), 215 deletions(-) rename app/UI/{CustomControls.cs => RForm.cs} (83%) rename app/UI/{CustomControls.resx => RForm.resx} (100%) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 8c55bfe5..c4aec4d4 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -3,6 +3,7 @@ using GHelper.Input; using GHelper.USB; using HidSharp; using System.Text; +using System.Windows.Forms; namespace GHelper.Ally { @@ -13,6 +14,7 @@ namespace GHelper.Ally Gamepad = 1, WASD = 2, Mouse = 3, + Skip = -1, } public enum BindingZone : byte @@ -41,40 +43,58 @@ namespace GHelper.Ally static int fpsLimit = -1; - public const int BindA = 0x0101; - public const int BindB = 0x0102; + public const string BindA = "01-01"; + public const string BindB = "01-02"; + public const string BindX = "01-03"; + public const string BindY = "01-04"; + public const string BindLB = "01-05"; + public const string BindRB = "01-06"; + public const string BindLS = "01-07"; + public const string BindRS = "01-08"; + public const string BindDU = "01-09"; + public const string BindDD = "01-0A"; + public const string BindDL = "01-0B"; + public const string BindDR = "01-0C"; + public const string BindVB = "01-11"; + public const string BindMB = "01-12"; + public const string BindM1 = "02-8F"; + public const string BindM2 = "02-8E"; + public const string BindLT = "01-0D"; + public const string BindRT = "01-0E"; + public const string BindMouseL = "03-01"; + public const string BindMouseR = "03-02"; - public const int BindX = 0x0103; - public const int BindY = 0x0104; + public const string BindKBU = "02-98"; + public const string BindKBD = "02-99"; + public const string BindKBL = "02-91"; + public const string BindKBR = "02-9D"; - public const int BindLB = 0x0105; - public const int BindRB = 0x0106; + public const string BindTab = "02-0D"; + public const string BindEnter = "02-5A"; + public const string BindBack = "02-66"; - public const int BindLS = 0x0107; - public const int BindRS = 0x0108; + public const string BindPgU = "02-96"; + public const string BindPgD = "02-97"; - public const int BindDU = 0x0109; - public const int BindDD = 0x010A; + public const string BindShift = "02-88"; + public const string BindCtrl = "02-8C"; - public const int BindDL = 0x010B; - public const int BindDR = 0x010C; + public const string BindTaskManager = "04-03-8C-88-76"; + public const string BindCloseWindow = "04-02-8A-0C"; - public const int BindVB = 0x0111; - public const int BindMB = 0x0112; + public const string BindBrightnessDown = "04-04-8C-88-8A-05"; + public const string BindBrightnessUp = "04-04-8C-88-8A-06"; - public const int BindM1 = 0x028f; - public const int BindM2 = 0x028e; + public const string BindOverlay = "04-03-8C-88-44"; - public const int BindLT = 0x010d; - public const int BindRT = 0x010e; static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; static byte[] CommandSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 }; - public static Dictionary BindCodes = new Dictionary + public static Dictionary BindCodes = new Dictionary { - { -1, "--------" }, - { 0x0000, "[ Disabled ]" }, + { "", "--------" }, + { "00-00", "[ Disabled ]" }, { BindM1, "M1" }, { BindM2, "M2" }, @@ -100,122 +120,128 @@ namespace GHelper.Ally { BindVB, "View Button" }, { BindMB, "Menu Button" }, - { 0x0113, "XBox/Steam" }, + { "01-13", "XBox/Steam" }, - { 0x0276, "Esc" }, - { 0x0250, "F1" }, - { 0x0260, "F2" }, - { 0x0240, "F3" }, - { 0x020C, "F4" }, - { 0x0203, "F5" }, - { 0x020b, "F6" }, - { 0x0280, "F7" }, - { 0x020a, "F8" }, - { 0x0201, "F9" }, - { 0x0209, "F10" }, - { 0x0278, "F11" }, - { 0x0207, "F12" }, - { 0x020E, "`" }, - { 0x0216, "1" }, - { 0x021E, "2" }, - { 0x0226, "3" }, - { 0x0225, "4" }, - { 0x022E, "5" }, - { 0x0236, "6" }, - { 0x023D, "7" }, - { 0x023E, "8" }, - { 0x0246, "9" }, - { 0x0245, "0" }, - { 0x024E, "-" }, - { 0x0255, "=" }, - { 0x0266, "Backspace" }, - { 0x020D, "Tab" }, - { 0x0215, "Q" }, - { 0x021D, "W" }, - { 0x0224, "E" }, - { 0x022D, "R" }, - { 0x022C, "T" }, - { 0x0235, "Y" }, - { 0x023C, "U" }, - { 0x0244, "O" }, - { 0x024D, "P" }, - { 0x0254, "[" }, - { 0x025B, "]" }, - { 0x025D, "|" }, - { 0x0258, "Caps" }, - { 0x021C, "A" }, - { 0x021B, "S" }, - { 0x0223, "D" }, - { 0x022B, "F" }, - { 0x0234, "G" }, - { 0x0233, "H" }, - { 0x023B, "J" }, - { 0x0242, "k" }, - { 0x024b, "l" }, - { 0x024c, ";" }, - { 0x0252, "'" }, - { 0x025A, "Enter" }, - { 0x0288, "LShift" }, - { 0x0222, "X" }, - { 0x021A, "Z" }, - { 0x0221, "C" }, - { 0x022A, "V" }, - { 0x0232, "B" }, - { 0x0231, "N" }, - { 0x023A, "M" }, - { 0x0241, "," }, - { 0x0249, "." }, - { 0x0289, "RShift" }, - { 0x028C, "LCtl" }, - { 0x0282, "Meta" }, - { 0x028A, "LAlt" }, - { 0x0229, "Space" }, - { 0x028B, "RAlt" }, - { 0x0284, "App menu" }, - { 0x028D, "RCtl" }, - { 0x02C3, "PrntScn" }, - { 0x027E, "ScrLk" }, - { 0x02C2, "Insert" }, - { 0x0294, "Home" }, - { 0x0296, "PgUp" }, - { 0x02C0, "Delete" }, - { 0x0295, "End" }, - { 0x0297, "PgDwn" }, - { 0x0298, "UpArrow" }, - { 0x0299, "DownArrow" }, - { 0x0291, "LeftArrow" }, - { 0x029B, "RightArrow" }, - { 0x0277, "NumLock" }, - { 0x0290, "NumSlash" }, - { 0x027C, "NumStar" }, - { 0x027B, "NumHyphen" }, - { 0x0270, "Num0" }, - { 0x0269, "Num1" }, - { 0x0272, "Num2" }, - { 0x027A, "Num3" }, - { 0x026B, "Num4" }, - { 0x0273, "Num5" }, - { 0x0274, "Num6" }, - { 0x026C, "Num7" }, - { 0x0275, "Num8" }, - { 0x027D, "Num9" }, - { 0x0279, "NumPlus" }, - { 0x0281, "NumEnter" }, - { 0x0271, "NumPeriod" }, + { "02-76", "Esc" }, + { "02-05", "F1" }, + { "02-06", "F2" }, + { "02-04", "F3" }, + { "02-0C", "F4" }, + { "02-03", "F5" }, + { "02-0B", "F6" }, + { "02-80", "F7" }, + { "02-0A", "F8" }, + { "02-01", "F9" }, + { "02-09", "F10" }, + { "02-78", "F11" }, + { "02-07", "F12" }, + { "02-0E", "`" }, + { "02-16", "1" }, + { "02-1E", "2" }, + { "02-26", "3" }, + { "02-25", "4" }, + { "02-2E", "5" }, + { "02-36", "6" }, + { "02-3D", "7" }, + { "02-3E", "8" }, + { "02-46", "9" }, + { "02-45", "0" }, + { "02-4E", "-" }, + { "02-55", "=" }, + { BindBack, "Backspace" }, + { BindTab, "Tab" }, + { "02-15", "Q" }, + { "02-1D", "W" }, + { "02-24", "E" }, + { "02-2D", "R" }, + { "02-2C", "T" }, + { "02-35", "Y" }, + { "02-3C", "U" }, + { "02-44", "O" }, + { "02-4D", "P" }, + { "02-54", "[" }, + { "02-5B", "]" }, + { "02-5D", "|" }, + { "02-58", "Caps" }, + { "02-1C", "A" }, + { "02-1B", "S" }, + { "02-23", "D" }, + { "02-2B", "F" }, + { "02-34", "G" }, + { "02-33", "H" }, + { "02-3B", "J" }, + { "02-42", "k" }, + { "02-4B", "l" }, + { "02-4C", ";" }, + { "02-52", "'" }, + { BindEnter, "Enter" }, + { BindShift, "LShift" }, + { "02-22", "X" }, + { "02-1A", "Z" }, + { "02-21", "C" }, + { "02-2A", "V" }, + { "02-32", "B" }, + { "02-31", "N" }, + { "02-3A", "M" }, + { "02-41", "," }, + { "02-49", "." }, + { "02-89", "RShift" }, + { BindCtrl, "LCtl" }, + { "02-82", "Meta" }, + { "02-8A", "LAlt" }, + { "02-29", "Space" }, + { "02-8B", "RAlt" }, + { "02-84", "App menu" }, + { "02-8D", "RCtl" }, + { "02-C3", "PrntScn" }, + { "02-7E", "ScrLk" }, + { "02-C2", "Insert" }, + { BindPgU, "PgUp" }, + { BindPgD, "PgDwn" }, + { "02-C0", "Delete" }, + { "02-94", "Home" }, + { "02-95", "End" }, + { BindKBU, "UpArrow" }, + { BindKBD, "DownArrow" }, + { BindKBL, "LeftArrow" }, + { BindKBR, "RightArrow" }, + { "02-77", "NumLock" }, + { "02-90", "NumSlash" }, + { "02-7C", "NumStar" }, + { "02-7B", "NumHyphen" }, + { "02-70", "Num0" }, + { "02-69", "Num1" }, + { "02-72", "Num2" }, + { "02-7A", "Num3" }, + { "02-6B", "Num4" }, + { "02-73", "Num5" }, + { "02-74", "Num6" }, + { "02-6C", "Num7" }, + { "02-75", "Num8" }, + { "02-7D", "Num9" }, + { "02-79", "NumPlus" }, + { "02-81", "NumEnter" }, + { "02-71", "NumPeriod" }, - { 0x0301, "Mouse left click" }, - { 0x0302, "Mouse right click" }, - { 0x0303, "Mouse middle click" }, - { 0x0304, "Mouse scroll up" }, - { 0x0305, "Mouse scroll down" }, + { BindMouseL, "Mouse left click" }, + { BindMouseR, "Mouse right click" }, + { "03-03", "Mouse middle click" }, + { "03-04", "Mouse scroll up" }, + { "03-05", "Mouse scroll down" }, - { 0x0516, "Screenshot" }, - { 0x0519, "Show keyboard" }, - { 0x051c, "Show desktop" }, - { 0x051e, "Begin recording" }, - { 0x0501, "Mic off" }, - { 0x0502, "Vol Down" }, - { 0x0503, "Vol Up" } + { BindTaskManager, "Task Manager" }, + { BindCloseWindow, "Close Window" }, + + { "05-16", "Screenshot" }, + { "05-19", "Show keyboard" }, + { "05-1C", "Show desktop" }, + { "05-1E", "Begin recording" }, + { "05-01", "Mic off" }, + + { "05-03", "Vol Up" }, + { "05-02", "Vol Down" }, + { BindBrightnessUp, "Bright Up" }, + { BindBrightnessDown, "Bright Down" } }; public AllyControl(SettingsForm settingsForm) @@ -293,29 +319,39 @@ namespace GHelper.Ally settings.VisualiseBacklight(InputDispatcher.GetBacklight()); } - static private byte[] DecodeBinding(int binding) + static private byte[] DecodeBinding(string binding = "") { + byte[] bytes; - if (binding < 0) return new byte[2]; + if (binding == "" || binding is null) return new byte[2]; - byte command = (byte)(binding & 0xFF); - byte device = (byte)((binding >> 8) & 0xFF); + try + { + bytes = AppConfig.StringToBytes(binding); + } catch + { + return new byte[2]; + } byte[] code = new byte[10]; - code[0] = device; - switch (device) + code[0] = bytes[0]; + + switch (bytes[0]) { case 0x02: - code[2] = command; + code[2] = bytes[1]; break; case 0x03: - code[4] = command; + code[4] = bytes[1]; + break; + case 0x04: + bytes.Skip(1).ToArray().CopyTo(code, 5); break; case 0x05: - code[3] = command; + code[3] = bytes[1]; break; default: - code[1] = command; + code[1] = bytes[1]; break; } @@ -324,70 +360,72 @@ namespace GHelper.Ally static private void BindZone(BindingZone zone) { - int KeyL1, KeyR1; - int KeyL2, KeyR2; + string KeyL1, KeyR1; + string KeyL2, KeyR2; + + bool desktop = (_applyMode == ControllerMode.Mouse); switch (zone) { case BindingZone.DPadUpDown: - KeyL1 = AppConfig.Get("bind_du", BindDU); - KeyR1 = AppConfig.Get("bind_dd", BindDD); - KeyL2 = AppConfig.Get("bind2_du"); - KeyR2 = AppConfig.Get("bind2_dd"); + KeyL1 = AppConfig.GetString("bind_du", desktop ? BindKBU : BindDU); + KeyR1 = AppConfig.GetString("bind_dd", desktop ? BindKBD : BindDD); + KeyL2 = AppConfig.GetString("bind2_du", BindBrightnessUp); + KeyR2 = AppConfig.GetString("bind2_dd", BindBrightnessDown); break; case BindingZone.DPadLeftRight: - KeyL1 = AppConfig.Get("bind_dl", BindDL); - KeyR1 = AppConfig.Get("bind_dr", BindDR); - KeyL2 = AppConfig.Get("bind2_dl"); - KeyR2 = AppConfig.Get("bind2_dr"); + KeyL1 = AppConfig.GetString("bind_dl", desktop ? BindKBL : BindDL); + KeyR1 = AppConfig.GetString("bind_dr", desktop ? BindKBR : BindDR); + KeyL2 = AppConfig.GetString("bind2_dl"); + KeyR2 = AppConfig.GetString("bind2_dr"); break; case BindingZone.StickClick: - KeyL1 = AppConfig.Get("bind_ls", BindLS); - KeyR1 = AppConfig.Get("bind_rs", BindRS); - KeyL2 = AppConfig.Get("bind2_ls"); - KeyR2 = AppConfig.Get("bind2_rs"); + KeyL1 = AppConfig.GetString("bind_ls", desktop ? BindShift : BindLS); + KeyR1 = AppConfig.GetString("bind_rs", desktop ? BindMouseL : BindRS); + KeyL2 = AppConfig.GetString("bind2_ls"); + KeyR2 = AppConfig.GetString("bind2_rs"); break; case BindingZone.Bumper: - KeyL1 = AppConfig.Get("bind_lb", BindLB); - KeyR1 = AppConfig.Get("bind_rb", BindRB); - KeyL2 = AppConfig.Get("bind2_lb"); - KeyR2 = AppConfig.Get("bind2_rb"); + KeyL1 = AppConfig.GetString("bind_lb", desktop ? BindTab : BindLB); + KeyR1 = AppConfig.GetString("bind_rb", desktop ? BindMouseL : BindRB); + KeyL2 = AppConfig.GetString("bind2_lb"); + KeyR2 = AppConfig.GetString("bind2_rb"); break; case BindingZone.AB: - KeyL1 = AppConfig.Get("bind_a", BindA); - KeyR1 = AppConfig.Get("bind_b", BindB); - KeyL2 = AppConfig.Get("bind2_a"); - KeyR2 = AppConfig.Get("bind2_b"); + KeyL1 = AppConfig.GetString("bind_a", desktop ? BindEnter : BindA); + KeyR1 = AppConfig.GetString("bind_b", desktop ? BindBack : BindB); + KeyL2 = AppConfig.GetString("bind2_a"); + KeyR2 = AppConfig.GetString("bind2_b"); break; case BindingZone.XY: - KeyL1 = AppConfig.Get("bind_x", BindX); - KeyR1 = AppConfig.Get("bind_y", BindY); - KeyL2 = AppConfig.Get("bind2_x"); - KeyR2 = AppConfig.Get("bind2_y"); + KeyL1 = AppConfig.GetString("bind_x", desktop ? BindPgD : BindX); + KeyR1 = AppConfig.GetString("bind_y", desktop ? BindPgU : BindY); + KeyL2 = AppConfig.GetString("bind2_x"); + KeyR2 = AppConfig.GetString("bind2_y", BindOverlay); break; case BindingZone.ViewMenu: - KeyL1 = AppConfig.Get("bind_vb", BindVB); - KeyR1 = AppConfig.Get("bind_mb", BindMB); - KeyL2 = AppConfig.Get("bind2_vb"); - KeyR2 = AppConfig.Get("bind2_mb"); + KeyL1 = AppConfig.GetString("bind_vb", BindVB); + KeyR1 = AppConfig.GetString("bind_mb", BindMB); + KeyL2 = AppConfig.GetString("bind2_vb"); + KeyR2 = AppConfig.GetString("bind2_mb", BindCloseWindow); break; case BindingZone.M1M2: - KeyL1 = AppConfig.Get("bind_m2", BindM2); - KeyR1 = AppConfig.Get("bind_m1", BindM1); - KeyL2 = AppConfig.Get("bind2_m2", BindM2); - KeyR2 = AppConfig.Get("bind2_m1", BindM1); + KeyL1 = AppConfig.GetString("bind_m2", BindM2); + KeyR1 = AppConfig.GetString("bind_m1", BindM1); + KeyL2 = AppConfig.GetString("bind2_m2", BindM2); + KeyR2 = AppConfig.GetString("bind2_m1", BindM1); break; default: - KeyL1 = AppConfig.Get("bind_trl", BindLT); - KeyR1 = AppConfig.Get("bind_trr", BindRT); - KeyL2 = AppConfig.Get("bind2_trl"); - KeyR2 = AppConfig.Get("bind2_trr"); + KeyL1 = AppConfig.GetString("bind_trl", desktop ? BindCtrl : BindLT); + KeyR1 = AppConfig.GetString("bind_trr", desktop ? BindMouseR : BindRT); + KeyL2 = AppConfig.GetString("bind2_trl"); + KeyR2 = AppConfig.GetString("bind2_trr"); break; } - if (KeyL1 == -1 && KeyR1 == -1) return; + if (KeyL1 == "" && KeyR1 == "") return; - byte[] bindings = new byte[64]; + byte[] bindings = new byte[50]; byte[] init = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x02, (byte)zone, 0x2c }; init.CopyTo(bindings, 0); @@ -399,7 +437,7 @@ namespace GHelper.Ally DecodeBinding(KeyR2).CopyTo(bindings, 38); AsusHid.WriteInput(CommandReady, null); - AsusHid.WriteInput(bindings, $"Bind{zone}"); + AsusHid.WriteInput(bindings, $"B{zone}"); @@ -437,7 +475,10 @@ namespace GHelper.Ally public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto) { - Task.Run(() => { + Task.Run(() => + { + + if (applyMode == ControllerMode.Skip) return; HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID); int count = 0; @@ -456,6 +497,7 @@ namespace GHelper.Ally if (applyMode != ControllerMode.Auto) _applyMode = applyMode; + InputDispatcher.SetBacklightAuto(true); WakeUp(); AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); @@ -463,20 +505,18 @@ namespace GHelper.Ally BindZone(BindingZone.M1M2); - if (_applyMode == ControllerMode.Gamepad) - { - BindZone(BindingZone.DPadUpDown); - BindZone(BindingZone.DPadLeftRight); - BindZone(BindingZone.StickClick); - BindZone(BindingZone.Bumper); - BindZone(BindingZone.AB); - BindZone(BindingZone.XY); - BindZone(BindingZone.ViewMenu); - BindZone(BindingZone.Trigger); - } + BindZone(BindingZone.DPadUpDown); + BindZone(BindingZone.DPadLeftRight); + BindZone(BindingZone.StickClick); + BindZone(BindingZone.Bumper); + BindZone(BindingZone.AB); + BindZone(BindingZone.XY); + BindZone(BindingZone.ViewMenu); + BindZone(BindingZone.Trigger); AsusHid.WriteInput(CommandSave, null); SetDeadzones(); + }); } @@ -484,9 +524,10 @@ namespace GHelper.Ally { _mode = mode; - ApplyMode(mode); AppConfig.Set("controller_mode", (int)mode); + ApplyMode(mode); + if (mode == ControllerMode.Auto) { amdControl.StartFPS(); @@ -497,7 +538,7 @@ namespace GHelper.Ally timer.Stop(); amdControl.StopFPS(); } - + settings.VisualiseController(mode); } @@ -513,6 +554,9 @@ namespace GHelper.Ally SetMode(ControllerMode.Mouse); break; case ControllerMode.Mouse: + SetMode(ControllerMode.Skip); + break; + case ControllerMode.Skip: SetMode(ControllerMode.Auto); break; } diff --git a/app/GHelper.csproj b/app/GHelper.csproj index e84d896f..819bb1dc 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.148 + 0.149 diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs index ba4974be..1c50b22e 100644 --- a/app/Handheld.Designer.cs +++ b/app/Handheld.Designer.cs @@ -640,9 +640,9 @@ labelBindings.Location = new Point(45, 17); labelBindings.Margin = new Padding(4, 0, 4, 0); labelBindings.Name = "labelBindings"; - labelBindings.Size = new Size(558, 32); + labelBindings.Size = new Size(114, 32); labelBindings.TabIndex = 40; - labelBindings.Text = "Bindings for Gamepad or Auto (in-game) Mode"; + labelBindings.Text = "Bindings"; // // Handheld // diff --git a/app/Handheld.cs b/app/Handheld.cs index 9996639e..e8619ad3 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -41,8 +41,8 @@ namespace GHelper trackVibra.ValueChanged += Controller_Complete; - FillBinding("m1", "M1", AllyControl.BindM1); - FillBinding("m2", "M2", AllyControl.BindM2); + FillBinding("m1", "M1"); + FillBinding("m2", "M2"); FillBinding("a", "A"); FillBinding("b", "B"); @@ -65,7 +65,7 @@ namespace GHelper FillBinding("mb", "Menu"); } - private RComboBox ComboBinding(string name, int value) + private RComboBox ComboBinding(string name, string value) { var combo = new RComboBox(); combo.BorderColor = Color.White; @@ -79,7 +79,7 @@ namespace GHelper combo.ValueMember = "Key"; foreach (var item in AllyControl.BindCodes) { - combo.Items.Add(new KeyValuePair(item.Key, item.Value)); + combo.Items.Add(new KeyValuePair(item.Key, item.Value)); if (item.Key == value) combo.SelectedItem = item; } combo.SelectedValueChanged += Binding_SelectedValueChanged; @@ -89,13 +89,13 @@ namespace GHelper } - private void FillBinding(string binding, string label, int defaultValue = -1) + private void FillBinding(string binding, string label) { tableBindings.RowStyles.Add(new RowStyle(SizeType.AutoSize)); tableBindings.Controls.Add(new Label { Text = label, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, tableBindings.RowCount); - tableBindings.Controls.Add(ComboBinding("bind_" + binding, AppConfig.Get("bind_" + binding, defaultValue)), 1, tableBindings.RowCount); - tableBindings.Controls.Add(ComboBinding("bind2_" + binding, AppConfig.Get("bind2_" + binding)), 2, tableBindings.RowCount); + tableBindings.Controls.Add(ComboBinding("bind_" + binding, AppConfig.GetString("bind_" + binding, "")), 1, tableBindings.RowCount); + tableBindings.Controls.Add(ComboBinding("bind2_" + binding, AppConfig.GetString("bind2_" + binding, "")), 2, tableBindings.RowCount); tableBindings.RowCount++; @@ -107,9 +107,9 @@ namespace GHelper if (sender is null) return; RComboBox combo = (RComboBox)sender; - int value = ((KeyValuePair)combo.SelectedItem).Key; + string value = ((KeyValuePair)combo.SelectedItem).Key; - if (value >= 0) AppConfig.Set(combo.Name, value); + if (value != "") AppConfig.Set(combo.Name, value); else AppConfig.Remove(combo.Name); AllyControl.ApplyMode(); diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 5fffeb9b..f054a396 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -118,7 +118,6 @@ namespace GHelper.Input if (!AppConfig.Is("skip_hotkeys")) { - hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15); @@ -142,6 +141,12 @@ namespace GHelper.Input if (actionM2 is not null && actionM2.Length > 0) hook.RegisterHotKey(ModifierKeys.None, Keys.VolumeUp); } + if (AppConfig.IsAlly()) + { + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F1); + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2); + } + // FN-Lock group if (AppConfig.Is("fn_lock") && !AppConfig.ContainsModel("VivoBook")) @@ -359,6 +364,12 @@ namespace GHelper.Input switch (e.Key) { + case Keys.F1: + SetBrightness(-10); + break; + case Keys.F2: + SetBrightness(10); + break; case Keys.F14: Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); break; diff --git a/app/Settings.cs b/app/Settings.cs index c0a65727..54cc81df 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -305,6 +305,9 @@ namespace GHelper case ControllerMode.Mouse: buttonControllerMode.Text = "Mouse"; break; + case ControllerMode.Skip: + buttonControllerMode.Text = "Skip"; + break; default: buttonControllerMode.Text = "Auto"; break; diff --git a/app/UI/CustomControls.cs b/app/UI/RForm.cs similarity index 83% rename from app/UI/CustomControls.cs rename to app/UI/RForm.cs index aaa19930..3df697d2 100644 --- a/app/UI/CustomControls.cs +++ b/app/UI/RForm.cs @@ -3,7 +3,6 @@ using System.Runtime.InteropServices; namespace GHelper.UI { - public class RForm : Form { @@ -22,6 +21,19 @@ namespace GHelper.UI public static Color chartMain; public static Color chartGrid; + static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); + static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2); + static readonly IntPtr HWND_TOP = new IntPtr(0); + static readonly IntPtr HWND_BOTTOM = new IntPtr(1); + const UInt32 SWP_NOSIZE = 0x0001; + const UInt32 SWP_NOMOVE = 0x0002; + const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE; + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); + protected override bool ShowWithoutActivation => true; + [DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")] public static extern bool CheckSystemDarkModeStatus(); diff --git a/app/UI/CustomControls.resx b/app/UI/RForm.resx similarity index 100% rename from app/UI/CustomControls.resx rename to app/UI/RForm.resx diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 2ded23a6..2da6d60c 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -110,6 +110,7 @@ namespace GHelper.USB { AuraMode.AuraStatic, Properties.Strings.AuraStatic }, { AuraMode.AuraBreathe, Properties.Strings.AuraBreathe }, { AuraMode.AuraColorCycle, Properties.Strings.AuraColorCycle }, + { AuraMode.AuraRainbow, Properties.Strings.AuraRainbow }, { AuraMode.AuraStrobe, Properties.Strings.AuraStrobe }, }; @@ -263,9 +264,10 @@ namespace GHelper.USB new byte[] { AsusHid.AURA_ID, 0xb9 }, Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1a }, - //Encoding.ASCII.GetBytes("^ASUS Tech.Inc."), - //new byte[] { 0x5e, 0x05, 0x20, 0x31, 0, 0x1a } }, "Init"); + + AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc.")); + } From d8bf8ed4636befe8ea54877fe95a3ab10081c324 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 19 Jan 2024 20:39:50 +0100 Subject: [PATCH 054/107] Start/Stop for AC services on Ally --- app/Ally/AllyControl.cs | 25 ++++++++++++------ app/Helpers/OptimizationService.cs | 41 ++++++++++++++++++++++++++++++ app/Helpers/ProcessHelper.cs | 4 +-- app/Settings.cs | 2 +- 4 files changed, 61 insertions(+), 11 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index c4aec4d4..c7457db5 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -66,12 +66,13 @@ namespace GHelper.Ally public const string BindKBU = "02-98"; public const string BindKBD = "02-99"; - public const string BindKBL = "02-91"; - public const string BindKBR = "02-9D"; + public const string BindKBL = "02-9A"; + public const string BindKBR = "02-9B"; public const string BindTab = "02-0D"; public const string BindEnter = "02-5A"; public const string BindBack = "02-66"; + public const string BindEsc = "02-76"; public const string BindPgU = "02-96"; public const string BindPgD = "02-97"; @@ -86,6 +87,7 @@ namespace GHelper.Ally public const string BindBrightnessUp = "04-04-8C-88-8A-06"; public const string BindOverlay = "04-03-8C-88-44"; + public const string BindShiftTab = "04-02-88-0D"; static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; @@ -122,7 +124,7 @@ namespace GHelper.Ally { "01-13", "XBox/Steam" }, - { "02-76", "Esc" }, + { BindEsc, "Esc" }, { "02-05", "F1" }, { "02-06", "F2" }, { "02-04", "F3" }, @@ -231,6 +233,7 @@ namespace GHelper.Ally { BindTaskManager, "Task Manager" }, { BindCloseWindow, "Close Window" }, + { BindShiftTab, "Shift-Tab" }, { "05-16", "Screenshot" }, { "05-19", "Show keyboard" }, @@ -292,14 +295,20 @@ namespace GHelper.Ally switch (fpsLimit) { case 30: - fpsLimit = 40; + fpsLimit = 45; break; - case 40: + case 45: fpsLimit = 60; break; case 60: + fpsLimit = 90; + break; + case 90: fpsLimit = 120; break; + case 120: + fpsLimit = 240; + break; default: fpsLimit = 30; break; @@ -393,7 +402,7 @@ namespace GHelper.Ally break; case BindingZone.AB: KeyL1 = AppConfig.GetString("bind_a", desktop ? BindEnter : BindA); - KeyR1 = AppConfig.GetString("bind_b", desktop ? BindBack : BindB); + KeyR1 = AppConfig.GetString("bind_b", desktop ? BindEsc : BindB); KeyL2 = AppConfig.GetString("bind2_a"); KeyR2 = AppConfig.GetString("bind2_b"); break; @@ -407,7 +416,7 @@ namespace GHelper.Ally KeyL1 = AppConfig.GetString("bind_vb", BindVB); KeyR1 = AppConfig.GetString("bind_mb", BindMB); KeyL2 = AppConfig.GetString("bind2_vb"); - KeyR2 = AppConfig.GetString("bind2_mb", BindCloseWindow); + KeyR2 = AppConfig.GetString("bind2_mb"); break; case BindingZone.M1M2: KeyL1 = AppConfig.GetString("bind_m2", BindM2); @@ -416,7 +425,7 @@ namespace GHelper.Ally KeyR2 = AppConfig.GetString("bind2_m1", BindM1); break; default: - KeyL1 = AppConfig.GetString("bind_trl", desktop ? BindCtrl : BindLT); + KeyL1 = AppConfig.GetString("bind_trl", desktop ? BindShiftTab : BindLT); KeyR1 = AppConfig.GetString("bind_trr", desktop ? BindMouseR : BindRT); KeyL2 = AppConfig.GetString("bind2_trl"); KeyR2 = AppConfig.GetString("bind2_trr"); diff --git a/app/Helpers/OptimizationService.cs b/app/Helpers/OptimizationService.cs index 18218b1e..d0a2f34d 100644 --- a/app/Helpers/OptimizationService.cs +++ b/app/Helpers/OptimizationService.cs @@ -18,6 +18,16 @@ namespace GHelper.Helpers "AsusCertService" }; + static List processesAC = new() { + "ArmouryCrateSE.Service", + "LightingService", + }; + + static List servicesAC = new() { + "ArmouryCrateSEService", + "LightingService", + }; + public static bool IsRunning() { return Process.GetProcessesByName("AsusOptimization").Count() > 0; @@ -36,6 +46,17 @@ namespace GHelper.Helpers { if (Process.GetProcessesByName(service).Count() > 0) count++; } + + if (AppConfig.IsAlly()) + foreach (string service in processesAC) + { + if (Process.GetProcessesByName(service).Count() > 0) + { + count++; + Logger.WriteLine(service); + } + } + return count; } @@ -46,6 +67,16 @@ namespace GHelper.Helpers { ProcessHelper.StopDisableService(service); } + + if (AppConfig.IsAlly()) + { + foreach (string service in servicesAC) + { + ProcessHelper.StopDisableService(service, "Manual"); + } + Thread.Sleep(1000); + } + } public static void StartAsusServices() @@ -54,6 +85,16 @@ namespace GHelper.Helpers { ProcessHelper.StartEnableService(service); } + + if (AppConfig.IsAlly()) + { + foreach (string service in servicesAC) + { + ProcessHelper.StartEnableService(service); + } + Thread.Sleep(1000); + } + } } diff --git a/app/Helpers/ProcessHelper.cs b/app/Helpers/ProcessHelper.cs index 2f5286e6..7c6303fb 100644 --- a/app/Helpers/ProcessHelper.cs +++ b/app/Helpers/ProcessHelper.cs @@ -94,11 +94,11 @@ namespace GHelper.Helpers } } - public static void StopDisableService(string serviceName) + public static void StopDisableService(string serviceName, string disable = "Disabled") { try { - string script = $"Get-Service -Name \"{serviceName}\" | Stop-Service -Force -PassThru | Set-Service -StartupType Disabled"; + string script = $"Get-Service -Name \"{serviceName}\" | Stop-Service -Force -PassThru | Set-Service -StartupType {disable}"; Logger.WriteLine(script); RunCMD("powershell", script); } diff --git a/app/Settings.cs b/app/Settings.cs index 54cc81df..c5645950 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -321,7 +321,7 @@ namespace GHelper public void VisualiseFPSLimit(int limit) { - buttonFPS.Text = "FPS Limit " + ((limit > 0 && limit < 120) ? limit : "OFF"); + buttonFPS.Text = "FPS Limit " + ((limit > 0 && limit <= 120) ? limit : "OFF"); } private void SettingsForm_LostFocus(object? sender, EventArgs e) From 0ac1a4480033e0b5081d2fc21b2ac10b0198440f Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 20 Jan 2024 01:29:55 +0100 Subject: [PATCH 055/107] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index d23646b0..5ea86efd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -12,7 +12,7 @@ body: options: - label: I made myself familiar with the Readme, FAQ and Troubleshooting. required: true - - label: I understand that, if insufficient information was provided, my issue will be closed without an answer. + - label: I understand that, if insufficient information or no app logs will be provided, my issue will be closed without an answer. required: true validations: required: true From 1b25017c1882bed419a66b0dea7478c987d1a160 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:46:35 +0100 Subject: [PATCH 056/107] Ally bindings --- app/Ally/AllyControl.cs | 64 ++++++++++++++++---------- app/Properties/Resources.Designer.cs | 10 ++++ app/Properties/Resources.resx | 7 ++- app/Resources/icons8-animation-32.png | Bin 0 -> 297 bytes app/Settings.Designer.cs | 46 +++++++++--------- 5 files changed, 77 insertions(+), 50 deletions(-) create mode 100644 app/Resources/icons8-animation-32.png diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index c7457db5..88e11b8f 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -3,7 +3,6 @@ using GHelper.Input; using GHelper.USB; using HidSharp; using System.Text; -using System.Windows.Forms; namespace GHelper.Ally { @@ -61,6 +60,8 @@ namespace GHelper.Ally public const string BindM2 = "02-8E"; public const string BindLT = "01-0D"; public const string BindRT = "01-0E"; + public const string BindXB = "01-13"; + public const string BindMouseL = "03-01"; public const string BindMouseR = "03-02"; @@ -79,6 +80,7 @@ namespace GHelper.Ally public const string BindShift = "02-88"; public const string BindCtrl = "02-8C"; + public const string BindAlt = "02-8A"; public const string BindTaskManager = "04-03-8C-88-76"; public const string BindCloseWindow = "04-02-8A-0C"; @@ -87,8 +89,14 @@ namespace GHelper.Ally public const string BindBrightnessUp = "04-04-8C-88-8A-06"; public const string BindOverlay = "04-03-8C-88-44"; - public const string BindShiftTab = "04-02-88-0D"; + public const string BindShiftTab = "04-02-88-0D"; + public const string BindAltTab = "04-02-8A-0D"; + + public const string BindVolUp = "05-03"; + public const string BindVolDown = "05-02"; + + public const string BindPrintScrn = "02-C3"; static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; static byte[] CommandSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 }; @@ -122,9 +130,35 @@ namespace GHelper.Ally { BindVB, "View Button" }, { BindMB, "Menu Button" }, - { "01-13", "XBox/Steam" }, + { BindXB, "XBox/Steam" }, + { BindVolUp, "Vol Up" }, + { BindVolDown, "Vol Down" }, + { BindBrightnessUp, "Bright Up" }, + { BindBrightnessDown, "Bright Down" }, + + { BindOverlay, "AMD Overlay" }, + { BindTaskManager, "Task Manager" }, + { BindCloseWindow, "Close Window" }, + { BindShiftTab, "Shift-Tab" }, + { BindAltTab, "Alt-Tab" }, + + { BindPrintScrn, "PrntScn" }, { BindEsc, "Esc" }, + { BindBack, "Backspace" }, + { BindTab, "Tab" }, + { BindEnter, "Enter" }, + { BindShift, "LShift" }, + { BindAlt, "LAlt" }, + { BindCtrl, "LCtl" }, + + { BindPgU, "PgUp" }, + { BindPgD, "PgDwn" }, + { BindKBU, "UpArrow" }, + { BindKBD, "DownArrow" }, + { BindKBL, "LeftArrow" }, + { BindKBR, "RightArrow" }, + { "02-05", "F1" }, { "02-06", "F2" }, { "02-04", "F3" }, @@ -150,8 +184,6 @@ namespace GHelper.Ally { "02-45", "0" }, { "02-4E", "-" }, { "02-55", "=" }, - { BindBack, "Backspace" }, - { BindTab, "Tab" }, { "02-15", "Q" }, { "02-1D", "W" }, { "02-24", "E" }, @@ -176,8 +208,6 @@ namespace GHelper.Ally { "02-4B", "l" }, { "02-4C", ";" }, { "02-52", "'" }, - { BindEnter, "Enter" }, - { BindShift, "LShift" }, { "02-22", "X" }, { "02-1A", "Z" }, { "02-21", "C" }, @@ -188,25 +218,16 @@ namespace GHelper.Ally { "02-41", "," }, { "02-49", "." }, { "02-89", "RShift" }, - { BindCtrl, "LCtl" }, { "02-82", "Meta" }, - { "02-8A", "LAlt" }, { "02-29", "Space" }, { "02-8B", "RAlt" }, { "02-84", "App menu" }, { "02-8D", "RCtl" }, - { "02-C3", "PrntScn" }, { "02-7E", "ScrLk" }, { "02-C2", "Insert" }, - { BindPgU, "PgUp" }, - { BindPgD, "PgDwn" }, { "02-C0", "Delete" }, { "02-94", "Home" }, { "02-95", "End" }, - { BindKBU, "UpArrow" }, - { BindKBD, "DownArrow" }, - { BindKBL, "LeftArrow" }, - { BindKBR, "RightArrow" }, { "02-77", "NumLock" }, { "02-90", "NumSlash" }, { "02-7C", "NumStar" }, @@ -231,20 +252,12 @@ namespace GHelper.Ally { "03-04", "Mouse scroll up" }, { "03-05", "Mouse scroll down" }, - { BindTaskManager, "Task Manager" }, - { BindCloseWindow, "Close Window" }, - { BindShiftTab, "Shift-Tab" }, - { "05-16", "Screenshot" }, { "05-19", "Show keyboard" }, { "05-1C", "Show desktop" }, { "05-1E", "Begin recording" }, { "05-01", "Mic off" }, - { "05-03", "Vol Up" }, - { "05-02", "Vol Down" }, - { BindBrightnessUp, "Bright Up" }, - { BindBrightnessDown, "Bright Down" } }; public AllyControl(SettingsForm settingsForm) @@ -337,7 +350,8 @@ namespace GHelper.Ally try { bytes = AppConfig.StringToBytes(binding); - } catch + } + catch { return new byte[2]; } diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index a8811e09..4f8bb67f 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -160,6 +160,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_animation_32 { + get { + object obj = ResourceManager.GetObject("icons8-animation-32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 2ed46cbb..fc984650 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -238,6 +238,9 @@ ..\Resources\backlight-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-xbox-lt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -313,7 +316,7 @@ ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-xbox-lt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-animation-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/app/Resources/icons8-animation-32.png b/app/Resources/icons8-animation-32.png new file mode 100644 index 0000000000000000000000000000000000000000..4392cc4abd9cc2ad0f8151b0a9aaed89a94298b6 GIT binary patch literal 297 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?3oVGw3ym^DWND0th` z#WAE}&fDpGIS(5MxXD+reOKgG@n)HHY_3?>Yn=)5+u3-huo^jt1q2AJ*uc#8+s{$& z%fUveyS61(wH#rKbT2T53Fro7GFlzbezbsfL)Rn!1%8|pT(>c7cqDd*QGLgp#PhnW z4Z%JqtXUiSKSup<`06lO=)foUn@kOBSgQ|kJo=KI5XP{9*{+Mzl7I46=H!{&2~+s2 zPKCRAuWe Date: Sat, 20 Jan 2024 15:55:04 +0100 Subject: [PATCH 057/107] Miniled / Multizone Toggle for 2024 models https://github.com/seerge/g-helper/issues/1957 --- app/AsusACPI.cs | 4 +++- app/Display/ScreenControl.cs | 35 +++++++++++++++++++++++++++++++---- app/Settings.cs | 12 +++++++++++- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index b1b638b4..2b95bec0 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -72,8 +72,10 @@ public class AsusACPI public const uint GPUMuxVivo = 0x00090026; public const uint BatteryLimit = 0x00120057; + public const uint ScreenOverdrive = 0x00050019; - public const uint ScreenMiniled = 0x0005001E; + public const uint ScreenMiniled1 = 0x0005001E; + public const uint ScreenMiniled2 = 0x0005002E; public const uint DevsCPUFan = 0x00110022; public const uint DevsGPUFan = 0x00110023; diff --git a/app/Display/ScreenControl.cs b/app/Display/ScreenControl.cs index d0ff4ad9..da5a40a0 100644 --- a/app/Display/ScreenControl.cs +++ b/app/Display/ScreenControl.cs @@ -49,8 +49,10 @@ namespace GHelper.Display if (miniled >= 0) { - Program.acpi.DeviceSet(AsusACPI.ScreenMiniled, miniled, "Miniled"); - Debug.WriteLine("Miniled " + miniled); + if (Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1) >= 0) + Program.acpi.DeviceSet(AsusACPI.ScreenMiniled1, miniled, "Miniled1"); + else + Program.acpi.DeviceSet(AsusACPI.ScreenMiniled2, miniled, "Miniled2"); } InitScreen(); @@ -59,7 +61,26 @@ namespace GHelper.Display public int ToogleMiniled() { - int miniled = (Program.acpi.DeviceGet(AsusACPI.ScreenMiniled) == 1) ? 0 : 1; + int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1); + int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2); + + Logger.WriteLine($"MiniledToggle: {miniled1} {miniled2}"); + + int miniled; + + if (miniled1 >= 0) + { + miniled = (miniled1 == 1) ? 0 : 1; + } else + { + switch (miniled2) + { + case 1: miniled = 2; break; + case 2: miniled = 0; break; + default: miniled = 1; break; + } + } + AppConfig.Set("miniled", miniled); SetScreen(-1, -1, miniled); return miniled; @@ -76,7 +97,13 @@ namespace GHelper.Display bool overdriveSetting = !AppConfig.Is("no_overdrive"); int overdrive = Program.acpi.DeviceGet(AsusACPI.ScreenOverdrive); - int miniled = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled); + + int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1); + int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2); + + Logger.WriteLine($"Miniled: {miniled1} {miniled2}"); + + int miniled = (miniled1 >= 0) ? miniled1 : miniled2; bool hdr = false; diff --git a/app/Settings.cs b/app/Settings.cs index c5645950..1e2ce33a 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -970,7 +970,17 @@ namespace GHelper if (miniled >= 0) { - buttonMiniled.Activated = (miniled == 1) || hdr; + if (miniled == 2) + { + buttonMiniled.Text = Properties.Strings.Multizone + " Strong"; + buttonMiniled.BorderColor = colorStandard; + } else + { + buttonMiniled.Text = Properties.Strings.Multizone; + buttonMiniled.BorderColor = colorTurbo; + } + + buttonMiniled.Activated = (miniled > 0) || hdr; buttonMiniled.Enabled = !hdr; } else From 6e3fde85376bc28759d15039365f39c16766b74a Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 20 Jan 2024 16:28:43 +0100 Subject: [PATCH 058/107] Multizone Toggle UI --- app/Display/ScreenControl.cs | 4 +-- app/Properties/Strings.Designer.cs | 20 +++++++++++++- app/Properties/Strings.resx | 8 +++++- app/Settings.cs | 42 +++++++++++++++++++++--------- 4 files changed, 57 insertions(+), 17 deletions(-) diff --git a/app/Display/ScreenControl.cs b/app/Display/ScreenControl.cs index da5a40a0..ff60746d 100644 --- a/app/Display/ScreenControl.cs +++ b/app/Display/ScreenControl.cs @@ -104,7 +104,6 @@ namespace GHelper.Display Logger.WriteLine($"Miniled: {miniled1} {miniled2}"); int miniled = (miniled1 >= 0) ? miniled1 : miniled2; - bool hdr = false; if (miniled >= 0) @@ -127,7 +126,8 @@ namespace GHelper.Display maxFrequency: maxFrequency, overdrive: overdrive, overdriveSetting: overdriveSetting, - miniled: miniled, + miniled1: miniled1, + miniled2: miniled2, hdr: hdr ); }); diff --git a/app/Properties/Strings.Designer.cs b/app/Properties/Strings.Designer.cs index 84e33216..4cf2299e 100644 --- a/app/Properties/Strings.Designer.cs +++ b/app/Properties/Strings.Designer.cs @@ -1215,7 +1215,7 @@ namespace GHelper.Properties { } /// - /// Looks up a localized string similar to Multizone. + /// Looks up a localized string similar to Multi Zone. /// internal static string Multizone { get { @@ -1223,6 +1223,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Multi Zone Strong. + /// + internal static string MultizoneStrong { + get { + return ResourceManager.GetString("MultizoneStrong", resourceCulture); + } + } + /// /// Looks up a localized string similar to Mute Mic. /// @@ -1268,6 +1277,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to One Zone. + /// + internal static string OneZone { + get { + return ResourceManager.GetString("OneZone", resourceCulture); + } + } + /// /// Looks up a localized string similar to Open G-Helper window. /// diff --git a/app/Properties/Strings.resx b/app/Properties/Strings.resx index f039488f..9c5ab07d 100644 --- a/app/Properties/Strings.resx +++ b/app/Properties/Strings.resx @@ -504,7 +504,10 @@ Do you still want to continue? Synchronize with mouse - Multizone + Multi Zone + + + Multi Zone Strong Mute Mic @@ -521,6 +524,9 @@ Do you still want to continue? Not Connected + + One Zone + Open G-Helper window diff --git a/app/Settings.cs b/app/Settings.cs index 1e2ce33a..bd9c6ff3 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -929,7 +929,7 @@ namespace GHelper - public void VisualiseScreen(bool screenEnabled, bool screenAuto, int frequency, int maxFrequency, int overdrive, bool overdriveSetting, int miniled, bool hdr) + public void VisualiseScreen(bool screenEnabled, bool screenAuto, int frequency, int maxFrequency, int overdrive, bool overdriveSetting, int miniled1, int miniled2, bool hdr) { ButtonEnabled(button60Hz, screenEnabled); @@ -968,20 +968,36 @@ namespace GHelper panelScreen.Visible = false; } - if (miniled >= 0) + if (miniled1 >= 0) { - if (miniled == 2) - { - buttonMiniled.Text = Properties.Strings.Multizone + " Strong"; - buttonMiniled.BorderColor = colorStandard; - } else - { - buttonMiniled.Text = Properties.Strings.Multizone; - buttonMiniled.BorderColor = colorTurbo; - } - - buttonMiniled.Activated = (miniled > 0) || hdr; buttonMiniled.Enabled = !hdr; + buttonMiniled.Activated = miniled1 == 1 || hdr; + } + else if (miniled2 >= 0) + { + buttonMiniled.Enabled = !hdr; + + switch (miniled2) + { + // Multizone On + case 0: + buttonMiniled.Text = Properties.Strings.Multizone; + buttonMiniled.BorderColor = colorStandard; + buttonMiniled.Activated = true; + break; + // Multizone Strong + case 1: + buttonMiniled.Text = Properties.Strings.MultizoneStrong; + buttonMiniled.BorderColor = colorTurbo; + buttonMiniled.Activated = true; + break; + // Multizone Off + case 2: + buttonMiniled.Text = hdr ? Properties.Strings.Multizone : Properties.Strings.OneZone; + buttonMiniled.BorderColor = colorStandard; + buttonMiniled.Activated = hdr; + break; + } } else { From 72dea26fde03af57eac2be8b7e500001d8225c0f Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 21 Jan 2024 13:31:48 +0100 Subject: [PATCH 059/107] New Ally bindings and Touch Keyboard Support --- app/Ally/AllyControl.cs | 26 +++-- app/GHelper.csproj | 2 +- app/Helpers/OnScreenKeyboard.cs | 176 ++++++++++++++++++++++++++++++++ app/Input/InputDispatcher.cs | 3 + app/Mode/ModeControl.cs | 2 +- app/USB/Aura.cs | 18 +++- 6 files changed, 214 insertions(+), 13 deletions(-) create mode 100644 app/Helpers/OnScreenKeyboard.cs diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 88e11b8f..170e4aff 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -81,6 +81,7 @@ namespace GHelper.Ally public const string BindShift = "02-88"; public const string BindCtrl = "02-8C"; public const string BindAlt = "02-8A"; + public const string BindWin = "02-82"; public const string BindTaskManager = "04-03-8C-88-76"; public const string BindCloseWindow = "04-02-8A-0C"; @@ -98,6 +99,10 @@ namespace GHelper.Ally public const string BindPrintScrn = "02-C3"; + public const string BindScreenshot = "04-03-82-88-1B"; + + public const string BindShowKeyboard = "05-19"; + static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; static byte[] CommandSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 }; @@ -137,13 +142,15 @@ namespace GHelper.Ally { BindBrightnessUp, "Bright Up" }, { BindBrightnessDown, "Bright Down" }, + { BindShowKeyboard, "Show Keyboard" }, + { BindScreenshot, "Screenshot" }, + { BindOverlay, "AMD Overlay" }, { BindTaskManager, "Task Manager" }, { BindCloseWindow, "Close Window" }, { BindShiftTab, "Shift-Tab" }, { BindAltTab, "Alt-Tab" }, - { BindPrintScrn, "PrntScn" }, { BindEsc, "Esc" }, { BindBack, "Backspace" }, { BindTab, "Tab" }, @@ -151,6 +158,8 @@ namespace GHelper.Ally { BindShift, "LShift" }, { BindAlt, "LAlt" }, { BindCtrl, "LCtl" }, + { BindWin, "WIN" }, + { BindPrintScrn, "PrntScn" }, { BindPgU, "PgUp" }, { BindPgD, "PgDwn" }, @@ -218,7 +227,6 @@ namespace GHelper.Ally { "02-41", "," }, { "02-49", "." }, { "02-89", "RShift" }, - { "02-82", "Meta" }, { "02-29", "Space" }, { "02-8B", "RAlt" }, { "02-84", "App menu" }, @@ -252,8 +260,8 @@ namespace GHelper.Ally { "03-04", "Mouse scroll up" }, { "03-05", "Mouse scroll down" }, - { "05-16", "Screenshot" }, - { "05-19", "Show keyboard" }, + //{ "05-16", "Screenshot" }, + { "05-1C", "Show desktop" }, { "05-1E", "Begin recording" }, { "05-01", "Mic off" }, @@ -393,14 +401,14 @@ namespace GHelper.Ally case BindingZone.DPadUpDown: KeyL1 = AppConfig.GetString("bind_du", desktop ? BindKBU : BindDU); KeyR1 = AppConfig.GetString("bind_dd", desktop ? BindKBD : BindDD); - KeyL2 = AppConfig.GetString("bind2_du", BindBrightnessUp); - KeyR2 = AppConfig.GetString("bind2_dd", BindBrightnessDown); + KeyL2 = AppConfig.GetString("bind2_du", BindShowKeyboard); + KeyR2 = AppConfig.GetString("bind2_dd", BindAltTab); break; case BindingZone.DPadLeftRight: KeyL1 = AppConfig.GetString("bind_dl", desktop ? BindKBL : BindDL); KeyR1 = AppConfig.GetString("bind_dr", desktop ? BindKBR : BindDR); - KeyL2 = AppConfig.GetString("bind2_dl"); - KeyR2 = AppConfig.GetString("bind2_dr"); + KeyL2 = AppConfig.GetString("bind2_dl", BindBrightnessDown); + KeyR2 = AppConfig.GetString("bind2_dr", BindBrightnessUp); break; case BindingZone.StickClick: KeyL1 = AppConfig.GetString("bind_ls", desktop ? BindShift : BindLS); @@ -423,7 +431,7 @@ namespace GHelper.Ally case BindingZone.XY: KeyL1 = AppConfig.GetString("bind_x", desktop ? BindPgD : BindX); KeyR1 = AppConfig.GetString("bind_y", desktop ? BindPgU : BindY); - KeyL2 = AppConfig.GetString("bind2_x"); + KeyL2 = AppConfig.GetString("bind2_x", BindScreenshot); KeyR2 = AppConfig.GetString("bind2_y", BindOverlay); break; case BindingZone.ViewMenu: diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 819bb1dc..ce70eea1 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.149 + 0.149.1 diff --git a/app/Helpers/OnScreenKeyboard.cs b/app/Helpers/OnScreenKeyboard.cs new file mode 100644 index 00000000..ee586eb5 --- /dev/null +++ b/app/Helpers/OnScreenKeyboard.cs @@ -0,0 +1,176 @@ +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace GHelper.Helpers +{ + public static class OnScreenKeyboard + { + static OnScreenKeyboard() + { + var version = Environment.OSVersion.Version; + switch (version.Major) + { + case 6: + switch (version.Minor) + { + case 2: + // Windows 10 (ok) + break; + } + break; + default: + break; + } + } + + private static void StartTabTip() + { + var p = Process.Start(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe"); + int handle = 0; + while ((handle = NativeMethods.FindWindow("IPTIP_Main_Window", "")) <= 0) + { + Thread.Sleep(100); + } + } + + public static void ToggleVisibility() + { + var type = Type.GetTypeFromCLSID(Guid.Parse("4ce576fa-83dc-4F88-951c-9d0782b4e376")); + var instance = (ITipInvocation)Activator.CreateInstance(type); + instance.Toggle(NativeMethods.GetDesktopWindow()); + Marshal.ReleaseComObject(instance); + } + + public static void Show() + { + int handle = NativeMethods.FindWindow("IPTIP_Main_Window", ""); + if (handle <= 0) // nothing found + { + StartTabTip(); + Thread.Sleep(100); + } + // on some devices starting TabTip don't show keyboard, on some does ¯\_(ツ)_/¯ + if (!IsOpen()) + { + ToggleVisibility(); + } + } + + public static void Hide() + { + if (IsOpen()) + { + ToggleVisibility(); + } + } + + + public static bool Close() + { + // find it + int handle = NativeMethods.FindWindow("IPTIP_Main_Window", ""); + bool active = handle > 0; + if (active) + { + // don't check style - just close + NativeMethods.SendMessage(handle, NativeMethods.WM_SYSCOMMAND, NativeMethods.SC_CLOSE, 0); + } + return active; + } + + public static bool IsOpen() + { + return GetIsOpen1709() ?? GetIsOpenLegacy(); + } + + + [DllImport("user32.dll", SetLastError = false)] + private static extern IntPtr FindWindowEx(IntPtr parent, IntPtr after, string className, string title = null); + + [DllImport("user32.dll", SetLastError = false)] + private static extern uint GetWindowLong(IntPtr wnd, int index); + + private static bool? GetIsOpen1709() + { + // if there is a top-level window - the keyboard is closed + var wnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, WindowClass1709, WindowCaption1709); + if (wnd != IntPtr.Zero) + return false; + + var parent = IntPtr.Zero; + for (; ; ) + { + parent = FindWindowEx(IntPtr.Zero, parent, WindowParentClass1709); + if (parent == IntPtr.Zero) + return null; // no more windows, keyboard state is unknown + + // if it's a child of a WindowParentClass1709 window - the keyboard is open + wnd = FindWindowEx(parent, IntPtr.Zero, WindowClass1709, WindowCaption1709); + if (wnd != IntPtr.Zero) + return true; + } + } + + private static bool GetIsOpenLegacy() + { + var wnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, WindowClass); + if (wnd == IntPtr.Zero) + return false; + + var style = GetWindowStyle(wnd); + return style.HasFlag(WindowStyle.Visible) + && !style.HasFlag(WindowStyle.Disabled); + } + + private const string WindowClass = "IPTip_Main_Window"; + private const string WindowParentClass1709 = "ApplicationFrameWindow"; + private const string WindowClass1709 = "Windows.UI.Core.CoreWindow"; + private const string WindowCaption1709 = "Microsoft Text Input Application"; + + private enum WindowStyle : uint + { + Disabled = 0x08000000, + Visible = 0x10000000, + } + + private static WindowStyle GetWindowStyle(IntPtr wnd) + { + return (WindowStyle)GetWindowLong(wnd, -16); + } + + } + + + [ComImport] + [Guid("37c994e7-432b-4834-a2f7-dce1f13b834b")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface ITipInvocation + { + void Toggle(IntPtr hwnd); + } + + internal static class NativeMethods + { + [DllImport("user32.dll", EntryPoint = "FindWindow")] + internal static extern int FindWindow(string lpClassName, string lpWindowName); + + [DllImport("user32.dll", EntryPoint = "SendMessage")] + internal static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam); + + [DllImport("user32.dll", EntryPoint = "GetDesktopWindow", SetLastError = false)] + internal static extern IntPtr GetDesktopWindow(); + + [DllImport("user32.dll", EntryPoint = "GetWindowLong")] + internal static extern int GetWindowLong(int hWnd, int nIndex); + + internal const int GWL_STYLE = -16; + internal const int GWL_EXSTYLE = -20; + internal const int WM_SYSCOMMAND = 0x0112; + internal const int SC_CLOSE = 0xF060; + + internal const int WS_DISABLED = 0x08000000; + + internal const int WS_VISIBLE = 0x10000000; + + } +} \ No newline at end of file diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index f054a396..5792dca8 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -602,6 +602,9 @@ namespace GHelper.Input case 56: KeyProcess("m4"); return; + case 162: + OnScreenKeyboard.Show(); + return; } } diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index a3fe3f6c..c7406ed9 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -318,7 +318,7 @@ namespace GHelper.Mode int memory = AppConfig.GetMode("gpu_memory"); int clock_limit = AppConfig.GetMode("gpu_clock_limit"); - //if (core == -1 && memory == -1 && clock_limit == -1) return; + if (core == -1 && memory == -1 && clock_limit == -1) return; //if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false; if (Program.acpi.DeviceGet(AsusACPI.GPUEco) == 1) { Logger.WriteLine("Clocks: Eco"); return; } diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 2da6d60c..dc7c6af8 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -261,9 +261,23 @@ namespace GHelper.USB public static void Init() { AsusHid.Write(new List { - new byte[] { AsusHid.AURA_ID, 0xb9 }, + new byte[] { AsusHid.AURA_ID, 0xB9 }, Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), - new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1a }, + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, + + // Random data AC sends to keyboard on start + new byte[] { AsusHid.AURA_ID, 0x9F, 0x01 }, + new byte[] { AsusHid.AURA_ID, 0xBF }, + + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 }, + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x20 }, + + new byte[] { AsusHid.AURA_ID, 0xC0, 0x03, 0x01}, + new byte[] { AsusHid.AURA_ID, 0x9E, 0x01, 0x20 }, + + Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, + new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01}, }, "Init"); AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc.")); From a3fd1a27036ac79dc1ccea0f688dc14c739f6f17 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 21 Jan 2024 13:38:26 +0100 Subject: [PATCH 060/107] Ally Show Desktop / Mic Mute --- app/Ally/AllyControl.cs | 8 +++++--- app/Input/InputDispatcher.cs | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 170e4aff..d22d64ba 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -100,6 +100,7 @@ namespace GHelper.Ally public const string BindPrintScrn = "02-C3"; public const string BindScreenshot = "04-03-82-88-1B"; + public const string BindShowDesktop = "04-02-82-23"; public const string BindShowKeyboard = "05-19"; @@ -143,6 +144,7 @@ namespace GHelper.Ally { BindBrightnessDown, "Bright Down" }, { BindShowKeyboard, "Show Keyboard" }, + { BindShowDesktop, "Show Desktop" }, { BindScreenshot, "Screenshot" }, { BindOverlay, "AMD Overlay" }, @@ -261,8 +263,8 @@ namespace GHelper.Ally { "03-05", "Mouse scroll down" }, //{ "05-16", "Screenshot" }, - - { "05-1C", "Show desktop" }, + //{ "05-1C", "Show desktop" }, + { "05-1E", "Begin recording" }, { "05-01", "Mic off" }, @@ -402,7 +404,7 @@ namespace GHelper.Ally KeyL1 = AppConfig.GetString("bind_du", desktop ? BindKBU : BindDU); KeyR1 = AppConfig.GetString("bind_dd", desktop ? BindKBD : BindDD); KeyL2 = AppConfig.GetString("bind2_du", BindShowKeyboard); - KeyR2 = AppConfig.GetString("bind2_dd", BindAltTab); + KeyR2 = AppConfig.GetString("bind2_dd", BindShowDesktop); break; case BindingZone.DPadLeftRight: KeyL1 = AppConfig.GetString("bind_dl", desktop ? BindKBL : BindDL); diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 5792dca8..9c69a977 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -605,6 +605,9 @@ namespace GHelper.Input case 162: OnScreenKeyboard.Show(); return; + case 124: + KeyProcess("m3"); + return; } } From 3fbd833e21e9d9ec10f08a73eb21e4d510ce4cdc Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:35:56 +0100 Subject: [PATCH 061/107] XGM binding for Ally https://github.com/seerge/g-helper/issues/1964 --- app/Ally/AllyControl.cs | 3 +++ app/Input/InputDispatcher.cs | 4 ++++ app/Input/KeyboardListener.cs | 15 ++++++++------- app/Settings.cs | 6 +++--- app/USB/Aura.cs | 19 +++++++++++-------- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index d22d64ba..8c4581c6 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -88,6 +88,7 @@ namespace GHelper.Ally public const string BindBrightnessDown = "04-04-8C-88-8A-05"; public const string BindBrightnessUp = "04-04-8C-88-8A-06"; + public const string BindXGM = "04-04-8C-88-8A-04"; public const string BindOverlay = "04-03-8C-88-44"; @@ -152,6 +153,8 @@ namespace GHelper.Ally { BindCloseWindow, "Close Window" }, { BindShiftTab, "Shift-Tab" }, { BindAltTab, "Alt-Tab" }, + { BindXGM, "XGM Toggle" }, + { BindEsc, "Esc" }, { BindBack, "Backspace" }, diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 9c69a977..d85df4e9 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -145,6 +145,7 @@ namespace GHelper.Input { hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F1); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2); + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F3); } // FN-Lock group @@ -370,6 +371,9 @@ namespace GHelper.Input case Keys.F2: SetBrightness(10); break; + case Keys.F3: + Program.settingsForm.gpuControl.ToggleXGM(); + break; case Keys.F14: Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); break; diff --git a/app/Input/KeyboardListener.cs b/app/Input/KeyboardListener.cs index 776ac43e..0b6ce49e 100644 --- a/app/Input/KeyboardListener.cs +++ b/app/Input/KeyboardListener.cs @@ -1,6 +1,6 @@ -using HidSharp; -using GHelper.USB; -using GHelper.Ally; +using GHelper.USB; +using HidSharp; +using System.Text; namespace GHelper.Input { @@ -16,17 +16,17 @@ namespace GHelper.Input var task = Task.Run(Listen); } - private void Listen () { + private void Listen() + { HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID); // Fallback int count = 0; - while (input == null && count++ < 5) + while (input == null && count++ < 10) { - Aura.Init(); - Thread.Sleep(2000); + Thread.Sleep(1000); input = AsusHid.FindHidStream(AsusHid.INPUT_ID); } @@ -36,6 +36,7 @@ namespace GHelper.Input return; } + AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc.")); Logger.WriteLine($"Input: {input.Device.DevicePath}"); try diff --git a/app/Settings.cs b/app/Settings.cs index bd9c6ff3..1f02ad2d 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1324,10 +1324,11 @@ namespace GHelper public void VisualiseGPUMode(int GPUMode = -1) { - if (AppConfig.IsAlly() && !Program.acpi.IsXGConnected()) + if (AppConfig.IsAlly()) { tableGPU.Visible = false; - GPUMode = AsusACPI.GPUModeEco; + if (Program.acpi.IsXGConnected()) tableAMD.Controls.Add(buttonXGM, 1, 0); + return; } ButtonEnabled(buttonOptimized, true); @@ -1370,7 +1371,6 @@ namespace GHelper VisualizeXGM(GPUMode); - if (isGpuSection) { menuEco.Checked = buttonEco.Activated; diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index dc7c6af8..a448596b 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -264,12 +264,13 @@ namespace GHelper.USB new byte[] { AsusHid.AURA_ID, 0xB9 }, Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 }, // Random data AC sends to keyboard on start + /* new byte[] { AsusHid.AURA_ID, 0x9F, 0x01 }, new byte[] { AsusHid.AURA_ID, 0xBF }, - new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 }, new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x20 }, new byte[] { AsusHid.AURA_ID, 0xC0, 0x03, 0x01}, @@ -277,10 +278,11 @@ namespace GHelper.USB Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, - new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01}, - }, "Init"); + */ - AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc.")); + new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01}, + + }, "Init"); } @@ -483,7 +485,7 @@ namespace GHelper.USB byte[] keyBuf = new byte[mapSize]; buffer[0] = AsusHid.AURA_ID; - buffer[1] = 0xbc; + buffer[1] = 0xBC; buffer[2] = 0; buffer[3] = 1; buffer[4] = 1; @@ -494,7 +496,7 @@ namespace GHelper.USB if (init) { Init(); - AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc }); + AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xBC }); } Array.Clear(keyBuf, 0, keyBuf.Length); @@ -531,7 +533,8 @@ namespace GHelper.USB buffer[6] = 0x00; buffer[7] = 0x00; - if (isStrix4Zone) { // per zone + if (isStrix4Zone) + { // per zone var leds_4_zone = packet4Zone.Count(); for (int ledIndex = 0; ledIndex < leds_4_zone; ledIndex++) { @@ -705,7 +708,7 @@ namespace GHelper.USB bound.Y += bound.Height / 3; bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel - Bitmap screen_low = AmbientData.CamptureScreen(bound, 512, 288); //quality decreases greatly if it is less 512 ; + Bitmap screen_low = AmbientData.CamptureScreen(bound, 512, 288); //quality decreases greatly if it is less 512 ; Bitmap screeb_pxl = AmbientData.ResizeImage(screen_low, 4, 2); // 4x2 zone. top for keyboard and bot for lightbar; int zones = AURA_ZONES; From 5b96757939272b43e427ae18dd9467a7a1350d41 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:47:49 +0100 Subject: [PATCH 062/107] Ally XGM binding --- app/AsusACPI.cs | 1 - app/Settings.cs | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index 2b95bec0..e5bde3e5 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -571,7 +571,6 @@ public class AsusACPI public bool IsXGConnected() { - //return true; return DeviceGet(GPUXGConnected) == 1; } diff --git a/app/Settings.cs b/app/Settings.cs index 1f02ad2d..85320929 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1327,7 +1327,12 @@ namespace GHelper if (AppConfig.IsAlly()) { tableGPU.Visible = false; - if (Program.acpi.IsXGConnected()) tableAMD.Controls.Add(buttonXGM, 1, 0); + labelGPU.Text = "GPU"; + if (Program.acpi.IsXGConnected()) + { + tableAMD.Controls.Add(buttonXGM, 1, 0); + VisualizeXGM(); + } return; } From d635dc275ff03b7c7b49cc429a4b82d6e71ae0e2 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 21 Jan 2024 18:23:01 +0100 Subject: [PATCH 063/107] Removed notification if XGM toggle happens via hotkey --- app/Gpu/GPUModeControl.cs | 14 +++++++++++--- app/Input/InputDispatcher.cs | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/Gpu/GPUModeControl.cs b/app/Gpu/GPUModeControl.cs index 8ab985ef..2861f2e6 100644 --- a/app/Gpu/GPUModeControl.cs +++ b/app/Gpu/GPUModeControl.cs @@ -284,7 +284,7 @@ namespace GHelper.Gpu } - public void ToggleXGM() + public void ToggleXGM(bool silent = false) { Task.Run(async () => @@ -296,12 +296,20 @@ namespace GHelper.Gpu XGM.Reset(); HardwareControl.KillGPUApps(); - DialogResult dialogResult = MessageBox.Show("Did you close all applications running on XG Mobile?", "Disabling XG Mobile", MessageBoxButtons.YesNo); - if (dialogResult == DialogResult.Yes) + if (silent) { Program.acpi.DeviceSet(AsusACPI.GPUXG, 0, "GPU XGM"); await Task.Delay(TimeSpan.FromSeconds(15)); } + else + { + DialogResult dialogResult = MessageBox.Show("Did you close all applications running on XG Mobile?", "Disabling XG Mobile", MessageBoxButtons.YesNo); + if (dialogResult == DialogResult.Yes) + { + Program.acpi.DeviceSet(AsusACPI.GPUXG, 0, "GPU XGM"); + await Task.Delay(TimeSpan.FromSeconds(15)); + } + } } else { diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index d85df4e9..01346d27 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -372,7 +372,7 @@ namespace GHelper.Input SetBrightness(10); break; case Keys.F3: - Program.settingsForm.gpuControl.ToggleXGM(); + Program.settingsForm.gpuControl.ToggleXGM(true); break; case Keys.F14: Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); From 76e547c2dc02521c844f89ca2181f223d37fa682 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 21 Jan 2024 18:44:46 +0100 Subject: [PATCH 064/107] UI Tweaks --- app/GHelper.csproj | 2 +- app/Properties/Resources.Designer.cs | 10 +++++++++ app/Properties/Resources.resx | 29 +++++++++++++++------------ app/Resources/icons8-controls-32.png | Bin 0 -> 309 bytes app/Settings.Designer.cs | 1 + app/USB/Aura.cs | 4 ++-- 6 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 app/Resources/icons8-controls-32.png diff --git a/app/GHelper.csproj b/app/GHelper.csproj index ce70eea1..819bb1dc 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.149.1 + 0.149 diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 4f8bb67f..9d5597ff 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -240,6 +240,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_controls_32 { + get { + object obj = ResourceManager.GetObject("icons8-controls-32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index fc984650..750793a1 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -154,6 +154,9 @@ ..\Resources\icons8-controller-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons8-next-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -196,8 +199,8 @@ ..\Resources\icons8-keyboard-32 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-spa-flower-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-xbox-lt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-video-card-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -229,6 +232,9 @@ ..\Resources\icons8-charging-battery-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-animation-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\dot-ultimate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -238,14 +244,11 @@ ..\Resources\backlight-up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-xbox-lt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\backlight-down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-spa-flower-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\dot-standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -277,8 +280,8 @@ ..\Resources\icons8-gauge-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-fan-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -304,8 +307,8 @@ ..\Resources\icons8-software-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -316,7 +319,7 @@ ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-animation-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-controls-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/app/Resources/icons8-controls-32.png b/app/Resources/icons8-controls-32.png new file mode 100644 index 0000000000000000000000000000000000000000..7c4ace3ac8b3fdb91c633afd2224f4196903d4ae GIT binary patch literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?3oVGw3ym^DWNDEQpd z#WAE}&f96$TuhEUZTqcXNal!q<&tx<>AH6;jMXtV`ZlZlT6F;y@4Kw0CpL08hJ8CY z>)6kS?K4GAx*H{mH#MzV$)3~LZo#xmVkQ5QhTjEDTXYzdLQC}P?oStEFxM;#**N(~ zUOnT6KwbNe``@=-WmAclTX<8gq+zbsyYsm{rXdXfa@Hj>97tece!yeXD0*Rw)Ip9J zOyB!MKO1ltu6eYvE4?y`t!UE5$EB4qEDwG;Gt9RR_j?l^K3z;JpW(#R-@gTyTx#?_ zmpA>RYwafQy%FJ?(_I;)m?nO`9C+34dQ1^J>%y;0iw<8gsAf3c4)ijEr>mdKI;Vst E0LtZc!vFvP literal 0 HcmV?d00001 diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index e9fa4e53..c6e5c94d 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -1495,6 +1495,7 @@ namespace GHelper buttonController.FlatAppearance.BorderSize = 0; buttonController.FlatStyle = FlatStyle.Flat; buttonController.ForeColor = SystemColors.ControlText; + buttonController.Image = Properties.Resources.icons8_controls_32; buttonController.ImageAlign = ContentAlignment.MiddleRight; buttonController.Location = new Point(528, 4); buttonController.Margin = new Padding(4); diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index a448596b..2d26b923 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -266,7 +266,7 @@ namespace GHelper.USB new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 }, - // Random data AC sends to keyboard on start + // Random data AC sends to keyboard on start, seem to wake up keyboard on Strix 2024 /* new byte[] { AsusHid.AURA_ID, 0x9F, 0x01 }, new byte[] { AsusHid.AURA_ID, 0xBF }, @@ -279,7 +279,7 @@ namespace GHelper.USB Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, */ - + new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01}, }, "Init"); From 5b3947c580321fe6f18caf9e23c9ea533551b87d Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 21 Jan 2024 19:31:05 +0100 Subject: [PATCH 065/107] New Crowdin updates (#1963) * New translations strings.resx (Portuguese) * New translations strings.resx (Romanian) * New translations strings.resx (Chinese Traditional) * New translations strings.resx (French) * New translations strings.resx (Spanish) * New translations strings.resx (German) * New translations strings.resx (Hungarian) * New translations strings.resx (Italian) * New translations strings.resx (Korean) * New translations strings.resx (Lithuanian) * New translations strings.resx (Polish) * New translations strings.resx (Turkish) * New translations strings.resx (Ukrainian) * New translations strings.resx (Chinese Simplified) * New translations strings.resx (Vietnamese) * New translations strings.resx (Portuguese, Brazilian) * New translations strings.resx (Indonesian) * New translations strings.resx (Spanish) --- app/Properties/Strings.de.resx | 8 +++++++- app/Properties/Strings.es.resx | 6 ++++++ app/Properties/Strings.fr.resx | 8 +++++++- app/Properties/Strings.hu.resx | 8 +++++++- app/Properties/Strings.id.resx | 8 +++++++- app/Properties/Strings.it.resx | 8 +++++++- app/Properties/Strings.ko.resx | 8 +++++++- app/Properties/Strings.lt.resx | 8 +++++++- app/Properties/Strings.pl.resx | 8 +++++++- app/Properties/Strings.pt-BR.resx | 8 +++++++- app/Properties/Strings.pt-PT.resx | 8 +++++++- app/Properties/Strings.ro.resx | 8 +++++++- app/Properties/Strings.tr.resx | 8 +++++++- app/Properties/Strings.uk.resx | 8 +++++++- app/Properties/Strings.vi.resx | 8 +++++++- app/Properties/Strings.zh-CN.resx | 8 +++++++- app/Properties/Strings.zh-TW.resx | 8 +++++++- 17 files changed, 118 insertions(+), 16 deletions(-) diff --git a/app/Properties/Strings.de.resx b/app/Properties/Strings.de.resx index 4206fd32..c7b8dc38 100644 --- a/app/Properties/Strings.de.resx +++ b/app/Properties/Strings.de.resx @@ -504,7 +504,10 @@ Trotzdem fortfahren? Maus synchronisieren - Multi-Zone + Multi Zone + + + Multi Zone Strong Mikrofon stummschalten @@ -521,6 +524,9 @@ Trotzdem fortfahren? Nicht verbunden + + One Zone + G-Helper Fenster öffnen diff --git a/app/Properties/Strings.es.resx b/app/Properties/Strings.es.resx index f3323332..557c4d53 100644 --- a/app/Properties/Strings.es.resx +++ b/app/Properties/Strings.es.resx @@ -506,6 +506,9 @@ Multizona + + Multizona fuerte + Silenciar micrófono @@ -521,6 +524,9 @@ No conectado + + Una zona + Abrir ventana G-Helper diff --git a/app/Properties/Strings.fr.resx b/app/Properties/Strings.fr.resx index ae3b23eb..4189b0f8 100644 --- a/app/Properties/Strings.fr.resx +++ b/app/Properties/Strings.fr.resx @@ -504,7 +504,10 @@ Voulez-vous continuer ? Synchroniser avec le pointeur - Multi-zone + Multi Zone + + + Multi Zone Strong Désactiver le micro @@ -521,6 +524,9 @@ Voulez-vous continuer ? Non connecté + + One Zone + Ouvrir G-Helper diff --git a/app/Properties/Strings.hu.resx b/app/Properties/Strings.hu.resx index 99455b57..c714e7f4 100644 --- a/app/Properties/Strings.hu.resx +++ b/app/Properties/Strings.hu.resx @@ -504,7 +504,10 @@ Do you still want to continue? Szinkronizálás egérrel - Többzónás + Multi Zone + + + Multi Zone Strong Mikrofon némítása @@ -521,6 +524,9 @@ Do you still want to continue? Nincs csatlakoztatva + + One Zone + G-Helper ablak megnyitása diff --git a/app/Properties/Strings.id.resx b/app/Properties/Strings.id.resx index 9f591416..7c7f22f3 100644 --- a/app/Properties/Strings.id.resx +++ b/app/Properties/Strings.id.resx @@ -504,7 +504,10 @@ Apakah Anda masih ingin melanjutkan? Sinkronkan dengan mouse - Multizona + Multi Zone + + + Multi Zone Strong Bisukan Mic @@ -521,6 +524,9 @@ Apakah Anda masih ingin melanjutkan? Tidak Tersambung + + One Zone + Buka Jendela G-Helper diff --git a/app/Properties/Strings.it.resx b/app/Properties/Strings.it.resx index c7c7fda2..17ce6ca8 100644 --- a/app/Properties/Strings.it.resx +++ b/app/Properties/Strings.it.resx @@ -504,7 +504,10 @@ Sei sicuro di voler continuare? Sincronizza con Mouse - Multizona + Multi Zone + + + Multi Zone Strong Silenzia microfono @@ -521,6 +524,9 @@ Sei sicuro di voler continuare? Non Connesso + + One Zone + Apri G-Helper diff --git a/app/Properties/Strings.ko.resx b/app/Properties/Strings.ko.resx index 901bae5d..2e3af927 100644 --- a/app/Properties/Strings.ko.resx +++ b/app/Properties/Strings.ko.resx @@ -504,7 +504,10 @@ 마우스와 동기화 - 멀티존 + Multi Zone + + + Multi Zone Strong 마이크 음소거 @@ -521,6 +524,9 @@ 연결되지 않음 + + One Zone + G-Helper 열기 diff --git a/app/Properties/Strings.lt.resx b/app/Properties/Strings.lt.resx index 730ee089..c31707db 100644 --- a/app/Properties/Strings.lt.resx +++ b/app/Properties/Strings.lt.resx @@ -504,7 +504,10 @@ Vis tiek norite tęsti? Sinchronizuoti su pele - Daugiazonis + Multi Zone + + + Multi Zone Strong Mikrofono nutildymas @@ -521,6 +524,9 @@ Vis tiek norite tęsti? Neprijungta + + One Zone + Atidaryti G-Helper langą diff --git a/app/Properties/Strings.pl.resx b/app/Properties/Strings.pl.resx index 9fdd7719..7b58d26c 100644 --- a/app/Properties/Strings.pl.resx +++ b/app/Properties/Strings.pl.resx @@ -504,7 +504,10 @@ Nadal chcesz kontynuować? Synchronizuj z myszką - Multizone + Multi Zone + + + Multi Zone Strong Wyciszenie mikrofonu @@ -521,6 +524,9 @@ Nadal chcesz kontynuować? Nie połączono + + One Zone + Otwórz okno G-Helper diff --git a/app/Properties/Strings.pt-BR.resx b/app/Properties/Strings.pt-BR.resx index 8afc5fda..e7bcf8d1 100644 --- a/app/Properties/Strings.pt-BR.resx +++ b/app/Properties/Strings.pt-BR.resx @@ -504,7 +504,10 @@ Do you still want to continue? Synchronize with mouse - Multizona + Multi Zone + + + Multi Zone Strong Desligar microfone @@ -521,6 +524,9 @@ Do you still want to continue? Not Connected + + One Zone + Abrir G-Helper diff --git a/app/Properties/Strings.pt-PT.resx b/app/Properties/Strings.pt-PT.resx index bdf98858..51369a7d 100644 --- a/app/Properties/Strings.pt-PT.resx +++ b/app/Properties/Strings.pt-PT.resx @@ -504,7 +504,10 @@ Quer prosseguir? Sincronizar com o rato - Multizona + Multi Zone + + + Multi Zone Strong Desligar microfone @@ -521,6 +524,9 @@ Quer prosseguir? Não conectado + + One Zone + Abrir G-Helper diff --git a/app/Properties/Strings.ro.resx b/app/Properties/Strings.ro.resx index baabbe6b..b49127e7 100644 --- a/app/Properties/Strings.ro.resx +++ b/app/Properties/Strings.ro.resx @@ -504,7 +504,10 @@ Sincronizare cu mouse-ul - Multizone + Multi Zone + + + Multi Zone Strong Oprire microfon @@ -521,6 +524,9 @@ Neconectat + + One Zone + Deschide fereastra G-Helper diff --git a/app/Properties/Strings.tr.resx b/app/Properties/Strings.tr.resx index d1db8d05..0c2b0c90 100644 --- a/app/Properties/Strings.tr.resx +++ b/app/Properties/Strings.tr.resx @@ -504,7 +504,10 @@ Yine de devam etmek istiyor musunuz? Fare ile senkronize edin - Çoklu Bölge + Multi Zone + + + Multi Zone Strong Mikrofonu Sustur @@ -521,6 +524,9 @@ Yine de devam etmek istiyor musunuz? Bağlantı Yok + + One Zone + G-Helper penceresini aç diff --git a/app/Properties/Strings.uk.resx b/app/Properties/Strings.uk.resx index 0c4b5320..e61b0e97 100644 --- a/app/Properties/Strings.uk.resx +++ b/app/Properties/Strings.uk.resx @@ -504,7 +504,10 @@ Синхронізувати з мишею - Мультизони + Multi Zone + + + Multi Zone Strong Вимкнути мікрофон @@ -521,6 +524,9 @@ Не під'єднано + + One Zone + Відкрити вікно G-Helper diff --git a/app/Properties/Strings.vi.resx b/app/Properties/Strings.vi.resx index 02b76041..dac420a1 100644 --- a/app/Properties/Strings.vi.resx +++ b/app/Properties/Strings.vi.resx @@ -504,7 +504,10 @@ Do you still want to continue? Synchronize with mouse - Đèn nền Đa vùng(Multi-Zone) + Multi Zone + + + Multi Zone Strong Tắt Mic @@ -521,6 +524,9 @@ Do you still want to continue? Not Connected + + One Zone + Mở cửa sổ G-Helper diff --git a/app/Properties/Strings.zh-CN.resx b/app/Properties/Strings.zh-CN.resx index 30cab1ee..8c75200f 100644 --- a/app/Properties/Strings.zh-CN.resx +++ b/app/Properties/Strings.zh-CN.resx @@ -504,7 +504,10 @@ 和鼠标同步 - 多区域设置 + Multi Zone + + + Multi Zone Strong 静音麦克风 @@ -521,6 +524,9 @@ 未连接 + + One Zone + 打开G-Helper窗口 diff --git a/app/Properties/Strings.zh-TW.resx b/app/Properties/Strings.zh-TW.resx index de0a553b..1c02c1aa 100644 --- a/app/Properties/Strings.zh-TW.resx +++ b/app/Properties/Strings.zh-TW.resx @@ -504,7 +504,10 @@ 與滑鼠同步 - 多區域 + Multi Zone + + + Multi Zone Strong 麥克風開關 @@ -521,6 +524,9 @@ 未連線 + + One Zone + 開啟G-Helper視窗 From bb10fff4e2fc266c13bc2eb0b2023391e9d71c83 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 22 Jan 2024 10:52:26 +0100 Subject: [PATCH 066/107] Aura tweaks --- app/Settings.cs | 4 ++-- app/USB/Aura.cs | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Settings.cs b/app/Settings.cs index 85320929..65f64a5b 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1214,14 +1214,14 @@ namespace GHelper public void AutoKeyboard() { + InputDispatcher.SetBacklightAuto(true); + if (!AppConfig.Is("skip_aura")) { Aura.ApplyPower(); Aura.ApplyAura(); } - InputDispatcher.SetBacklightAuto(true); - if (Program.acpi.IsXGConnected()) XGM.Light(AppConfig.Is("xmg_light")); diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 2d26b923..00ca3b9d 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -266,21 +266,22 @@ namespace GHelper.USB new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 }, + Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x20 }, + // Random data AC sends to keyboard on start, seem to wake up keyboard on Strix 2024 /* new byte[] { AsusHid.AURA_ID, 0x9F, 0x01 }, new byte[] { AsusHid.AURA_ID, 0xBF }, - new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x20 }, new byte[] { AsusHid.AURA_ID, 0xC0, 0x03, 0x01}, new byte[] { AsusHid.AURA_ID, 0x9E, 0x01, 0x20 }, - Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, + new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01}, */ - new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01}, }, "Init"); @@ -648,7 +649,7 @@ namespace GHelper.USB int _speed = (Speed == AuraSpeed.Normal) ? 0xeb : (Speed == AuraSpeed.Fast) ? 0xf5 : 0xe1; - AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_APPLY, MESSAGE_SET }); + AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_SET, MESSAGE_APPLY }); if (isACPI) Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed); From bbe1fd3d9fc2ca0d5b9c7deffd77ced9b9f04108 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:08:46 +0100 Subject: [PATCH 067/107] Aura tweaks for 2024 models --- app/AppConfig.cs | 5 +++++ app/USB/Aura.cs | 37 ++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index f111d7a4..725d5151 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -495,6 +495,11 @@ public static class AppConfig return ContainsModel("G814") || ContainsModel("G614") || ContainsModel("G834") || ContainsModel("G634"); } + public static bool IsNewAura() + { + return ContainsModel("G834") || ContainsModel("G614") || ContainsModel("G834") || ContainsModel("G634"); + } + public static bool IsASUS() { return ContainsModel("ROG") || ContainsModel("TUF") || ContainsModel("Vivobook") || ContainsModel("Zenbook"); diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 00ca3b9d..c1ce061f 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -264,27 +264,26 @@ namespace GHelper.USB new byte[] { AsusHid.AURA_ID, 0xB9 }, Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, - new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 }, - - Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), - new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x20 }, - - // Random data AC sends to keyboard on start, seem to wake up keyboard on Strix 2024 - /* - new byte[] { AsusHid.AURA_ID, 0x9F, 0x01 }, - new byte[] { AsusHid.AURA_ID, 0xBF }, - - - new byte[] { AsusHid.AURA_ID, 0xC0, 0x03, 0x01}, - new byte[] { AsusHid.AURA_ID, 0x9E, 0x01, 0x20 }, - - new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, - new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01}, - */ - - }, "Init"); + // Random data AC sends to keyboard on start, that seem to wake up keyboard on 2024 + if (AppConfig.IsNewAura()) + { + AsusHid.Write(new List { + new byte[] { AsusHid.AURA_ID, 0x9F, 0x01 }, + new byte[] { AsusHid.AURA_ID, 0xBF }, + + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 }, + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x20 }, + + new byte[] { AsusHid.AURA_ID, 0xC0, 0x03, 0x01 }, + new byte[] { AsusHid.AURA_ID, 0x9E, 0x01, 0x20 }, + + Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), + new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, + new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01 }, + }, "Init"); + } } From 5e49c2e699a3288efc66905db05e6aebb17b5781 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:16:40 +0100 Subject: [PATCH 068/107] Update README.md --- docs/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 9d8824f8..57792f15 100644 --- a/docs/README.md +++ b/docs/README.md @@ -121,8 +121,14 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio - ``Fn + Shift + F7 / F8`` - Matrix brightness Down / Up - ``Fn + Shift + F7 / F8`` - Screenpad brightness Down / Up - ``Ctrl + Shift + F20`` - Mute Microphone -- ``Ctrl + Shift + Alt + F14`` - Eco Mode -- ``Ctrl + Shift + Alt + F15`` - Standard Mode +- ``Ctrl + Shift + Alt + F14`` - Eco GPU Mode +- ``Ctrl + Shift + Alt + F15`` - Standard GPU Mode +- ``Ctrl + Shift + Alt + F16`` - Silent +- ``Ctrl + Shift + Alt + F17`` - Balanced +- ``Ctrl + Shift + Alt + F18`` - Turbo +- ``Ctrl + Shift + Alt + F19`` - Custom 1 (if exists) +- ``Ctrl + Shift + Alt + F20`` - Custom 2 (if exists) + - [Custom keybindings / hotkeys](https://github.com/seerge/g-helper/wiki/Power-user-settings#custom-hotkey-actions) ------------------ From ef1a82329437059209092f558082ceac2ffec98c Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:17:00 +0100 Subject: [PATCH 069/107] Update README.md --- docs/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 57792f15..03e7115f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -128,7 +128,6 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio - ``Ctrl + Shift + Alt + F18`` - Turbo - ``Ctrl + Shift + Alt + F19`` - Custom 1 (if exists) - ``Ctrl + Shift + Alt + F20`` - Custom 2 (if exists) - - [Custom keybindings / hotkeys](https://github.com/seerge/g-helper/wiki/Power-user-settings#custom-hotkey-actions) ------------------ From a3768bcedfcbdfb6f26453ea8d2842454234af75 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:49:57 +0100 Subject: [PATCH 070/107] Anime Matrix tweaks https://github.com/seerge/g-helper/issues/1648 --- app/AnimeMatrix/AnimeMatrixDevice.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index 93666a3f..7a289e64 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -408,7 +408,7 @@ namespace Starlight.AnimeMatrix var pixel = bmp.GetPixel(x, y); var color = Math.Min((pixel.R + pixel.G + pixel.B) * contrast / 300, 255); if (color > 20) - SetLedDiagonal(x, y, (byte)color, deltaX + (FullRows / 2) + 1, deltaY - (FullRows / 2) - 1); + SetLedDiagonal(x, y, (byte)color, deltaX, deltaY - (FullRows / 2) - 1); } } } @@ -431,7 +431,7 @@ namespace Starlight.AnimeMatrix public void Text(string text, float fontSize = 10, int x = 0, int y = 0) { - int width = MaxRows - FullRows; + int width = MaxRows; int height = MaxRows - FullRows; int textHeight, textWidth; @@ -501,8 +501,11 @@ namespace Starlight.AnimeMatrix public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100) { - int width = MaxRows - FullRows; - int height = MaxRows - FullRows*2; + int width = MaxRows + FullRows; + int height = MaxColumns + FullRows; + + if ((image.Height / image.Width) > (height / width)) height = MaxColumns; + float scale; using (Bitmap bmp = new Bitmap(width, height)) @@ -518,7 +521,7 @@ namespace Starlight.AnimeMatrix graph.CompositingQuality = CompositingQuality.HighQuality; graph.SmoothingMode = SmoothingMode.AntiAlias; - graph.DrawImage(image, width - scaleWidth, height - scaleHeight, scaleWidth, scaleHeight); + graph.DrawImage(image, (width - scaleWidth) / 2, height - scaleHeight, scaleWidth, scaleHeight); } From 8531d903bbda4f1403cb4386ea104f5bd02bbe13 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 24 Jan 2024 23:00:06 +0100 Subject: [PATCH 071/107] Minor tweaks --- app/AnimeMatrix/AniMatrixControl.cs | 87 ++++++++++++++-------------- app/AnimeMatrix/AnimeMatrixDevice.cs | 21 +------ app/Display/ScreenControl.cs | 3 +- app/Helpers/ClamshellModeControl.cs | 2 + 4 files changed, 50 insertions(+), 63 deletions(-) diff --git a/app/AnimeMatrix/AniMatrixControl.cs b/app/AnimeMatrix/AniMatrixControl.cs index d5d4b1b9..bce848ce 100644 --- a/app/AnimeMatrix/AniMatrixControl.cs +++ b/app/AnimeMatrix/AniMatrixControl.cs @@ -4,7 +4,6 @@ using Starlight.AnimeMatrix; using System.Diagnostics; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -using System.IO; using System.Timers; namespace GHelper.AnimeMatrix @@ -69,49 +68,51 @@ namespace GHelper.AnimeMatrix StopMatrixTimer(); StopMatrixAudio(); - try + Task.Run(() => { - device.SetProvider(); - } - catch (Exception ex) - { - Logger.WriteLine(ex.Message); - return; - } - - if (wakeUp && AppConfig.ContainsModel("401")) device.WakeUp(); - - if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online)) - { - device.SetDisplayState(false); - device.SetDisplayState(false); // some devices are dumb - Logger.WriteLine("Matrix Off"); - } - else - { - device.SetDisplayState(true); - device.SetBrightness((BrightnessMode)brightness); - - switch (running) + try { - case 2: - SetMatrixPicture(AppConfig.GetString("matrix_picture")); - break; - case 3: - SetMatrixClock(); - break; - case 4: - SetMatrixAudio(); - break; - default: - device.SetBuiltInAnimation(true, animation); - Logger.WriteLine("Matrix builtin " + animation.AsByte); - break; - + device.SetProvider(); + } + catch (Exception ex) + { + Logger.WriteLine(ex.Message); + return; } - //mat.SetBrightness((BrightnessMode)brightness); - } + if (wakeUp && AppConfig.ContainsModel("401")) device.WakeUp(); + + if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online)) + { + device.SetDisplayState(false); + device.SetDisplayState(false); // some devices are dumb + Logger.WriteLine("Matrix Off"); + } + else + { + device.SetDisplayState(true); + device.SetBrightness((BrightnessMode)brightness); + + switch (running) + { + case 2: + SetMatrixPicture(AppConfig.GetString("matrix_picture")); + break; + case 3: + SetMatrixClock(); + break; + case 4: + SetMatrixAudio(); + break; + default: + device.SetBuiltInAnimation(true, animation); + Logger.WriteLine("Matrix builtin " + animation.AsByte); + break; + } + + } + }); + } private void StartMatrixTimer(int interval = 100) @@ -358,10 +359,10 @@ namespace GHelper.AnimeMatrix int matrixZoom = AppConfig.Get("matrix_zoom", 100); int matrixContrast = AppConfig.Get("matrix_contrast", 100); - + int matrixSpeed = AppConfig.Get("matrix_speed", 50); - MatrixRotation rotation = (MatrixRotation)AppConfig.Get("matrix_rotation", 0); + MatrixRotation rotation = (MatrixRotation)AppConfig.Get("matrix_rotation", 0); InterpolationMode matrixQuality = (InterpolationMode)AppConfig.Get("matrix_quality", 0); @@ -382,7 +383,7 @@ namespace GHelper.AnimeMatrix device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); else device.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); - + device.AddFrame(); } diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index 7a289e64..915d39d7 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -3,7 +3,6 @@ using GHelper.AnimeMatrix.Communication; using System.Drawing.Drawing2D; using System.Drawing.Text; -using System.Management; using System.Text; namespace Starlight.AnimeMatrix @@ -107,9 +106,7 @@ namespace Starlight.AnimeMatrix public AnimeMatrixDevice() : base(0x0B05, 0x193B, 640) { - string model = GetModel(); - - if (model.Contains("401")) + if (AppConfig.ContainsModel("401")) { _model = AnimeType.GA401; @@ -124,7 +121,7 @@ namespace Starlight.AnimeMatrix LedStart = 1; } - if (model.Contains("GU604")) + if (AppConfig.ContainsModel("GU604")) { _model = AnimeType.GU604; @@ -154,18 +151,6 @@ namespace Starlight.AnimeMatrix System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr); } - public string GetModel() - { - using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_ComputerSystem")) - { - foreach (var process in searcher.Get()) - return process["Model"].ToString(); - } - - return null; - - } - public byte[] GetBuffer() { return _displayBuffer; @@ -452,7 +437,7 @@ namespace Starlight.AnimeMatrix } } - SetBitmapDiagonal(bmp, 5 , height); + SetBitmapDiagonal(bmp, 5, height); } } diff --git a/app/Display/ScreenControl.cs b/app/Display/ScreenControl.cs index ff60746d..6331baaf 100644 --- a/app/Display/ScreenControl.cs +++ b/app/Display/ScreenControl.cs @@ -101,13 +101,12 @@ namespace GHelper.Display int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1); int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2); - Logger.WriteLine($"Miniled: {miniled1} {miniled2}"); - int miniled = (miniled1 >= 0) ? miniled1 : miniled2; bool hdr = false; if (miniled >= 0) { + Logger.WriteLine($"Miniled: {miniled1} {miniled2}"); AppConfig.Set("miniled", miniled); hdr = ScreenCCD.GetHDRStatus(); } diff --git a/app/Helpers/ClamshellModeControl.cs b/app/Helpers/ClamshellModeControl.cs index e3565533..16b7492e 100644 --- a/app/Helpers/ClamshellModeControl.cs +++ b/app/Helpers/ClamshellModeControl.cs @@ -69,12 +69,14 @@ namespace GHelper.Helpers } public static void DisableClamshellMode() { + if (PowerNative.GetLidAction(true) == GetDefaultLidAction()) return; PowerNative.SetLidAction(GetDefaultLidAction(), true); Logger.WriteLine("Disengaging Clamshell Mode"); } public static void EnableClamshellMode() { + if (PowerNative.GetLidAction(true) == 0) return; PowerNative.SetLidAction(0, true); Logger.WriteLine("Engaging Clamshell Mode"); } From 06bfe8361db72d55dd3088507edf84f0502d61f1 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:35:16 +0100 Subject: [PATCH 072/107] Create feature_request.yml --- .github/ISSUE_TEMPLATE/feature_request.yml | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..c008d324 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,46 @@ +name: Feature request +description: Suggest an idea for this project +body: + - type: checkboxes + id: rules + attributes: + label: Rules + options: + - label: I made myself familiar with the Readme, FAQ and Troubleshooting. + required: true + - label: I understand that, if insufficient information or no app logs will be provided, my issue will be closed without an answer. + required: true + validations: + required: true + - type: textarea + id: description + attributes: + label: Is your feature request related to a problem? Please describe + description: A clear and concise description of what the problem is. + validations: + required: true + - type: textarea + id: solution + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + - type: input + id: device + attributes: + label: Device and Model + description: Which laptop do you use? + placeholder: e.g. Asus Zephyrus G14 GA404RK + validations: + required: true + - type: textarea + id: additional + attributes: + label: Additional information. + description: If applicable, add screenshots or other relevant information From a27b02ff629fe2e01b4e480d5dc819af6d8379b8 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:35:35 +0100 Subject: [PATCH 073/107] Delete .github/ISSUE_TEMPLATE/feature_request.md --- .github/ISSUE_TEMPLATE/feature_request.md | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. From 545e2cc705c483ba8bf0dea42375250127daf2db Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:40:54 +0100 Subject: [PATCH 074/107] Update feature_request.yml --- .github/ISSUE_TEMPLATE/feature_request.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index c008d324..2f779c31 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -8,7 +8,7 @@ body: options: - label: I made myself familiar with the Readme, FAQ and Troubleshooting. required: true - - label: I understand that, if insufficient information or no app logs will be provided, my issue will be closed without an answer. + - label: I understand that, if insufficient information will be provided, my issue will be closed without an answer. required: true validations: required: true @@ -16,21 +16,21 @@ body: id: description attributes: label: Is your feature request related to a problem? Please describe - description: A clear and concise description of what the problem is. + placeholder: A clear and concise description of what the problem is. validations: required: true - type: textarea id: solution attributes: label: Describe the solution you'd like - description: A clear and concise description of what you want to happen. + placeholder: A clear and concise description of what you want to happen. validations: required: true - type: textarea id: alternatives attributes: label: Describe alternatives you've considered - description: A clear and concise description of any alternative solutions or features you've considered. + placeholder: A clear and concise description of any alternative solutions or features you've considered. - type: input id: device attributes: @@ -43,4 +43,4 @@ body: id: additional attributes: label: Additional information. - description: If applicable, add screenshots or other relevant information + placeholder: If applicable, add screenshots or other relevant information From fbfbe8e730e14009ca499e48117c2cb1ee521e4c Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Jan 2024 16:54:34 +0100 Subject: [PATCH 075/107] Ally Backlight control --- app/Ally/AllyControl.cs | 10 +++++++++- app/Extra.cs | 2 ++ app/Settings.cs | 5 +++++ app/UI/RForm.cs | 13 ------------- app/USB/Aura.cs | 18 +++++++++++++++++- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 8c4581c6..0d591b5f 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,5 +1,6 @@ using GHelper.Gpu.AMD; using GHelper.Input; +using GHelper.Mode; using GHelper.USB; using HidSharp; using System.Text; @@ -580,7 +581,6 @@ namespace GHelper.Ally public void ToggleMode() { - switch (_mode) { case ControllerMode.Auto: @@ -596,7 +596,15 @@ namespace GHelper.Ally SetMode(ControllerMode.Auto); break; } + } + public void ToggleXBox() + { + bool status = !AppConfig.IsNotFalse("controller_xbox"); + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0B, 0x01, status ? (byte)0x01 : (byte)0x02 }, "XBox"); + AppConfig.Set("controller_xbox", status ? 1 : 0); + + settings.VisualiseXBox(status); } } diff --git a/app/Extra.cs b/app/Extra.cs index 8dfd85d2..5e75cb85 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -228,6 +228,8 @@ namespace GHelper checkGpuApps.Visible = false; checkUSBC.Visible = false; + checkAutoToggleClamshellMode.Visible = false; + checkNoOverdrive.Visible = false; int apuMem = Program.acpi.GetAPUMem(); if (apuMem >= 0) diff --git a/app/Settings.cs b/app/Settings.cs index 65f64a5b..b9d4b84a 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -314,6 +314,11 @@ namespace GHelper } } + public void VisualiseXBox(bool status) + { + + } + public void VisualiseBacklight(int backlight) { buttonBacklight.Text = Math.Round((double)backlight*33.33).ToString() + "%"; diff --git a/app/UI/RForm.cs b/app/UI/RForm.cs index 3df697d2..003f2937 100644 --- a/app/UI/RForm.cs +++ b/app/UI/RForm.cs @@ -21,19 +21,6 @@ namespace GHelper.UI public static Color chartMain; public static Color chartGrid; - static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); - static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2); - static readonly IntPtr HWND_TOP = new IntPtr(0); - static readonly IntPtr HWND_BOTTOM = new IntPtr(1); - const UInt32 SWP_NOSIZE = 0x0001; - const UInt32 SWP_NOMOVE = 0x0002; - const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE; - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); - protected override bool ShowWithoutActivation => true; - [DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")] public static extern bool CheckSystemDarkModeStatus(); diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index c1ce061f..8a8e2078 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -343,7 +343,17 @@ namespace GHelper.USB if (flags.SleepRear) rear |= 1 << 6; if (flags.ShutdownRear) rear |= 1 << 7; - return new byte[] { 0x5d, 0xbd, 0x01, keyb, bar, lid, rear, 0xFF }; + return new byte[] { AsusHid.AURA_ID, 0xBD, 0x01, keyb, bar, lid, rear, 0xFF }; + } + + private static void ApplyAllyPower(AuraPower flags) + { + byte power = 0x00; + if (flags.BootKeyb) power |= 0x01; + if (flags.AwakeKeyb) power |= 0x02; + if (flags.SleepKeyb) power |= 0x04; + if (flags.ShutdownKeyb) power |= 0x08; + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x09, 0x01, power }, "Aura"); } public static void ApplyPower() @@ -381,6 +391,12 @@ namespace GHelper.USB flags.SleepRear = AppConfig.IsNotFalse("keyboard_sleep_lid"); flags.ShutdownRear = AppConfig.IsNotFalse("keyboard_shutdown_lid"); + if (AppConfig.IsAlly()) + { + ApplyAllyPower(flags); + return; + } + AsusHid.Write(AuraPowerMessage(flags)); if (isACPI) From 8a3752045310e90525aedbcd319bf2e95614cce5 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:01:14 +0100 Subject: [PATCH 076/107] Advanced Settings Plugin downloader --- app/Fans.Designer.cs | 106 ++++++++++++++++++++++++++------------ app/Fans.cs | 34 ++++++++++++ app/GHelper.csproj | 2 +- app/Ryzen/RyzenControl.cs | 51 +++++++++++++++++- 4 files changed, 158 insertions(+), 35 deletions(-) diff --git a/app/Fans.Designer.cs b/app/Fans.Designer.cs index 6b0379e3..8b653e1c 100644 --- a/app/Fans.Designer.cs +++ b/app/Fans.Designer.cs @@ -31,14 +31,14 @@ namespace GHelper /// private void InitializeComponent() { - ChartArea chartArea5 = new ChartArea(); - Title title5 = new Title(); - ChartArea chartArea6 = new ChartArea(); - Title title6 = new Title(); - ChartArea chartArea7 = new ChartArea(); - Title title7 = new Title(); - ChartArea chartArea8 = new ChartArea(); - Title title8 = new Title(); + ChartArea chartArea1 = new ChartArea(); + Title title1 = new Title(); + ChartArea chartArea2 = new ChartArea(); + Title title2 = new Title(); + ChartArea chartArea3 = new ChartArea(); + Title title3 = new Title(); + ChartArea chartArea4 = new ChartArea(); + Title title4 = new Title(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Fans)); panelFans = new Panel(); labelTip = new Label(); @@ -85,6 +85,8 @@ namespace GHelper panelTitleTemp = new Panel(); pictureTemp = new PictureBox(); labelTempLimit = new Label(); + panelDownload = new Panel(); + buttonDownload = new RButton(); panelPower = new Panel(); panelApplyPower = new Panel(); checkApplyPower = new RCheckBox(); @@ -168,6 +170,7 @@ namespace GHelper ((System.ComponentModel.ISupportInitialize)trackTemp).BeginInit(); panelTitleTemp.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureTemp).BeginInit(); + panelDownload.SuspendLayout(); panelPower.SuspendLayout(); panelApplyPower.SuspendLayout(); panelCPU.SuspendLayout(); @@ -257,8 +260,8 @@ namespace GHelper // // chartGPU // - chartArea5.Name = "ChartArea1"; - chartGPU.ChartAreas.Add(chartArea5); + chartArea1.Name = "ChartArea1"; + chartGPU.ChartAreas.Add(chartArea1); chartGPU.Dock = DockStyle.Fill; chartGPU.Location = new Point(12, 493); chartGPU.Margin = new Padding(2, 10, 2, 10); @@ -266,13 +269,13 @@ namespace GHelper chartGPU.Size = new Size(782, 463); chartGPU.TabIndex = 17; chartGPU.Text = "chartGPU"; - title5.Name = "Title1"; - chartGPU.Titles.Add(title5); + title1.Name = "Title1"; + chartGPU.Titles.Add(title1); // // chartCPU // - chartArea6.Name = "ChartArea1"; - chartCPU.ChartAreas.Add(chartArea6); + chartArea2.Name = "ChartArea1"; + chartCPU.ChartAreas.Add(chartArea2); chartCPU.Dock = DockStyle.Fill; chartCPU.Location = new Point(12, 10); chartCPU.Margin = new Padding(2, 10, 2, 10); @@ -280,13 +283,13 @@ namespace GHelper chartCPU.Size = new Size(782, 463); chartCPU.TabIndex = 14; chartCPU.Text = "chartCPU"; - title6.Name = "Title1"; - chartCPU.Titles.Add(title6); + title2.Name = "Title1"; + chartCPU.Titles.Add(title2); // // chartXGM // - chartArea7.Name = "ChartAreaXGM"; - chartXGM.ChartAreas.Add(chartArea7); + chartArea3.Name = "ChartAreaXGM"; + chartXGM.ChartAreas.Add(chartArea3); chartXGM.Dock = DockStyle.Fill; chartXGM.Location = new Point(12, 1459); chartXGM.Margin = new Padding(2, 10, 2, 10); @@ -294,14 +297,14 @@ namespace GHelper chartXGM.Size = new Size(782, 463); chartXGM.TabIndex = 14; chartXGM.Text = "chartXGM"; - title7.Name = "Title4"; - chartXGM.Titles.Add(title7); + title3.Name = "Title4"; + chartXGM.Titles.Add(title3); chartXGM.Visible = false; // // chartMid // - chartArea8.Name = "ChartArea3"; - chartMid.ChartAreas.Add(chartArea8); + chartArea4.Name = "ChartArea3"; + chartMid.ChartAreas.Add(chartArea4); chartMid.Dock = DockStyle.Fill; chartMid.Location = new Point(12, 976); chartMid.Margin = new Padding(2, 10, 2, 10); @@ -309,8 +312,8 @@ namespace GHelper chartMid.Size = new Size(782, 463); chartMid.TabIndex = 14; chartMid.Text = "chartMid"; - title8.Name = "Title3"; - chartMid.Titles.Add(title8); + title4.Name = "Title3"; + chartMid.Titles.Add(title4); chartMid.Visible = false; // // panelTitleFans @@ -528,10 +531,11 @@ namespace GHelper panelAdvanced.Controls.Add(panelTitleAdvanced); panelAdvanced.Controls.Add(panelTemperature); panelAdvanced.Controls.Add(panelTitleTemp); + panelAdvanced.Controls.Add(panelDownload); panelAdvanced.Dock = DockStyle.Top; panelAdvanced.Location = new Point(10, 1644); panelAdvanced.Name = "panelAdvanced"; - panelAdvanced.Size = new Size(520, 888); + panelAdvanced.Size = new Size(520, 992); panelAdvanced.TabIndex = 14; panelAdvanced.Visible = false; // @@ -540,7 +544,7 @@ namespace GHelper panelAdvancedAlways.AutoSize = true; panelAdvancedAlways.Controls.Add(checkApplyUV); panelAdvancedAlways.Dock = DockStyle.Top; - panelAdvancedAlways.Location = new Point(0, 827); + panelAdvancedAlways.Location = new Point(0, 931); panelAdvancedAlways.Name = "panelAdvancedAlways"; panelAdvancedAlways.Padding = new Padding(16, 0, 16, 15); panelAdvancedAlways.Size = new Size(520, 61); @@ -566,7 +570,7 @@ namespace GHelper panelAdvancedApply.AutoSize = true; panelAdvancedApply.Controls.Add(buttonApplyAdvanced); panelAdvancedApply.Dock = DockStyle.Top; - panelAdvancedApply.Location = new Point(0, 747); + panelAdvancedApply.Location = new Point(0, 851); panelAdvancedApply.Name = "panelAdvancedApply"; panelAdvancedApply.Padding = new Padding(15); panelAdvancedApply.Size = new Size(520, 80); @@ -595,7 +599,7 @@ namespace GHelper labelRisky.BackColor = Color.IndianRed; labelRisky.Dock = DockStyle.Top; labelRisky.ForeColor = SystemColors.ControlLightLight; - labelRisky.Location = new Point(0, 504); + labelRisky.Location = new Point(0, 608); labelRisky.Margin = new Padding(0); labelRisky.Name = "labelRisky"; labelRisky.Padding = new Padding(10, 10, 10, 5); @@ -611,7 +615,7 @@ namespace GHelper panelUViGPU.Controls.Add(labelLeftUViGPU); panelUViGPU.Controls.Add(trackUViGPU); panelUViGPU.Dock = DockStyle.Top; - panelUViGPU.Location = new Point(0, 380); + panelUViGPU.Location = new Point(0, 484); panelUViGPU.Margin = new Padding(4); panelUViGPU.MaximumSize = new Size(0, 124); panelUViGPU.Name = "panelUViGPU"; @@ -659,7 +663,7 @@ namespace GHelper panelUV.Controls.Add(labelLeftUV); panelUV.Controls.Add(trackUV); panelUV.Dock = DockStyle.Top; - panelUV.Location = new Point(0, 256); + panelUV.Location = new Point(0, 360); panelUV.Margin = new Padding(4); panelUV.MaximumSize = new Size(0, 124); panelUV.Name = "panelUV"; @@ -704,7 +708,7 @@ namespace GHelper panelTitleAdvanced.Controls.Add(pictureUV); panelTitleAdvanced.Controls.Add(labelTitleUV); panelTitleAdvanced.Dock = DockStyle.Top; - panelTitleAdvanced.Location = new Point(0, 190); + panelTitleAdvanced.Location = new Point(0, 294); panelTitleAdvanced.Name = "panelTitleAdvanced"; panelTitleAdvanced.Size = new Size(520, 66); panelTitleAdvanced.TabIndex = 48; @@ -740,7 +744,7 @@ namespace GHelper panelTemperature.Controls.Add(labelLeftTemp); panelTemperature.Controls.Add(trackTemp); panelTemperature.Dock = DockStyle.Top; - panelTemperature.Location = new Point(0, 66); + panelTemperature.Location = new Point(0, 170); panelTemperature.Margin = new Padding(4); panelTemperature.MaximumSize = new Size(0, 124); panelTemperature.Name = "panelTemperature"; @@ -785,7 +789,7 @@ namespace GHelper panelTitleTemp.Controls.Add(pictureTemp); panelTitleTemp.Controls.Add(labelTempLimit); panelTitleTemp.Dock = DockStyle.Top; - panelTitleTemp.Location = new Point(0, 0); + panelTitleTemp.Location = new Point(0, 104); panelTitleTemp.Name = "panelTitleTemp"; panelTitleTemp.Size = new Size(520, 66); panelTitleTemp.TabIndex = 50; @@ -813,6 +817,38 @@ namespace GHelper labelTempLimit.TabIndex = 47; labelTempLimit.Text = "Temp Limit"; // + // panelDownload + // + panelDownload.AutoSize = true; + panelDownload.Controls.Add(buttonDownload); + panelDownload.Dock = DockStyle.Top; + panelDownload.Location = new Point(0, 0); + panelDownload.Name = "panelDownload"; + panelDownload.Padding = new Padding(20); + panelDownload.Size = new Size(520, 104); + panelDownload.TabIndex = 52; + panelDownload.Visible = false; + // + // buttonDownload + // + buttonDownload.Activated = false; + buttonDownload.AutoSize = true; + buttonDownload.AutoSizeMode = AutoSizeMode.GrowAndShrink; + buttonDownload.BackColor = SystemColors.ControlLight; + buttonDownload.BorderColor = Color.Transparent; + buttonDownload.BorderRadius = 2; + buttonDownload.Dock = DockStyle.Top; + buttonDownload.FlatStyle = FlatStyle.Flat; + buttonDownload.Location = new Point(20, 20); + buttonDownload.Margin = new Padding(20); + buttonDownload.Name = "buttonDownload"; + buttonDownload.Padding = new Padding(10); + buttonDownload.Secondary = true; + buttonDownload.Size = new Size(480, 64); + buttonDownload.TabIndex = 19; + buttonDownload.Text = "Download Advanced Settings Plugin"; + buttonDownload.UseVisualStyleBackColor = false; + // // panelPower // panelPower.AutoSize = true; @@ -1634,6 +1670,8 @@ namespace GHelper panelTitleTemp.ResumeLayout(false); panelTitleTemp.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureTemp).EndInit(); + panelDownload.ResumeLayout(false); + panelDownload.PerformLayout(); panelPower.ResumeLayout(false); panelPower.PerformLayout(); panelApplyPower.ResumeLayout(false); @@ -1793,5 +1831,7 @@ namespace GHelper private Label labelSlow; private Label labelLeftSlow; private TrackBar trackSlow; + private Panel panelDownload; + private RButton buttonDownload; } } \ No newline at end of file diff --git a/app/Fans.cs b/app/Fans.cs index e793d609..cdc85c34 100644 --- a/app/Fans.cs +++ b/app/Fans.cs @@ -213,6 +213,8 @@ namespace GHelper buttonCalibrate.Click += ButtonCalibrate_Click; + buttonDownload.Click += ButtonDownload_Click; + ToggleNavigation(0); if (Program.acpi.DeviceGet(AsusACPI.DevsCPUFanCurve) < 0) buttonCalibrate.Visible = false; @@ -221,7 +223,21 @@ namespace GHelper } + private void ButtonDownload_Click(object? sender, EventArgs e) + { + RyzenControl.DownloadRing(); + panelAdvancedAlways.Visible = true; + panelAdvancedApply.Visible = true; + labelRisky.Visible = true; + panelUViGPU.Visible = true; + panelUV.Visible = true; + panelTitleAdvanced.Visible = true; + panelTemperature.Visible = true; + panelTitleTemp.Visible = true; + + VisualiseAdvanced(); + } private void ButtonCalibrate_Click(object? sender, EventArgs e) { @@ -365,6 +381,24 @@ namespace GHelper private void VisualiseAdvanced() { + + if (!RyzenControl.IsRingExsists()) + { + panelTitleAdvanced.Visible = false; + labelRisky.Visible = false; + panelUV.Visible = false; + panelUViGPU.Visible = false; + panelTitleTemp.Visible = false; + panelTemperature.Visible = false; + panelAdvancedAlways.Visible = false; + panelAdvancedApply.Visible = false; + panelDownload.Visible = true; + + } else + { + panelDownload.Visible = false; + } + if (!RyzenControl.IsSupportedUV()) { panelTitleAdvanced.Visible = false; diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 819bb1dc..c43e6850 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.149 + 0.150 diff --git a/app/Ryzen/RyzenControl.cs b/app/Ryzen/RyzenControl.cs index 8b197fdd..3473f633 100644 --- a/app/Ryzen/RyzenControl.cs +++ b/app/Ryzen/RyzenControl.cs @@ -4,7 +4,9 @@ // +using GHelper.Helpers; using System.Management; +using System.Net; namespace Ryzen { @@ -52,7 +54,8 @@ namespace Ryzen CPUName = obj["Name"].ToString(); CPUModel = obj["Caption"].ToString(); } - } catch (Exception ex) + } + catch (Exception ex) { Logger.WriteLine(ex.Message); } @@ -142,6 +145,52 @@ namespace Ryzen return CPUName.Contains("6900H") || CPUName.Contains("7945H") || CPUName.Contains("7845H"); } + public static bool IsRingExsists() + { + string exeDir = Path.GetDirectoryName(Application.ExecutablePath); + return File.Exists(exeDir + "\\" + "WinRing0x64.dll"); + } + + public static void DownloadRing() + { + string requestUri = "https://github.com/seerge/g-helper/releases/latest/download/PluginAdvancedSettings.zip"; + + Uri uri = new Uri(requestUri); + + string exeDir = Path.GetDirectoryName(Application.ExecutablePath); + string zipName = Path.GetFileName(uri.LocalPath); + string zipLocation = exeDir + "\\" + zipName; + + using (WebClient client = new WebClient()) + { + Logger.WriteLine(requestUri); + Logger.WriteLine(exeDir); + Logger.WriteLine(zipName); + + try + { + client.DownloadFile(uri, zipLocation); + } + catch (Exception ex) + { + Logger.WriteLine(ex.Message); + Logger.WriteLine(ex.ToString()); + if (!ProcessHelper.IsUserAdministrator()) ProcessHelper.RunAsAdmin("uv"); + return; + } + + try + { + System.IO.Compression.ZipFile.ExtractToDirectory(zipLocation, exeDir, overwriteFiles: true); + File.Delete(zipLocation); + } + catch (Exception ex) + { + Logger.WriteLine(ex.ToString()); + } + } + } + public static void SetAddresses() { From 39cc2b7563363d47ced837bedc71ee26a145efe0 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:14:56 +0100 Subject: [PATCH 077/107] Update README.md --- docs/README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/README.md b/docs/README.md index 03e7115f..0a2a0501 100644 --- a/docs/README.md +++ b/docs/README.md @@ -82,13 +82,6 @@ Each BIOS mode is paired with matching Windows Power Mode. You can adjust this s ![GPU Modes](https://github.com/seerge/g-helper/assets/5920850/65c6bdd5-728c-4965-b544-fcf5a85ed6a2) -### 🔖 Important Notice - -G-Helper is **NOT** an operating system, firmware or a driver. It **DOESN'T** "run" your hardware in realtime anyhow. - -It's an app that lets you select (already predefined and stored in BIOS) operating modes and (optionally) set some settings that already exist on your device (same as Armoury Crate). If you use same mode / settings as in Armoury Crate - performance of your device won't be different. - -Role of G-Helper for your laptop is similar to a role of a remote control for your TV. ### :mouse: Asus Mouse and other peripherals support @@ -139,6 +132,16 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio ------------------ +### 🔖 Important Notice + +G-Helper is **NOT** an operating system, firmware, or driver. It **DOES NOT** "run" your hardware in real-time anyhow. + +It's an app that lets you select one of the operating modes created by Asus (and stored in BIOS) and optionally (!) set some settings that already exist on your device same as Armoury Crate can set. It does it by using the Asus System Control Interface "driver" that Armoury uses for it. + +If you use equivalent mode/settings as in Armoury Crate - the performance of the behavior of your device won't be different. + +The role of G-Helper for your laptop is similar to the role of a remote control for your TV. + **Libraries and projects used** - [Linux Kernel](https://github.com/torvalds/linux/blob/master/drivers/platform/x86/asus-wmi.c) for some basic endpoints in ASUS ACPI/WMI interface - [NvAPIWrapper](https://github.com/falahati/NvAPIWrapper) for accessing Nvidia API From 1fa24420234be98b110f2bb6d4b61eafb72803d6 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:15:29 +0100 Subject: [PATCH 078/107] Update README.md --- docs/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 0a2a0501..97408ab7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -142,14 +142,14 @@ If you use equivalent mode/settings as in Armoury Crate - the performance of the The role of G-Helper for your laptop is similar to the role of a remote control for your TV. -**Libraries and projects used** +### Libraries and projects used - [Linux Kernel](https://github.com/torvalds/linux/blob/master/drivers/platform/x86/asus-wmi.c) for some basic endpoints in ASUS ACPI/WMI interface - [NvAPIWrapper](https://github.com/falahati/NvAPIWrapper) for accessing Nvidia API - [Starlight](https://github.com/vddCore/Starlight) for anime matrix communication protocol - [UXTU](https://github.com/JamesCJ60/Universal-x86-Tuning-Utility) for undervolting using Ryzen System Management Unit - [AsusCtl](https://gitlab.com/asus-linux/asusctl) for inspiration and some reverse engineering -**Disclaimers** +### Disclaimers "ROG", "TUF", and "Armoury Crate" are trademarked by and belong to AsusTek Computer, Inc. I make no claims to these or any assets belonging to AsusTek Computer and use them purely for informational purposes only. THE SOFTWARE IS PROVIDED “AS IS” AND WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MISUSE OF THIS SOFTWARE COULD CAUSE SYSTEM INSTABILITY OR MALFUNCTION. From 31b535a582bd58a606a658c4659f60234255a3fc Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:52:37 +0100 Subject: [PATCH 079/107] Update README.md --- docs/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 97408ab7..d400973a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -136,9 +136,9 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio G-Helper is **NOT** an operating system, firmware, or driver. It **DOES NOT** "run" your hardware in real-time anyhow. -It's an app that lets you select one of the operating modes created by Asus (and stored in BIOS) and optionally (!) set some settings that already exist on your device same as Armoury Crate can set. It does it by using the Asus System Control Interface "driver" that Armoury uses for it. +It's an app that lets you select one of the predefined operating modes created by Asus (and stored in BIOS) and optionally(!) set some settings that already exist on your device same as Armoury Crate can. It does it by using the Asus System Control Interface "driver" that Armoury uses for it. -If you use equivalent mode/settings as in Armoury Crate - the performance of the behavior of your device won't be different. +If you use equivalent mode/settings as in Armoury Crate - the performance or the behavior of your device won't be different. The role of G-Helper for your laptop is similar to the role of a remote control for your TV. From 7b34ec4a8c09e11a601e30b299d954033fba4fd8 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:59:29 +0100 Subject: [PATCH 080/107] Update release.yml --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3565ce40..25a816fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,9 +22,10 @@ jobs: - name: Publish run: | dotnet publish app/GHelper.sln --configuration Release --runtime win-x64 -p:PublishSingleFile=true --no-self-contained - powershell Compress-Archive app/bin/x64/Release/net7.0-windows/win-x64/publish/* GHelper.zip + powershell Compress-Archive app/bin/x64/Release/net7.0-windows/win-x64/publish/GHelper.exe GHelper.zip + powershell Compress-Archive app/bin/x64/Release/net7.0-windows/win-x64/publish/WinRing* PluginAdvancedSettings.zip - name: Upload env: GH_TOKEN: ${{ github.token }} run: | - gh release upload ${{ github.ref_name }} GHelper.zip + gh release upload ${{ github.ref_name }} GHelper.zip PluginAdvancedSettings.zip From 325c6ff3eab6c777c2eb8d65b3c97512a79e9122 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:10:11 +0100 Subject: [PATCH 081/107] Advanced Settings Plugin downloader tweaks --- app/GHelper.csproj | 2 +- app/Ryzen/RyzenControl.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/GHelper.csproj b/app/GHelper.csproj index c43e6850..819bb1dc 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.150 + 0.149 diff --git a/app/Ryzen/RyzenControl.cs b/app/Ryzen/RyzenControl.cs index 3473f633..567d3b78 100644 --- a/app/Ryzen/RyzenControl.cs +++ b/app/Ryzen/RyzenControl.cs @@ -7,6 +7,7 @@ using GHelper.Helpers; using System.Management; using System.Net; +using System.Reflection; namespace Ryzen { @@ -153,7 +154,8 @@ namespace Ryzen public static void DownloadRing() { - string requestUri = "https://github.com/seerge/g-helper/releases/latest/download/PluginAdvancedSettings.zip"; + var appVersion = new Version(Assembly.GetExecutingAssembly().GetName().Version.ToString()); + string requestUri = "https://github.com/seerge/g-helper/releases/download/v" + appVersion.Major + "." + appVersion.Minor + "/PluginAdvancedSettings.zip"; Uri uri = new Uri(requestUri); @@ -175,7 +177,7 @@ namespace Ryzen { Logger.WriteLine(ex.Message); Logger.WriteLine(ex.ToString()); - if (!ProcessHelper.IsUserAdministrator()) ProcessHelper.RunAsAdmin("uv"); + if (!ProcessHelper.IsUserAdministrator() && !ex.Message.Contains("remote server")) ProcessHelper.RunAsAdmin("uv"); return; } From 163b35d6b02d8aacc9e9f7abddb3057e0d5bd221 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:21:47 +0100 Subject: [PATCH 082/107] Advanced Settings Plugin downloader fixes --- app/Helpers/ProcessHelper.cs | 4 ++-- app/Ryzen/RyzenControl.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Helpers/ProcessHelper.cs b/app/Helpers/ProcessHelper.cs index 7c6303fb..5b3957e2 100644 --- a/app/Helpers/ProcessHelper.cs +++ b/app/Helpers/ProcessHelper.cs @@ -37,14 +37,14 @@ namespace GHelper.Helpers return principal.IsInRole(WindowsBuiltInRole.Administrator); } - public static void RunAsAdmin(string? param = null) + public static void RunAsAdmin(string? param = null, bool force = false) { if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAdmin) < 2000) return; lastAdmin = DateTimeOffset.Now.ToUnixTimeMilliseconds(); // Check if the current user is an administrator - if (!IsUserAdministrator()) + if (!IsUserAdministrator() || force) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = true; diff --git a/app/Ryzen/RyzenControl.cs b/app/Ryzen/RyzenControl.cs index 567d3b78..26bd2e44 100644 --- a/app/Ryzen/RyzenControl.cs +++ b/app/Ryzen/RyzenControl.cs @@ -185,6 +185,7 @@ namespace Ryzen { System.IO.Compression.ZipFile.ExtractToDirectory(zipLocation, exeDir, overwriteFiles: true); File.Delete(zipLocation); + ProcessHelper.RunAsAdmin("uv", true); } catch (Exception ex) { From fb33f426d3a457371764e39ca69f29ccbc4dfd5a Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 20:43:51 +0100 Subject: [PATCH 083/107] Binding UI --- app/AppConfig.cs | 2 +- app/Extra.cs | 1 - app/Handheld.Designer.cs | 1234 +++++++++++++++++--------- app/Handheld.cs | 131 ++- app/Mode/ModeControl.cs | 2 + app/Properties/Resources.Designer.cs | 10 + app/Properties/Resources.resx | 7 +- app/Resources/ally.png | Bin 0 -> 26177 bytes 8 files changed, 913 insertions(+), 474 deletions(-) create mode 100644 app/Resources/ally.png diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 725d5151..8de91e6b 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -321,7 +321,7 @@ public static class AppConfig public static bool IsAlly() { - return ContainsModel("RC71"); + return true || ContainsModel("RC71"); } public static bool NoMKeys() diff --git a/app/Extra.cs b/app/Extra.cs index 5e75cb85..baf171fe 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -13,7 +13,6 @@ namespace GHelper { ScreenControl screenControl = new ScreenControl(); - ModeControl modeControl = new ModeControl(); ClamshellModeControl clamshellControl = new ClamshellModeControl(); const string EMPTY = "--------------"; diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs index 1c50b22e..3c7086b1 100644 --- a/app/Handheld.Designer.cs +++ b/app/Handheld.Designer.cs @@ -28,95 +28,113 @@ /// private void InitializeComponent() { - panelController = new Panel(); + panelDeadzones = new Panel(); + panelRight = new Panel(); buttonReset = new UI.RButton(); - panelVibra = new Panel(); - labelVibra = new Label(); - labelVibraTitle = new Label(); - trackVibra = new TrackBar(); - panelVibrationTitle = new Panel(); - pictureVibration = new PictureBox(); - labelVibraHeader = new Label(); panelRT = new Panel(); + pictureBox4 = new PictureBox(); trackRTMax = new TrackBar(); labelRT = new Label(); trackRTMin = new TrackBar(); labelRTTitle = new Label(); - panelLT = new Panel(); - trackLTMax = new TrackBar(); - labelLT = new Label(); - trackLTMin = new TrackBar(); - labelLTTitle = new Label(); - panelTDeadzone = new Panel(); - pictureTDeadzone = new PictureBox(); - labelTDeadzone = new Label(); panelRS = new Panel(); + pictureBox1 = new PictureBox(); trackRSMax = new TrackBar(); labelRS = new Label(); trackRSMin = new TrackBar(); labelRSTitle = new Label(); + panelLeft = new Panel(); + panelVibra = new Panel(); + pictureBox5 = new PictureBox(); + labelVibra = new Label(); + labelVibraTitle = new Label(); + trackVibra = new TrackBar(); + panelLT = new Panel(); + pictureBox2 = new PictureBox(); + trackLTMax = new TrackBar(); + labelLT = new Label(); + trackLTMin = new TrackBar(); + labelLTTitle = new Label(); panelLS = new Panel(); + pictureBox3 = new PictureBox(); trackLSMax = new TrackBar(); labelLS = new Label(); trackLSMin = new TrackBar(); labelLSTitle = new Label(); - panelSDeadzone = new Panel(); - pictureSDeadzone = new PictureBox(); - labelSDeadzone = new Label(); panelBindings = new Panel(); - tableBindings = new TableLayoutPanel(); - labelPrimary = new Label(); + buttonView = new UI.RButton(); + buttonLS = new UI.RButton(); + buttonLT = new UI.RButton(); + buttonLB = new UI.RButton(); + buttonDPR = new UI.RButton(); + buttonDPL = new UI.RButton(); + buttonDPD = new UI.RButton(); + buttonDPU = new UI.RButton(); + buttonM2 = new UI.RButton(); + buttonM1 = new UI.RButton(); + buttonRS = new UI.RButton(); + buttonMenu = new UI.RButton(); + buttonRT = new UI.RButton(); + buttonRB = new UI.RButton(); + buttonB = new UI.RButton(); + buttonA = new UI.RButton(); + buttonY = new UI.RButton(); + buttonX = new UI.RButton(); + pictureAlly = new PictureBox(); + panelBinding = new Panel(); + labelBinding = new Label(); labelSecondary = new Label(); - panelBindingsTitle = new Panel(); - pictureBindings = new PictureBox(); - labelBindings = new Label(); - panelController.SuspendLayout(); - panelVibra.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)trackVibra).BeginInit(); - panelVibrationTitle.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)pictureVibration).BeginInit(); + labelPrimary = new Label(); + comboSecondary = new UI.RComboBox(); + comboPrimary = new UI.RComboBox(); + panelDeadzones.SuspendLayout(); + panelRight.SuspendLayout(); panelRT.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox4).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackRTMax).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackRTMin).BeginInit(); - panelLT.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)trackLTMax).BeginInit(); - ((System.ComponentModel.ISupportInitialize)trackLTMin).BeginInit(); - panelTDeadzone.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)pictureTDeadzone).BeginInit(); panelRS.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackRSMax).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackRSMin).BeginInit(); + panelLeft.SuspendLayout(); + panelVibra.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox5).BeginInit(); + ((System.ComponentModel.ISupportInitialize)trackVibra).BeginInit(); + panelLT.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit(); + ((System.ComponentModel.ISupportInitialize)trackLTMax).BeginInit(); + ((System.ComponentModel.ISupportInitialize)trackLTMin).BeginInit(); panelLS.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox3).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackLSMax).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackLSMin).BeginInit(); - panelSDeadzone.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).BeginInit(); panelBindings.SuspendLayout(); - tableBindings.SuspendLayout(); - panelBindingsTitle.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)pictureBindings).BeginInit(); + ((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit(); + panelBinding.SuspendLayout(); SuspendLayout(); // - // panelController + // panelDeadzones // - panelController.AutoSize = true; - panelController.Controls.Add(buttonReset); - panelController.Controls.Add(panelVibra); - panelController.Controls.Add(panelVibrationTitle); - panelController.Controls.Add(panelRT); - panelController.Controls.Add(panelLT); - panelController.Controls.Add(panelTDeadzone); - panelController.Controls.Add(panelRS); - panelController.Controls.Add(panelLS); - panelController.Controls.Add(panelSDeadzone); - panelController.Dock = DockStyle.Left; - panelController.Location = new Point(10, 10); - panelController.Margin = new Padding(4); - panelController.MinimumSize = new Size(560, 800); - panelController.Name = "panelController"; - panelController.Padding = new Padding(0, 0, 0, 18); - panelController.Size = new Size(560, 912); - panelController.TabIndex = 45; + panelDeadzones.Controls.Add(panelRight); + panelDeadzones.Controls.Add(panelLeft); + panelDeadzones.Dock = DockStyle.Top; + panelDeadzones.Location = new Point(10, 10); + panelDeadzones.Name = "panelDeadzones"; + panelDeadzones.Size = new Size(1130, 372); + panelDeadzones.TabIndex = 0; + // + // panelRight + // + panelRight.Controls.Add(buttonReset); + panelRight.Controls.Add(panelRT); + panelRight.Controls.Add(panelRS); + panelRight.Dock = DockStyle.Left; + panelRight.Location = new Point(560, 0); + panelRight.MinimumSize = new Size(560, 0); + panelRight.Name = "panelRight"; + panelRight.Size = new Size(560, 372); + panelRight.TabIndex = 48; // // buttonReset // @@ -126,115 +144,44 @@ buttonReset.BorderColor = Color.Transparent; buttonReset.BorderRadius = 2; buttonReset.FlatStyle = FlatStyle.Flat; - buttonReset.Location = new Point(20, 840); + buttonReset.Location = new Point(310, 296); buttonReset.Margin = new Padding(4, 2, 4, 2); buttonReset.Name = "buttonReset"; buttonReset.Secondary = true; buttonReset.Size = new Size(239, 50); - buttonReset.TabIndex = 54; - buttonReset.Text = "Reset"; + buttonReset.TabIndex = 55; + buttonReset.Text = "Reset Deadzones"; buttonReset.UseVisualStyleBackColor = false; // - // panelVibra - // - panelVibra.AutoSize = true; - panelVibra.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panelVibra.Controls.Add(labelVibra); - panelVibra.Controls.Add(labelVibraTitle); - panelVibra.Controls.Add(trackVibra); - panelVibra.Dock = DockStyle.Top; - panelVibra.Location = new Point(0, 676); - panelVibra.Margin = new Padding(4); - panelVibra.MaximumSize = new Size(0, 124); - panelVibra.Name = "panelVibra"; - panelVibra.Size = new Size(560, 124); - panelVibra.TabIndex = 46; - // - // labelVibra - // - labelVibra.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelVibra.Location = new Point(408, 14); - labelVibra.Margin = new Padding(4, 0, 4, 0); - labelVibra.Name = "labelVibra"; - labelVibra.Size = new Size(124, 32); - labelVibra.TabIndex = 44; - labelVibra.Text = "100%"; - labelVibra.TextAlign = ContentAlignment.TopRight; - // - // labelVibraTitle - // - labelVibraTitle.AutoSize = true; - labelVibraTitle.Location = new Point(10, 14); - labelVibraTitle.Margin = new Padding(4, 0, 4, 0); - labelVibraTitle.Name = "labelVibraTitle"; - labelVibraTitle.Size = new Size(209, 32); - labelVibraTitle.TabIndex = 43; - labelVibraTitle.Text = "Vibration Strength"; - // - // trackVibra - // - trackVibra.Location = new Point(6, 48); - trackVibra.Margin = new Padding(4, 2, 4, 2); - trackVibra.Maximum = 100; - trackVibra.Name = "trackVibra"; - trackVibra.Size = new Size(546, 90); - trackVibra.TabIndex = 42; - trackVibra.TickFrequency = 5; - trackVibra.TickStyle = TickStyle.TopLeft; - trackVibra.Value = 100; - // - // panelVibrationTitle - // - panelVibrationTitle.AutoSize = true; - panelVibrationTitle.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panelVibrationTitle.Controls.Add(pictureVibration); - panelVibrationTitle.Controls.Add(labelVibraHeader); - panelVibrationTitle.Dock = DockStyle.Top; - panelVibrationTitle.Location = new Point(0, 616); - panelVibrationTitle.Margin = new Padding(4); - panelVibrationTitle.Name = "panelVibrationTitle"; - panelVibrationTitle.Size = new Size(560, 60); - panelVibrationTitle.TabIndex = 53; - // - // pictureVibration - // - pictureVibration.BackgroundImage = Properties.Resources.icons8_soonvibes_32; - pictureVibration.BackgroundImageLayout = ImageLayout.Zoom; - pictureVibration.ErrorImage = null; - pictureVibration.InitialImage = null; - pictureVibration.Location = new Point(10, 18); - pictureVibration.Margin = new Padding(4, 2, 4, 10); - pictureVibration.Name = "pictureVibration"; - pictureVibration.Size = new Size(32, 32); - pictureVibration.TabIndex = 41; - pictureVibration.TabStop = false; - // - // labelVibraHeader - // - labelVibraHeader.AutoSize = true; - labelVibraHeader.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelVibraHeader.Location = new Point(45, 17); - labelVibraHeader.Margin = new Padding(4, 0, 4, 0); - labelVibraHeader.Name = "labelVibraHeader"; - labelVibraHeader.Size = new Size(121, 32); - labelVibraHeader.TabIndex = 40; - labelVibraHeader.Text = "Vibration"; - // // panelRT // panelRT.AutoSize = true; panelRT.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelRT.Controls.Add(pictureBox4); panelRT.Controls.Add(trackRTMax); panelRT.Controls.Add(labelRT); panelRT.Controls.Add(trackRTMin); panelRT.Controls.Add(labelRTTitle); panelRT.Dock = DockStyle.Top; - panelRT.Location = new Point(0, 492); + panelRT.Location = new Point(0, 124); panelRT.Margin = new Padding(4); panelRT.MaximumSize = new Size(0, 124); panelRT.Name = "panelRT"; panelRT.Size = new Size(560, 124); - panelRT.TabIndex = 50; + panelRT.TabIndex = 51; + // + // pictureBox4 + // + pictureBox4.BackgroundImage = Properties.Resources.icons8_xbox_lt_32; + pictureBox4.BackgroundImageLayout = ImageLayout.Zoom; + pictureBox4.ErrorImage = null; + pictureBox4.InitialImage = null; + pictureBox4.Location = new Point(16, 18); + pictureBox4.Margin = new Padding(4, 2, 4, 10); + pictureBox4.Name = "pictureBox4"; + pictureBox4.Size = new Size(32, 32); + pictureBox4.TabIndex = 43; + pictureBox4.TabStop = false; // // trackRTMax // @@ -278,130 +225,42 @@ // labelRTTitle // labelRTTitle.AutoSize = true; - labelRTTitle.Location = new Point(10, 16); + labelRTTitle.Location = new Point(56, 16); labelRTTitle.Margin = new Padding(4, 0, 4, 0); labelRTTitle.Name = "labelRTTitle"; - labelRTTitle.Size = new Size(151, 32); + labelRTTitle.Size = new Size(276, 32); labelRTTitle.TabIndex = 17; - labelRTTitle.Text = "Right Trigger"; - // - // panelLT - // - panelLT.AutoSize = true; - panelLT.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panelLT.Controls.Add(trackLTMax); - panelLT.Controls.Add(labelLT); - panelLT.Controls.Add(trackLTMin); - panelLT.Controls.Add(labelLTTitle); - panelLT.Dock = DockStyle.Top; - panelLT.Location = new Point(0, 368); - panelLT.Margin = new Padding(4); - panelLT.MaximumSize = new Size(0, 124); - panelLT.Name = "panelLT"; - panelLT.Size = new Size(560, 124); - panelLT.TabIndex = 51; - // - // trackLTMax - // - trackLTMax.Location = new Point(272, 48); - trackLTMax.Margin = new Padding(4, 2, 4, 2); - trackLTMax.Maximum = 100; - trackLTMax.Minimum = 50; - trackLTMax.Name = "trackLTMax"; - trackLTMax.RightToLeft = RightToLeft.No; - trackLTMax.Size = new Size(280, 90); - trackLTMax.TabIndex = 30; - trackLTMax.TickFrequency = 5; - trackLTMax.TickStyle = TickStyle.TopLeft; - trackLTMax.Value = 100; - // - // labelLT - // - labelLT.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelLT.Location = new Point(363, 13); - labelLT.Margin = new Padding(4, 0, 4, 0); - labelLT.Name = "labelLT"; - labelLT.Size = new Size(176, 32); - labelLT.TabIndex = 29; - labelLT.Text = "0 - 100%"; - labelLT.TextAlign = ContentAlignment.TopRight; - // - // trackLTMin - // - trackLTMin.LargeChange = 100; - trackLTMin.Location = new Point(6, 48); - trackLTMin.Margin = new Padding(4, 2, 4, 2); - trackLTMin.Maximum = 50; - trackLTMin.Name = "trackLTMin"; - trackLTMin.RightToLeft = RightToLeft.No; - trackLTMin.Size = new Size(280, 90); - trackLTMin.SmallChange = 10; - trackLTMin.TabIndex = 18; - trackLTMin.TickFrequency = 5; - trackLTMin.TickStyle = TickStyle.TopLeft; - // - // labelLTTitle - // - labelLTTitle.AutoSize = true; - labelLTTitle.Location = new Point(10, 16); - labelLTTitle.Margin = new Padding(4, 0, 4, 0); - labelLTTitle.Name = "labelLTTitle"; - labelLTTitle.Size = new Size(135, 32); - labelLTTitle.TabIndex = 17; - labelLTTitle.Text = "Left Trigger"; - // - // panelTDeadzone - // - panelTDeadzone.AutoSize = true; - panelTDeadzone.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panelTDeadzone.Controls.Add(pictureTDeadzone); - panelTDeadzone.Controls.Add(labelTDeadzone); - panelTDeadzone.Dock = DockStyle.Top; - panelTDeadzone.Location = new Point(0, 308); - panelTDeadzone.Margin = new Padding(4); - panelTDeadzone.Name = "panelTDeadzone"; - panelTDeadzone.Size = new Size(560, 60); - panelTDeadzone.TabIndex = 52; - // - // pictureTDeadzone - // - pictureTDeadzone.BackgroundImage = Properties.Resources.icons8_xbox_lt_32; - pictureTDeadzone.BackgroundImageLayout = ImageLayout.Zoom; - pictureTDeadzone.ErrorImage = null; - pictureTDeadzone.InitialImage = null; - pictureTDeadzone.Location = new Point(10, 18); - pictureTDeadzone.Margin = new Padding(4, 2, 4, 10); - pictureTDeadzone.Name = "pictureTDeadzone"; - pictureTDeadzone.Size = new Size(32, 32); - pictureTDeadzone.TabIndex = 41; - pictureTDeadzone.TabStop = false; - // - // labelTDeadzone - // - labelTDeadzone.AutoSize = true; - labelTDeadzone.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelTDeadzone.Location = new Point(45, 17); - labelTDeadzone.Margin = new Padding(4, 0, 4, 0); - labelTDeadzone.Name = "labelTDeadzone"; - labelTDeadzone.Size = new Size(228, 32); - labelTDeadzone.TabIndex = 40; - labelTDeadzone.Text = "Trigger Deadzones"; + labelRTTitle.Text = "Right Trigger Deadzones"; // // panelRS // panelRS.AutoSize = true; panelRS.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelRS.Controls.Add(pictureBox1); panelRS.Controls.Add(trackRSMax); panelRS.Controls.Add(labelRS); panelRS.Controls.Add(trackRSMin); panelRS.Controls.Add(labelRSTitle); panelRS.Dock = DockStyle.Top; - panelRS.Location = new Point(0, 184); + panelRS.Location = new Point(0, 0); panelRS.Margin = new Padding(4); panelRS.MaximumSize = new Size(0, 124); panelRS.Name = "panelRS"; panelRS.Size = new Size(560, 124); - panelRS.TabIndex = 49; + panelRS.TabIndex = 50; + // + // pictureBox1 + // + pictureBox1.BackgroundImage = Properties.Resources.icons8_joystick_32; + pictureBox1.BackgroundImageLayout = ImageLayout.Zoom; + pictureBox1.ErrorImage = null; + pictureBox1.InitialImage = null; + pictureBox1.Location = new Point(16, 14); + pictureBox1.Margin = new Padding(4, 2, 4, 10); + pictureBox1.Name = "pictureBox1"; + pictureBox1.Size = new Size(32, 32); + pictureBox1.TabIndex = 43; + pictureBox1.TabStop = false; // // trackRSMax // @@ -445,29 +304,199 @@ // labelRSTitle // labelRSTitle.AutoSize = true; - labelRSTitle.Location = new Point(10, 16); + labelRSTitle.Location = new Point(56, 14); labelRSTitle.Margin = new Padding(4, 0, 4, 0); labelRSTitle.Name = "labelRSTitle"; - labelRSTitle.Size = new Size(126, 32); + labelRSTitle.Size = new Size(251, 32); labelRSTitle.TabIndex = 17; - labelRSTitle.Text = "Right Stick"; + labelRSTitle.Text = "Right Stick Deadzones"; + // + // panelLeft + // + panelLeft.AutoSize = true; + panelLeft.Controls.Add(panelVibra); + panelLeft.Controls.Add(panelLT); + panelLeft.Controls.Add(panelLS); + panelLeft.Dock = DockStyle.Left; + panelLeft.Location = new Point(0, 0); + panelLeft.Margin = new Padding(4); + panelLeft.MinimumSize = new Size(560, 0); + panelLeft.Name = "panelLeft"; + panelLeft.Padding = new Padding(0, 0, 0, 18); + panelLeft.Size = new Size(560, 372); + panelLeft.TabIndex = 47; + // + // panelVibra + // + panelVibra.AutoSize = true; + panelVibra.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelVibra.Controls.Add(pictureBox5); + panelVibra.Controls.Add(labelVibra); + panelVibra.Controls.Add(labelVibraTitle); + panelVibra.Controls.Add(trackVibra); + panelVibra.Dock = DockStyle.Top; + panelVibra.Location = new Point(0, 248); + panelVibra.Margin = new Padding(4); + panelVibra.MaximumSize = new Size(0, 124); + panelVibra.Name = "panelVibra"; + panelVibra.Size = new Size(560, 124); + panelVibra.TabIndex = 46; + // + // pictureBox5 + // + pictureBox5.BackgroundImage = Properties.Resources.icons8_soonvibes_32; + pictureBox5.BackgroundImageLayout = ImageLayout.Zoom; + pictureBox5.ErrorImage = null; + pictureBox5.InitialImage = null; + pictureBox5.Location = new Point(10, 14); + pictureBox5.Margin = new Padding(4, 2, 4, 10); + pictureBox5.Name = "pictureBox5"; + pictureBox5.Size = new Size(32, 32); + pictureBox5.TabIndex = 45; + pictureBox5.TabStop = false; + // + // labelVibra + // + labelVibra.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelVibra.Location = new Point(408, 14); + labelVibra.Margin = new Padding(4, 0, 4, 0); + labelVibra.Name = "labelVibra"; + labelVibra.Size = new Size(124, 32); + labelVibra.TabIndex = 44; + labelVibra.Text = "100%"; + labelVibra.TextAlign = ContentAlignment.TopRight; + // + // labelVibraTitle + // + labelVibraTitle.AutoSize = true; + labelVibraTitle.Location = new Point(77, 14); + labelVibraTitle.Margin = new Padding(4, 0, 4, 0); + labelVibraTitle.Name = "labelVibraTitle"; + labelVibraTitle.Size = new Size(209, 32); + labelVibraTitle.TabIndex = 43; + labelVibraTitle.Text = "Vibration Strength"; + // + // trackVibra + // + trackVibra.Location = new Point(6, 48); + trackVibra.Margin = new Padding(4, 2, 4, 2); + trackVibra.Maximum = 100; + trackVibra.Name = "trackVibra"; + trackVibra.Size = new Size(546, 90); + trackVibra.TabIndex = 42; + trackVibra.TickFrequency = 5; + trackVibra.TickStyle = TickStyle.TopLeft; + trackVibra.Value = 100; + // + // panelLT + // + panelLT.AutoSize = true; + panelLT.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelLT.Controls.Add(pictureBox2); + panelLT.Controls.Add(trackLTMax); + panelLT.Controls.Add(labelLT); + panelLT.Controls.Add(trackLTMin); + panelLT.Controls.Add(labelLTTitle); + panelLT.Dock = DockStyle.Top; + panelLT.Location = new Point(0, 124); + panelLT.Margin = new Padding(4); + panelLT.MaximumSize = new Size(0, 124); + panelLT.Name = "panelLT"; + panelLT.Size = new Size(560, 124); + panelLT.TabIndex = 51; + // + // pictureBox2 + // + pictureBox2.BackgroundImage = Properties.Resources.icons8_xbox_lt_32; + pictureBox2.BackgroundImageLayout = ImageLayout.Zoom; + pictureBox2.ErrorImage = null; + pictureBox2.InitialImage = null; + pictureBox2.Location = new Point(20, 14); + pictureBox2.Margin = new Padding(4, 2, 4, 10); + pictureBox2.Name = "pictureBox2"; + pictureBox2.Size = new Size(32, 32); + pictureBox2.TabIndex = 42; + pictureBox2.TabStop = false; + // + // trackLTMax + // + trackLTMax.Location = new Point(272, 48); + trackLTMax.Margin = new Padding(4, 2, 4, 2); + trackLTMax.Maximum = 100; + trackLTMax.Minimum = 50; + trackLTMax.Name = "trackLTMax"; + trackLTMax.RightToLeft = RightToLeft.No; + trackLTMax.Size = new Size(280, 90); + trackLTMax.TabIndex = 30; + trackLTMax.TickFrequency = 5; + trackLTMax.TickStyle = TickStyle.TopLeft; + trackLTMax.Value = 100; + // + // labelLT + // + labelLT.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelLT.Location = new Point(363, 13); + labelLT.Margin = new Padding(4, 0, 4, 0); + labelLT.Name = "labelLT"; + labelLT.Size = new Size(176, 32); + labelLT.TabIndex = 29; + labelLT.Text = "0 - 100%"; + labelLT.TextAlign = ContentAlignment.TopRight; + // + // trackLTMin + // + trackLTMin.LargeChange = 100; + trackLTMin.Location = new Point(6, 48); + trackLTMin.Margin = new Padding(4, 2, 4, 2); + trackLTMin.Maximum = 50; + trackLTMin.Name = "trackLTMin"; + trackLTMin.RightToLeft = RightToLeft.No; + trackLTMin.Size = new Size(280, 90); + trackLTMin.SmallChange = 10; + trackLTMin.TabIndex = 18; + trackLTMin.TickFrequency = 5; + trackLTMin.TickStyle = TickStyle.TopLeft; + // + // labelLTTitle + // + labelLTTitle.AutoSize = true; + labelLTTitle.Location = new Point(60, 14); + labelLTTitle.Margin = new Padding(4, 0, 4, 0); + labelLTTitle.Name = "labelLTTitle"; + labelLTTitle.Size = new Size(260, 32); + labelLTTitle.TabIndex = 17; + labelLTTitle.Text = "Left Trigger Deadzones"; // // panelLS // panelLS.AutoSize = true; panelLS.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelLS.Controls.Add(pictureBox3); panelLS.Controls.Add(trackLSMax); panelLS.Controls.Add(labelLS); panelLS.Controls.Add(trackLSMin); panelLS.Controls.Add(labelLSTitle); panelLS.Dock = DockStyle.Top; - panelLS.Location = new Point(0, 60); + panelLS.Location = new Point(0, 0); panelLS.Margin = new Padding(4); panelLS.MaximumSize = new Size(0, 124); panelLS.Name = "panelLS"; panelLS.Size = new Size(560, 124); panelLS.TabIndex = 48; // + // pictureBox3 + // + pictureBox3.BackgroundImage = Properties.Resources.icons8_joystick_32; + pictureBox3.BackgroundImageLayout = ImageLayout.Zoom; + pictureBox3.ErrorImage = null; + pictureBox3.InitialImage = null; + pictureBox3.Location = new Point(20, 13); + pictureBox3.Margin = new Padding(4, 2, 4, 10); + pictureBox3.Name = "pictureBox3"; + pictureBox3.Size = new Size(32, 32); + pictureBox3.TabIndex = 42; + pictureBox3.TabStop = false; + // // trackLSMax // trackLSMax.Location = new Point(272, 48); @@ -510,148 +539,488 @@ // labelLSTitle // labelLSTitle.AutoSize = true; - labelLSTitle.Location = new Point(10, 16); + labelLSTitle.Location = new Point(56, 13); labelLSTitle.Margin = new Padding(4, 0, 4, 0); labelLSTitle.Name = "labelLSTitle"; - labelLSTitle.Size = new Size(110, 32); + labelLSTitle.Size = new Size(235, 32); labelLSTitle.TabIndex = 17; - labelLSTitle.Text = "Left Stick"; - // - // panelSDeadzone - // - panelSDeadzone.AutoSize = true; - panelSDeadzone.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panelSDeadzone.Controls.Add(pictureSDeadzone); - panelSDeadzone.Controls.Add(labelSDeadzone); - panelSDeadzone.Dock = DockStyle.Top; - panelSDeadzone.Location = new Point(0, 0); - panelSDeadzone.Margin = new Padding(4); - panelSDeadzone.Name = "panelSDeadzone"; - panelSDeadzone.Size = new Size(560, 60); - panelSDeadzone.TabIndex = 43; - // - // pictureSDeadzone - // - pictureSDeadzone.BackgroundImage = Properties.Resources.icons8_joystick_32; - pictureSDeadzone.BackgroundImageLayout = ImageLayout.Zoom; - pictureSDeadzone.ErrorImage = null; - pictureSDeadzone.InitialImage = null; - pictureSDeadzone.Location = new Point(10, 18); - pictureSDeadzone.Margin = new Padding(4, 2, 4, 10); - pictureSDeadzone.Name = "pictureSDeadzone"; - pictureSDeadzone.Size = new Size(32, 32); - pictureSDeadzone.TabIndex = 41; - pictureSDeadzone.TabStop = false; - // - // labelSDeadzone - // - labelSDeadzone.AutoSize = true; - labelSDeadzone.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelSDeadzone.Location = new Point(45, 17); - labelSDeadzone.Margin = new Padding(4, 0, 4, 0); - labelSDeadzone.Name = "labelSDeadzone"; - labelSDeadzone.Size = new Size(199, 32); - labelSDeadzone.TabIndex = 40; - labelSDeadzone.Text = "Stick Deadzones"; + labelLSTitle.Text = "Left Stick Deadzones"; // // panelBindings // - panelBindings.Controls.Add(tableBindings); - panelBindings.Controls.Add(panelBindingsTitle); - panelBindings.Dock = DockStyle.Left; - panelBindings.Location = new Point(570, 10); - panelBindings.MinimumSize = new Size(700, 0); + panelBindings.Controls.Add(panelBinding); + panelBindings.Controls.Add(buttonView); + panelBindings.Controls.Add(buttonLS); + panelBindings.Controls.Add(buttonLT); + panelBindings.Controls.Add(buttonLB); + panelBindings.Controls.Add(buttonDPR); + panelBindings.Controls.Add(buttonDPL); + panelBindings.Controls.Add(buttonDPD); + panelBindings.Controls.Add(buttonDPU); + panelBindings.Controls.Add(buttonM2); + panelBindings.Controls.Add(buttonM1); + panelBindings.Controls.Add(buttonRS); + panelBindings.Controls.Add(buttonMenu); + panelBindings.Controls.Add(buttonRT); + panelBindings.Controls.Add(buttonRB); + panelBindings.Controls.Add(buttonB); + panelBindings.Controls.Add(buttonA); + panelBindings.Controls.Add(buttonY); + panelBindings.Controls.Add(buttonX); + panelBindings.Controls.Add(pictureAlly); + panelBindings.Dock = DockStyle.Top; + panelBindings.Location = new Point(10, 382); panelBindings.Name = "panelBindings"; - panelBindings.Size = new Size(700, 912); - panelBindings.TabIndex = 46; + panelBindings.Size = new Size(1130, 480); + panelBindings.TabIndex = 1; // - // tableBindings + // buttonView // - tableBindings.AutoSize = true; - tableBindings.ColumnCount = 3; - tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F)); - tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); - tableBindings.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); - tableBindings.Controls.Add(labelPrimary, 1, 0); - tableBindings.Controls.Add(labelSecondary, 2, 0); - tableBindings.Dock = DockStyle.Top; - tableBindings.Location = new Point(0, 60); - tableBindings.Name = "tableBindings"; - tableBindings.Padding = new Padding(5); - tableBindings.RowCount = 1; - tableBindings.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - tableBindings.Size = new Size(700, 52); - tableBindings.TabIndex = 49; + buttonView.Activated = false; + buttonView.BackColor = SystemColors.ControlLight; + buttonView.BorderColor = Color.Transparent; + buttonView.BorderRadius = 5; + buttonView.FlatAppearance.BorderSize = 0; + buttonView.FlatStyle = FlatStyle.Flat; + buttonView.ForeColor = SystemColors.ControlText; + buttonView.ImageAlign = ContentAlignment.MiddleRight; + buttonView.Location = new Point(175, 8); + buttonView.Margin = new Padding(4); + buttonView.Name = "buttonView"; + buttonView.Secondary = true; + buttonView.Size = new Size(147, 55); + buttonView.TabIndex = 36; + buttonView.Text = "View"; + buttonView.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonView.UseVisualStyleBackColor = false; // - // labelPrimary + // buttonLS // - labelPrimary.AutoSize = true; - labelPrimary.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelPrimary.Location = new Point(147, 5); - labelPrimary.Margin = new Padding(4, 0, 4, 0); - labelPrimary.Name = "labelPrimary"; - labelPrimary.Padding = new Padding(5); - labelPrimary.Size = new Size(115, 42); - labelPrimary.TabIndex = 41; - labelPrimary.Text = "Primary"; + buttonLS.Activated = false; + buttonLS.BackColor = SystemColors.ControlLight; + buttonLS.BorderColor = Color.Transparent; + buttonLS.BorderRadius = 5; + buttonLS.FlatAppearance.BorderSize = 0; + buttonLS.FlatStyle = FlatStyle.Flat; + buttonLS.ForeColor = SystemColors.ControlText; + buttonLS.ImageAlign = ContentAlignment.MiddleRight; + buttonLS.Location = new Point(20, 385); + buttonLS.Margin = new Padding(4); + buttonLS.Name = "buttonLS"; + buttonLS.Secondary = true; + buttonLS.Size = new Size(147, 55); + buttonLS.TabIndex = 35; + buttonLS.Text = "LStick"; + buttonLS.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonLS.UseVisualStyleBackColor = false; + // + // buttonLT + // + buttonLT.Activated = false; + buttonLT.BackColor = SystemColors.ControlLight; + buttonLT.BorderColor = Color.Transparent; + buttonLT.BorderRadius = 5; + buttonLT.FlatAppearance.BorderSize = 0; + buttonLT.FlatStyle = FlatStyle.Flat; + buttonLT.ForeColor = SystemColors.ControlText; + buttonLT.ImageAlign = ContentAlignment.MiddleRight; + buttonLT.Location = new Point(20, 70); + buttonLT.Margin = new Padding(4); + buttonLT.Name = "buttonLT"; + buttonLT.Secondary = true; + buttonLT.Size = new Size(147, 55); + buttonLT.TabIndex = 34; + buttonLT.Text = "LTrigger"; + buttonLT.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonLT.UseVisualStyleBackColor = false; + // + // buttonLB + // + buttonLB.Activated = false; + buttonLB.BackColor = SystemColors.ControlLight; + buttonLB.BorderColor = Color.Transparent; + buttonLB.BorderRadius = 5; + buttonLB.FlatAppearance.BorderSize = 0; + buttonLB.FlatStyle = FlatStyle.Flat; + buttonLB.ForeColor = SystemColors.ControlText; + buttonLB.ImageAlign = ContentAlignment.MiddleRight; + buttonLB.Location = new Point(20, 7); + buttonLB.Margin = new Padding(4); + buttonLB.Name = "buttonLB"; + buttonLB.Secondary = true; + buttonLB.Size = new Size(147, 55); + buttonLB.TabIndex = 33; + buttonLB.Text = "LBumper"; + buttonLB.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonLB.UseVisualStyleBackColor = false; + // + // buttonDPR + // + buttonDPR.Activated = false; + buttonDPR.BackColor = SystemColors.ControlLight; + buttonDPR.BorderColor = Color.Transparent; + buttonDPR.BorderRadius = 5; + buttonDPR.FlatAppearance.BorderSize = 0; + buttonDPR.FlatStyle = FlatStyle.Flat; + buttonDPR.ForeColor = SystemColors.ControlText; + buttonDPR.ImageAlign = ContentAlignment.MiddleRight; + buttonDPR.Location = new Point(20, 322); + buttonDPR.Margin = new Padding(4); + buttonDPR.Name = "buttonDPR"; + buttonDPR.Secondary = true; + buttonDPR.Size = new Size(147, 55); + buttonDPR.TabIndex = 32; + buttonDPR.Text = "DpadRight"; + buttonDPR.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonDPR.UseVisualStyleBackColor = false; + // + // buttonDPL + // + buttonDPL.Activated = false; + buttonDPL.BackColor = SystemColors.ControlLight; + buttonDPL.BorderColor = Color.Transparent; + buttonDPL.BorderRadius = 5; + buttonDPL.FlatAppearance.BorderSize = 0; + buttonDPL.FlatStyle = FlatStyle.Flat; + buttonDPL.ForeColor = SystemColors.ControlText; + buttonDPL.ImageAlign = ContentAlignment.MiddleRight; + buttonDPL.Location = new Point(20, 259); + buttonDPL.Margin = new Padding(4); + buttonDPL.Name = "buttonDPL"; + buttonDPL.Secondary = true; + buttonDPL.Size = new Size(147, 55); + buttonDPL.TabIndex = 31; + buttonDPL.Text = "DpadLeft"; + buttonDPL.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonDPL.UseVisualStyleBackColor = false; + // + // buttonDPD + // + buttonDPD.Activated = false; + buttonDPD.BackColor = SystemColors.ControlLight; + buttonDPD.BorderColor = Color.Transparent; + buttonDPD.BorderRadius = 5; + buttonDPD.FlatAppearance.BorderSize = 0; + buttonDPD.FlatStyle = FlatStyle.Flat; + buttonDPD.ForeColor = SystemColors.ControlText; + buttonDPD.ImageAlign = ContentAlignment.MiddleRight; + buttonDPD.Location = new Point(20, 196); + buttonDPD.Margin = new Padding(4); + buttonDPD.Name = "buttonDPD"; + buttonDPD.Secondary = true; + buttonDPD.Size = new Size(147, 55); + buttonDPD.TabIndex = 30; + buttonDPD.Text = "DpadDown"; + buttonDPD.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonDPD.UseVisualStyleBackColor = false; + // + // buttonDPU + // + buttonDPU.Activated = false; + buttonDPU.BackColor = SystemColors.ControlLight; + buttonDPU.BorderColor = Color.Transparent; + buttonDPU.BorderRadius = 5; + buttonDPU.FlatAppearance.BorderSize = 0; + buttonDPU.FlatStyle = FlatStyle.Flat; + buttonDPU.ForeColor = SystemColors.ControlText; + buttonDPU.ImageAlign = ContentAlignment.MiddleRight; + buttonDPU.Location = new Point(20, 133); + buttonDPU.Margin = new Padding(4); + buttonDPU.Name = "buttonDPU"; + buttonDPU.Secondary = true; + buttonDPU.Size = new Size(147, 55); + buttonDPU.TabIndex = 29; + buttonDPU.Text = "DpadUp"; + buttonDPU.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonDPU.UseVisualStyleBackColor = false; + // + // buttonM2 + // + buttonM2.Activated = false; + buttonM2.BackColor = SystemColors.ControlLight; + buttonM2.BorderColor = Color.Transparent; + buttonM2.BorderRadius = 5; + buttonM2.FlatAppearance.BorderSize = 0; + buttonM2.FlatStyle = FlatStyle.Flat; + buttonM2.ForeColor = SystemColors.ControlText; + buttonM2.ImageAlign = ContentAlignment.MiddleRight; + buttonM2.Location = new Point(330, 8); + buttonM2.Margin = new Padding(4); + buttonM2.Name = "buttonM2"; + buttonM2.Secondary = true; + buttonM2.Size = new Size(147, 55); + buttonM2.TabIndex = 28; + buttonM2.Text = "M2"; + buttonM2.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonM2.UseVisualStyleBackColor = false; + // + // buttonM1 + // + buttonM1.Activated = false; + buttonM1.BackColor = SystemColors.ControlLight; + buttonM1.BorderColor = Color.Transparent; + buttonM1.BorderRadius = 5; + buttonM1.FlatAppearance.BorderSize = 0; + buttonM1.FlatStyle = FlatStyle.Flat; + buttonM1.ForeColor = SystemColors.ControlText; + buttonM1.ImageAlign = ContentAlignment.MiddleRight; + buttonM1.Location = new Point(650, 8); + buttonM1.Margin = new Padding(4); + buttonM1.Name = "buttonM1"; + buttonM1.Secondary = true; + buttonM1.Size = new Size(147, 55); + buttonM1.TabIndex = 27; + buttonM1.Text = "M1"; + buttonM1.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonM1.UseVisualStyleBackColor = false; + // + // buttonRS + // + buttonRS.Activated = false; + buttonRS.BackColor = SystemColors.ControlLight; + buttonRS.BorderColor = Color.Transparent; + buttonRS.BorderRadius = 5; + buttonRS.FlatAppearance.BorderSize = 0; + buttonRS.FlatStyle = FlatStyle.Flat; + buttonRS.ForeColor = SystemColors.ControlText; + buttonRS.ImageAlign = ContentAlignment.MiddleRight; + buttonRS.Location = new Point(962, 385); + buttonRS.Margin = new Padding(4); + buttonRS.Name = "buttonRS"; + buttonRS.Secondary = true; + buttonRS.Size = new Size(147, 55); + buttonRS.TabIndex = 23; + buttonRS.Text = "RStick"; + buttonRS.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonRS.UseVisualStyleBackColor = false; + // + // buttonMenu + // + buttonMenu.Activated = false; + buttonMenu.BackColor = SystemColors.ControlLight; + buttonMenu.BorderColor = Color.Transparent; + buttonMenu.BorderRadius = 5; + buttonMenu.FlatAppearance.BorderSize = 0; + buttonMenu.FlatStyle = FlatStyle.Flat; + buttonMenu.ForeColor = SystemColors.ControlText; + buttonMenu.ImageAlign = ContentAlignment.MiddleRight; + buttonMenu.Location = new Point(805, 8); + buttonMenu.Margin = new Padding(4); + buttonMenu.Name = "buttonMenu"; + buttonMenu.Secondary = true; + buttonMenu.Size = new Size(147, 55); + buttonMenu.TabIndex = 22; + buttonMenu.Text = "Menu"; + buttonMenu.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonMenu.UseVisualStyleBackColor = false; + // + // buttonRT + // + buttonRT.Activated = false; + buttonRT.BackColor = SystemColors.ControlLight; + buttonRT.BorderColor = Color.Transparent; + buttonRT.BorderRadius = 5; + buttonRT.FlatAppearance.BorderSize = 0; + buttonRT.FlatStyle = FlatStyle.Flat; + buttonRT.ForeColor = SystemColors.ControlText; + buttonRT.ImageAlign = ContentAlignment.MiddleRight; + buttonRT.Location = new Point(962, 70); + buttonRT.Margin = new Padding(4); + buttonRT.Name = "buttonRT"; + buttonRT.Secondary = true; + buttonRT.Size = new Size(147, 55); + buttonRT.TabIndex = 21; + buttonRT.Text = "RTrigger"; + buttonRT.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonRT.UseVisualStyleBackColor = false; + // + // buttonRB + // + buttonRB.Activated = false; + buttonRB.BackColor = SystemColors.ControlLight; + buttonRB.BorderColor = Color.Transparent; + buttonRB.BorderRadius = 5; + buttonRB.FlatAppearance.BorderSize = 0; + buttonRB.FlatStyle = FlatStyle.Flat; + buttonRB.ForeColor = SystemColors.ControlText; + buttonRB.ImageAlign = ContentAlignment.MiddleRight; + buttonRB.Location = new Point(962, 7); + buttonRB.Margin = new Padding(4); + buttonRB.Name = "buttonRB"; + buttonRB.Secondary = true; + buttonRB.Size = new Size(147, 55); + buttonRB.TabIndex = 20; + buttonRB.Text = "RBumper"; + buttonRB.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonRB.UseVisualStyleBackColor = false; + // + // buttonB + // + buttonB.Activated = false; + buttonB.BackColor = SystemColors.ControlLight; + buttonB.BorderColor = Color.Transparent; + buttonB.BorderRadius = 5; + buttonB.FlatAppearance.BorderSize = 0; + buttonB.FlatStyle = FlatStyle.Flat; + buttonB.ForeColor = SystemColors.ControlText; + buttonB.ImageAlign = ContentAlignment.MiddleRight; + buttonB.Location = new Point(962, 322); + buttonB.Margin = new Padding(4); + buttonB.Name = "buttonB"; + buttonB.Secondary = true; + buttonB.Size = new Size(147, 55); + buttonB.TabIndex = 19; + buttonB.Text = "B"; + buttonB.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonB.UseVisualStyleBackColor = false; + // + // buttonA + // + buttonA.Activated = false; + buttonA.BackColor = SystemColors.ControlLight; + buttonA.BorderColor = Color.Transparent; + buttonA.BorderRadius = 5; + buttonA.FlatAppearance.BorderSize = 0; + buttonA.FlatStyle = FlatStyle.Flat; + buttonA.ForeColor = SystemColors.ControlText; + buttonA.ImageAlign = ContentAlignment.MiddleRight; + buttonA.Location = new Point(962, 259); + buttonA.Margin = new Padding(4); + buttonA.Name = "buttonA"; + buttonA.Secondary = true; + buttonA.Size = new Size(147, 55); + buttonA.TabIndex = 18; + buttonA.Text = "A"; + buttonA.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonA.UseVisualStyleBackColor = false; + // + // buttonY + // + buttonY.Activated = false; + buttonY.BackColor = SystemColors.ControlLight; + buttonY.BorderColor = Color.Transparent; + buttonY.BorderRadius = 5; + buttonY.FlatAppearance.BorderSize = 0; + buttonY.FlatStyle = FlatStyle.Flat; + buttonY.ForeColor = SystemColors.ControlText; + buttonY.ImageAlign = ContentAlignment.MiddleRight; + buttonY.Location = new Point(962, 196); + buttonY.Margin = new Padding(4); + buttonY.Name = "buttonY"; + buttonY.Secondary = true; + buttonY.Size = new Size(147, 55); + buttonY.TabIndex = 17; + buttonY.Text = "Y"; + buttonY.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonY.UseVisualStyleBackColor = false; + // + // buttonX + // + buttonX.Activated = false; + buttonX.BackColor = SystemColors.ControlLight; + buttonX.BorderColor = Color.Transparent; + buttonX.BorderRadius = 5; + buttonX.FlatAppearance.BorderSize = 0; + buttonX.FlatStyle = FlatStyle.Flat; + buttonX.ForeColor = SystemColors.ControlText; + buttonX.ImageAlign = ContentAlignment.MiddleRight; + buttonX.Location = new Point(962, 133); + buttonX.Margin = new Padding(4); + buttonX.Name = "buttonX"; + buttonX.Secondary = true; + buttonX.Size = new Size(147, 55); + buttonX.TabIndex = 16; + buttonX.Text = "X"; + buttonX.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonX.UseVisualStyleBackColor = false; + // + // pictureAlly + // + pictureAlly.BackgroundImage = Properties.Resources.ally; + pictureAlly.BackgroundImageLayout = ImageLayout.Zoom; + pictureAlly.Location = new Point(185, 79); + pictureAlly.Name = "pictureAlly"; + pictureAlly.Size = new Size(767, 354); + pictureAlly.TabIndex = 0; + pictureAlly.TabStop = false; + // + // panelBinding + // + panelBinding.Controls.Add(labelBinding); + panelBinding.Controls.Add(labelSecondary); + panelBinding.Controls.Add(labelPrimary); + panelBinding.Controls.Add(comboSecondary); + panelBinding.Controls.Add(comboPrimary); + panelBinding.Location = new Point(372, 156); + panelBinding.Name = "panelBinding"; + panelBinding.Size = new Size(400, 186); + panelBinding.TabIndex = 37; + panelBinding.Visible = false; + // + // labelBinding + // + labelBinding.AutoSize = true; + labelBinding.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelBinding.Location = new Point(2, 11); + labelBinding.Name = "labelBinding"; + labelBinding.Size = new Size(183, 32); + labelBinding.TabIndex = 31; + labelBinding.Text = "Binding: Menu"; // // labelSecondary // labelSecondary.AutoSize = true; - labelSecondary.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelSecondary.Location = new Point(423, 5); - labelSecondary.Margin = new Padding(4, 0, 4, 0); + labelSecondary.Location = new Point(2, 122); labelSecondary.Name = "labelSecondary"; - labelSecondary.Padding = new Padding(5); - labelSecondary.Size = new Size(144, 42); - labelSecondary.TabIndex = 42; + labelSecondary.Size = new Size(125, 32); + labelSecondary.TabIndex = 30; labelSecondary.Text = "Secondary"; // - // panelBindingsTitle + // labelPrimary // - panelBindingsTitle.AutoSize = true; - panelBindingsTitle.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panelBindingsTitle.Controls.Add(pictureBindings); - panelBindingsTitle.Controls.Add(labelBindings); - panelBindingsTitle.Dock = DockStyle.Top; - panelBindingsTitle.Location = new Point(0, 0); - panelBindingsTitle.Margin = new Padding(4); - panelBindingsTitle.Name = "panelBindingsTitle"; - panelBindingsTitle.Size = new Size(700, 60); - panelBindingsTitle.TabIndex = 44; + labelPrimary.AutoSize = true; + labelPrimary.Location = new Point(2, 63); + labelPrimary.Name = "labelPrimary"; + labelPrimary.Size = new Size(94, 32); + labelPrimary.TabIndex = 29; + labelPrimary.Text = "Primary"; // - // pictureBindings + // comboSecondary // - pictureBindings.BackgroundImage = Properties.Resources.icons8_next_32; - pictureBindings.BackgroundImageLayout = ImageLayout.Zoom; - pictureBindings.ErrorImage = null; - pictureBindings.InitialImage = null; - pictureBindings.Location = new Point(10, 18); - pictureBindings.Margin = new Padding(4, 2, 4, 10); - pictureBindings.Name = "pictureBindings"; - pictureBindings.Size = new Size(32, 32); - pictureBindings.TabIndex = 41; - pictureBindings.TabStop = false; + comboSecondary.BorderColor = Color.White; + comboSecondary.ButtonColor = Color.FromArgb(255, 255, 255); + comboSecondary.FlatStyle = FlatStyle.Flat; + comboSecondary.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); + comboSecondary.FormattingEnabled = true; + comboSecondary.ItemHeight = 32; + comboSecondary.Location = new Point(133, 121); + comboSecondary.Margin = new Padding(4, 11, 4, 8); + comboSecondary.Name = "comboSecondary"; + comboSecondary.Size = new Size(254, 40); + comboSecondary.TabIndex = 28; // - // labelBindings + // comboPrimary // - labelBindings.AutoSize = true; - labelBindings.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelBindings.Location = new Point(45, 17); - labelBindings.Margin = new Padding(4, 0, 4, 0); - labelBindings.Name = "labelBindings"; - labelBindings.Size = new Size(114, 32); - labelBindings.TabIndex = 40; - labelBindings.Text = "Bindings"; + comboPrimary.BorderColor = Color.White; + comboPrimary.ButtonColor = Color.FromArgb(255, 255, 255); + comboPrimary.FlatStyle = FlatStyle.Flat; + comboPrimary.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); + comboPrimary.FormattingEnabled = true; + comboPrimary.ItemHeight = 32; + comboPrimary.Location = new Point(133, 60); + comboPrimary.Margin = new Padding(4, 11, 4, 8); + comboPrimary.Name = "comboPrimary"; + comboPrimary.Size = new Size(254, 40); + comboPrimary.TabIndex = 27; // // Handheld // AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; AutoSize = true; - ClientSize = new Size(1286, 932); + ClientSize = new Size(1150, 888); Controls.Add(panelBindings); - Controls.Add(panelController); + Controls.Add(panelDeadzones); MaximizeBox = false; MinimizeBox = false; Name = "Handheld"; @@ -659,90 +1028,103 @@ ShowIcon = false; ShowInTaskbar = false; Text = "Controller"; - panelController.ResumeLayout(false); - panelController.PerformLayout(); - panelVibra.ResumeLayout(false); - panelVibra.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)trackVibra).EndInit(); - panelVibrationTitle.ResumeLayout(false); - panelVibrationTitle.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)pictureVibration).EndInit(); + panelDeadzones.ResumeLayout(false); + panelDeadzones.PerformLayout(); + panelRight.ResumeLayout(false); + panelRight.PerformLayout(); panelRT.ResumeLayout(false); panelRT.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox4).EndInit(); ((System.ComponentModel.ISupportInitialize)trackRTMax).EndInit(); ((System.ComponentModel.ISupportInitialize)trackRTMin).EndInit(); - panelLT.ResumeLayout(false); - panelLT.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)trackLTMax).EndInit(); - ((System.ComponentModel.ISupportInitialize)trackLTMin).EndInit(); - panelTDeadzone.ResumeLayout(false); - panelTDeadzone.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)pictureTDeadzone).EndInit(); panelRS.ResumeLayout(false); panelRS.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); ((System.ComponentModel.ISupportInitialize)trackRSMax).EndInit(); ((System.ComponentModel.ISupportInitialize)trackRSMin).EndInit(); + panelLeft.ResumeLayout(false); + panelLeft.PerformLayout(); + panelVibra.ResumeLayout(false); + panelVibra.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox5).EndInit(); + ((System.ComponentModel.ISupportInitialize)trackVibra).EndInit(); + panelLT.ResumeLayout(false); + panelLT.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit(); + ((System.ComponentModel.ISupportInitialize)trackLTMax).EndInit(); + ((System.ComponentModel.ISupportInitialize)trackLTMin).EndInit(); panelLS.ResumeLayout(false); panelLS.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox3).EndInit(); ((System.ComponentModel.ISupportInitialize)trackLSMax).EndInit(); ((System.ComponentModel.ISupportInitialize)trackLSMin).EndInit(); - panelSDeadzone.ResumeLayout(false); - panelSDeadzone.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)pictureSDeadzone).EndInit(); panelBindings.ResumeLayout(false); - panelBindings.PerformLayout(); - tableBindings.ResumeLayout(false); - tableBindings.PerformLayout(); - panelBindingsTitle.ResumeLayout(false); - panelBindingsTitle.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)pictureBindings).EndInit(); + ((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit(); + panelBinding.ResumeLayout(false); + panelBinding.PerformLayout(); ResumeLayout(false); - PerformLayout(); } #endregion - private Panel panelController; - private Panel panelVibra; - private Label labelVibra; - private Label labelVibraTitle; - private TrackBar trackVibra; - private Panel panelLS; - private TrackBar trackLSMax; - private Label labelLS; - private TrackBar trackLSMin; - private Label labelLSTitle; - private Panel panelSDeadzone; - private PictureBox pictureSDeadzone; - private Label labelSDeadzone; - private Panel panelRS; - private TrackBar trackRSMax; - private Label labelRS; - private TrackBar trackRSMin; - private Label labelRSTitle; + private Panel panelDeadzones; + private Panel panelRight; private Panel panelRT; + private PictureBox pictureBox4; private TrackBar trackRTMax; private Label labelRT; private TrackBar trackRTMin; private Label labelRTTitle; + private Panel panelRS; + private PictureBox pictureBox1; + private TrackBar trackRSMax; + private Label labelRS; + private TrackBar trackRSMin; + private Label labelRSTitle; + private Panel panelLeft; + private Panel panelVibra; + private PictureBox pictureBox5; + private Label labelVibra; + private Label labelVibraTitle; + private TrackBar trackVibra; private Panel panelLT; + private PictureBox pictureBox2; private TrackBar trackLTMax; private Label labelLT; private TrackBar trackLTMin; private Label labelLTTitle; - private Panel panelTDeadzone; - private PictureBox pictureTDeadzone; - private Label labelTDeadzone; - private Panel panelVibrationTitle; - private PictureBox pictureVibration; - private Label labelVibraHeader; - private UI.RButton buttonReset; + private Panel panelLS; + private PictureBox pictureBox3; + private TrackBar trackLSMax; + private Label labelLS; + private TrackBar trackLSMin; + private Label labelLSTitle; private Panel panelBindings; - private Panel panelBindingsTitle; - private PictureBox pictureBindings; - private Label labelBindings; - private TableLayoutPanel tableBindings; - private Label labelPrimary; + private PictureBox pictureAlly; + private UI.RButton buttonX; + private UI.RButton buttonRS; + private UI.RButton buttonMenu; + private UI.RButton buttonRT; + private UI.RButton buttonRB; + private UI.RButton buttonB; + private UI.RButton buttonA; + private UI.RButton buttonY; + private UI.RButton buttonM1; + private UI.RButton buttonM2; + private UI.RButton buttonLS; + private UI.RButton buttonLT; + private UI.RButton buttonLB; + private UI.RButton buttonDPR; + private UI.RButton buttonDPL; + private UI.RButton buttonDPD; + private UI.RButton buttonDPU; + private UI.RButton buttonView; + private UI.RButton buttonReset; + private Panel panelBinding; + private Label labelBinding; private Label labelSecondary; + private Label labelPrimary; + private UI.RComboBox comboSecondary; + private UI.RComboBox comboPrimary; } } \ No newline at end of file diff --git a/app/Handheld.cs b/app/Handheld.cs index e8619ad3..17ce2cb5 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -6,6 +6,9 @@ namespace GHelper public partial class Handheld : RForm { + static string activeBinding = ""; + static RButton? activeButton; + public Handheld() { InitializeComponent(); @@ -41,80 +44,120 @@ namespace GHelper trackVibra.ValueChanged += Controller_Complete; - FillBinding("m1", "M1"); - FillBinding("m2", "M2"); + ButtonBinding("m1", "M1", buttonM1); + ButtonBinding("m2", "M2", buttonM2); - FillBinding("a", "A"); - FillBinding("b", "B"); - FillBinding("x", "X"); - FillBinding("y", "Y"); + ButtonBinding("a", "A", buttonA); + ButtonBinding("b", "B", buttonB); + ButtonBinding("x", "X", buttonX); + ButtonBinding("y", "Y", buttonY); - FillBinding("du", "DPadUp"); - FillBinding("dd", "DPadDown"); + ButtonBinding("du", "DPad Up", buttonDPU); + ButtonBinding("dd", "DPad Down", buttonDPD); - FillBinding("dl", "DPadLeft"); - FillBinding("dr", "DPadRight"); + ButtonBinding("dl", "DPad Left", buttonDPL); + ButtonBinding("dr", "DPad Right", buttonDPR); - FillBinding("rb", "RBumper"); - FillBinding("lb", "LBumper"); + ButtonBinding("rt", "Right Trigger", buttonRT); + ButtonBinding("lt", "Left Trigger", buttonLT); - FillBinding("rs", "RStick"); - FillBinding("ll", "LStick"); + ButtonBinding("rb", "Right Bumper", buttonRB); + ButtonBinding("lb", "Left Bumper", buttonLB); + + ButtonBinding("rs", "Right Stick", buttonRS); + ButtonBinding("ll", "Left Stick", buttonLS); + + ButtonBinding("vb", "View", buttonView); + ButtonBinding("mb", "Menu", buttonMenu); + + ComboBinding(comboPrimary); + ComboBinding(comboSecondary); - FillBinding("vb", "View"); - FillBinding("mb", "Menu"); } - private RComboBox ComboBinding(string name, string value) + private void ComboBinding(RComboBox combo) { - var combo = new RComboBox(); - combo.BorderColor = Color.White; - combo.ButtonColor = Color.FromArgb(255, 255, 255); - combo.Dock = DockStyle.Fill; - combo.Name = name; - combo.Margin = new Padding(5, 5, 5, 5); combo.DropDownStyle = ComboBoxStyle.DropDownList; combo.DisplayMember = "Value"; combo.ValueMember = "Key"; foreach (var item in AllyControl.BindCodes) - { combo.Items.Add(new KeyValuePair(item.Key, item.Value)); - if (item.Key == value) combo.SelectedItem = item; - } + combo.SelectedValueChanged += Binding_SelectedValueChanged; - return combo; - - } - - - private void FillBinding(string binding, string label) - { - tableBindings.RowStyles.Add(new RowStyle(SizeType.AutoSize)); - tableBindings.Controls.Add(new Label { Text = label, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, tableBindings.RowCount); - - tableBindings.Controls.Add(ComboBinding("bind_" + binding, AppConfig.GetString("bind_" + binding, "")), 1, tableBindings.RowCount); - tableBindings.Controls.Add(ComboBinding("bind2_" + binding, AppConfig.GetString("bind2_" + binding, "")), 2, tableBindings.RowCount); - - tableBindings.RowCount++; - } private void Binding_SelectedValueChanged(object? sender, EventArgs e) { - if (sender is null) return; RComboBox combo = (RComboBox)sender; string value = ((KeyValuePair)combo.SelectedItem).Key; + string binding = "bind" + (combo.Name == "comboPrimary" ? "" : "2") + "_" + activeBinding; - if (value != "") AppConfig.Set(combo.Name, value); - else AppConfig.Remove(combo.Name); + if (value != "") AppConfig.Set(binding, value); + else AppConfig.Remove(binding); + + VisualiseButton(activeButton, activeBinding); AllyControl.ApplyMode(); } + private void SetComboValue(RComboBox combo, string value) + { + foreach (var item in AllyControl.BindCodes) + if (item.Key == value) + { + combo.SelectedItem = item; + return; + } + + combo.SelectedIndex = 0; + } + + private void VisualiseButton(RButton button, string binding) + { + if (button == null) return; + + string primary = AppConfig.GetString("bind_" + binding, ""); + string secondary = AppConfig.GetString("bind2_" + binding, ""); + + if (primary != "" || secondary != "") + { + button.BorderColor = colorStandard; + button.Activated = true; + } + else + { + button.Activated = false; + } + } + + private void ButtonBinding(string binding, string label, RButton button) + { + button.Click += (sender, EventArgs) => { buttonBinding_Click(sender, EventArgs, binding, label); }; + VisualiseButton(button, binding); + } + + void buttonBinding_Click(object sender, EventArgs e, string binding, string label) + { + + if (sender is null) return; + RButton button = (RButton)sender; + + labelBinding.Text = "Binding: " + label; + activeBinding = binding; + + SetComboValue(comboPrimary, AppConfig.GetString("bind_" + binding, "")); + SetComboValue(comboSecondary, AppConfig.GetString("bind2_" + binding, "")); + + panelBinding.Visible = true; + activeButton = button; + } + + + private void Controller_Complete(object? sender, EventArgs e) { AllyControl.SetDeadzones(); diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index c7406ed9..cb43f672 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -415,6 +415,8 @@ namespace GHelper.Mode return; } + if (!RyzenControl.IsRingExsists()) return; + try { SetUV(AppConfig.GetMode("cpu_uv", 0)); diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 9d5597ff..c07f6574 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -60,6 +60,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ally { + get { + object obj = ResourceManager.GetObject("ally", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 750793a1..245016f9 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -130,6 +130,9 @@ ..\Resources\icons8-microphone-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-controls-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons8-maus-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -319,7 +322,7 @@ ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-controls-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ally.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/app/Resources/ally.png b/app/Resources/ally.png new file mode 100644 index 0000000000000000000000000000000000000000..f1f7ba82094c99c2358e613bdaafce221df12b03 GIT binary patch literal 26177 zcmaI8dpy(aA3wfMx4ILR?j)yMZn|@8%K13=oo>2g6iH+bF>)9(h8Vgl>dqlK40E_u zNY0bfmP0A0nHAccW{Ej%C}U$Y`@Y}$e1G5juiqa%dbIcJx~|vtdcCgK^?V(!9$vDw zI`HH1A0ZIPfxj-Cw}(LX)IcCRukHN-_@(Y<`zY|&zK{#fXb9w}8u(|&U-rLz1%BLt zwzoP5sp?ml2mZ0!_Ye3V5J+w6{!Pz45D1d?*ZDuLMDE~-PDiRajY4n23Q4~k5GYdU zBl1_BIcE}`m8Ugn$@cFPM&A2e>b?0dO8>6C<>1``%TkF`NhLXh70wCHI;3H_D=l={ z0bHodKlS1p%MXV6SVXXfL%?tKam4}V-#STKrz_xfWvLUw^`5)+iONi|33niP;kE-4 z-~p2DLMp>WDCeXyC(55PhqUm5wWTT1D89y6d^BqgmK}?6Djdgd&Q)E*!Tt^e2VCsA z(wg%5_Gy8H-k=tH}QxehzovvPkgP*p2tQU!34S%)+Np!P6Oi{7~5;NF?TdA+~Bje78= z_^8jH@n+JCC9oFZ@DB}x$h`z1KnT(MJD}ksa;|^rY1HHW^q>X2WXFuScxcC(hVj}C z2;}oAwTf6dxunsS37>96@2lNSdt*Ibo?<)h9sve_{opu#X2H<0z^eL0pHJ~9oZ;iF zb+LZ@_D_H41D|n~ln-X4d;D+yQEU1uvR6OHR@q0Lql*44r8x!bgb59R1>(scEoF*~ zQH-F4KRy0P+IJcKvT!Fjwn+Cdbl!~Q;?zPp=xs3hV(UoCyav%NN0y|q3jzr_1(V9N zt1H99*CLeLNJ0|{L1Ty{D&aGc;unq=L^%Y1+4E*9mi%=Sm@B?M;Az?8uFN0W2peBY zjTq?X%%MiSKt05g)gunKjW&LZN^rOlMg!Mv52^|sHJT6hvgG{{=CNE&@r#ge=?Pi* zL)I|G3FH^KuF(&hZOVlsX2T{|;HIhk6YUdJvZUSDvdnMN{L43 zbsTOh>y3-4zBk9_ugYl84p2zeD(yc0l#oO|{$4wa>Wb zN-B;x{6Hz*Pny1)>!PgEuH-a>a7P-mbaz;c8Oi=%9%sgLZA^-as9#N&JC^s>DDy8T zoSd$+d8Pp0xSqnj+vrNyA4E9O$fqJh z2L8IiVlct2#V=-htdA+c>ZJ#|1M}5<`(wgbh}bPg;=lSBkokjS7Ml(SlJ{7p6)5d4=>sOX&WiGB(gIs`Ix@i8`>|4mHlpoizgs$=BT24>&7hQ=c> z`$TQX+-mNqBeA8iQ|8@7q_RCJ*#yaqXU+`I)R6pN8_d>tvyB41JB&~rLrlWTC0 zF1~qQ#~Uk>a!2PEMPYu#V%lJjFb@@n;R(%jW!5_8Ks8xr0}oO{&|&8C!oQ|MT5!go%|3>27;Czu`xX4_?qgCc z6t3;2|4~+dRR*B#U(_ex)+!q^^0!stRnfi9!ny^FnWk38P@%yZcssxj`x z(B}V$qP~yF7?K@n3uuZ#_?>9!S*3@Mjh4y?7rL2o;fUdYu*?o+4q@X)I^(tJTfXDM zK>0pk7qb{VvITdA{L;xNmLHa0#9c>)J{dc6Rd{chy41RKj43wmn;28z{mk^?tN!FZ z`}HKw{$f1fZ_Y?;E1*7!NLgJL;uYc=R$=wQ4@A5R%J%%jrJ?oVng;v>YvB=ZRsF zX$)N>Q}ob%GY1qe?oxFfUj1!Aamfo%8F^!qLFJ}JRlCT8!3!iC-$LaEVE3+726%zW;7x+iGD^X& ztt`%4?xF!Yy~uOTwQ9MlgBh`zdjn@$(sRc0`F`I|J|tBsc`_quO7rnt1!GEpdo;Us*A?)11nV8p%GhkX=^Jx ziM_mBNxN)c@XSCu$Gsa{W@db#lhNr#MGb&E5d@mwx={<5`QDm<$+hqXx;OtMh)N-@ zFN-nmOtyC60VzC3`9@or>r$QO(D9ud-a{%*PM<#Fw(sqII!IZQuT0=9v7^nsVYwWb z;#2AwTkk-r4R^vNU{YlgS6twkz0t6gSPUW^2&CbgF*_uEk>77}UntrrSmq(cFw2dy zl=b&1)@~N@4Ab@KsHd6F4j7C~$jZ3|K2r3S0*CpYDeY%jWZ2Z||2;Ky@v5^nS*s4u zHdVTT6Ib`_JZ;t<+jPgPQ04UmtB0pe3isc>H9E%UjKWVV`&W5x(&e=K5U#%2QKGG> zy6&?lfQtrCO2sxXZ*kqCK38v(a~8TPtZ^H}{v{O*u4tq&?rXET?;YAf4_pcx(ZO~) zugE3)Wv#M+3DzTNQUlUL{3VRvDq`*h^=g{WHy5c)ud=~~W(&8g>4 zaciu-mY~raYjVc5ZOL-OzP04EGLR(hhyV#dt7eE zw^XWk>>2}35ny3Mx%wfm8#Ag_2L8Q%JRHxNQQsf7ZwDso_wPz*chPNr+=pJ=fsy}y zWz@jn2^{n%)pWXoM_YF+*8`j-p3L>kD(!iE2S&YEsn;HxbH6`q+nMgUNq||S?wzI! z!xNH^JNYK>!0fC3E)*MNvV(LM?4K#Nq z^Y+(PYdfG1)UaqzXzi%0LTu4Lg+;~!%sXFXor_E>0orw4qnH`CsE176(}=sp|oN- zV_U%4b?WTV?pr8D)}K8#jR&5`wF-y5eN=dPJ2`vW5xFuFpASm|(4ltWxk$axm0blWg$enlnt42~LpHu5JF z7)^}b)R~U6)04t=eXUJlhd%zIK6Rig-N-kdF+IQ9N^a7}m6L0JyNSD9D)17d)vxS^ z{(-?y4m|`xIOI&#y#hr4kr1WN#<<2VH>2SY?mL$_CrWf-TVau?(KQ^(*0v zGVYBu4SrX-q+OLm#04hxcv~|`$-0?3MEd{pik!M95ko%C{N>sO$4*943<|%0V0zx< zDTesQz?qhQgGr>28n&97dTWGp_DdFO?SObpcC#MncZ81mn22QShKzK6vi9taAjAV$GS1MPRk2QvwVTA+8PT+yk}N>jLD>-`M6?TY1k_Q|%NzaPkKFJH0vmr$#HRfSAW8=gpc> zAlWz-`)V&Z3Rm8g;o4#^udfl=32VaZo}|+k?EA(ICP43MogrBsNHm?8QgwG zJ>xRHeD*465}%*wma%{>vLaM2N+YURO{ip(TT;Ei`yMw8gvy%5r0qJ+xut?;OJaoXes z>Oj~1z;fz`WJD0Zc-#l%bZgGo;_>*j?!|T&%Y;6xMGsnFjcn1koQ|@c&e(yu?p&=V zL}isxKZJ|mP={s)i^m83&S(3~nW2GXk;dTtUbUv!C_XkxQjUI=7FSgfS0JP-W2^%d4o3?oW3Bm9_W9B`Im2zNuvp5v%!{Pl^_lqU zLj20k*S&t3!qOhn$!KmjvR4!-zEKw5Vpn9^c~Wt;|GD{vTm@#~GcO>p`aIq{cVEAY zf4ziqBDcc5S=`DTN|k%dj1_8$_+77dk2>X0noVT(A87*7P7;4k_loErjdrzm9RiTfg5(ZDW z`R*;@H&?OPLCaNW{9sc*LCG$B)E@}f+na%m!?K!IQIL-A9;Na(bv+;Um^F@V3^GvI zOce`ab?_3*iN>eAvHferAHKwA*YN!L@xrBV z8iOsD;#!2_Ql)pX`8J`VPb>d{X0GTK$}4yxJRv0V6u(P>tv_gPY0&ernqS__Z-I-N zn~xV;L~=T}u51X{ecYanScLC!{;oMYY}h=iM6n_+f7<?|G^WXJnLb`V{X5+# zU!BY8E&%3Uh5sw97s2Fa)8qQ|CG>ME&M&5jT36QUAu&>V?_cB8xf^c)4oy{ppKMx} zN&E+6R#jfC^G)aento))_^Fqz<4P}jksgsh#Yj0jX7g#?^tVe&-J=I8@3)yF8%?%` z!tqlY{1JLjPn8(DrqLzdaT}k<5tMKI2SqoRXc&z&|NSu%VPjqoFZ(h2x{2z$wYK`!P<#q>5 zR6iL(AYr)*TgMQ|o8mEDb-H?h=3D*BnZ<6pIXNgoP*(T~p7N|`CDv$srm2xRf9mCx z|A*|G6Nvqr84&bR`XO6qsbR4KAzXR?m9#19&NVEImZ1|B2cKJ zeC_y`LU<(?Tcqf94O=+51^S34T{W5J{>{yXvNo3C27N$eHYGRHyowiSc6imN+S!Z6 zUAoS94u_-^ueM!njm1kXp@+&9y2v(h2)oN#XoWFO&`TQPKU#cJ-e54UpxeyRnXT4| zL-9x`bH^*@;X;;%zMl8Nkju{%05oY*@F zz&wUKn1qB_hgP(FvYj`^=}8NX$)pycZi3Qr4}+W!Lpyl-lU%LLHFa+2+-01$&y)rm zliAVrFhh3CKIL~XTgG`x)t=F4tM=9tcO#p6CgBycAAI?ngtE;zy>#0T*#HXIe+u8% zRboi5kVbA@OSC@ zD%7G~(S5GQH9`d%7NM^f7@E`T71>>qLaYHicD&xkS#}Mrqyxr2mS(^5Du_&`8NU$r z-cARl9M|+7nRU<>Gtwp$JW|lN^g1xgF&AE!1sAJ1ipVm{{Za&F4*2>5{eE`~jBoiNQ4-bG&q|Ssa*sOP))$L0Vu6>7N7aNkBDPNu=A8PZZ0)*h zmHwYo6*9UruwBtoZocM}61RJa7Y%Nwi(hfE*9_1mZ zRw((nJU7gP$}B60s6YEl^xz${ASOg;oYdSK8w3*6*kEbCsG`l|(%P#=$)lE!qh&l& z$098IN4J`WCZKm95@#w z?_#=6u6BD+!|U;D@!0-nN-aAF7&c#yO|P})6$2%ccG9w;yV$F-$*&1gAX;YAIUcYbFl4) zu}{|g2vD5hm`Iy|;Z-cgcBhTIt9a?KZ{rwe(zz zc+q6{Xt0sp1BS18VFH3vm*!QpUml>omV20|?~K!D6N0bm`NjbwyqvG6Zv*J)8>>bw zg>{8`u%6Oa!Joy}068SfmudE9#vet=WBuGQy3&GqM4oG}x~ahyCiEoE)sa$fY^_!C zTBrh$Skn%_c9YQW)2|2UwGj}I1aCyzz7HwW<>M_*r(R6L{hyd!7DQf;%~&lhr3{J+N40Q<5AYI@2AU z=w=oxR>66!SO!ZF2G}YNd*Q??ATKpiV+oJYL*6Y@7E76VD`ZW&V*~!^WqeF6d1NPC zT^k1>9b>)MxHv9H@0R?z7q%cO~IjrQU?DxmGA9e-G?0Sul{ITGEKeo_LVd3 z*ED?+f~owQm|m4@;{nAR9!1UQNQ`yaI>Rb5@6q2Y^6(mO2Y05w=$GSmWS2lkJ3j%~7?VQ98jaWBq2=YMtdVcLD(+ zeP(FJy>W!mmD8TFg9m#k9G1)ZpJ1YD%i~fxwqOztQt{Wm3$vrF>zxUjeo382 za{C&0VGF+!*JHg=g&XvqomLMxXw?984Joe^MsJZ84xd~P-afNRe3j|(bDYC&?uk!9 zaBfjx;FaTw7gfZ{bUm$%K~&a@uH|x;8jqYzN>p~{y1MPtpbIBmNPW78pT zAlsWR>R>~=3gZx(K|kWG1vbxpeILsN`8|dYqaEbMSGxJf&Z;Kc~xYp zqvIHlolDD|RShW3z02@1H@}DC2n~PyZuo=Vd$p}E2#gc=6r&R4##rLRuF7EH>oq$! zu0T{TN1R+1SL=5 zaZ@TO=BTFc`R?Ei(et~hggka^W(3{?Bd3HHcFl># zK8-u}Scsnp!v3)cR}EM^)EcoNcxL+|J0Kq6@~La4IYV`iySEG9E(@{z)gZ#XE<<+6 zXmzB`p#?NK$osmAslc@-#hE@`hdXhBmDIr;*X9;@Lekt|pP1K}V^{FWH|E|2e21c0 zd%=_>M_3Jnl6Ge;y_uAq2!b@B=&Q@<_{@dhom7M^We9;Y6S>#bE+*7Uj8eb(hYIT>Y11I{0rQ)+su zb-y&jTl~!39gM)^i<=A4jM-NgFS)HeZ~M~#b6LJ8CTWBI{^Kr=Ir4ZH@u}K|c;;a} zv_t0B0$eo8X^ZxWN{dmFmp+Q+Ew@5b)=m(0DJ4}P_uLQOM1Gl7VGH@ql7WwDDPhuU zUvMyb#FrmuPM}Rks-8c}HI5;b#VHmA{l=VKOKY{Otg36%vI`MqT}lkQ5k4jup_ms=bJWJjdtzsB3CuG(8-8UX8AzZD8*$Z?jNJ!_dvnn5i#s>L~|gb zVCgxtlML_zsX0>2C6ZsS8c}~uH=5IiA--JWRzFg=(*H9a+jmQjCHA+Xb-6H8%Un|} zj31C6@s8|Tn0-MF5%R--Qfvliu>O{s2dx`(EF??T2Ef}3XCjZ*KAftp_BH{0M3`NZ z1rfk?N54RwH;O*_#u2wmP+3KsI83+mdg+JRl~7`kcV*8lyp`-B4+EpB(L?bL$%l+y z?I$Tj8GFlgsA)9vAFBpAeZ+zmU9%f2HD{IM zwA%LdA*+kI@Rq*Gi@0wtZojZF3eN%r{tjB8Wwjq3_a3>}K8DOE_6lZmEYnqUPqc6S zGI&g0)xO|n8|&4@Ytc#nuHANsBZsD5$rQG@irETPJ-4JJL0-?a;5A7?!GsH`CIH@s zI_hys_544zXHTe|R}4rj>@_gzKXiY^TcAlc8689|R2#WT#K>td!O$*V?HXAr7-7p) zi2kvDgYMuLdfr-2#on~KLi~8}H!pY)I?rx-J`6m*$eT z-NLQRm>1;Rd8*g*?EQF)R;-0%+G<-s+pK9m%%1>@j88!3>)%Vqr= z3FIDep03?Y^tiCuw4_V2100?0h6|r3K)qDs@HQsm1H@_+(1;*47rGnyQg$dfsL?D1fiGWQKFCV$HQpbtIeiHmAS8}Da zT2DhbetQ0F;6mgKKuyM-jSV_>`>gN7~yTz)53oAn5 z(-^96gtB?h6xXL$X09-*QD(j@HLG4O_SoF(?F6LlR!;bwCG8?+*xSX5BFZ}E5$EEp zWfE9m(hluSOHuD)u7=p4S}D!gL-P9Drg%k=lzPw)eH@;m`vmC+A~2RPX|X2CA6d|6 zclL16y7AipVCRr*dne~=Jqc=m?Jka8=y9)zFr&9;N>x_ifVun$bx8LNx{Bg$mt*n< z%LtTHpK_ze@&Lrd0vYY)S!d%}ZP401C|h~qeuPcSKIPxorKWQqrZ1!@0 ztdrc|6F6t9#|)o2sFu9m0uhwqwZ{5z53Lp<@mRpZ=_mw#(8vWA*#{906(O%X7Xq;@ zA2G|gmZnY~^l92^Jj(`a9iQ#t}AgMwFt38Yc3q}QJp z_rA{fc!Krk=_YWECY#cwxqO$?0ePg+^~Vkpt95yIunSV0RPC)38!+STccF!*q&;WSn%{ zSLe4)ktmG7O=2=rgG0wD8s^}Y?%?1Z(eLv|wNel&_20gEBU^bXH*ULHWY{06o+{lI2W)hI#NMjJ~18*DA3ja z^jCAxFo3?YeHYx3&KKue6PDP}sj2Iud3NclhCV5u$n%d1! zIR^cGDS))CY7!u%NEmQm?yb8DQp8_&_uUe{(!&!ew|RYROIj}~ur8$Q#~P|AzA-c0 z>pV#0al2ZF88xidk;h#dbCgpYNUmr!ss<*@f{U3Vv_@ri&Mx znq>~x_Jo+xj=ITu0Sznt%&_t4y|g19^pszRTo$$^Ii(?Q(%KvKc1TP69vx1brIZNL z*7RrT0G;-^=Qnkfo=1Rm5ZgtKj=ia}M#;Vr%w>Gvvu~ImgEiQNzG}1~;2sY5jF7W@ z2+~1HKLsuTg#sPKW5zf(bs(JK!)PrBw%Mj`6;c5a{%Uej>5XsZnlk8eAbHm5K8{~Fu#VT5VEzG~0V~x1Xxt5OqI#LVC^g z+^qTQ>%gZHn@u(DNAH-ro|k}MkY(-dFtDp&MD*(4DP@QsYf6~*O5cNZIkj3vI58)% zKuUG9#r$s&#)dq+NE=Ql4Fh6D(sHiCO%&)`kqm`EfUoRlTeGB8wQEagV?@Fs!?+fb zRO!|hxTC)7g@R4Ck&&SR%o1SR4OUqZryN-tb}p{IELGYBx_@B4}b0boRDx2PC+;uC#hWsY`mMvzG+svdMsl)OH!L=9l7A zjmpl!IzV#y6%9h7tjAQ~%4oB7ZJ!{M9?(e6vMM(3Esq&o4lm$ovbwFvgHP2r6ExcnEQLku73h9B7wKdgl0)1JK&rO}3 zKWj}^h@{c+^${Mj^`EH<9CE|GWQDO~+vg?ZAu-AB@lBmLxYXBDg_5342K7zs!X4=8 zb@xPTy;((<qq41B-Suf` z$g`ex+p1Zg7|=*H>3E4XpgAgWGMpk(3g#<|pCFTxKN}K(`fnbvqy(kC^_~>x>F#&~ zRW|EFr|hJCy+)UqngO0CJbGMsTo=g?O+LqSK~s@fdO3z&v@=BUvCx zEh^RYB>aAh23Iie(H_zdtyrAyAyS$_Hm#UHPk^lc%crCD20*MFJTjG*!~Vc zt-h6sobb)5!&ed9$fmQ;dkVJqL9>lZdgiG~&r7{}+B4-4Foo;WCu-Qth@!Pdqu|yd zR;s5yndV5t>0&U;P>#hejyn15QTr@qsMq3p#h6H;thu?@v>J4#u7n@}ULSOI_bq^@ zAtvsR5D7RoVD#!_01GciIPO|m8WM40VI4C<6YT=76D^7a0sIz;7 zWgPd@AG{|SK4Y=KrB8^-Geg+NGki7$xp%Q6Ge!6mz?S=r!wFj)p@QLHsj$=(C3~2QCvLtHv~D3a{C+;wru%m)wAE9(tye; z21Ky024{$GJo=;YPCaF8g2Vo;(;Zs>wE0HHl;k?X8jJW^p)o879OvoqFf=a9{i+zl z|M&(>p+=TYORJ?e^&2yF_;M@pap%>~Sn=ih9Y!^^@S-!mAA%O#_m?+L8O$?Ne?QG? zsAzFx`LXtl1}!{-xAcE)Qksg^&q-A8YBpoVp5l8o7y8RPPAJVsSIvV?xXBxRyD)M= zppGl<`9}CDJnv<=yF2x>v64_9{v|3a!Yb3>GHB3Bhgg7fBlUmt(>6Ux*2)<(YnyeP znbaV;^WAmEmqLYPQ4RZY6PpuJ2)_)TE1+*m2@PGAv2zTrdtEEp6_$@Qa|@`Fm5VS* zXE$4mGIW}HSC(GbyZekU+EmRJ)6d%8y~(Yz7M7lFoqg12F`os!vpO7px^dPqf$o{! zQJ+Kg0)rs1>nvvCWWm#3AxAx9ydvwb7xU#kgIS~TLVe$meB^|4K;Rqq>kOac{AX5G z%dK725o;&7LN(xmQ|}O6uJYP9X?=|8LzJ^ZZ|wPAV*G6xKl@eb+mY~eZn+l?^o-G_lVk_2y&oL#jjxn&M%i~ic2s!gT*D3D})q8l-)+L7sf z+o2(Ds$6op#f~+C(8CLUv4DP@<{OO#OE2IgJy)o5D|cXnY=brDguBP!hV?+zf7ZDw zeKy3v`RZG7&1e$(<-4fzeX}1rr=$Us`>fB6Of^Izd~c%?EPKWjP6pq`Piij8=4^@3 zGWo-^FZ8D-`ac^lU5DFp^vNxCRXR&Eee~rgY?L7`^hltTL~t&k2cRo7$IAAMBf{6X zxI=)ny-B^J4y+G!G0vpPDAdLF-pafs)d-e!tJbu;4oH$0>x0K%t!YkWgH)|-8)yj(HcC1CV_d$)JYC~00!yy6 z<8Dk+&!kENlruG_!A8-Z^`t<764T|eH-pF02G`a4{sOzzuT@b)v#aZtz6#vtpTfKw zLL1A1J5>CIZ|j}ybZ*shQ6mQJ69HY_IWOx!%d2Xe$@}!Db^)uz7ZZCtlbw+romyzQ zi`m!oF@c0O_V9;q2LYIkqOsCBa|3|x;hpZ!)w;PS@~$e+l%&pr5db-?``ROY_DIdG z>uR&n`66!X6Xm(L6HIompwt(adUsF zZ8?qPIa#K4AL8lI?jW>>_1U3>Lni|E*NpWNjfMvWdVQC-HbLJ`m39uRY3Zj{eI`v6_&$W_7?BLGCMy7zpe7;Ru}qWF%#Es z6+)s>4EmpyicEz-=*Q#kY+ytMU1i6D%9IZ6dC!*owJc7>e$sj?p|t@>iT>r|QLQ)R z{~NpWLC9ad>`iBY+(S;lQ7*{(O5De9?cU;dsi?X_;itc9HQS`GZTw;~da^x;VB7hi z-DEo{kTp%>l=hr~-HW*BFxIL#kFYsAd=(XQ0UvHWqMi~ktzigQ%k61)1+Jd8xT(9=W;Gc@RpMgSQ>Qs8vC54Qjhy;0;X7Fi(Dqa zgv~$N0fkZBJ3+JdKs79%@cRzl@~3m8QJF_T@oTme?99{bXpN#cz7{Jw_;@a-kA$7I zd|pCb{{yHR>PN-5_)vdiBeKuQ%)I*{1tjiiRczCGoBc%E6$#W5&I0%?>oPQ7inA-j zq*~E=`ODscE4gQ6zi;sdGp!mz-KJ#N=&F6i-?8?OxQ< z)=@wtYa#gO3&CB?2s@53$d`p>`w{O76HS0?$ zr%L}^7IQ2j?@w7J2mDgVJ_#rF!aLY~&y+gdvRQk3T1!j6zN$|xasKD9oBS*QrQ7W{ zpD_H!N8xx8hdb>0cNJm6M+6&Zz1_*_!d`V|@>h=(%;36AUjYJ-XAPJ3)Epq)B)BWR z*s+=_NMdTCpsLaNVLd@0});NjN8w)#6pBbotM<6*`-a6x<+Q*YHihkNJ%FndO>3DzIHhY%T&((^@^D^Kz4kMBR3e+T=Q zBB5SYDdmKsyL^9HG8FVAS+r}R_jgCUG0GQxJ! zsCv75KtULI_{FUNa}yMi9}ne303uXILCLi0KX>p3{dICEZ(yy~Ib0p5`n%ioVLLe@ z-H}v?FyBQd5Kq>22EzW(43k?GsJ2uGm6XcySyV~5*sOJUhz)P)HqB&5;U|rO7Atn8dt@iGM~B=$kZvw* zQ4jaW=9(wGVli2_^2QFmSs4#d-V_yS$F(qrs8JDuo+6!*@HWsP>Jp>ve3>>MymaSu z3K$tNFME(1zg(Yj-pK)yjLOKQ2M}RXuP7>CG#=rE)8M`e@bdUay<^I>F=vLV5m0<_ zZgXV`4Mw!}KrkAUz8H5oQVA4&mwLMrP^#9)%}$}TngZfQe?iGuh+yc^BJAg|p_pmFwV=MI&s=dtUfl|1;;qYN}Lo~NZ(y7)E=kt?=F@b-UnO2BS%~Rc-0s9 z!I7qQ%bn0;`M~vQIULJ5#oOjSeP<2kxtBwAJt!_dXw)i4_4{fIIdr4Ekc-NX63b0jWRhiNe4q z5aE-0xi$w<&3Ux>m)mV=ssQCzD`jNc*`JJSA{>?$q8{ zs2|*sT?*y;s#*cmk)tpbKUqvI&;x53qG%n9y^4t!OhP06+U|l zPW%eHlLPCIoOs`wXUbK?CcVoZmdG)VR z$d>)qxA3f*ZBdw_m^G_om$+~q8X(gT9#4Tp??iPjOOzIBc0D=gDQ^UNxk3K}iFP9f zc`Zi}yfF^p;nEj+<{GxJE`ZykFMHTyIf%2@9>|i-6j2GbGKW1tJr7>IMzjl3>yqO; z@&0$sb(O}7QD@#{Q{I%_p5EMh|smV1*US0475(dkY=DSZ5GA-W$QcJd+ zjHc+zj_S8#N?X08ctFFHl7uBF2R~to_uL6`R9`r6@O;FrMH_)N^Ycm(Ad7u95p?g( z{>2-zW6jsUTu1@0^>&9*PNBQV%=8K`QV10`OVtaP1`L|UM;dluWRzYip4w39bH=gG zN`SFkCpJg4diLUUQJi<&+mUbMWe*QPmHiu#kMYa!y~d^4tH zw>aC*U-ry7@3G3K0$Yo<-$P1I_09?5a4N$_&8;hYr(m$LU5FkeOb=B_= zl=p}`HUS9p{m7qP9ED8Pe}HFej#=M2>M3V<)AaQ}z~sucy?o zV;fG97mW_nlPhpPUpcwBlKJdrF_34JH2*iQS?C(a|0a4CNV%I@+^ewR8{xRMSdmaF zGQ!n611X1g1%{6q;#nMJ(znMz&X^c5nNjLwSaX+I?V+aPygo`T2C#|=&JVwaq?tyzr(mhmw!!6!JzA`8l%yxfHHj>y0$gu z|3icA$6G*@RgMB*tV3){dM3Fw%Lw1OhQ&Gspa~Q)_hY4^sopIWPFuLV)Z28WY$Q01)cX7(i%nQsGTJ@De-qver5i1skJk(IFuD(&;-lpoZiU37e!w6W z_XKX|N82|Tsc#H@zLyf?@Pqx`OZsb#HZrcV$kkrlx>=ljPMx#B<#x0g{387Obj2}O4W_7$poH|nid10V~PHm z^^m}Cc4Yx?^+%J;{m6%MzE_o-8HvMcn`W5ym})Yq;ziHFY~T?$nZakO|E^UORyb*# zCD>S+I^ww|yhooBB$-F_PL16|#h5lU!Q(}q!D z1m!(!@}? zD@N+-Id+-P-Rh6209*-Vr`G}~?$$QuQwM|F&!$z{Nk{yEcCg_w>y||!& z9?!Uk0`4!m?P+kb&oMylolne+%?#f&f|>|Nkhd^& zU(@!W8&BU~{sdSl=OyOe`(t22GM?4cdvHBA2N|F}o??$0c5-qK?x@PGeUI|-sKe_| zSyfMX$8?*3Q*s9a7udk-axFqd2^HgDAXgPFFZIchW-cv^)VBL{$1J&)qF@~W%Lv7^){{`6#1mMi}4Jvr&(~ z-CXAGb*1|VQBtR-aKN&FsI`Ol5D*mpF6i-Vq)-#db4}89g)ChdP%>wlu5Z!P=HbQQ zO}{&8G@UwPj-+aN4~e8xmmaQdRe>oXpkWt~ff-+}vm1jK7QIEL8Jjd90p#KAz)GZ4hV2|Wn((U2Q>pMAHRlQ8WGsVble4|RZ zJ7stXIwZt)GW})1s~P%qSUz9&PYGUFZ^|=fQU&hpiEYRgPrgiO@I4d;{YVAOL*Xf~ zhW;)*(B)+g2}v5fRo~sq-y!5({}CUFdSq!;W1C z6q-SfATt%ZMLeKGCFurisLSs3F%|7f+03^nEt8(VI zw?E}MRqk6G40$nAcE1*KeN1@k)&E!VE9iw`7~Qwizx{Bvp^mPe0vOVZ#ozst_HIv^ zPLa2>h{sy8_Vx{9ofF!{Kp+SRCdkc+7CdEO7;n}xssOYS{*Q43;~G2PSqN!g zm;KnoAq6ne0LjJ;gpHRy^UHI*p5lG(d z_bJ!b{6N=`DX*s%B1{jl`EJ+k+8J0jF>OtKN;q-r7v*~nXDzpDq*-rfl1u5PyuVb> z+mNGl7UOK}FZ zw;>B;rcyTt6tH)x!}@xy9qcEMXh_Lrllp)6gVTlB)-SPL(lvx5WxKA&ni7!lP$G0ijxiq ztXiQ+PX6Nn=rtgQi2xdOL2D##SOoe1z?;t$VmP{YNBy=vPrGiIM)g z-M8hP=Z$ow#VYLu659z#$mdu740?TugYECYf5-yw^i2g=J-%&}oD!NYz-r>mq`A`m z8uNX#9^ciTXE_p4CGQ-p-5RVoxbbz;9JUwj`M*yI6!}^9RH7IFn6TbM`L)7U$xQL~ zCDC5Aed0>;9zddDy&@RK<=p=jv0;W3XTx7Y`L+4685>Lznm6p3cG z2y<8|${Zuc9CMh%oSXCP`+9HPzsK(%f9(A_T(86RybiDHy5wA$tRm_qYri`WT5|!5 zvf7>3wZ?Stclb9+wiDp_4$2%p?491mdbAX@O<}iw$$=E(=ozcJUnx<%otWl0tpm^o zX~qEOOr))ra4^0*TJcOEB~QR`?6*Mdr&uK0FU%^sVw&3+Y3ct#11Z0IODs0&59L#% z;}poN2#rHZg#!w6-#?3M`U`XsVh7#5Xsa*aMSrWwD*S#|^DyJ{Be!LlQ}3IXTltd@ zEV-jzW=59XoaP;%WfXQxDgF*$I37~F^xQ+c??QcYg(3j-(JcSZb%HCxu!N*r+PZl* zN7Rwn9UbtQplnvn=eRd{diU}BM~A<`m}1X@ZL>H+!b$e|rCP{Uc29O2*%ck?j!<8L5-qrIL0#zRu}`DtDj z_|P3K`D{iT8NsIse&yZD!s#SE1qS^Bv!RF&OtV!*bJSuk%OEpu2I?W_?sUric%ERW zacyMTiyeNPL9W9c%u&;K!b|}GFIQe`b35WUbT4JCdW>ct**z{ka^{jCe8V0*zN3sW zTR;c%>$W^Ch}aXY-V=>qS1C8g&>~>+Imq^fe!l>@YZ`399)Vvk#%>GI1))Uu)cAoZ zc8_O(jCH-}`qL43a+0X|VCkBIFaLlb&60lkg_Z;pFw2wQ_lnpt+!gsH5JZFR86|?$ z%Qa{QnoBU+Hgvx#0vlQiFp;ihD#UgHHtt)6ThPXa6>A}#(JAv$u;AqSXIVvc1>*Voe9#HA zm@g-L-TNxk_4#%(kT&CA@BYWF@F)p3Ze?jp-x}aQiv?R3ZWKf;&1H;_;#v=G+(K%E zg3}<%JjV%`xpWT@IxNR$V3Vv3Z?wl20F0U7V+>?_G*;VZ#L*RxkqGbJ73|}KHLaTi zG40I(bXI@NPA#4b^w{;^ClG*v&`5*@cL9Ce-y6ZV?|a$9)iy<&yS9>+=ii**SnmwBQk@-*eq&^!Ql0pfRzM*)eu z62IbJ4-r-9zc)f~vISSL8#wSGc{ir;zThXjlnr9WyhZ@JLIcP&1tjq4@IeO$^s?G0 z4F_eKeU$2ud3<@aBn2{&!(OidKJr*~-sJhSbbqn(*7zux}s`p0w>4sWZEASuF`J&>~0@z>!}YRZvsiOhfSQ8rRl7Oqg9oLE~Un?qD3m zHZ7LlyJq`43B^+Yq}t6t04Sr~_Zi~()rf3LuEmdDv3Vl7nK5}ORs%44NNt=YL_7!- zc+Tlg5K0^x+68zW<&I|jp7$~Ur=VczAl6%OyqVn+`TzY6occTRZ|tt)+ydc&dCYdc zfC?MQ({t-cIc_VvY4Mnx;9U2{j9f$A!4#sLBEBB`5v$AhPKCMT>A93R;zSse?XDG+ zJ^^nhj^bQ;m!JNj4y0tqP0#2v$>F_xuuB}O11wko-~LKCxDwn8fpSf|bSHJfyyHRV zVHKKvVfT{`0ca*>bwnSc+2@`=3z*j?TU(e4Oc8w!U(44F1#}}~!XA7NukCk#jfC!V9!o3&PyDO;{Ua9nw+L)VaE{w8y_C zu%EA$ZK%}M^I;)|L=c+#TTj$ftc}7%eBCTiH^W{FSatA#80n~a>YUeFDs*>fMm?81 zVkFCU3bE5Vh3S36U^7<=C!Gzne-H7mO_Jd2HcZSr;Dm@jlQX}q};UcRtp8(HLhW7Scw*O)%R#LyiLKMLp z407oeT<_R-%`HYN396i)$DGx&^@~Dm{lV|gm2I6;4FzhT0TGxF`{1??8!h1|kQA8@ zYSGA#L*NIiTL6ORiO;u<%DGkimXe*R-LA0?{JRdG&WF~B#?-@bko--9ulkI4x9j`e zc>!s#VNP$R$`)NpomHaN<0RNWStml&Ha_roz2;Y5Ts~LVj?80xxG0K{?E1ZCP>HP& z@gu^bqn|f|q~UinymaaW2H#pfwr}}>T{$mF_5f`(q_|N&hOe|?9Q5Tfw*Z|#69KQu zRzBs~V&0llmF&bnbOsu`P&-Le-sImZx&?F*SP|@;xW;{XhX*;Ky4Ov_NgfopQhD&v zI}55201NB214P_dFzeeF!2M{o-R?aW;it<_c?`pH@-lz$v}f%J8=~ir_{_OeD+PPU zuq4dstTM-{TxS<*LMu#!nKok6#`I;^*pV`Ur880Ww!mR?WW(GysRNI+4y@Zxy^raZ z7PJKioaE0m_3}W@)cocKjXlMa>Kw%U_NEU!;{uULCQ0Cfc3+Ltx1}a%K}v@ zHpsro-h3OQx-%Dvd{rX4kB}YAj#o6AFH;n*woWy@6F)cr2_aYyl?Y7PkjCRCz&@=L zV#8;HLB%}<+oOZUaK5=a%>iG%_NR*s;aZFa475m+7Jh zlKy3yGVfvpeMIEha4On+}=CYb4b*`sL>e=G9XM&6fPA$I@#XJVXP1)@eWC3ox- zWUiLll^1sXh;w?P7+t{K8JH#@qAviroY`J?(m0}PcqN%Bb$+%qY}pw6`gZtXFJp5p zc#s(~KUeB0_)^O6FkRQZ8Tkfi7@w?&S%NcAD(whqMA~=4FKj2pNI5nj(2Njh?`$YD zS!*fW%lqDVZ1R_J`ZKWm$^@EGoDD^xz%;Bg?*`zo=^(k~3A;=hBUAfOa})$Hpw#a( zAQrJH0Ne;DG@1sl6WHCDfbd-7{>#_PqWRQ^amIC`CFT4S0_||ZbvIIB)P|1;vk0wX zTLxNQjNd=?cYh*1F_;Ag0M2gIz%4AGAT&-`2_nJccKqEXPCjkOtE6%OvB}?20-;w7 zXXCB<`9{9po0#azvz3F-=*2&lpWa}?)>Ji#C~m@2Z}LbUGzF~T>ej-wdKdS`SUaNj zRCfR3C*~H0%P&(IS!Vk9@DWprMK2*}qkZprRdss^cgJDj zJ^XmAY@Z4ZEE<~tXLn0bLMHBSK$9iKAvs1Y+lk;;x4XQ^*=Qm5Ct0ZyfC+TZWLz5r zT45@smX&^sI82Y_km+NzFgsP2OY=V~vuOUDp0Go~I1{vijZUd@T9pu9uX5yf_ zRa@Kj=MU_h#R-t^G z$*(mRDgEl3kH2v{JN+OCZICfTlAd7A9^KKB+y}_SNSvh%y5$8l>{a-LSQYQ;w_n^r zqRJ|N@+y&2@l6-bXn+NoU(u+ z*lqLFEiXCiwPR*cq{>wJv8OQVvJxp(TXYS<31al-Y(NqYmeb)z z)%i&eWU#`g5?E~?SLR-BT0}+P#RQ-tvvGQ_udlt3Cv+k@Lq>d6N~K^`GCCNd z-!%>Ub`@j{FdLqk>iwqlweukdub?iFl)QP-uRU$qhChYG59bdc%L|&}#pp~IUbSd8 z#WZ1M0v$V+1Rx~U(6?08^dXe0p19*rp7f9hXb9VHr5#`GDm#9m&H1Y{QD|*V)!e@U zMkOUH*R^;~aB}RuZg+iOsh+CkBR(Okd8d7K*H1Dka<+U2C}|<$loO|b=|82fQRkOF zb&@@Q-{v8tqiHf!4&Tz}Se5J>-{w?)Zh!&R7pvYO-;9g&0!d|rNoD?W)f7lf*Z(;< zk5v#y;G~#B?Qkbi#+O!Bn$KLl5gQvTvM7f?;qB)x4u+(4C&1>^nW!^rZk6;ogT&Nx z?Ka0whoSBNL=Tjvh?|R~){m@;FQmsJy&>U)$vL}!X-V9T+?n7tX?@*Zx^Hi2TF-LFY^FQh>7O>!bRGm^g2Q1qLNfDq)U?aP(3>su2k+9 zjCF`=Q+Td8$@_q=^R>>@yXmWzW&LhRPkQ;ZuK0Hq%smlL?<`&yS)9YFB3uBSc;V8( zW=gNrXCzbcIW$~SHX7lfQQtM$FOstmqKd#li!Uc7UyC0+bHl34F7xH?;CUIy?@W8f z>B3WLzhk-TyPH)M-g@h++*jSAqxguQ0CQEKyP z?=Al=1a&=REUgAE*SCJr-W|+rRN(P7%AmuIFPX8YLlTuL@X|>gC`;Y9OM5o?j|ZmT zIe0d(nUho1_tSS|;IUx5GWEs)2Un_8YgRt1 zfKXV2>DB@Z`=Tl5`@V=(R3xR%(H(7>^g3OgHa)$~a(v@`a*l5q5)lBcfApm;^Lbhp zC@qTc7?!sz|Ih<%d`?iB>F(6ykg7?)P&?}toD;Y^RnPY>+Op@(Jy1vhoMDqwCs;P3(#X%SJi^?Ez;j=fyKQ#bLF>89= z?2}0Q8&uSq&f1>3(CzP6hpag&=?AfLSYAR&!%lLCe_R<~CMd)ipm4?ugpuq)VAP zI0qTlHWGF0lPl6c`3V~T?H&a3VZ8}3ALcWq)5!tcW20z4d}rAOkl^^bJ$eE=;a4;h z5>z``w)p?0=(6mYvD*(#v(QIJO7d`>%(SkuW27f=aM1{=rUw`4N8oFXIUDlIr=h`f zIdbL1YCy&7qNWOu(cxomi=eh$@`K(jqa(*^TASwA*RjLCA${Ckcco%q^P~D4y3Xf& zb}Ta!2}iq5ev^$BcZ8Rx-CpEWhSFDh%^o%yfxA0Y>#N>^Nc{^s)yb(H-Prgm-QPTYN>A!Mz zqNC%gI^$JvsP*~>adbWwQ?=2Sli@wVYBy!?^5;DrG~{MNt17q{#B&%G;T2xDuhRA2 z=oF9f*0iR8uE?+V60$E-%A5waq9WUZAppi(g*N)^ff(C{psoF?VrJ$;1&FuK%nFYW zI&63~Q!be<_AJ;s_3j@wk?@-FJzQx5_68BEa#QeErjq2C|8mMvGV`I7K@_q^ZgYsM zGbkSN1?3++S7TT#cXAvQQ(2UYt;h3Kf;{kENvDk9VmA28NtMOLDokS!3)%Ju2E~jK9AW8 zN@gd63f|nnwC+>kl$8$+OlDv!#g3b^kvMf;%Uz$Np0NP>_`p>@ANC8Y?jQ6xt8+cb zq;N7tWmO$KoKW;SCD_3(;x$(=$@ND`yvg2vk9|hcA(6e&^zheEh$8LK^QB>`Zq^@w z`6hEV{4hZvlV-&>H5jB~`3Go9hbR@1n(QUH$Z!X2T0RS+=rUZgq&gmC>lw! zQ^}vu_EU7;AnFXsX^>v4)|^QrfZNmG?x3?SGzAIhb1$RMtIbqX6{>Q2+s{kcQ#|!; zPXwYhUJ6r7>oqOJI$ktS_cBHZSvnA=gNz_{pKi`%O7R%wIs$jqVvGj&B0p6YB0W&0 z1~?HMVnh4d`F_U5A8umP{yS#6$I4xeiIf*Q8-(xSXk9t{g?oE!;*eC{cMa;^(DXq) z2$NW`Qs_NL8cp!SxDSlixQ z!WDsZfc3DIL*?hn#KE;xUsE{bp&ik6^ye9fj>#4mvEj3woT`twThSoSbB1(P<$QV5 zKSw~_)f9215=C9R$G)e^Q@%#{#(gRFd)rE?ITWZ_fKOjLP39f zKSkREfY621L9uI zc$U&URH*?~xjUS8p{N#|mrhZ&#O#IS-Mpcks%D>K-<+EMz${5_RC$-SvdHT?lgEdK zJHI;20b!o}mT&cx3(d85udweNL67h2T6 z<$vB&bdQ!nRGl)tww)xZQoD0)XWCg*GyO!6J;kwG4x<11*$Iyse7ONdB=`FlgCKOa z){!j?3Y8>t{5-tyUDuoOf?IB&9W1s8(Tl$1z}%hD{C=XOFzV)I`liJfpJkmL>K5Dc zSeUNQ(4?^7%a?dwdiC}vXW@I(%kAAk;U4raTwCXrv^uT$=CbXX5dIB#pPeui;Yr31 zpdFU1yfa{HlwD3qA%@0^(*3?Zc2=P=h535EGLWtTa-E;Ihx+|J+Pz|%K4DnfQog;f aaudd;$Kd!8$-kf(|2}Pbig*(9&;J3Cqptq| literal 0 HcmV?d00001 From b5e160bc00c09edcc48ca00351d7473c202a67bf Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Jan 2024 21:23:22 +0100 Subject: [PATCH 084/107] Bindings UI --- app/AppConfig.cs | 2 +- app/Handheld.Designer.cs | 310 ++++++++++++++++++++------------------- app/Handheld.cs | 8 +- 3 files changed, 162 insertions(+), 158 deletions(-) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 8de91e6b..725d5151 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -321,7 +321,7 @@ public static class AppConfig public static bool IsAlly() { - return true || ContainsModel("RC71"); + return ContainsModel("RC71"); } public static bool NoMKeys() diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs index 3c7086b1..8f109639 100644 --- a/app/Handheld.Designer.cs +++ b/app/Handheld.Designer.cs @@ -44,11 +44,6 @@ trackRSMin = new TrackBar(); labelRSTitle = new Label(); panelLeft = new Panel(); - panelVibra = new Panel(); - pictureBox5 = new PictureBox(); - labelVibra = new Label(); - labelVibraTitle = new Label(); - trackVibra = new TrackBar(); panelLT = new Panel(); pictureBox2 = new PictureBox(); trackLTMax = new TrackBar(); @@ -62,6 +57,12 @@ trackLSMin = new TrackBar(); labelLSTitle = new Label(); panelBindings = new Panel(); + panelBinding = new Panel(); + labelBinding = new Label(); + labelSecondary = new Label(); + labelPrimary = new Label(); + comboSecondary = new UI.RComboBox(); + comboPrimary = new UI.RComboBox(); buttonView = new UI.RButton(); buttonLS = new UI.RButton(); buttonLT = new UI.RButton(); @@ -81,12 +82,11 @@ buttonY = new UI.RButton(); buttonX = new UI.RButton(); pictureAlly = new PictureBox(); - panelBinding = new Panel(); - labelBinding = new Label(); - labelSecondary = new Label(); - labelPrimary = new Label(); - comboSecondary = new UI.RComboBox(); - comboPrimary = new UI.RComboBox(); + panelVibra = new Panel(); + pictureBox5 = new PictureBox(); + labelVibra = new Label(); + labelVibraTitle = new Label(); + trackVibra = new TrackBar(); panelDeadzones.SuspendLayout(); panelRight.SuspendLayout(); panelRT.SuspendLayout(); @@ -98,9 +98,6 @@ ((System.ComponentModel.ISupportInitialize)trackRSMax).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackRSMin).BeginInit(); panelLeft.SuspendLayout(); - panelVibra.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)pictureBox5).BeginInit(); - ((System.ComponentModel.ISupportInitialize)trackVibra).BeginInit(); panelLT.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackLTMax).BeginInit(); @@ -110,8 +107,11 @@ ((System.ComponentModel.ISupportInitialize)trackLSMax).BeginInit(); ((System.ComponentModel.ISupportInitialize)trackLSMin).BeginInit(); panelBindings.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit(); panelBinding.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit(); + panelVibra.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox5).BeginInit(); + ((System.ComponentModel.ISupportInitialize)trackVibra).BeginInit(); SuspendLayout(); // // panelDeadzones @@ -121,19 +121,19 @@ panelDeadzones.Dock = DockStyle.Top; panelDeadzones.Location = new Point(10, 10); panelDeadzones.Name = "panelDeadzones"; - panelDeadzones.Size = new Size(1130, 372); + panelDeadzones.Size = new Size(1130, 258); panelDeadzones.TabIndex = 0; // // panelRight // - panelRight.Controls.Add(buttonReset); + panelRight.AutoSize = true; panelRight.Controls.Add(panelRT); panelRight.Controls.Add(panelRS); panelRight.Dock = DockStyle.Left; panelRight.Location = new Point(560, 0); panelRight.MinimumSize = new Size(560, 0); panelRight.Name = "panelRight"; - panelRight.Size = new Size(560, 372); + panelRight.Size = new Size(560, 258); panelRight.TabIndex = 48; // // buttonReset @@ -144,7 +144,7 @@ buttonReset.BorderColor = Color.Transparent; buttonReset.BorderRadius = 2; buttonReset.FlatStyle = FlatStyle.Flat; - buttonReset.Location = new Point(310, 296); + buttonReset.Location = new Point(870, 41); buttonReset.Margin = new Padding(4, 2, 4, 2); buttonReset.Name = "buttonReset"; buttonReset.Secondary = true; @@ -314,7 +314,6 @@ // panelLeft // panelLeft.AutoSize = true; - panelLeft.Controls.Add(panelVibra); panelLeft.Controls.Add(panelLT); panelLeft.Controls.Add(panelLS); panelLeft.Dock = DockStyle.Left; @@ -323,71 +322,9 @@ panelLeft.MinimumSize = new Size(560, 0); panelLeft.Name = "panelLeft"; panelLeft.Padding = new Padding(0, 0, 0, 18); - panelLeft.Size = new Size(560, 372); + panelLeft.Size = new Size(560, 258); panelLeft.TabIndex = 47; // - // panelVibra - // - panelVibra.AutoSize = true; - panelVibra.AutoSizeMode = AutoSizeMode.GrowAndShrink; - panelVibra.Controls.Add(pictureBox5); - panelVibra.Controls.Add(labelVibra); - panelVibra.Controls.Add(labelVibraTitle); - panelVibra.Controls.Add(trackVibra); - panelVibra.Dock = DockStyle.Top; - panelVibra.Location = new Point(0, 248); - panelVibra.Margin = new Padding(4); - panelVibra.MaximumSize = new Size(0, 124); - panelVibra.Name = "panelVibra"; - panelVibra.Size = new Size(560, 124); - panelVibra.TabIndex = 46; - // - // pictureBox5 - // - pictureBox5.BackgroundImage = Properties.Resources.icons8_soonvibes_32; - pictureBox5.BackgroundImageLayout = ImageLayout.Zoom; - pictureBox5.ErrorImage = null; - pictureBox5.InitialImage = null; - pictureBox5.Location = new Point(10, 14); - pictureBox5.Margin = new Padding(4, 2, 4, 10); - pictureBox5.Name = "pictureBox5"; - pictureBox5.Size = new Size(32, 32); - pictureBox5.TabIndex = 45; - pictureBox5.TabStop = false; - // - // labelVibra - // - labelVibra.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelVibra.Location = new Point(408, 14); - labelVibra.Margin = new Padding(4, 0, 4, 0); - labelVibra.Name = "labelVibra"; - labelVibra.Size = new Size(124, 32); - labelVibra.TabIndex = 44; - labelVibra.Text = "100%"; - labelVibra.TextAlign = ContentAlignment.TopRight; - // - // labelVibraTitle - // - labelVibraTitle.AutoSize = true; - labelVibraTitle.Location = new Point(77, 14); - labelVibraTitle.Margin = new Padding(4, 0, 4, 0); - labelVibraTitle.Name = "labelVibraTitle"; - labelVibraTitle.Size = new Size(209, 32); - labelVibraTitle.TabIndex = 43; - labelVibraTitle.Text = "Vibration Strength"; - // - // trackVibra - // - trackVibra.Location = new Point(6, 48); - trackVibra.Margin = new Padding(4, 2, 4, 2); - trackVibra.Maximum = 100; - trackVibra.Name = "trackVibra"; - trackVibra.Size = new Size(546, 90); - trackVibra.TabIndex = 42; - trackVibra.TickFrequency = 5; - trackVibra.TickStyle = TickStyle.TopLeft; - trackVibra.Value = 100; - // // panelLT // panelLT.AutoSize = true; @@ -569,11 +506,80 @@ panelBindings.Controls.Add(buttonX); panelBindings.Controls.Add(pictureAlly); panelBindings.Dock = DockStyle.Top; - panelBindings.Location = new Point(10, 382); + panelBindings.Location = new Point(10, 268); panelBindings.Name = "panelBindings"; panelBindings.Size = new Size(1130, 480); panelBindings.TabIndex = 1; // + // panelBinding + // + panelBinding.Controls.Add(labelBinding); + panelBinding.Controls.Add(labelSecondary); + panelBinding.Controls.Add(labelPrimary); + panelBinding.Controls.Add(comboSecondary); + panelBinding.Controls.Add(comboPrimary); + panelBinding.Location = new Point(372, 156); + panelBinding.Name = "panelBinding"; + panelBinding.Size = new Size(400, 186); + panelBinding.TabIndex = 37; + panelBinding.Visible = false; + // + // labelBinding + // + labelBinding.AutoSize = true; + labelBinding.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelBinding.Location = new Point(2, 11); + labelBinding.Name = "labelBinding"; + labelBinding.Size = new Size(183, 32); + labelBinding.TabIndex = 31; + labelBinding.Text = "Binding: Menu"; + // + // labelSecondary + // + labelSecondary.AutoSize = true; + labelSecondary.Location = new Point(2, 122); + labelSecondary.Name = "labelSecondary"; + labelSecondary.Size = new Size(125, 32); + labelSecondary.TabIndex = 30; + labelSecondary.Text = "Secondary"; + // + // labelPrimary + // + labelPrimary.AutoSize = true; + labelPrimary.Location = new Point(2, 63); + labelPrimary.Name = "labelPrimary"; + labelPrimary.Size = new Size(94, 32); + labelPrimary.TabIndex = 29; + labelPrimary.Text = "Primary"; + // + // comboSecondary + // + comboSecondary.BorderColor = Color.White; + comboSecondary.ButtonColor = Color.FromArgb(255, 255, 255); + comboSecondary.FlatStyle = FlatStyle.Flat; + comboSecondary.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); + comboSecondary.FormattingEnabled = true; + comboSecondary.ItemHeight = 32; + comboSecondary.Location = new Point(133, 121); + comboSecondary.Margin = new Padding(4, 11, 4, 8); + comboSecondary.Name = "comboSecondary"; + comboSecondary.Size = new Size(254, 40); + comboSecondary.TabIndex = 28; + // + // comboPrimary + // + comboPrimary.BorderColor = Color.White; + comboPrimary.ButtonColor = Color.FromArgb(255, 255, 255); + comboPrimary.FlatStyle = FlatStyle.Flat; + comboPrimary.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); + comboPrimary.FormattingEnabled = true; + comboPrimary.ItemHeight = 32; + comboPrimary.Location = new Point(133, 60); + comboPrimary.Margin = new Padding(4, 11, 4, 8); + comboPrimary.Name = "comboPrimary"; + comboPrimary.Size = new Size(254, 40); + comboPrimary.TabIndex = 27; + // // buttonView // buttonView.Activated = false; @@ -944,81 +950,76 @@ pictureAlly.TabIndex = 0; pictureAlly.TabStop = false; // - // panelBinding + // panelVibra // - panelBinding.Controls.Add(labelBinding); - panelBinding.Controls.Add(labelSecondary); - panelBinding.Controls.Add(labelPrimary); - panelBinding.Controls.Add(comboSecondary); - panelBinding.Controls.Add(comboPrimary); - panelBinding.Location = new Point(372, 156); - panelBinding.Name = "panelBinding"; - panelBinding.Size = new Size(400, 186); - panelBinding.TabIndex = 37; - panelBinding.Visible = false; + panelVibra.AutoSize = true; + panelVibra.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelVibra.Controls.Add(buttonReset); + panelVibra.Controls.Add(pictureBox5); + panelVibra.Controls.Add(labelVibra); + panelVibra.Controls.Add(labelVibraTitle); + panelVibra.Controls.Add(trackVibra); + panelVibra.Dock = DockStyle.Top; + panelVibra.Location = new Point(10, 748); + panelVibra.Margin = new Padding(4); + panelVibra.MaximumSize = new Size(0, 124); + panelVibra.Name = "panelVibra"; + panelVibra.Size = new Size(1130, 124); + panelVibra.TabIndex = 47; // - // labelBinding + // pictureBox5 // - labelBinding.AutoSize = true; - labelBinding.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelBinding.Location = new Point(2, 11); - labelBinding.Name = "labelBinding"; - labelBinding.Size = new Size(183, 32); - labelBinding.TabIndex = 31; - labelBinding.Text = "Binding: Menu"; + pictureBox5.BackgroundImage = Properties.Resources.icons8_soonvibes_32; + pictureBox5.BackgroundImageLayout = ImageLayout.Zoom; + pictureBox5.ErrorImage = null; + pictureBox5.InitialImage = null; + pictureBox5.Location = new Point(13, 14); + pictureBox5.Margin = new Padding(4, 2, 4, 10); + pictureBox5.Name = "pictureBox5"; + pictureBox5.Size = new Size(32, 32); + pictureBox5.TabIndex = 45; + pictureBox5.TabStop = false; // - // labelSecondary + // labelVibra // - labelSecondary.AutoSize = true; - labelSecondary.Location = new Point(2, 122); - labelSecondary.Name = "labelSecondary"; - labelSecondary.Size = new Size(125, 32); - labelSecondary.TabIndex = 30; - labelSecondary.Text = "Secondary"; + labelVibra.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelVibra.Location = new Point(408, 14); + labelVibra.Margin = new Padding(4, 0, 4, 0); + labelVibra.Name = "labelVibra"; + labelVibra.Size = new Size(124, 32); + labelVibra.TabIndex = 44; + labelVibra.Text = "100%"; + labelVibra.TextAlign = ContentAlignment.TopRight; // - // labelPrimary + // labelVibraTitle // - labelPrimary.AutoSize = true; - labelPrimary.Location = new Point(2, 63); - labelPrimary.Name = "labelPrimary"; - labelPrimary.Size = new Size(94, 32); - labelPrimary.TabIndex = 29; - labelPrimary.Text = "Primary"; + labelVibraTitle.AutoSize = true; + labelVibraTitle.Location = new Point(77, 14); + labelVibraTitle.Margin = new Padding(4, 0, 4, 0); + labelVibraTitle.Name = "labelVibraTitle"; + labelVibraTitle.Size = new Size(209, 32); + labelVibraTitle.TabIndex = 43; + labelVibraTitle.Text = "Vibration Strength"; // - // comboSecondary + // trackVibra // - comboSecondary.BorderColor = Color.White; - comboSecondary.ButtonColor = Color.FromArgb(255, 255, 255); - comboSecondary.FlatStyle = FlatStyle.Flat; - comboSecondary.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); - comboSecondary.FormattingEnabled = true; - comboSecondary.ItemHeight = 32; - comboSecondary.Location = new Point(133, 121); - comboSecondary.Margin = new Padding(4, 11, 4, 8); - comboSecondary.Name = "comboSecondary"; - comboSecondary.Size = new Size(254, 40); - comboSecondary.TabIndex = 28; - // - // comboPrimary - // - comboPrimary.BorderColor = Color.White; - comboPrimary.ButtonColor = Color.FromArgb(255, 255, 255); - comboPrimary.FlatStyle = FlatStyle.Flat; - comboPrimary.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); - comboPrimary.FormattingEnabled = true; - comboPrimary.ItemHeight = 32; - comboPrimary.Location = new Point(133, 60); - comboPrimary.Margin = new Padding(4, 11, 4, 8); - comboPrimary.Name = "comboPrimary"; - comboPrimary.Size = new Size(254, 40); - comboPrimary.TabIndex = 27; + trackVibra.Location = new Point(6, 48); + trackVibra.Margin = new Padding(4, 2, 4, 2); + trackVibra.Maximum = 100; + trackVibra.Name = "trackVibra"; + trackVibra.Size = new Size(546, 90); + trackVibra.TabIndex = 42; + trackVibra.TickFrequency = 5; + trackVibra.TickStyle = TickStyle.TopLeft; + trackVibra.Value = 100; // // Handheld // AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; AutoSize = true; - ClientSize = new Size(1150, 888); + ClientSize = new Size(1150, 880); + Controls.Add(panelVibra); Controls.Add(panelBindings); Controls.Add(panelDeadzones); MaximizeBox = false; @@ -1044,10 +1045,6 @@ ((System.ComponentModel.ISupportInitialize)trackRSMin).EndInit(); panelLeft.ResumeLayout(false); panelLeft.PerformLayout(); - panelVibra.ResumeLayout(false); - panelVibra.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)pictureBox5).EndInit(); - ((System.ComponentModel.ISupportInitialize)trackVibra).EndInit(); panelLT.ResumeLayout(false); panelLT.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit(); @@ -1059,10 +1056,15 @@ ((System.ComponentModel.ISupportInitialize)trackLSMax).EndInit(); ((System.ComponentModel.ISupportInitialize)trackLSMin).EndInit(); panelBindings.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit(); panelBinding.ResumeLayout(false); panelBinding.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit(); + panelVibra.ResumeLayout(false); + panelVibra.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox5).EndInit(); + ((System.ComponentModel.ISupportInitialize)trackVibra).EndInit(); ResumeLayout(false); + PerformLayout(); } #endregion @@ -1082,11 +1084,6 @@ private TrackBar trackRSMin; private Label labelRSTitle; private Panel panelLeft; - private Panel panelVibra; - private PictureBox pictureBox5; - private Label labelVibra; - private Label labelVibraTitle; - private TrackBar trackVibra; private Panel panelLT; private PictureBox pictureBox2; private TrackBar trackLTMax; @@ -1126,5 +1123,10 @@ private Label labelPrimary; private UI.RComboBox comboSecondary; private UI.RComboBox comboPrimary; + private Panel panelVibra; + private PictureBox pictureBox5; + private Label labelVibra; + private Label labelVibraTitle; + private TrackBar trackVibra; } } \ No newline at end of file diff --git a/app/Handheld.cs b/app/Handheld.cs index 17ce2cb5..e718704e 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -146,14 +146,16 @@ namespace GHelper if (sender is null) return; RButton button = (RButton)sender; - labelBinding.Text = "Binding: " + label; + panelBinding.Visible = true; + + activeButton = button; activeBinding = binding; + labelBinding.Text = "Binding: " + label; + SetComboValue(comboPrimary, AppConfig.GetString("bind_" + binding, "")); SetComboValue(comboSecondary, AppConfig.GetString("bind2_" + binding, "")); - panelBinding.Visible = true; - activeButton = button; } From 2987d750e36dd6c21282e5b046f51b1ea74816f3 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 27 Jan 2024 11:44:07 +0100 Subject: [PATCH 085/107] XBox controller disable / enable toggle --- app/Ally/AllyControl.cs | 7 +- app/Handheld.Designer.cs | 111 +++++++++++++++------------ app/Handheld.cs | 12 ++- app/Properties/Resources.Designer.cs | 10 +++ app/Properties/Resources.resx | 21 ++--- app/Resources/icons8-xbox-rt-32.png | Bin 0 -> 448 bytes 6 files changed, 103 insertions(+), 58 deletions(-) create mode 100644 app/Resources/icons8-xbox-rt-32.png diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 0d591b5f..2aea8195 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -510,6 +510,11 @@ namespace GHelper.Ally } + public static void ApplyXBoxStatus() + { + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0B, 0x01, AppConfig.Is("controller_disabled") ? (byte)0x02 : (byte)0x01 }, "Status"); + } + public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto) { Task.Run(() => @@ -537,7 +542,7 @@ namespace GHelper.Ally InputDispatcher.SetBacklightAuto(true); WakeUp(); - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 0x01, 0x01, (byte)_applyMode }, "Controller"); + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x01, 0x01, (byte)_applyMode }, "Controller"); AsusHid.WriteInput(CommandSave, null); BindZone(BindingZone.M1M2); diff --git a/app/Handheld.Designer.cs b/app/Handheld.Designer.cs index 8f109639..53ff0120 100644 --- a/app/Handheld.Designer.cs +++ b/app/Handheld.Designer.cs @@ -30,7 +30,6 @@ { panelDeadzones = new Panel(); panelRight = new Panel(); - buttonReset = new UI.RButton(); panelRT = new Panel(); pictureBox4 = new PictureBox(); trackRTMax = new TrackBar(); @@ -56,6 +55,7 @@ labelLS = new Label(); trackLSMin = new TrackBar(); labelLSTitle = new Label(); + buttonReset = new UI.RButton(); panelBindings = new Panel(); panelBinding = new Panel(); labelBinding = new Label(); @@ -83,6 +83,7 @@ buttonX = new UI.RButton(); pictureAlly = new PictureBox(); panelVibra = new Panel(); + checkController = new UI.RCheckBox(); pictureBox5 = new PictureBox(); labelVibra = new Label(); labelVibraTitle = new Label(); @@ -119,9 +120,9 @@ panelDeadzones.Controls.Add(panelRight); panelDeadzones.Controls.Add(panelLeft); panelDeadzones.Dock = DockStyle.Top; - panelDeadzones.Location = new Point(10, 10); + panelDeadzones.Location = new Point(10, 527); panelDeadzones.Name = "panelDeadzones"; - panelDeadzones.Size = new Size(1130, 258); + panelDeadzones.Size = new Size(1123, 258); panelDeadzones.TabIndex = 0; // // panelRight @@ -136,23 +137,6 @@ panelRight.Size = new Size(560, 258); panelRight.TabIndex = 48; // - // buttonReset - // - buttonReset.Activated = false; - buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; - buttonReset.BackColor = SystemColors.ControlLight; - buttonReset.BorderColor = Color.Transparent; - buttonReset.BorderRadius = 2; - buttonReset.FlatStyle = FlatStyle.Flat; - buttonReset.Location = new Point(870, 41); - buttonReset.Margin = new Padding(4, 2, 4, 2); - buttonReset.Name = "buttonReset"; - buttonReset.Secondary = true; - buttonReset.Size = new Size(239, 50); - buttonReset.TabIndex = 55; - buttonReset.Text = "Reset Deadzones"; - buttonReset.UseVisualStyleBackColor = false; - // // panelRT // panelRT.AutoSize = true; @@ -172,7 +156,7 @@ // // pictureBox4 // - pictureBox4.BackgroundImage = Properties.Resources.icons8_xbox_lt_32; + pictureBox4.BackgroundImage = Properties.Resources.icons8_xbox_rt_32; pictureBox4.BackgroundImageLayout = ImageLayout.Zoom; pictureBox4.ErrorImage = null; pictureBox4.InitialImage = null; @@ -483,6 +467,23 @@ labelLSTitle.TabIndex = 17; labelLSTitle.Text = "Left Stick Deadzones"; // + // buttonReset + // + buttonReset.Activated = false; + buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonReset.BackColor = SystemColors.ControlLight; + buttonReset.BorderColor = Color.Transparent; + buttonReset.BorderRadius = 2; + buttonReset.FlatStyle = FlatStyle.Flat; + buttonReset.Location = new Point(944, 39); + buttonReset.Margin = new Padding(4, 2, 4, 2); + buttonReset.Name = "buttonReset"; + buttonReset.Secondary = true; + buttonReset.Size = new Size(165, 50); + buttonReset.TabIndex = 55; + buttonReset.Text = "Reset"; + buttonReset.UseVisualStyleBackColor = false; + // // panelBindings // panelBindings.Controls.Add(panelBinding); @@ -506,9 +507,9 @@ panelBindings.Controls.Add(buttonX); panelBindings.Controls.Add(pictureAlly); panelBindings.Dock = DockStyle.Top; - panelBindings.Location = new Point(10, 268); + panelBindings.Location = new Point(10, 10); panelBindings.Name = "panelBindings"; - panelBindings.Size = new Size(1130, 480); + panelBindings.Size = new Size(1123, 517); panelBindings.TabIndex = 1; // // panelBinding @@ -518,7 +519,7 @@ panelBinding.Controls.Add(labelPrimary); panelBinding.Controls.Add(comboSecondary); panelBinding.Controls.Add(comboPrimary); - panelBinding.Location = new Point(372, 156); + panelBinding.Location = new Point(372, 174); panelBinding.Name = "panelBinding"; panelBinding.Size = new Size(400, 186); panelBinding.TabIndex = 37; @@ -590,7 +591,7 @@ buttonView.FlatStyle = FlatStyle.Flat; buttonView.ForeColor = SystemColors.ControlText; buttonView.ImageAlign = ContentAlignment.MiddleRight; - buttonView.Location = new Point(175, 8); + buttonView.Location = new Point(175, 26); buttonView.Margin = new Padding(4); buttonView.Name = "buttonView"; buttonView.Secondary = true; @@ -610,7 +611,7 @@ buttonLS.FlatStyle = FlatStyle.Flat; buttonLS.ForeColor = SystemColors.ControlText; buttonLS.ImageAlign = ContentAlignment.MiddleRight; - buttonLS.Location = new Point(20, 385); + buttonLS.Location = new Point(20, 403); buttonLS.Margin = new Padding(4); buttonLS.Name = "buttonLS"; buttonLS.Secondary = true; @@ -630,7 +631,7 @@ buttonLT.FlatStyle = FlatStyle.Flat; buttonLT.ForeColor = SystemColors.ControlText; buttonLT.ImageAlign = ContentAlignment.MiddleRight; - buttonLT.Location = new Point(20, 70); + buttonLT.Location = new Point(20, 88); buttonLT.Margin = new Padding(4); buttonLT.Name = "buttonLT"; buttonLT.Secondary = true; @@ -650,7 +651,7 @@ buttonLB.FlatStyle = FlatStyle.Flat; buttonLB.ForeColor = SystemColors.ControlText; buttonLB.ImageAlign = ContentAlignment.MiddleRight; - buttonLB.Location = new Point(20, 7); + buttonLB.Location = new Point(20, 25); buttonLB.Margin = new Padding(4); buttonLB.Name = "buttonLB"; buttonLB.Secondary = true; @@ -670,7 +671,7 @@ buttonDPR.FlatStyle = FlatStyle.Flat; buttonDPR.ForeColor = SystemColors.ControlText; buttonDPR.ImageAlign = ContentAlignment.MiddleRight; - buttonDPR.Location = new Point(20, 322); + buttonDPR.Location = new Point(20, 340); buttonDPR.Margin = new Padding(4); buttonDPR.Name = "buttonDPR"; buttonDPR.Secondary = true; @@ -690,7 +691,7 @@ buttonDPL.FlatStyle = FlatStyle.Flat; buttonDPL.ForeColor = SystemColors.ControlText; buttonDPL.ImageAlign = ContentAlignment.MiddleRight; - buttonDPL.Location = new Point(20, 259); + buttonDPL.Location = new Point(20, 277); buttonDPL.Margin = new Padding(4); buttonDPL.Name = "buttonDPL"; buttonDPL.Secondary = true; @@ -710,7 +711,7 @@ buttonDPD.FlatStyle = FlatStyle.Flat; buttonDPD.ForeColor = SystemColors.ControlText; buttonDPD.ImageAlign = ContentAlignment.MiddleRight; - buttonDPD.Location = new Point(20, 196); + buttonDPD.Location = new Point(20, 214); buttonDPD.Margin = new Padding(4); buttonDPD.Name = "buttonDPD"; buttonDPD.Secondary = true; @@ -730,7 +731,7 @@ buttonDPU.FlatStyle = FlatStyle.Flat; buttonDPU.ForeColor = SystemColors.ControlText; buttonDPU.ImageAlign = ContentAlignment.MiddleRight; - buttonDPU.Location = new Point(20, 133); + buttonDPU.Location = new Point(20, 151); buttonDPU.Margin = new Padding(4); buttonDPU.Name = "buttonDPU"; buttonDPU.Secondary = true; @@ -750,7 +751,7 @@ buttonM2.FlatStyle = FlatStyle.Flat; buttonM2.ForeColor = SystemColors.ControlText; buttonM2.ImageAlign = ContentAlignment.MiddleRight; - buttonM2.Location = new Point(330, 8); + buttonM2.Location = new Point(330, 26); buttonM2.Margin = new Padding(4); buttonM2.Name = "buttonM2"; buttonM2.Secondary = true; @@ -770,7 +771,7 @@ buttonM1.FlatStyle = FlatStyle.Flat; buttonM1.ForeColor = SystemColors.ControlText; buttonM1.ImageAlign = ContentAlignment.MiddleRight; - buttonM1.Location = new Point(650, 8); + buttonM1.Location = new Point(650, 26); buttonM1.Margin = new Padding(4); buttonM1.Name = "buttonM1"; buttonM1.Secondary = true; @@ -790,7 +791,7 @@ buttonRS.FlatStyle = FlatStyle.Flat; buttonRS.ForeColor = SystemColors.ControlText; buttonRS.ImageAlign = ContentAlignment.MiddleRight; - buttonRS.Location = new Point(962, 385); + buttonRS.Location = new Point(962, 403); buttonRS.Margin = new Padding(4); buttonRS.Name = "buttonRS"; buttonRS.Secondary = true; @@ -810,7 +811,7 @@ buttonMenu.FlatStyle = FlatStyle.Flat; buttonMenu.ForeColor = SystemColors.ControlText; buttonMenu.ImageAlign = ContentAlignment.MiddleRight; - buttonMenu.Location = new Point(805, 8); + buttonMenu.Location = new Point(805, 26); buttonMenu.Margin = new Padding(4); buttonMenu.Name = "buttonMenu"; buttonMenu.Secondary = true; @@ -830,7 +831,7 @@ buttonRT.FlatStyle = FlatStyle.Flat; buttonRT.ForeColor = SystemColors.ControlText; buttonRT.ImageAlign = ContentAlignment.MiddleRight; - buttonRT.Location = new Point(962, 70); + buttonRT.Location = new Point(962, 88); buttonRT.Margin = new Padding(4); buttonRT.Name = "buttonRT"; buttonRT.Secondary = true; @@ -850,7 +851,7 @@ buttonRB.FlatStyle = FlatStyle.Flat; buttonRB.ForeColor = SystemColors.ControlText; buttonRB.ImageAlign = ContentAlignment.MiddleRight; - buttonRB.Location = new Point(962, 7); + buttonRB.Location = new Point(962, 25); buttonRB.Margin = new Padding(4); buttonRB.Name = "buttonRB"; buttonRB.Secondary = true; @@ -870,7 +871,7 @@ buttonB.FlatStyle = FlatStyle.Flat; buttonB.ForeColor = SystemColors.ControlText; buttonB.ImageAlign = ContentAlignment.MiddleRight; - buttonB.Location = new Point(962, 322); + buttonB.Location = new Point(962, 340); buttonB.Margin = new Padding(4); buttonB.Name = "buttonB"; buttonB.Secondary = true; @@ -890,7 +891,7 @@ buttonA.FlatStyle = FlatStyle.Flat; buttonA.ForeColor = SystemColors.ControlText; buttonA.ImageAlign = ContentAlignment.MiddleRight; - buttonA.Location = new Point(962, 259); + buttonA.Location = new Point(962, 277); buttonA.Margin = new Padding(4); buttonA.Name = "buttonA"; buttonA.Secondary = true; @@ -910,7 +911,7 @@ buttonY.FlatStyle = FlatStyle.Flat; buttonY.ForeColor = SystemColors.ControlText; buttonY.ImageAlign = ContentAlignment.MiddleRight; - buttonY.Location = new Point(962, 196); + buttonY.Location = new Point(962, 214); buttonY.Margin = new Padding(4); buttonY.Name = "buttonY"; buttonY.Secondary = true; @@ -930,7 +931,7 @@ buttonX.FlatStyle = FlatStyle.Flat; buttonX.ForeColor = SystemColors.ControlText; buttonX.ImageAlign = ContentAlignment.MiddleRight; - buttonX.Location = new Point(962, 133); + buttonX.Location = new Point(962, 151); buttonX.Margin = new Padding(4); buttonX.Name = "buttonX"; buttonX.Secondary = true; @@ -944,7 +945,7 @@ // pictureAlly.BackgroundImage = Properties.Resources.ally; pictureAlly.BackgroundImageLayout = ImageLayout.Zoom; - pictureAlly.Location = new Point(185, 79); + pictureAlly.Location = new Point(185, 97); pictureAlly.Name = "pictureAlly"; pictureAlly.Size = new Size(767, 354); pictureAlly.TabIndex = 0; @@ -954,19 +955,34 @@ // panelVibra.AutoSize = true; panelVibra.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelVibra.Controls.Add(checkController); panelVibra.Controls.Add(buttonReset); panelVibra.Controls.Add(pictureBox5); panelVibra.Controls.Add(labelVibra); panelVibra.Controls.Add(labelVibraTitle); panelVibra.Controls.Add(trackVibra); panelVibra.Dock = DockStyle.Top; - panelVibra.Location = new Point(10, 748); + panelVibra.Location = new Point(10, 785); panelVibra.Margin = new Padding(4); panelVibra.MaximumSize = new Size(0, 124); panelVibra.Name = "panelVibra"; - panelVibra.Size = new Size(1130, 124); + panelVibra.Size = new Size(1123, 124); panelVibra.TabIndex = 47; // + // checkController + // + checkController.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + checkController.AutoSize = true; + checkController.BackColor = SystemColors.ControlLight; + checkController.Location = new Point(650, 41); + checkController.Margin = new Padding(0); + checkController.Name = "checkController"; + checkController.Padding = new Padding(16, 6, 16, 6); + checkController.Size = new Size(269, 48); + checkController.TabIndex = 56; + checkController.Text = "Disable Controller"; + checkController.UseVisualStyleBackColor = false; + // // pictureBox5 // pictureBox5.BackgroundImage = Properties.Resources.icons8_soonvibes_32; @@ -1018,10 +1034,10 @@ AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; AutoSize = true; - ClientSize = new Size(1150, 880); + ClientSize = new Size(1143, 912); Controls.Add(panelVibra); - Controls.Add(panelBindings); Controls.Add(panelDeadzones); + Controls.Add(panelBindings); MaximizeBox = false; MinimizeBox = false; Name = "Handheld"; @@ -1128,5 +1144,6 @@ private Label labelVibra; private Label labelVibraTitle; private TrackBar trackVibra; + private UI.RCheckBox checkController; } } \ No newline at end of file diff --git a/app/Handheld.cs b/app/Handheld.cs index e718704e..b12dc784 100644 --- a/app/Handheld.cs +++ b/app/Handheld.cs @@ -54,7 +54,7 @@ namespace GHelper ButtonBinding("du", "DPad Up", buttonDPU); ButtonBinding("dd", "DPad Down", buttonDPD); - + ButtonBinding("dl", "DPad Left", buttonDPL); ButtonBinding("dr", "DPad Right", buttonDPR); @@ -73,6 +73,15 @@ namespace GHelper ComboBinding(comboPrimary); ComboBinding(comboSecondary); + checkController.Checked = AppConfig.Is("controller_disabled"); + checkController.CheckedChanged += CheckController_CheckedChanged; + + } + + private void CheckController_CheckedChanged(object? sender, EventArgs e) + { + AppConfig.Set("controller_disabled", checkController.Checked ? 1 : 0); + AllyControl.ApplyXBoxStatus(); } private void ComboBinding(RComboBox combo) @@ -246,5 +255,6 @@ namespace GHelper Top = Program.settingsForm.Top; Left = Program.settingsForm.Left - Width - 5; } + } } diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index c07f6574..7e09db07 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -690,6 +690,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_xbox_rt_32 { + get { + object obj = ResourceManager.GetObject("icons8-xbox-rt-32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 245016f9..1dc0a113 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -130,15 +130,15 @@ ..\Resources\icons8-microphone-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-controls-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\icons8-maus-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -157,8 +157,8 @@ ..\Resources\icons8-controller-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-controls-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-next-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -190,6 +190,9 @@ ..\Resources\icons8-laptop-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ally.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -310,8 +313,8 @@ ..\Resources\icons8-software-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -322,7 +325,7 @@ ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ally.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/app/Resources/icons8-xbox-rt-32.png b/app/Resources/icons8-xbox-rt-32.png new file mode 100644 index 0000000000000000000000000000000000000000..6ce45590249ac825db2159e0261e0c48e829fcf1 GIT binary patch literal 448 zcmV;x0YCnUP)iSTtU&H5Ro1eK7#@R!u#yEMo(Xb#|>a4z&P12>`3W8qf{Y0cGF-*Z}&a zWP-N6mi$EW{g|2yhX-D@0HX;2Tfh!5BzegLz<5HXNreZ@g*EM{aRC@( zsI7$^WZvGH? q8&ulMplL-uWEN=hX`U+=f1w{n(xz%z2{~v00000 Date: Sat, 27 Jan 2024 11:50:13 +0100 Subject: [PATCH 086/107] XBox controller toggle --- app/Ally/AllyControl.cs | 9 --------- app/AppConfig.cs | 5 +++++ app/AsusACPI.cs | 7 ++++++- app/Settings.cs | 5 ----- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 2aea8195..f8aec50e 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -603,14 +603,5 @@ namespace GHelper.Ally } } - public void ToggleXBox() - { - bool status = !AppConfig.IsNotFalse("controller_xbox"); - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0B, 0x01, status ? (byte)0x01 : (byte)0x02 }, "XBox"); - AppConfig.Set("controller_xbox", status ? 1 : 0); - - settings.VisualiseXBox(status); - } - } } diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 725d5151..1456c10a 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -412,6 +412,11 @@ public static class AppConfig return ContainsModel("X13"); } + public static bool IsG14AMD() + { + return ContainsModel("GA402R"); + } + public static bool DynamicBoost5() { return ContainsModel("GZ301ZE"); diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index e5bde3e5..7430cb6e 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -133,7 +133,7 @@ public class AsusACPI public const int MinTotal = 5; public static int MaxTotal = 150; - public static int DefaultTotal = 125; + public static int DefaultTotal = 80; public const int MinCPU = 5; public const int MaxCPU = 100; @@ -251,6 +251,11 @@ public class AsusACPI MaxTotal = 250; } + if (AppConfig.IsG14AMD()) + { + DefaultTotal = 125; + } + if (AppConfig.IsX13()) { MaxTotal = 75; diff --git a/app/Settings.cs b/app/Settings.cs index b9d4b84a..65f64a5b 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -314,11 +314,6 @@ namespace GHelper } } - public void VisualiseXBox(bool status) - { - - } - public void VisualiseBacklight(int backlight) { buttonBacklight.Text = Math.Round((double)backlight*33.33).ToString() + "%"; From 6f861957dfb4768848597b7380f621faea616bc6 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 27 Jan 2024 11:51:27 +0100 Subject: [PATCH 087/107] Version Bump --- app/GHelper.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 819bb1dc..c43e6850 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.149 + 0.150 From 8c5f4aa0f355e690248dc5f05a03d9d545d69444 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 27 Jan 2024 12:06:46 +0100 Subject: [PATCH 088/107] Handheld form behavior --- app/Settings.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Settings.cs b/app/Settings.cs index 65f64a5b..63a8aa16 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1024,6 +1024,7 @@ namespace GHelper if (extraForm != null && extraForm.Text != "") extraForm.Close(); if (updatesForm != null && updatesForm.Text != "") updatesForm.Close(); if (matrixForm != null && matrixForm.Text != "") matrixForm.Close(); + if (handheldForm != null && handheldForm.Text != "") handheldForm.Close(); } /// @@ -1044,6 +1045,7 @@ namespace GHelper (extraForm != null && extraForm.ContainsFocus) || (updatesForm != null && updatesForm.ContainsFocus) || (matrixForm != null && matrixForm.ContainsFocus) || + (handheldForm != null && handheldForm.ContainsFocus) || this.ContainsFocus || (lostFocusCheck && Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastLostFocus) < 300); } From cda04d3c3b9e390addb82671f87415b2b62f6636 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 27 Jan 2024 12:55:12 +0100 Subject: [PATCH 089/107] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index d400973a..e52094ae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -136,7 +136,7 @@ Huge thanks to [@IceStormNG](https://github.com/IceStormNG) 👑 for contributio G-Helper is **NOT** an operating system, firmware, or driver. It **DOES NOT** "run" your hardware in real-time anyhow. -It's an app that lets you select one of the predefined operating modes created by Asus (and stored in BIOS) and optionally(!) set some settings that already exist on your device same as Armoury Crate can. It does it by using the Asus System Control Interface "driver" that Armoury uses for it. +It's an app that lets you select one of the predefined operating modes created by manufacturer (and stored in BIOS) and optionally(!) set some settings that already exist on your device same as Armoury Crate can. It does it by using the Asus System Control Interface "driver" that Armoury uses for it. If you use equivalent mode/settings as in Armoury Crate - the performance or the behavior of your device won't be different. From ca8531cf2607508aed07fb26955530fb2b0e5848 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 27 Jan 2024 21:43:06 +0100 Subject: [PATCH 090/107] Matrix Pixel Fix --- app/AnimeMatrix/AnimeMatrixDevice.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index 915d39d7..3b4c1740 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -278,7 +278,7 @@ namespace Starlight.AnimeMatrix if (x >= FirstX(y) && x < Width()) SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x, value); - } + } public void SetLedDiagonal(int x, int y, byte color, int deltaX = 0, int deltaY = 0) { @@ -287,6 +287,9 @@ namespace Starlight.AnimeMatrix int plX = (x - y) / 2; int plY = x + y; + + if (x - y == -1) plX = -1; + SetLedPlanar(plX, plY, color); } From d534f5440b76bd083dfb73aa502d9cd8439766cb Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:23:43 +0100 Subject: [PATCH 091/107] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25a816fd..8ecfb988 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,4 +28,4 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh release upload ${{ github.ref_name }} GHelper.zip PluginAdvancedSettings.zip + gh release upload ${{ github.ref_name }} GHelper.exe GHelper.zip PluginAdvancedSettings.zip From 296527d994c4870cd931f3c1e7420935e47b2717 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 28 Jan 2024 16:04:41 +0100 Subject: [PATCH 092/107] UI crash fix https://github.com/seerge/g-helper/issues/1992 --- app/Battery/BatteryControl.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Battery/BatteryControl.cs b/app/Battery/BatteryControl.cs index 6f41b246..e1b20860 100644 --- a/app/Battery/BatteryControl.cs +++ b/app/Battery/BatteryControl.cs @@ -1,4 +1,6 @@ -namespace GHelper.Battery +using GHelper.Properties; + +namespace GHelper.Battery { internal class BatteryControl { @@ -19,7 +21,7 @@ public static void UnSetBatteryLimitFull() { AppConfig.Set("charge_full", 0); - Program.settingsForm.VisualiseBatteryFull(); + Program.settingsForm.Invoke(Program.settingsForm.VisualiseBatteryFull); } public static void AutoBattery(bool init = false) From 3d95fb33ce25c29da8848b126da15765c03813ec Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 28 Jan 2024 20:09:40 +0100 Subject: [PATCH 093/107] Controller mode binding --- app/Ally/AllyControl.cs | 19 +++++++++++++++++++ app/Gpu/AMD/AmdGpuControl.cs | 8 +++++++- app/Helpers/ToastForm.cs | 6 +++++- app/Input/InputDispatcher.cs | 4 ++++ app/Properties/Resources.Designer.cs | 10 ++++++++++ app/Properties/Resources.resx | 3 +++ app/Resources/icons8-controller-96.png | Bin 0 -> 1782 bytes app/Settings.cs | 2 +- app/USB/Aura.cs | 9 +++++---- 9 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 app/Resources/icons8-controller-96.png diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index f8aec50e..1a7bf5f0 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,4 +1,5 @@ using GHelper.Gpu.AMD; +using GHelper.Helpers; using GHelper.Input; using GHelper.Mode; using GHelper.USB; @@ -90,6 +91,7 @@ namespace GHelper.Ally public const string BindBrightnessDown = "04-04-8C-88-8A-05"; public const string BindBrightnessUp = "04-04-8C-88-8A-06"; public const string BindXGM = "04-04-8C-88-8A-04"; + public const string BindToggleMode = "04-04-8C-88-8A-0C"; public const string BindOverlay = "04-03-8C-88-44"; @@ -140,6 +142,8 @@ namespace GHelper.Ally { BindXB, "XBox/Steam" }, + { BindToggleMode, "Controller Mode" }, + { BindVolUp, "Vol Up" }, { BindVolDown, "Vol Down" }, { BindBrightnessUp, "Bright Up" }, @@ -584,6 +588,21 @@ namespace GHelper.Ally settings.VisualiseController(mode); } + + public void ToggleModeHotkey() + { + if (_applyMode == ControllerMode.Gamepad) + { + SetMode(ControllerMode.Mouse); + Program.toast.RunToast("Mouse", ToastIcon.Controller); + } + else + { + SetMode(ControllerMode.Gamepad); + Program.toast.RunToast("Gamepad", ToastIcon.Controller); + } + } + public void ToggleMode() { switch (_mode) diff --git a/app/Gpu/AMD/AmdGpuControl.cs b/app/Gpu/AMD/AmdGpuControl.cs index bae8716c..6583f12a 100644 --- a/app/Gpu/AMD/AmdGpuControl.cs +++ b/app/Gpu/AMD/AmdGpuControl.cs @@ -65,8 +65,14 @@ public class AmdGpuControl : IGpuControl if (!Adl2.Load()) return; - if (Adl2.ADL2_Main_Control_Create(1, out _adlContextHandle) != Adl2.ADL_SUCCESS) + try + { + if (Adl2.ADL2_Main_Control_Create(1, out _adlContextHandle) != Adl2.ADL_SUCCESS) return; + } catch (Exception ex) + { + Logger.WriteLine(ex.Message); return; + } ADLAdapterInfo? internalDiscreteAdapter = FindByType(ADLAsicFamilyType.Discrete); diff --git a/app/Helpers/ToastForm.cs b/app/Helpers/ToastForm.cs index 31be15ca..a96cc509 100644 --- a/app/Helpers/ToastForm.cs +++ b/app/Helpers/ToastForm.cs @@ -50,7 +50,8 @@ namespace GHelper.Helpers MicrophoneMute, FnLock, Battery, - Charger + Charger, + Controller } public class ToastForm : OSDNativeForm @@ -111,6 +112,9 @@ namespace GHelper.Helpers case ToastIcon.Charger: icon = Properties.Resources.icons8_charging_battery_96; break; + case ToastIcon.Controller: + icon = Properties.Resources.icons8_controller_96; + break; } diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 01346d27..580d97f7 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -146,6 +146,7 @@ namespace GHelper.Input hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F1); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F3); + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F4); } // FN-Lock group @@ -374,6 +375,9 @@ namespace GHelper.Input case Keys.F3: Program.settingsForm.gpuControl.ToggleXGM(true); break; + case Keys.F4: + Program.settingsForm.allyControl.ToggleModeHotkey(); + break; case Keys.F14: Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); break; diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 7e09db07..7afc4654 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -250,6 +250,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_controller_96 { + get { + object obj = ResourceManager.GetObject("icons8_controller_96", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 1dc0a113..61b20e70 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -328,4 +328,7 @@ ..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/app/Resources/icons8-controller-96.png b/app/Resources/icons8-controller-96.png new file mode 100644 index 0000000000000000000000000000000000000000..56f92739a6b92f6f76ad34871dcfa9ede4b7f7ee GIT binary patch literal 1782 zcmVUi-J!I`<4~uYC*xkH_Qjcsw4D$K&yMJRXmyOn`1cU&E)HD?tXjSBln1 zfL_2l?AQSGFHmcL;3G?|?*csomjSu}KNF8%i*QWM3H%mQ>rcwZz*T@5B%>B+nWN5@ zGG`K|1+F4L)1=%7^Z^C~HvA*r@1yCoai;ch*pdR=~KK1f%8|6E7GG?LJm?$;} z%N%O1q^u2GMI3ML)CI2M6Oc1Ndte|i4wwttpgw=W{_mjG`84Mj)80U9J0 zgYyV{3t(o^9y^S>;J3&!0rwQ`VFhq^mXGUui}tPpP%-MBMFOT2?O6r!aN5Cd3v7=m zVl^7@>UEUgS)I!8bg|o1b!&vV%(~n1YB08L+aWw2si>b4R{6jd0Dh7&F9IgT{#RX zCjshK%t+|_9e`_q%@MS z%DQIksd7uF;|9&RI`ZLw`GH}E?<-&Wlo&J3Vy+#DR{NyX8i`@Nst}f|0si)|Dg$fjYX}cYe5M(V1Bs} zua6irziATWPDyu=g;BBW947%+#&D)-q3!vQs0I-}9+(B}3iSgm4UOMMel*U%G}Iro zOSDb^7KH9}ly5HpD}lda&Ubm71WZlAK^6RqOI)dv6`Uod#PIV%j>N{5jhsXlMa~I>ZdxMFv|J z#I$8wPR@MczsNE{o0vhXPIPqXpZc9BcQgu8>zsMhGiK0+#a-%**ixG}Q%!=NDnQVL zm_d8aV5=s@>q%D3F$q%j@4VTpT0krVc5=k6Sq_9y`{X67asI5l?bzvwGKq$Bs3o1gQ3GPqwTy zCE$&WC-=Z|Qvy_PyeC_hm=Z9LVm3C@zgroB8k(Ilcp8GB-F*%5C4a{<{{vMq;SzWIeta!Z&clLAKp zCS~mVleVw(&5GSFzj+qulwu=pDf-$9$!c9-X5cu$V;T9rB94eNGHBat(Cv`wyJ5NtQgX|Zi)7H8Fg1w?)u_8RMG?`vLmWX`;?rtUUK6+Ztf`RBz~?E5 zSQb0Fx;Q$OE2N{mfUg_|1{DVTcgU2(y43FYq=#}w!u_)Af(ixu{|O{~!JVG? zv=bqyO3rC<+Dy(2Diq+Xn0G|0bMaRau^?ivm0D;S8dNyIjS&ksdn6WBMTl!JI||=y z@>=71c|Sz2pqT*l7M~h-Ozst*M;7w>dL6)FK{JPgz( { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_SET, MESSAGE_APPLY }); + //AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor, 0x0A), MESSAGE_SET, MESSAGE_APPLY }); if (isACPI) Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed); From 279d07d674014c915a7356a9b9c5c8b33ca8add2 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 28 Jan 2024 21:34:15 +0100 Subject: [PATCH 094/107] Controller Toggle tweaks --- app/Ally/AllyControl.cs | 22 +++++++++++++--------- app/Extra.cs | 5 +++++ app/Input/InputDispatcher.cs | 5 ++++- app/Program.cs | 9 +++++++-- app/USB/Aura.cs | 6 +++--- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 1a7bf5f0..39ce65b2 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -314,7 +314,7 @@ namespace GHelper.Ally if (AppConfig.IsAlly()) settings.VisualiseAlly(true); else return; - SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto)); + SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto), true); settings.VisualiseBacklight(InputDispatcher.GetBacklight()); settings.VisualiseFPSLimit(amdControl.GetFPSLimit()); @@ -477,7 +477,7 @@ namespace GHelper.Ally DecodeBinding(KeyR1).CopyTo(bindings, 27); DecodeBinding(KeyR2).CopyTo(bindings, 38); - AsusHid.WriteInput(CommandReady, null); + //AsusHid.WriteInput(CommandReady, null); AsusHid.WriteInput(bindings, $"B{zone}"); @@ -491,7 +491,7 @@ namespace GHelper.Ally static public void SetDeadzones() { - WakeUp(); + //WakeUp(); AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4, (byte)AppConfig.Get("ls_min", 0), @@ -519,7 +519,7 @@ namespace GHelper.Ally AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0B, 0x01, AppConfig.Is("controller_disabled") ? (byte)0x02 : (byte)0x01 }, "Status"); } - public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto) + public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto, bool init = false) { Task.Run(() => { @@ -543,11 +543,14 @@ namespace GHelper.Ally if (applyMode != ControllerMode.Auto) _applyMode = applyMode; - InputDispatcher.SetBacklightAuto(true); - WakeUp(); + if (init) + { + WakeUp(); + InputDispatcher.SetBacklightAuto(true); + } AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x01, 0x01, (byte)_applyMode }, "Controller"); - AsusHid.WriteInput(CommandSave, null); + //AsusHid.WriteInput(CommandSave, null); BindZone(BindingZone.M1M2); @@ -561,18 +564,19 @@ namespace GHelper.Ally BindZone(BindingZone.Trigger); AsusHid.WriteInput(CommandSave, null); + SetDeadzones(); }); } - private void SetMode(ControllerMode mode) + private void SetMode(ControllerMode mode, bool init = false) { _mode = mode; AppConfig.Set("controller_mode", (int)mode); - ApplyMode(mode); + ApplyMode(mode, init); if (mode == ControllerMode.Auto) { diff --git a/app/Extra.cs b/app/Extra.cs index baf171fe..8784b7cd 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -44,6 +44,11 @@ namespace GHelper customActions.Add("screenpad_up", Properties.Strings.ScreenPadUp); } + if (AppConfig.IsAlly()) + { + customActions.Add("controller", "Controller Mode"); + } + switch (name) { case "m1": diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 580d97f7..d1b4c88d 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -376,7 +376,7 @@ namespace GHelper.Input Program.settingsForm.gpuControl.ToggleXGM(true); break; case Keys.F4: - Program.settingsForm.allyControl.ToggleModeHotkey(); + Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey); break; case Keys.F14: Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); @@ -520,6 +520,9 @@ namespace GHelper.Input case "calculator": LaunchProcess("calc"); break; + case "controller": + Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey); + break; default: break; } diff --git a/app/Program.cs b/app/Program.cs index 701cb46f..7e0f0c92 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -229,10 +229,15 @@ namespace GHelper BatteryControl.AutoBattery(init); - settingsForm.AutoKeyboard(); settingsForm.matrixControl.SetMatrix(true); - allyControl.Init(); + if (AppConfig.IsAlly()) + { + allyControl.Init(); + } else + { + settingsForm.AutoKeyboard(); + } } private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index c2addfdb..982fc94a 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -250,7 +250,7 @@ namespace GHelper.USB msg[5] = mono ? (byte)0 : color.G; // G msg[6] = mono ? (byte)0 : color.B; // B msg[7] = (byte)speed; // aura.speed as u8; - msg[8] = 0xFF; // aura.direction as u8; + msg[8] = 0x00; // aura.direction as u8; msg[9] = mode == AuraMode.AuraBreathe ? (byte)1 : (byte)0; msg[10] = color2.R; // R msg[11] = mono ? (byte)0 : color2.G; // G @@ -294,12 +294,12 @@ namespace GHelper.USB if (delay) await Task.Delay(TimeSpan.FromSeconds(1)); if (isACPI) Program.acpi.TUFKeyboardBrightness(brightness); - AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log); + AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log); if (AppConfig.IsAlly()) ApplyAura(); if (AppConfig.ContainsModel("GA503")) - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log); + AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log); }); From bc75b154c3444070e90581eea6d7c7659406a184 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:49:03 +0100 Subject: [PATCH 095/107] New translations strings.resx (Polish) (#1993) --- app/Properties/Strings.pl.resx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Properties/Strings.pl.resx b/app/Properties/Strings.pl.resx index 7b58d26c..3e0b7020 100644 --- a/app/Properties/Strings.pl.resx +++ b/app/Properties/Strings.pl.resx @@ -504,10 +504,10 @@ Nadal chcesz kontynuować? Synchronizuj z myszką - Multi Zone + Wiele stref - Multi Zone Strong + Wiele stref (mocniejsze) Wyciszenie mikrofonu @@ -525,7 +525,7 @@ Nadal chcesz kontynuować? Nie połączono - One Zone + Jedna strefa Otwórz okno G-Helper From f2371b09316c7327ac67813fb5e555dcb35b9203 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 29 Jan 2024 12:05:29 +0100 Subject: [PATCH 096/107] Ally tweaks --- app/Ally/AllyControl.cs | 17 ++++++++--------- app/GHelper.csproj | 2 +- app/Program.cs | 6 +++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 39ce65b2..299c6a79 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,7 +1,6 @@ using GHelper.Gpu.AMD; using GHelper.Helpers; using GHelper.Input; -using GHelper.Mode; using GHelper.USB; using HidSharp; using System.Text; @@ -108,8 +107,8 @@ namespace GHelper.Ally public const string BindShowKeyboard = "05-19"; - static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0a, 0x01 }; - static byte[] CommandSave = new byte[] { AsusHid.INPUT_ID, 0xd1, 0x0f, 0x20 }; + static byte[] CommandReady = new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0A, 0x01 }; + static byte[] CommandSave = new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0F, 0x20 }; public static Dictionary BindCodes = new Dictionary { @@ -317,7 +316,9 @@ namespace GHelper.Ally SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto), true); settings.VisualiseBacklight(InputDispatcher.GetBacklight()); - settings.VisualiseFPSLimit(amdControl.GetFPSLimit()); + + fpsLimit = amdControl.GetFPSLimit(); + settings.VisualiseFPSLimit(fpsLimit); } @@ -424,7 +425,7 @@ namespace GHelper.Ally KeyL1 = AppConfig.GetString("bind_ls", desktop ? BindShift : BindLS); KeyR1 = AppConfig.GetString("bind_rs", desktop ? BindMouseL : BindRS); KeyL2 = AppConfig.GetString("bind2_ls"); - KeyR2 = AppConfig.GetString("bind2_rs"); + KeyR2 = AppConfig.GetString("bind2_rs", BindToggleMode); break; case BindingZone.Bumper: KeyL1 = AppConfig.GetString("bind_lb", desktop ? BindTab : BindLB); @@ -480,8 +481,6 @@ namespace GHelper.Ally //AsusHid.WriteInput(CommandReady, null); AsusHid.WriteInput(bindings, $"B{zone}"); - - } static void WakeUp() @@ -529,10 +528,10 @@ namespace GHelper.Ally HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID); int count = 0; - while (input == null && count++ < 5) + while (input == null && count++ < 10) { input = AsusHid.FindHidStream(AsusHid.INPUT_ID); - Thread.Sleep(2000); + Thread.Sleep(500); } if (input == null) diff --git a/app/GHelper.csproj b/app/GHelper.csproj index c43e6850..1c264264 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.150 + 0.151 diff --git a/app/Program.cs b/app/Program.cs index 7e0f0c92..6488b564 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -278,7 +278,11 @@ namespace GHelper settingsForm.Activate(); settingsForm.Left = Screen.FromControl(settingsForm).WorkingArea.Width - 10 - settingsForm.Width; - settingsForm.Top = Screen.FromControl(settingsForm).WorkingArea.Height - 10 - settingsForm.Height; + + if (AppConfig.IsAlly()) + settingsForm.Top = Screen.FromControl(settingsForm).Bounds.Height - 100 - settingsForm.Height; + else + settingsForm.Top = Screen.FromControl(settingsForm).WorkingArea.Height - 10 - settingsForm.Height; settingsForm.VisualiseGPUMode(); } From e04c4cd46fec4785595cb53e05583eda6d360739 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 29 Jan 2024 12:31:31 +0100 Subject: [PATCH 097/107] AMD Overlay button --- app/Properties/Resources.Designer.cs | 10 ++++++++++ app/Properties/Resources.resx | 23 +++++++++++++---------- app/Resources/icons8-heartbeat-32.png | Bin 0 -> 387 bytes app/Settings.Designer.cs | 25 +++++++++++++++++++++++++ app/Settings.cs | 7 +++++++ 5 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 app/Resources/icons8-heartbeat-32.png diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 7afc4654..8ff78342 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -340,6 +340,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_heartbeat_32 { + get { + object obj = ResourceManager.GetObject("icons8-heartbeat-32", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 61b20e70..7d0ca668 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -136,9 +136,6 @@ ..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -196,6 +193,9 @@ ..\Resources\icons8-remove-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -226,6 +226,12 @@ ..\Resources\icons8-keyboard-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -313,8 +319,8 @@ ..\Resources\icons8-software-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-share-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icons8-soonvibes-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -325,10 +331,7 @@ ..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-heartbeat-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/app/Resources/icons8-heartbeat-32.png b/app/Resources/icons8-heartbeat-32.png new file mode 100644 index 0000000000000000000000000000000000000000..3592c445418509cad91d7ae3e912854db24f694d GIT binary patch literal 387 zcmV-}0et?6P)K}G2{V~Yg2lS7AFJ0Fr2Hd+{8t^9|rFBzn%Mv*_{DOl{!=tKnx%SkQs&KnltxV z#fCr5$EOcK%8wHOGowhDbL|6=F=V5aW-9OP0#pHv01N?CLICuX7li;ADsK=1V5z)C z2!KR+zt;w6I4%`g(~|cVi`5*U?EsLqz2sDUpQw+*0PhZfH|2NK`X7J?Yk-LZK-Tt} z=DZhcfG@87umI(GMX%=QoUtXqBY=%MehWTt=)I~vTjf0!1;`xHXOX!)`T2)OOD+Tu zF^={6I$N#@K$7d}10J_3uVw9x0X%bmmqqEC2MXPU_cITqp+~a0MBSYGPBv;*m2McId}Yc2o)002ovPDHLkV1glpo{|6n literal 0 HcmV?d00001 diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index c6e5c94d..d0b30d58 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -118,6 +118,7 @@ namespace GHelper panelAllyTitle = new Panel(); pictureAlly = new PictureBox(); labelAlly = new Label(); + buttonOverlay = new RButton(); panelMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); panelMatrixTitle.SuspendLayout(); @@ -694,6 +695,7 @@ namespace GHelper tableAMD.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); tableAMD.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); tableAMD.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F)); + tableAMD.Controls.Add(buttonOverlay, 0, 0); tableAMD.Controls.Add(buttonFPS, 0, 0); tableAMD.Dock = DockStyle.Top; tableAMD.Location = new Point(20, 316); @@ -1584,6 +1586,28 @@ namespace GHelper labelAlly.TabIndex = 26; labelAlly.Text = "Ally Controller"; // + // buttonOverlay + // + buttonOverlay.Activated = false; + buttonOverlay.BackColor = SystemColors.ControlLightLight; + buttonOverlay.BorderColor = Color.Transparent; + buttonOverlay.BorderRadius = 5; + buttonOverlay.Dock = DockStyle.Fill; + buttonOverlay.FlatAppearance.BorderSize = 0; + buttonOverlay.FlatStyle = FlatStyle.Flat; + buttonOverlay.ForeColor = SystemColors.ControlText; + buttonOverlay.Image = Properties.Resources.icons8_heartbeat_32; + buttonOverlay.ImageAlign = ContentAlignment.MiddleRight; + buttonOverlay.Location = new Point(266, 4); + buttonOverlay.Margin = new Padding(4); + buttonOverlay.Name = "buttonOverlay"; + buttonOverlay.Secondary = false; + buttonOverlay.Size = new Size(254, 72); + buttonOverlay.TabIndex = 12; + buttonOverlay.Text = "AMD Overlay"; + buttonOverlay.TextImageRelation = TextImageRelation.ImageBeforeText; + buttonOverlay.UseVisualStyleBackColor = false; + // // SettingsForm // AutoScaleDimensions = new SizeF(192F, 192F); @@ -1759,5 +1783,6 @@ namespace GHelper private TableLayoutPanel tableAMD; private RButton buttonFPS; private RButton buttonController; + private RButton buttonOverlay; } } diff --git a/app/Settings.cs b/app/Settings.cs index 0ad3e14f..1b048c89 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -235,7 +235,9 @@ namespace GHelper buttonControllerMode.Click += ButtonControllerMode_Click; buttonBacklight.Click += ButtonBacklight_Click; + buttonFPS.Click += ButtonFPS_Click; + buttonOverlay.Click += ButtonOverlay_Click; Text = "G-Helper " + (ProcessHelper.IsUserAdministrator() ? "—" : "-") + " " + AppConfig.GetModelShort(); TopMost = AppConfig.Is("topmost"); @@ -250,6 +252,11 @@ namespace GHelper panelPerformance.Focus(); } + private void ButtonOverlay_Click(object? sender, EventArgs e) + { + KeyboardHook.KeyKeyKeyPress(Keys.LControlKey, Keys.LShiftKey, Keys.O); + } + private void ButtonHandheld_Click(object? sender, EventArgs e) { if (handheldForm == null || handheldForm.Text == "") From 297ebe5d64cfc2a715c86581dca4165e151abb37 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 29 Jan 2024 22:00:10 +0100 Subject: [PATCH 098/107] Cleanup --- app/Battery/BatteryControl.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Battery/BatteryControl.cs b/app/Battery/BatteryControl.cs index e1b20860..e674a6a9 100644 --- a/app/Battery/BatteryControl.cs +++ b/app/Battery/BatteryControl.cs @@ -1,6 +1,4 @@ -using GHelper.Properties; - -namespace GHelper.Battery +namespace GHelper.Battery { internal class BatteryControl { From 621835076bdf5ea0f94cde34015f35485e344070 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:49:04 +0100 Subject: [PATCH 099/107] Lightbar toggle for old devices https://github.com/seerge/g-helper/issues/1929 --- app/USB/Aura.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 982fc94a..96858804 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -318,6 +318,7 @@ namespace GHelper.USB if (flags.ShutdownLogo) keyb |= 1 << 6; if (flags.ShutdownKeyb) keyb |= 1 << 7; + if (flags.AwakeBar) bar |= 1 << 0; if (flags.BootBar) bar |= 1 << 1; if (flags.AwakeBar) bar |= 1 << 2; if (flags.SleepBar) bar |= 1 << 3; @@ -664,6 +665,8 @@ namespace GHelper.USB int _speed = (Speed == AuraSpeed.Normal) ? 0xeb : (Speed == AuraSpeed.Fast) ? 0xf5 : 0xe1; + //AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xBD, 0x01, 0xFF, 0x1F, 0xFF, 0x0F }); + AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_SET, MESSAGE_APPLY }); //AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor, 0x0A), MESSAGE_SET, MESSAGE_APPLY }); From bdc1f92f1b11334ade886b8fc828cf9dcf51d32f Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:43:25 +0100 Subject: [PATCH 100/107] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ecfb988..bd730fbd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,4 +28,4 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh release upload ${{ github.ref_name }} GHelper.exe GHelper.zip PluginAdvancedSettings.zip + gh release upload ${{ github.ref_name }} app/bin/x64/Release/net7.0-windows/win-x64/publish/GHelper.exe GHelper.zip PluginAdvancedSettings.zip From e57f61b07aa5bae5de4006b4cdfcab998c8039cd Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 30 Jan 2024 14:35:03 +0100 Subject: [PATCH 101/107] Release Update Logic --- .github/workflows/release.yml | 2 +- app/Ryzen/RyzenControl.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ecfb988..cfc9d5e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,4 +28,4 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh release upload ${{ github.ref_name }} GHelper.exe GHelper.zip PluginAdvancedSettings.zip + gh release upload ${{ github.ref_name }} GHelper.exe GHelper.zip diff --git a/app/Ryzen/RyzenControl.cs b/app/Ryzen/RyzenControl.cs index 26bd2e44..77330f5b 100644 --- a/app/Ryzen/RyzenControl.cs +++ b/app/Ryzen/RyzenControl.cs @@ -154,8 +154,9 @@ namespace Ryzen public static void DownloadRing() { - var appVersion = new Version(Assembly.GetExecutingAssembly().GetName().Version.ToString()); - string requestUri = "https://github.com/seerge/g-helper/releases/download/v" + appVersion.Major + "." + appVersion.Minor + "/PluginAdvancedSettings.zip"; + //var appVersion = new Version(Assembly.GetExecutingAssembly().GetName().Version.ToString()); + //string requestUri = "https://github.com/seerge/g-helper/releases/download/v" + appVersion.Major + "." + appVersion.Minor + "/PluginAdvancedSettings.zip"; + string requestUri = "https://github.com/seerge/g-helper/releases/download/v0.150/PluginAdvancedSettings.zip"; Uri uri = new Uri(requestUri); From 2a7bea83ad268c8b735e26bf465f091096715c63 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 30 Jan 2024 14:56:28 +0100 Subject: [PATCH 102/107] Aura cleanup --- app/USB/Aura.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 96858804..6a63e040 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -664,11 +664,7 @@ namespace GHelper.USB } int _speed = (Speed == AuraSpeed.Normal) ? 0xeb : (Speed == AuraSpeed.Fast) ? 0xf5 : 0xe1; - - //AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xBD, 0x01, 0xFF, 0x1F, 0xFF, 0x0F }); - AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_SET, MESSAGE_APPLY }); - //AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor, 0x0A), MESSAGE_SET, MESSAGE_APPLY }); if (isACPI) Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed); From 31eef60e75bbdb393811599d62238ac553a60c72 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 30 Jan 2024 14:59:05 +0100 Subject: [PATCH 103/107] UI tweaks --- app/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Program.cs b/app/Program.cs index 6488b564..4cee9ad4 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -280,7 +280,7 @@ namespace GHelper settingsForm.Left = Screen.FromControl(settingsForm).WorkingArea.Width - 10 - settingsForm.Width; if (AppConfig.IsAlly()) - settingsForm.Top = Screen.FromControl(settingsForm).Bounds.Height - 100 - settingsForm.Height; + settingsForm.Top = Screen.FromControl(settingsForm).Bounds.Height - 110 - settingsForm.Height; else settingsForm.Top = Screen.FromControl(settingsForm).WorkingArea.Height - 10 - settingsForm.Height; From d73458149335ffbdcf0d67ca079cc3a73894c6b0 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:02:11 +0100 Subject: [PATCH 104/107] Release logic --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd730fbd..0159dd9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,9 +23,8 @@ jobs: run: | dotnet publish app/GHelper.sln --configuration Release --runtime win-x64 -p:PublishSingleFile=true --no-self-contained powershell Compress-Archive app/bin/x64/Release/net7.0-windows/win-x64/publish/GHelper.exe GHelper.zip - powershell Compress-Archive app/bin/x64/Release/net7.0-windows/win-x64/publish/WinRing* PluginAdvancedSettings.zip - name: Upload env: GH_TOKEN: ${{ github.token }} run: | - gh release upload ${{ github.ref_name }} app/bin/x64/Release/net7.0-windows/win-x64/publish/GHelper.exe GHelper.zip PluginAdvancedSettings.zip + gh release upload ${{ github.ref_name }} app/bin/x64/Release/net7.0-windows/win-x64/publish/GHelper.exe GHelper.zip From b2a64bf0122e1c93848bba1dd65b666e5564aebc Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:04:12 +0100 Subject: [PATCH 105/107] Ally cleanup --- app/Ally/AllyControl.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index 299c6a79..f0c826ff 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -490,8 +490,6 @@ namespace GHelper.Ally static public void SetDeadzones() { - //WakeUp(); - AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4, (byte)AppConfig.Get("ls_min", 0), (byte)AppConfig.Get("ls_max", 100), @@ -552,7 +550,6 @@ namespace GHelper.Ally //AsusHid.WriteInput(CommandSave, null); BindZone(BindingZone.M1M2); - BindZone(BindingZone.DPadUpDown); BindZone(BindingZone.DPadLeftRight); BindZone(BindingZone.StickClick); From 1478f80c1a3f83af14575750d1478e626f630807 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:24:49 +0100 Subject: [PATCH 106/107] Ally UI Fix --- app/AppConfig.cs | 2 +- app/Program.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 1456c10a..9c68b277 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -379,7 +379,7 @@ public static class AppConfig public static bool IsStrix() { - return ContainsModel("Strix") || ContainsModel("Scar"); + return ContainsModel("Strix") || ContainsModel("Scar") || ContainsModel("G703G"); } public static bool IsStrixLimitedRGB() diff --git a/app/Program.cs b/app/Program.cs index 4cee9ad4..d71bb0bd 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -280,7 +280,7 @@ namespace GHelper settingsForm.Left = Screen.FromControl(settingsForm).WorkingArea.Width - 10 - settingsForm.Width; if (AppConfig.IsAlly()) - settingsForm.Top = Screen.FromControl(settingsForm).Bounds.Height - 110 - settingsForm.Height; + settingsForm.Top = Math.Max(10, Screen.FromControl(settingsForm).Bounds.Height - 110 - settingsForm.Height); else settingsForm.Top = Screen.FromControl(settingsForm).WorkingArea.Height - 10 - settingsForm.Height; From 222cefcee237b062ff0891ed191fcb7285347d00 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Tue, 30 Jan 2024 16:58:54 +0100 Subject: [PATCH 107/107] LED brightness fix for TuF M3 Gen II (#2004) * Support for Strix Carry (P508) * Fixes polling rate, angle snapping and debounce for Gladius II Origin. * The Gen2 version of the TuF M3 uses 0-100 for brightness. --- app/Peripherals/Mouse/Models/TUFM3.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Peripherals/Mouse/Models/TUFM3.cs b/app/Peripherals/Mouse/Models/TUFM3.cs index 57014589..633952bf 100644 --- a/app/Peripherals/Mouse/Models/TUFM3.cs +++ b/app/Peripherals/Mouse/Models/TUFM3.cs @@ -124,5 +124,11 @@ { return "TUF GAMING M3 (Gen II)"; } + + public override int MaxBrightness() + { + return 100; + } + } }