diff --git a/app/Fans.cs b/app/Fans.cs index 6ef8b3ac..7c1293c2 100644 --- a/app/Fans.cs +++ b/app/Fans.cs @@ -132,14 +132,14 @@ namespace GHelper labelFansResult.Visible = false; - trackUV.Minimum = Undervolter.MinCPUUV; - trackUV.Maximum = Undervolter.MaxCPUUV; + trackUV.Minimum = RyzenControl.MinCPUUV; + trackUV.Maximum = RyzenControl.MaxCPUUV; - trackUViGPU.Minimum = Undervolter.MinIGPUUV; - trackUViGPU.Maximum = Undervolter.MaxIGPUUV; + trackUViGPU.Minimum = RyzenControl.MinIGPUUV; + trackUViGPU.Maximum = RyzenControl.MaxIGPUUV; - trackTemp.Minimum = Undervolter.MinTemp; - trackTemp.Maximum = Undervolter.MaxTemp; + trackTemp.Minimum = RyzenControl.MinTemp; + trackTemp.Maximum = RyzenControl.MaxTemp; FillModes(); @@ -270,7 +270,7 @@ namespace GHelper labelTemp.Text = trackTemp.Value.ToString() + "°C"; - buttonAdvanced.Visible = Undervolter.IsAMD(); + buttonAdvanced.Visible = RyzenControl.IsAMD(); } @@ -622,7 +622,7 @@ namespace GHelper public void InitPower(bool changed = false) { - bool modeA0 = (Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0 || Undervolter.IsAMD()); + bool modeA0 = (Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0 || RyzenControl.IsAMD()); bool modeB0 = Program.acpi.IsAllAmdPPT(); bool modeC1 = Program.acpi.DeviceGet(AsusACPI.PPT_APUC1) >= 0; diff --git a/app/Program.cs b/app/Program.cs index 3e7cc54f..eb0410be 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -74,7 +74,7 @@ namespace GHelper Application.EnableVisualStyles(); HardwareControl.RecreateGpuControl(); - Undervolter.Init(); + RyzenControl.Init(); var ds = settingsForm.Handle; diff --git a/app/Properties/Strings.Designer.cs b/app/Properties/Strings.Designer.cs index 4d5c6aba..e5ba1ab9 100644 --- a/app/Properties/Strings.Designer.cs +++ b/app/Properties/Strings.Designer.cs @@ -1124,6 +1124,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Stop GPU Applications. + /// + internal static string StopGPUApps { + get { + return ResourceManager.GetString("StopGPUApps", resourceCulture); + } + } + /// /// Looks up a localized string similar to Stopping Services. /// diff --git a/app/Properties/Strings.resx b/app/Properties/Strings.resx index 080f99e0..0a020801 100644 --- a/app/Properties/Strings.resx +++ b/app/Properties/Strings.resx @@ -473,6 +473,9 @@ Do you still want to continue? Stop + + Stop GPU Applications + Stopping Services diff --git a/app/Ryzen/Undervolter.cs b/app/Ryzen/RyzenControl.cs similarity index 99% rename from app/Ryzen/Undervolter.cs rename to app/Ryzen/RyzenControl.cs index df21283f..0e942809 100644 --- a/app/Ryzen/Undervolter.cs +++ b/app/Ryzen/RyzenControl.cs @@ -8,7 +8,7 @@ using System.Management; namespace Ryzen { - internal class Undervolter + internal class RyzenControl { public const int MinCPUUV = -30; diff --git a/app/Ryzen/SendCommand.cs b/app/Ryzen/SendCommand.cs index 77be8411..271bcd97 100644 --- a/app/Ryzen/SendCommand.cs +++ b/app/Ryzen/SendCommand.cs @@ -22,7 +22,7 @@ namespace Ryzen //RAPHAEL/DRAGON RANGE - 10 public static Smu RyzenAccess = new Smu(false); - public static int FAMID = Undervolter.FAMID; + public static int FAMID = RyzenControl.FAMID; //STAMP Limit diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 88307144..10706172 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -97,6 +97,7 @@ namespace GHelper labelVersion = new Label(); labelModel = new Label(); panelVersion = new Panel(); + buttonStopGPU = new RButton(); panelMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); panelMatrixTitle.SuspendLayout(); @@ -592,6 +593,7 @@ namespace GHelper tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + tableGPU.Controls.Add(buttonStopGPU, 0, 0); tableGPU.Controls.Add(buttonEco, 0, 0); tableGPU.Controls.Add(buttonStandard, 1, 0); tableGPU.Controls.Add(buttonXGM, 2, 0); @@ -664,11 +666,11 @@ namespace GHelper buttonXGM.ForeColor = SystemColors.ControlText; buttonXGM.Image = Properties.Resources.icons8_video_48; buttonXGM.ImageAlign = ContentAlignment.BottomCenter; - buttonXGM.Location = new Point(4, 132); + buttonXGM.Location = new Point(580, 4); buttonXGM.Margin = new Padding(4); buttonXGM.Name = "buttonXGM"; buttonXGM.Secondary = false; - buttonXGM.Size = new Size(184, 120); + buttonXGM.Size = new Size(186, 120); buttonXGM.TabIndex = 2; buttonXGM.Text = "XG Mobile"; buttonXGM.TextImageRelation = TextImageRelation.ImageAboveText; @@ -687,11 +689,11 @@ namespace GHelper buttonOptimized.ForeColor = SystemColors.ControlText; buttonOptimized.Image = Properties.Resources.icons8_project_management_48__1_; buttonOptimized.ImageAlign = ContentAlignment.BottomCenter; - buttonOptimized.Location = new Point(580, 4); + buttonOptimized.Location = new Point(388, 4); buttonOptimized.Margin = new Padding(4); buttonOptimized.Name = "buttonOptimized"; buttonOptimized.Secondary = false; - buttonOptimized.Size = new Size(186, 120); + buttonOptimized.Size = new Size(184, 120); buttonOptimized.TabIndex = 3; buttonOptimized.Text = Properties.Strings.Optimized; buttonOptimized.TextImageRelation = TextImageRelation.ImageAboveText; @@ -709,7 +711,7 @@ namespace GHelper buttonUltimate.ForeColor = SystemColors.ControlText; buttonUltimate.Image = Properties.Resources.icons8_game_controller_48; buttonUltimate.ImageAlign = ContentAlignment.BottomCenter; - buttonUltimate.Location = new Point(388, 4); + buttonUltimate.Location = new Point(4, 132); buttonUltimate.Margin = new Padding(4); buttonUltimate.Name = "buttonUltimate"; buttonUltimate.Secondary = false; @@ -1118,6 +1120,30 @@ namespace GHelper panelVersion.Size = new Size(810, 57); panelVersion.TabIndex = 41; // + // buttonStopGPU + // + buttonStopGPU.Activated = false; + buttonStopGPU.BackColor = SystemColors.ControlLightLight; + buttonStopGPU.BorderColor = Color.Transparent; + buttonStopGPU.BorderRadius = 5; + buttonStopGPU.CausesValidation = false; + buttonStopGPU.Dock = DockStyle.Top; + buttonStopGPU.FlatAppearance.BorderSize = 0; + buttonStopGPU.FlatStyle = FlatStyle.Flat; + buttonStopGPU.ForeColor = SystemColors.ControlText; + buttonStopGPU.Image = Properties.Resources.icons8_leaf_48; + buttonStopGPU.ImageAlign = ContentAlignment.BottomCenter; + buttonStopGPU.Location = new Point(196, 132); + buttonStopGPU.Margin = new Padding(4); + buttonStopGPU.Name = "buttonStopGPU"; + buttonStopGPU.Secondary = false; + buttonStopGPU.Size = new Size(184, 120); + buttonStopGPU.TabIndex = 4; + buttonStopGPU.Text = "Stop GPU applications"; + buttonStopGPU.TextImageRelation = TextImageRelation.ImageAboveText; + buttonStopGPU.UseVisualStyleBackColor = false; + buttonStopGPU.Visible = false; + // // SettingsForm // AutoScaleDimensions = new SizeF(192F, 192F); @@ -1255,5 +1281,6 @@ namespace GHelper private Panel panelVersion; private Label labelVersion; private Label labelModel; + private RButton buttonStopGPU; } } \ No newline at end of file diff --git a/app/Settings.cs b/app/Settings.cs index 1334ac58..21104017 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -54,7 +54,7 @@ namespace GHelper buttonUltimate.Text = Properties.Strings.UltimateMode; buttonStandard.Text = Properties.Strings.StandardMode; buttonOptimized.Text = Properties.Strings.Optimized; - + buttonStopGPU.Text = Properties.Strings.StopGPUApps; buttonScreenAuto.Text = Properties.Strings.AutoMode; buttonMiniled.Text = Properties.Strings.Multizone; @@ -102,6 +102,7 @@ namespace GHelper buttonStandard.Click += ButtonStandard_Click; buttonUltimate.Click += ButtonUltimate_Click; buttonOptimized.Click += ButtonOptimized_Click; + buttonStopGPU.Click += ButtonStopGPU_Click; VisibleChanged += SettingsForm_VisibleChanged; @@ -186,6 +187,7 @@ namespace GHelper } + private void SettingsForm_VisibleChanged(object? sender, EventArgs e) { aTimer.Enabled = this.Visible; @@ -988,6 +990,12 @@ namespace GHelper SetGPUMode(AsusACPI.GPUModeEco); } + + private void ButtonStopGPU_Click(object? sender, EventArgs e) + { + HardwareControl.KillGPUApps(); + } + public async void RefreshSensors(bool force = false) { @@ -1059,7 +1067,7 @@ namespace GHelper Program.acpi.DeviceSet(AsusACPI.PPT_APUA3, limit_total, "PowerLimit A3"); customPower = limit_total; } - else if (Undervolter.IsAMD()) + else if (RyzenControl.IsAMD()) { if (ProcessHelper.IsUserAdministrator()) @@ -1165,7 +1173,7 @@ namespace GHelper return; } - if (!Undervolter.IsAMD()) return; + if (!RyzenControl.IsAMD()) return; int cpuUV = AppConfig.GetMode("cpu_uv", 0); int igpuUV = AppConfig.GetMode("igpu_uv", 0); @@ -1173,17 +1181,17 @@ namespace GHelper try { - if (cpuUV >= Undervolter.MinCPUUV && cpuUV <= Undervolter.MaxCPUUV) + if (cpuUV >= RyzenControl.MinCPUUV && cpuUV <= RyzenControl.MaxCPUUV) { SendCommand.set_coall(cpuUV); } - if (igpuUV >= Undervolter.MinIGPUUV && igpuUV <= Undervolter.MaxIGPUUV) + if (igpuUV >= RyzenControl.MinIGPUUV && igpuUV <= RyzenControl.MaxIGPUUV) { SendCommand.set_cogfx(igpuUV); } - if (cpuTemp >= Undervolter.MinTemp && cpuTemp <= Undervolter.MaxTemp) + if (cpuTemp >= RyzenControl.MinTemp && cpuTemp <= RyzenControl.MaxTemp) { SendCommand.set_tctl_temp((uint)cpuTemp); SendCommand.set_apu_skin_temp_limit((uint)cpuTemp); @@ -1544,20 +1552,6 @@ namespace GHelper return true; } - private void UltimateUI(bool ultimate) - { - if (!ultimate) - { - tableGPU.Controls.Remove(buttonUltimate); - tablePerf.ColumnCount = 0; - tableGPU.ColumnCount = 0; - tableScreen.ColumnCount = 0; - menuUltimate.Visible = false; - - } - //tableLayoutMatrix.ColumnCount = 0; - } - public void InitXGM() { bool connected = Program.acpi.IsXGConnected(); @@ -1608,12 +1602,28 @@ namespace GHelper else GpuMode = AsusACPI.GPUModeStandard; - UltimateUI(mux == 1); + // Ultimate mode not suported + if (mux != 1) + { + tableGPU.Controls.Remove(buttonUltimate); + tablePerf.ColumnCount = 0; + tableGPU.ColumnCount = 0; + tableScreen.ColumnCount = 0; + menuUltimate.Visible = false; + } if (eco < 0 && mux < 0) { - isGpuSection = tableGPU.Visible = false; + isGpuSection = false; + + buttonEco.Visible = false; + buttonStandard.Visible = false; + buttonUltimate.Visible = false; + buttonOptimized.Visible = false; + buttonStopGPU.Visible = true; + SetContextMenu(); + if (HardwareControl.FormatFan(Program.acpi.DeviceGet(AsusACPI.GPU_Fan)) is null) panelGPU.Visible = false; } diff --git a/app/Updates.cs b/app/Updates.cs index 680a2594..5e4b96c0 100644 --- a/app/Updates.cs +++ b/app/Updates.cs @@ -74,7 +74,7 @@ namespace GHelper public Updates() { InitializeComponent(); - InitTheme(); + InitTheme(true); LoadUpdates();