mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-21 06:03:52 +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
62
PowerControl/Options/CPUFrequency.cs
Normal file
62
PowerControl/Options/CPUFrequency.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using PowerControl.Helpers.AMD;
|
||||
|
||||
namespace PowerControl.Options
|
||||
{
|
||||
public static class CPUFrequency
|
||||
{
|
||||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
||||
{
|
||||
Name = "CPU",
|
||||
Options = { "Default", "Power-Save", "Balanced", "Max" },
|
||||
ApplyDelay = 1000,
|
||||
ActiveOption = "?",
|
||||
Visible = VangoghGPU.IsSupported,
|
||||
ResetValue = () => { return "Default"; },
|
||||
ApplyValue = delegate (object selected)
|
||||
{
|
||||
if (!Settings.Default.AckAntiCheat(
|
||||
Controller.TitleWithVersion,
|
||||
"CPU",
|
||||
"Changing GPU frequency requires kernel access for a short period. Leave the game if it uses anti-cheat protection.")
|
||||
)
|
||||
return null;
|
||||
|
||||
return CommonHelpers.Instance.WithGlobalMutex<object>(200, () =>
|
||||
{
|
||||
using (var sd = VangoghGPU.Open())
|
||||
{
|
||||
if (sd is null)
|
||||
return null;
|
||||
|
||||
switch (selected.ToString())
|
||||
{
|
||||
case "Default":
|
||||
sd.MinCPUClock = 1400;
|
||||
sd.MaxCPUClock = 3500;
|
||||
break;
|
||||
|
||||
case "Power-Save":
|
||||
sd.MinCPUClock = 1400;
|
||||
sd.MaxCPUClock = 1800;
|
||||
break;
|
||||
|
||||
case "Balanced":
|
||||
sd.MinCPUClock = 2200;
|
||||
sd.MaxCPUClock = 2800;
|
||||
break;
|
||||
|
||||
case "Max":
|
||||
sd.MinCPUClock = 3000;
|
||||
sd.MaxCPUClock = 3500;
|
||||
break;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue