mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-06 06:43:49 +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
43
PowerControl/Options/Resolution.cs
Normal file
43
PowerControl/Options/Resolution.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using PowerControl.Helpers;
|
||||
using PowerControl.Helpers.AMD;
|
||||
|
||||
namespace PowerControl.Options
|
||||
{
|
||||
public static class Resolution
|
||||
{
|
||||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
||||
{
|
||||
Name = "Resolution",
|
||||
ApplyDelay = 1000,
|
||||
ResetValue = () =>
|
||||
{
|
||||
if (!GPUScaling.SafeResolutionChange && !Settings.Default.EnableExperimentalFeatures)
|
||||
return null;
|
||||
return DisplayResolutionController.GetAllResolutions().Last();
|
||||
},
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
var resolutions = DisplayResolutionController.GetAllResolutions();
|
||||
if (resolutions.Count() > 1)
|
||||
return resolutions.Select(item => (object)item).ToArray();
|
||||
return null;
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
if (!GPUScaling.SafeResolutionChange && !Settings.Default.EnableExperimentalFeatures)
|
||||
return null;
|
||||
return DisplayResolutionController.GetResolution();
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
{
|
||||
DisplayResolutionController.SetResolution((DisplayResolutionController.DisplayResolution)selected);
|
||||
// force refresh Refresh Rate
|
||||
RefreshRate.Instance.Update();
|
||||
// force reset and refresh of FPS limit
|
||||
FPSLimit.Instance.Reset();
|
||||
FPSLimit.Instance.Update();
|
||||
return DisplayResolutionController.GetResolution();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue