steam-deck-tools/PowerControl/Options/GPUScalingItem.cs
Kamil Trzciński 2ff2864f23 PowerControl: Expose all settings and apply them in order
Since some settings impact others, the application will
apply them in a correct order with a fixed delay.

This additionally exposes all settings, just some of them
are not persisted on create, only on change.
2023-01-10 12:01:33 +01:00

54 lines
1.6 KiB
C#

using PowerControl.Helpers.AMD;
namespace PowerControl.Options
{
public static class GPUScalingItem
{
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
{
Name = "GPU Scaling",
PersistentKey = "GPUScaling",
ApplyDelay = 1000,
Options = Enum.GetNames<GPUScaling.ScalingMode>().Prepend("Off").ToArray(),
CurrentValue = delegate ()
{
if (!GPUScaling.IsSupported)
return null;
if (!GPUScaling.Enabled)
return "Off";
return GPUScaling.Mode.ToString();
},
ApplyValue = (selected) =>
{
if (!GPUScaling.IsSupported)
return null;
if (selected == "Off")
GPUScaling.Enabled = false;
else
GPUScaling.Mode = Enum.Parse<GPUScaling.ScalingMode>(selected);
// Since the RadeonSoftware will try to revert values
RadeonSoftware.Kill();
if (!GPUScaling.Enabled)
return "Off";
return GPUScaling.Mode.ToString();
},
Impacts =
{
Resolution.Instance,
RefreshRate.Instance,
FPSLimit.Instance
},
AfterApply = () =>
{
Resolution.Instance.Update();
RefreshRate.Instance.Update();
FPSLimit.Instance.Reset();
FPSLimit.Instance.Update();
}
};
}
}