From a9c6033c3598bed2153ad21f9e8ec6ffdea4acd4 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 25 Feb 2024 11:39:43 +0100 Subject: [PATCH] Intel E/P Cores UI Tweaks --- app/AsusACPI.cs | 7 +++---- app/Extra.Designer.cs | 38 +++++++++++++++++++++++++++++--------- app/Extra.cs | 15 +++++++-------- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index 1e955c7b..1bc64a13 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -2,7 +2,6 @@ using GHelper.USB; using System.Management; using System.Runtime.InteropServices; -using static System.Runtime.InteropServices.JavaScript.JSType; public enum AsusFan { @@ -145,7 +144,7 @@ public class AsusACPI public const int DefaultCPU = 80; public const int MinGPUBoost = 5; - public static int MaxGPUBoost = 50; + public static int MaxGPUBoost = 25; public const int MinGPUTemp = 75; public const int MaxGPUTemp = 87; @@ -685,7 +684,7 @@ public class AsusACPI if (value < 0) return (-1, -1); Logger.WriteLine("Cores" + (max ? "Max" : "") + ": 0x" + value.ToString("X4")); - + return ((value >> 8) & 0xFF, (value) & 0xFF); } @@ -693,7 +692,7 @@ public class AsusACPI { if (eCores < 0 || eCores > 16 || pCores < 0 || pCores > 16) return; int value = (eCores << 8) | pCores; - Program.acpi.DeviceSet(CORES_CPU, value, "Cores (0x" + value.ToString("X4")+")"); + Program.acpi.DeviceSet(CORES_CPU, value, "Cores (0x" + value.ToString("X4") + ")"); } public string ScanRange() diff --git a/app/Extra.Designer.cs b/app/Extra.Designer.cs index d65b07e8..8dc4a06e 100644 --- a/app/Extra.Designer.cs +++ b/app/Extra.Designer.cs @@ -122,6 +122,7 @@ namespace GHelper pictureAPUMem = new PictureBox(); labelAPUMem = new Label(); panelCores = new Panel(); + buttonCores = new RButton(); comboCoresP = new RComboBox(); comboCoresE = new RComboBox(); pictureCores = new PictureBox(); @@ -162,7 +163,7 @@ namespace GHelper panelServices.Controls.Add(labelServices); panelServices.Controls.Add(buttonServices); panelServices.Dock = DockStyle.Top; - panelServices.Location = new Point(15, 1436); + panelServices.Location = new Point(15, 1439); panelServices.Name = "panelServices"; panelServices.Size = new Size(983, 75); panelServices.TabIndex = 5; @@ -1084,7 +1085,7 @@ namespace GHelper panelSettings.Controls.Add(checkGpuApps); panelSettings.Controls.Add(checkGPUFix); panelSettings.Dock = DockStyle.Top; - panelSettings.Location = new Point(15, 1036); + panelSettings.Location = new Point(15, 1039); panelSettings.Name = "panelSettings"; panelSettings.Padding = new Padding(20, 5, 11, 5); panelSettings.Size = new Size(983, 346); @@ -1199,7 +1200,7 @@ namespace GHelper panelPower.Controls.Add(labelHibernateAfter); panelPower.Controls.Add(pictureHibernate); panelPower.Dock = DockStyle.Top; - panelPower.Location = new Point(15, 1382); + panelPower.Location = new Point(15, 1385); panelPower.Name = "panelPower"; panelPower.Size = new Size(983, 54); panelPower.TabIndex = 4; @@ -1242,7 +1243,7 @@ namespace GHelper panelAPU.Controls.Add(pictureAPUMem); panelAPU.Controls.Add(labelAPUMem); panelAPU.Dock = DockStyle.Top; - panelAPU.Location = new Point(15, 979); + panelAPU.Location = new Point(15, 982); panelAPU.Name = "panelAPU"; panelAPU.Padding = new Padding(11, 5, 11, 0); panelAPU.Size = new Size(983, 57); @@ -1260,7 +1261,7 @@ namespace GHelper comboAPU.FormattingEnabled = true; comboAPU.ItemHeight = 32; comboAPU.Items.AddRange(new object[] { "Auto", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G" }); - comboAPU.Location = new Point(647, 8); + comboAPU.Location = new Point(654, 8); comboAPU.Margin = new Padding(4, 12, 4, 9); comboAPU.Name = "comboAPU"; comboAPU.Size = new Size(309, 40); @@ -1281,7 +1282,7 @@ namespace GHelper // labelAPUMem.AutoSize = true; labelAPUMem.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelAPUMem.Location = new Point(56, 11); + labelAPUMem.Location = new Point(64, 11); labelAPUMem.Name = "labelAPUMem"; labelAPUMem.Size = new Size(309, 32); labelAPUMem.TabIndex = 0; @@ -1290,6 +1291,7 @@ namespace GHelper // panelCores // panelCores.AutoSize = true; + panelCores.Controls.Add(buttonCores); panelCores.Controls.Add(comboCoresP); panelCores.Controls.Add(comboCoresE); panelCores.Controls.Add(pictureCores); @@ -1298,10 +1300,27 @@ namespace GHelper panelCores.Location = new Point(15, 921); panelCores.Name = "panelCores"; panelCores.Padding = new Padding(11, 5, 11, 0); - panelCores.Size = new Size(983, 58); + panelCores.Size = new Size(983, 61); panelCores.TabIndex = 47; panelCores.Visible = false; // + // buttonCores + // + buttonCores.Activated = false; + buttonCores.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCores.BackColor = SystemColors.ButtonHighlight; + buttonCores.BorderColor = Color.Transparent; + buttonCores.BorderRadius = 2; + buttonCores.FlatStyle = FlatStyle.Flat; + buttonCores.Location = new Point(856, 7); + buttonCores.Margin = new Padding(4, 3, 4, 3); + buttonCores.Name = "buttonCores"; + buttonCores.Secondary = false; + buttonCores.Size = new Size(106, 46); + buttonCores.TabIndex = 20; + buttonCores.Text = "Apply"; + buttonCores.UseVisualStyleBackColor = false; + // // comboCoresP // comboCoresP.Anchor = AnchorStyles.Top | AnchorStyles.Right; @@ -1311,7 +1330,7 @@ namespace GHelper comboCoresP.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); comboCoresP.FormattingEnabled = true; comboCoresP.ItemHeight = 32; - comboCoresP.Location = new Point(805, 9); + comboCoresP.Location = new Point(701, 10); comboCoresP.Margin = new Padding(4, 12, 4, 9); comboCoresP.Name = "comboCoresP"; comboCoresP.Size = new Size(150, 40); @@ -1327,7 +1346,7 @@ namespace GHelper comboCoresE.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); comboCoresE.FormattingEnabled = true; comboCoresE.ItemHeight = 32; - comboCoresE.Location = new Point(647, 9); + comboCoresE.Location = new Point(543, 10); comboCoresE.Margin = new Padding(4, 12, 4, 9); comboCoresE.Name = "comboCoresE"; comboCoresE.Size = new Size(150, 40); @@ -1522,5 +1541,6 @@ namespace GHelper private PictureBox pictureCores; private Label label1; private RComboBox comboCoresP; + private RButton buttonCores; } } \ No newline at end of file diff --git a/app/Extra.cs b/app/Extra.cs index e3c21d0d..f93c5062 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -419,29 +419,28 @@ namespace GHelper comboCoresE.DropDownStyle = ComboBoxStyle.DropDownList; comboCoresP.DropDownStyle = ComboBoxStyle.DropDownList; - for (int i = 0; i <= eCoresMax; i++) comboCoresE.Items.Add(i.ToString() + "E-cores"); - for (int i = 0; i <= pCoresMax; i++) comboCoresP.Items.Add(i.ToString() + "P-cores"); + for (int i = 0; i <= eCoresMax; i++) comboCoresE.Items.Add(i.ToString() + " Ecores"); + for (int i = 0; i <= pCoresMax; i++) comboCoresP.Items.Add(i.ToString() + " Pcores"); comboCoresE.SelectedIndex = Math.Min(eCores, eCoresMax); comboCoresP.SelectedIndex = Math.Min(pCores, pCoresMax); - comboCoresP.SelectedIndexChanged += ComboCores_SelectedIndexChanged; - comboCoresE.SelectedIndexChanged += ComboCores_SelectedIndexChanged; + buttonCores.Click += ButtonCores_Click; } - private void ComboCores_SelectedIndexChanged(object? sender, EventArgs e) + private void ButtonCores_Click(object? sender, EventArgs e) { - Program.acpi.SetCores(comboCoresE.SelectedIndex, comboCoresP.SelectedIndex); - DialogResult dialogResult = MessageBox.Show(Properties.Strings.AlertAPUMemoryRestart, Properties.Strings.AlertAPUMemoryRestartTitle, MessageBoxButtons.YesNo); - + if (dialogResult == DialogResult.Yes) { + Program.acpi.SetCores(comboCoresE.SelectedIndex, comboCoresP.SelectedIndex); Process.Start("shutdown", "/r /t 1"); } } + private void PictureScan_Click(object? sender, EventArgs e) { string logFile = Program.acpi.ScanRange();