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",
|
2023-01-05 23:52:23 +01:00
|
|
|
PersistentKey = "Resolution",
|
2022-12-19 22:47:10 +01:00
|
|
|
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);
|
2023-02-08 23:41:08 +01:00
|
|
|
|
|
|
|
|
if (ExternalHelpers.DisplayConfig.IsInternalConnected == true)
|
|
|
|
|
{
|
|
|
|
|
ModeTiming.AddTiming(new Helpers.AMD.ADLDisplayModeX2()
|
|
|
|
|
{
|
|
|
|
|
PelsWidth = selectedResolution.Width,
|
|
|
|
|
PelsHeight = selectedResolution.Height,
|
|
|
|
|
RefreshRate = DisplayResolutionController.GetRefreshRate(),
|
|
|
|
|
TimingStandard = Helpers.AMD.ADL.ADL_DL_MODETIMING_STANDARD_CVT,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DisplayResolutionController.SetResolution(selectedResolution);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-10 11:12:31 +01:00
|
|
|
return DisplayResolutionController.GetResolution().ToString();
|
|
|
|
|
},
|
|
|
|
|
Impacts =
|
|
|
|
|
{
|
|
|
|
|
RefreshRate.Instance,
|
|
|
|
|
FPSLimit.Instance
|
2022-12-19 22:47:10 +01:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|