diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index c4b8c8fe..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - -## NOTE -Bug reports without clear information or scenario to reproduce and logs from ``%AppData%\GHelper`` will be closed without answer. Please respect the time of the developer. Thanks. - -**Describe the bug** -A clear and concise description of what the bug is. - -**Clear scenario to Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. Explanation of an error or a bug - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**App Logs** -Please include and attach log.txt from ``%AppData%\GHelper`` - -**Screenshots or screencasts** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. Windows 11] - - Laptop model - -**Asus software** -- Armoury Crate (or it's services installed) -- MyASUS installed -- Other Asus services running in background - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..37d95fcd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,82 @@ +name: Bug Report +description: Something isn't working correctly +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report. The more information you provide, the easier it will be for me to fix it! + - 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 was provided, my issue will be closed without an answer. + required: true + validations: + required: true + - type: textarea + id: description + attributes: + label: What's wrong? + description: Provide detailed description of what is wrong or does not work as expected. + placeholder: Provide detailed description of what is wrong or does not work as expected. + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: How to reproduce the bug? + description: Describe how to reproduce the behavior. Be as specific as possible and provide as many details as possible. + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + validations: + required: true + - type: textarea + id: logs + attributes: + label: Logs + placeholder: Please drag and drop complete log file from ``%APPDATA%\GHelper\log.txt`` + description: Please drag and drop complete log file from ``%APPDATA%\GHelper\log.txt`` + validations: + required: true + - 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 to help explain your problem. + - type: checkboxes + id: asus + attributes: + label: Asus Software + description: Please check what Asus/Armoury Services do you have installed and running + options: + - label: Armoury Crate + - label: MyAsus + - label: Other Asus Services + - type: input + id: version + attributes: + label: Version + description: G-Helper version? + placeholder: e.g. 0.146 + - type: input + id: os + attributes: + label: OS + description: Which operating system do you use? + placeholder: e.g. Windows 11 21H2 + diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs new file mode 100644 index 00000000..ce404457 --- /dev/null +++ b/app/Ally/AllyControl.cs @@ -0,0 +1,52 @@ +using GHelper.USB; + +namespace GHelper.Ally +{ + + public enum ControllerMode : int + { + Gamepad = 1, + WASD = 2, + Mouse = 3, + } + + public class AllyControl + { + SettingsForm settings; + ControllerMode mode = ControllerMode.Gamepad; + public AllyControl(SettingsForm settingsForm) + { + settings = settingsForm; + } + + public void Init() + { + if (!AppConfig.IsAlly()) + { + settings.VisualiseAlly(false); + return; + } + + mode = (ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Gamepad); + SetMode(mode); + } + + private void SetMode(ControllerMode mode) + { + 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++; + + SetMode(mode); + } + + } +} diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 8bd990b4..887d305d 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"); + return (ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513R") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G713RC") || ContainsModel("G513QM")) && !Is("per_key_rgb"); } public static bool IsNoDirectRGB() @@ -490,6 +490,11 @@ public static class AppConfig return ContainsModel("FA507"); } + public static bool IsIntelHX() + { + return ContainsModel("G814") || ContainsModel("G614") || ContainsModel("G834") || ContainsModel("G634"); + } + public static bool IsASUS() { return ContainsModel("ROG") || ContainsModel("TUF") || ContainsModel("Vivobook") || ContainsModel("Zenbook"); diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index f7ca78dc..effd6c04 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -259,6 +259,11 @@ public class AsusACPI DefaultTotal = 30; } + if (AppConfig.IsIntelHX()) + { + MaxTotal = 175; + } + if (AppConfig.DynamicBoost5()) { MaxGPUBoost = 5; diff --git a/app/AutoUpdate/AutoUpdateControl.cs b/app/AutoUpdate/AutoUpdateControl.cs index 8c60a0a2..42093c87 100644 --- a/app/AutoUpdate/AutoUpdateControl.cs +++ b/app/AutoUpdate/AutoUpdateControl.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using GHelper.Helpers; +using System.Diagnostics; using System.Net; using System.Reflection; using System.Text.Json; @@ -130,6 +131,7 @@ namespace GHelper.AutoUpdate cmd.StartInfo.CreateNoWindow = true; cmd.StartInfo.FileName = "powershell"; cmd.StartInfo.Arguments = command; + if (ProcessHelper.IsUserAdministrator()) cmd.StartInfo.Verb = "runas"; cmd.Start(); } catch (Exception ex) diff --git a/app/GHelper.csproj b/app/GHelper.csproj index baba1abe..8f54d835 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.146 + 0.147 diff --git a/app/Helpers/OptimizationService.cs b/app/Helpers/OptimizationService.cs index 8ab7b314..18218b1e 100644 --- a/app/Helpers/OptimizationService.cs +++ b/app/Helpers/OptimizationService.cs @@ -1,7 +1,4 @@ -using Microsoft.Win32; -using System.Diagnostics; -using System.Text; -using System.Text.RegularExpressions; +using System.Diagnostics; namespace GHelper.Helpers { @@ -21,35 +18,6 @@ namespace GHelper.Helpers "AsusCertService" }; - public static void SetChargeLimit(int newValue) - { - // Set the path to the .ini file - string path = @"C:\ProgramData\ASUS\ASUS System Control Interface\ASUSOptimization\Customization.ini"; - - - // Make a backup copy of the INI file - string backupPath = path + ".bak"; - File.Copy(path, backupPath, true); - - string fileContents = File.ReadAllText(path, Encoding.Unicode); - - // Find the section [BatteryHealthCharging] - string sectionPattern = @"\[BatteryHealthCharging\]\s*(version=\d+)?\s+value=(\d+)"; - Match sectionMatch = Regex.Match(fileContents, sectionPattern); - if (sectionMatch.Success) - { - // Replace the value with the new value - string oldValueString = sectionMatch.Groups[2].Value; - int oldValue = int.Parse(oldValueString); - string newSection = sectionMatch.Value.Replace($"value={oldValue}", $"value={newValue}"); - - // Replace the section in the file contents - fileContents = fileContents.Replace(sectionMatch.Value, newSection); - - File.WriteAllText(path, fileContents, Encoding.Unicode); - } - } - public static bool IsRunning() { return Process.GetProcessesByName("AsusOptimization").Count() > 0; @@ -72,25 +40,6 @@ namespace GHelper.Helpers } - public static void SetBacklightOffDelay(int value = 60) - { - try - { - RegistryKey myKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\ASUS\ASUS System Control Interface\AsusOptimization\ASUS Keyboard Hotkeys", true); - if (myKey != null) - { - myKey.SetValue("TurnOffKeybdLight", value, RegistryValueKind.DWord); - myKey.Close(); - } - } - catch (Exception ex) - { - Logger.WriteLine(ex.Message); - } - } - - - public static void StopAsusServices() { foreach (string service in services) diff --git a/app/Program.cs b/app/Program.cs index 494abac5..b94b1620 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -1,3 +1,4 @@ +using GHelper.Ally; using GHelper.Battery; using GHelper.Display; using GHelper.Gpu; @@ -5,6 +6,8 @@ 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; @@ -30,6 +33,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 ScreenControl screenControl = new ScreenControl(); public static ClamshellModeControl clamshellControl = new ClamshellModeControl(); @@ -225,6 +229,8 @@ namespace GHelper settingsForm.AutoKeyboard(); settingsForm.matrixControl.SetMatrix(true); + + controllerControl.Init(); } private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index c68924a0..4fe184b7 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -220,6 +220,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_controller_32 { + get { + object obj = ResourceManager.GetObject("icons8-controller-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 3242cd04..83108d59 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -133,6 +133,9 @@ ..\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 @@ -148,6 +151,9 @@ ..\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 @@ -214,6 +220,9 @@ ..\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 @@ -277,6 +286,9 @@ ..\Resources\icons8-settings-32.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 @@ -289,16 +301,7 @@ ..\Resources\icons8-rocket-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\dot-eco.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\dot-ultimate.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 \ No newline at end of file diff --git a/app/Resources/icons8-controller-32.png b/app/Resources/icons8-controller-32.png new file mode 100644 index 00000000..2be3db0e Binary files /dev/null and b/app/Resources/icons8-controller-32.png differ diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 28adcfaf..8295764d 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -108,6 +108,13 @@ namespace GHelper panelPeripheralsTile = new Panel(); 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(); panelMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); panelMatrixTitle.SuspendLayout(); @@ -141,6 +148,10 @@ namespace GHelper tableLayoutPeripherals.SuspendLayout(); panelPeripheralsTile.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)picturePeripherals).BeginInit(); + panelAlly.SuspendLayout(); + tableLayoutAlly.SuspendLayout(); + panelAllyTitle.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit(); SuspendLayout(); // // panelMatrix @@ -282,7 +293,7 @@ namespace GHelper panelBattery.Controls.Add(sliderBattery); panelBattery.Controls.Add(panelBatteryTitle); panelBattery.Dock = DockStyle.Top; - panelBattery.Location = new Point(11, 1265); + panelBattery.Location = new Point(11, 1441); panelBattery.Margin = new Padding(0); panelBattery.Name = "panelBattery"; panelBattery.Padding = new Padding(20, 20, 20, 10); @@ -374,7 +385,7 @@ namespace GHelper panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelFooter.Controls.Add(tableButtons); panelFooter.Dock = DockStyle.Top; - panelFooter.Location = new Point(11, 1440); + panelFooter.Location = new Point(11, 1616); panelFooter.Margin = new Padding(0); panelFooter.Name = "panelFooter"; panelFooter.Padding = new Padding(20); @@ -1232,7 +1243,7 @@ namespace GHelper panelVersion.Controls.Add(labelCharge); panelVersion.Controls.Add(checkStartup); panelVersion.Dock = DockStyle.Top; - panelVersion.Location = new Point(11, 1384); + panelVersion.Location = new Point(11, 1560); panelVersion.Margin = new Padding(4); panelVersion.Name = "panelVersion"; panelVersion.Size = new Size(827, 56); @@ -1257,7 +1268,7 @@ namespace GHelper panelPeripherals.Controls.Add(tableLayoutPeripherals); panelPeripherals.Controls.Add(panelPeripheralsTile); panelPeripherals.Dock = DockStyle.Top; - panelPeripherals.Location = new Point(11, 1067); + panelPeripherals.Location = new Point(11, 1243); panelPeripherals.Margin = new Padding(0); panelPeripherals.Name = "panelPeripherals"; panelPeripherals.Padding = new Padding(20, 20, 20, 10); @@ -1391,17 +1402,115 @@ namespace GHelper labelPeripherals.TabIndex = 40; labelPeripherals.Text = "Peripherals"; // + // panelAlly + // + 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.Margin = new Padding(0); + panelAlly.Name = "panelAlly"; + panelAlly.Padding = new Padding(20, 20, 20, 0); + panelAlly.Size = new Size(827, 176); + panelAlly.TabIndex = 8; + panelAlly.TabStop = true; + // + // 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; + tableLayoutAlly.AutoSizeMode = AutoSizeMode.GrowAndShrink; + tableLayoutAlly.ColumnCount = 3; + 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(buttonController, 0, 0); + tableLayoutAlly.Dock = DockStyle.Top; + tableLayoutAlly.Location = new Point(20, 60); + tableLayoutAlly.Margin = new Padding(8, 4, 8, 4); + tableLayoutAlly.Name = "tableLayoutAlly"; + tableLayoutAlly.RowCount = 1; + tableLayoutAlly.RowStyles.Add(new RowStyle(SizeType.Absolute, 80F)); + tableLayoutAlly.Size = new Size(787, 80); + tableLayoutAlly.TabIndex = 23; + // + // buttonController + // + buttonController.Activated = false; + buttonController.BackColor = SystemColors.ControlLightLight; + buttonController.BorderColor = Color.Transparent; + buttonController.BorderRadius = 5; + buttonController.Dock = DockStyle.Fill; + buttonController.FlatAppearance.BorderSize = 0; + buttonController.FlatStyle = FlatStyle.Flat; + buttonController.ForeColor = SystemColors.ControlText; + buttonController.Location = new Point(4, 4); + buttonController.Margin = new Padding(4); + buttonController.Name = "buttonController"; + buttonController.Secondary = false; + buttonController.Size = new Size(254, 72); + buttonController.TabIndex = 9; + buttonController.Text = Properties.Strings.AutoMode; + buttonController.UseVisualStyleBackColor = false; + // + // panelAllyTitle + // + panelAllyTitle.Controls.Add(pictureAlly); + panelAllyTitle.Controls.Add(labelAlly); + panelAllyTitle.Dock = DockStyle.Top; + panelAllyTitle.Location = new Point(20, 20); + panelAllyTitle.Margin = new Padding(4); + panelAllyTitle.Name = "panelAllyTitle"; + panelAllyTitle.Size = new Size(787, 40); + panelAllyTitle.TabIndex = 25; + // + // pictureAlly + // + pictureAlly.BackgroundImage = Properties.Resources.icons8_controller_32; + pictureAlly.BackgroundImageLayout = ImageLayout.Center; + pictureAlly.Location = new Point(5, 0); + pictureAlly.Margin = new Padding(4); + pictureAlly.Name = "pictureAlly"; + pictureAlly.Size = new Size(32, 32); + pictureAlly.TabIndex = 27; + pictureAlly.TabStop = false; + // + // labelAlly + // + labelAlly.AutoSize = true; + labelAlly.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelAlly.Location = new Point(45, 0); + labelAlly.Margin = new Padding(8, 0, 8, 0); + labelAlly.Name = "labelAlly"; + labelAlly.Size = new Size(58, 32); + labelAlly.TabIndex = 26; + labelAlly.Text = "Ally"; + // // SettingsForm // AutoScaleDimensions = new SizeF(192F, 192F); AutoScaleMode = AutoScaleMode.Dpi; AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; - ClientSize = new Size(849, 1552); + ClientSize = new Size(849, 1717); Controls.Add(panelFooter); Controls.Add(panelVersion); Controls.Add(panelBattery); Controls.Add(panelPeripherals); + Controls.Add(panelAlly); Controls.Add(panelKeyboard); Controls.Add(panelMatrix); Controls.Add(panelScreen); @@ -1465,6 +1574,12 @@ namespace GHelper panelPeripheralsTile.ResumeLayout(false); panelPeripheralsTile.PerformLayout(); ((System.ComponentModel.ISupportInitialize)picturePeripherals).EndInit(); + panelAlly.ResumeLayout(false); + panelAlly.PerformLayout(); + tableLayoutAlly.ResumeLayout(false); + panelAllyTitle.ResumeLayout(false); + panelAllyTitle.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -1548,5 +1663,12 @@ namespace GHelper private Label labelCharge; 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; } } diff --git a/app/Settings.cs b/app/Settings.cs index d8af8b90..e117393c 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1,4 +1,5 @@ -using GHelper.AnimeMatrix; +using GHelper.Ally; +using GHelper.AnimeMatrix; using GHelper.AutoUpdate; using GHelper.Battery; using GHelper.Display; @@ -23,6 +24,7 @@ namespace GHelper public GPUModeControl gpuControl; ScreenControl screenControl = new ScreenControl(); + AllyControl controllerControl; AutoUpdateControl updateControl; AsusMouseSettings? mouseSettings; @@ -54,6 +56,7 @@ namespace GHelper gpuControl = new GPUModeControl(this); updateControl = new AutoUpdateControl(this); matrixControl = new AniMatrixControl(this); + controllerControl = new AllyControl(this); buttonSilent.Text = Properties.Strings.Silent; buttonBalanced.Text = Properties.Strings.Balanced; @@ -227,6 +230,8 @@ namespace GHelper buttonBatteryFull.MouseLeave += ButtonBatteryFull_MouseLeave; buttonBatteryFull.Click += ButtonBatteryFull_Click; + buttonController.Click += ButtonController_Click; + Text = "G-Helper " + (ProcessHelper.IsUserAdministrator() ? "—" : "-") + " " + AppConfig.GetModelShort(); TopMost = AppConfig.Is("topmost"); @@ -240,6 +245,32 @@ namespace GHelper panelPerformance.Focus(); } + private void ButtonController_Click(object? sender, EventArgs e) + { + controllerControl.ToggleMode(); + } + + public void VisualiseAlly(bool visible = false) + { + panelAlly.Visible = visible; + } + + public void VisualiseController(ControllerMode mode) + { + switch (mode) + { + case ControllerMode.Gamepad: + buttonController.Text = "Gamepad"; + break; + case ControllerMode.WASD: + buttonController.Text = "WASD"; + break; + case ControllerMode.Mouse: + buttonController.Text = "Mouse"; + break; + } + } + private void SettingsForm_LostFocus(object? sender, EventArgs e) { lastLostFocus = DateTimeOffset.Now.ToUnixTimeMilliseconds();