From 0e4422f103d078c9b4ca3fb706321aec9a404a95 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sun, 25 Feb 2024 13:22:07 +0100 Subject: [PATCH] Intel Cores UI tweaks --- app/AsusACPI.cs | 8 +++++++- app/Extra.Designer.cs | 4 ++-- app/Extra.cs | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index 1bc64a13..63419eec 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -149,6 +149,12 @@ public class AsusACPI public const int MinGPUTemp = 75; public const int MaxGPUTemp = 87; + public const int PCoreMin = 4; + public const int ECoreMin = 0; + + public const int PCoreMax = 16; + public const int ECoreMax = 16; + [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] private static extern IntPtr CreateFile( @@ -690,7 +696,7 @@ public class AsusACPI public void SetCores(int eCores, int pCores) { - if (eCores < 0 || eCores > 16 || pCores < 0 || pCores > 16) return; + if (eCores < ECoreMin || eCores > ECoreMax || pCores < PCoreMin || pCores > PCoreMax) return; int value = (eCores << 8) | pCores; Program.acpi.DeviceSet(CORES_CPU, value, "Cores (0x" + value.ToString("X4") + ")"); } diff --git a/app/Extra.Designer.cs b/app/Extra.Designer.cs index 8dc4a06e..43b9d71e 100644 --- a/app/Extra.Designer.cs +++ b/app/Extra.Designer.cs @@ -1330,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(701, 10); + comboCoresP.Location = new Point(543, 10); comboCoresP.Margin = new Padding(4, 12, 4, 9); comboCoresP.Name = "comboCoresP"; comboCoresP.Size = new Size(150, 40); @@ -1346,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(543, 10); + comboCoresE.Location = new Point(702, 10); comboCoresE.Margin = new Padding(4, 12, 4, 9); comboCoresE.Name = "comboCoresE"; comboCoresE.Size = new Size(150, 40); diff --git a/app/Extra.cs b/app/Extra.cs index f93c5062..77198d39 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -419,11 +419,11 @@ namespace GHelper comboCoresE.DropDownStyle = ComboBoxStyle.DropDownList; comboCoresP.DropDownStyle = ComboBoxStyle.DropDownList; - 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"); + for (int i = AsusACPI.PCoreMin; i <= pCoresMax; i++) comboCoresP.Items.Add(i.ToString() + " Pcores"); + for (int i = AsusACPI.ECoreMin; i <= eCoresMax; i++) comboCoresE.Items.Add(i.ToString() + " Ecores"); - comboCoresE.SelectedIndex = Math.Min(eCores, eCoresMax); - comboCoresP.SelectedIndex = Math.Min(pCores, pCoresMax); + comboCoresP.SelectedIndex = Math.Max(Math.Min(pCores - AsusACPI.PCoreMin, comboCoresP.Items.Count - 1), 0); + comboCoresE.SelectedIndex = Math.Max(Math.Min(eCores - AsusACPI.ECoreMin, comboCoresE.Items.Count - 1), 0); buttonCores.Click += ButtonCores_Click;