2022-12-19 22:47:10 +01:00
|
|
|
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;
|
2022-12-19 23:36:22 +01:00
|
|
|
return DisplayResolutionController.GetAllResolutions().Last().ToString();
|
2022-12-19 22:47:10 +01:00
|
|
|
},
|
|
|
|
|
OptionsValues = delegate ()
|
|
|
|
|
{
|
|
|
|
|
var resolutions = DisplayResolutionController.GetAllResolutions();
|
|
|
|
|
if (resolutions.Count() > 1)
|
2022-12-19 23:36:22 +01:00
|
|
|
return resolutions.Select(item => item.ToString()).ToArray();
|
2022-12-19 22:47:10 +01:00
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
CurrentValue = delegate ()
|
|
|
|
|
{
|
|
|
|
|
if (!GPUScaling.SafeResolutionChange && !Settings.Default.EnableExperimentalFeatures)
|
|
|
|
|
return null;
|
2022-12-19 23:36:22 +01:00
|
|
|
return DisplayResolutionController.GetResolution().ToString();
|
2022-12-19 22:47:10 +01:00
|
|
|
},
|
2022-12-19 23:36:22 +01:00
|
|
|
ApplyValue = (selected) =>
|
2022-12-19 22:47:10 +01:00
|
|
|
{
|
2022-12-19 23:36:22 +01:00
|
|
|
var selectedResolution = new DisplayResolutionController.DisplayResolution(selected);
|
|
|
|
|
DisplayResolutionController.SetResolution(selectedResolution);
|
2022-12-19 22:47:10 +01:00
|
|
|
// force refresh Refresh Rate
|
|
|
|
|
RefreshRate.Instance.Update();
|
|
|
|
|
// force reset and refresh of FPS limit
|
|
|
|
|
FPSLimit.Instance.Reset();
|
|
|
|
|
FPSLimit.Instance.Update();
|
2022-12-19 23:36:22 +01:00
|
|
|
return DisplayResolutionController.GetResolution().ToString();
|
2022-12-19 22:47:10 +01:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|