mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-04 22:07:40 +00:00
PowerControl: Decompose MenuStack.cs into Options/
This commit is contained in:
parent
ebe1cdba87
commit
f207c12935
18 changed files with 660 additions and 528 deletions
64
PowerControl/Options/TDP.cs
Normal file
64
PowerControl/Options/TDP.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System.Diagnostics;
|
||||
using PowerControl.Helpers.AMD;
|
||||
|
||||
namespace PowerControl.Options
|
||||
{
|
||||
public static class TDP
|
||||
{
|
||||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
||||
{
|
||||
Name = "TDP",
|
||||
Options = { "3W", "4W", "5W", "6W", "7W", "8W", "10W", "12W", "15W" },
|
||||
ApplyDelay = 1000,
|
||||
ResetValue = () => { return "15W"; },
|
||||
ActiveOption = "?",
|
||||
ApplyValue = delegate (object selected)
|
||||
{
|
||||
if (!Settings.Default.AckAntiCheat(
|
||||
Controller.TitleWithVersion,
|
||||
"TDP",
|
||||
"Changing TDP requires kernel access for a short period. Leave the game if it uses anti-cheat protection.")
|
||||
)
|
||||
return null;
|
||||
|
||||
uint mW = uint.Parse(selected.ToString().Replace("W", "")) * 1000;
|
||||
|
||||
if (VangoghGPU.IsSupported)
|
||||
{
|
||||
return CommonHelpers.Instance.WithGlobalMutex<object>(200, () =>
|
||||
{
|
||||
using (var sd = VangoghGPU.Open())
|
||||
{
|
||||
if (sd is null)
|
||||
return null;
|
||||
|
||||
sd.SlowTDP = mW;
|
||||
sd.FastTDP = mW;
|
||||
}
|
||||
|
||||
return selected;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
uint stampLimit = mW / 10;
|
||||
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
FileName = "Resources/RyzenAdj/ryzenadj.exe",
|
||||
ArgumentList = {
|
||||
"--stapm-limit=" + stampLimit.ToString(),
|
||||
"--slow-limit=" + mW.ToString(),
|
||||
"--fast-limit=" + mW.ToString(),
|
||||
},
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
|
||||
return selected;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue