mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-04 22:07:40 +00:00
Add Image Sharpening option
This commit is contained in:
parent
306017e0fb
commit
f704640d04
4 changed files with 115 additions and 6 deletions
62
PowerControl/Helpers/AMD/ImageSharpening.cs
Normal file
62
PowerControl/Helpers/AMD/ImageSharpening.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PowerControl.Helpers.AMD
|
||||
{
|
||||
internal class ImageSharpening
|
||||
{
|
||||
internal static bool? Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetSettings(out var settings) ? settings.GlobalEnable != 0 : null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!GetSettings(out var settings))
|
||||
return;
|
||||
|
||||
var enabled = value.GetValueOrDefault(false) ? 1 : 0;
|
||||
if (settings.GlobalEnable == enabled)
|
||||
return;
|
||||
|
||||
settings.GlobalEnable = enabled;
|
||||
SetSettings(settings, new ADL_RIS_NOTFICATION_REASON() { GlobalEnableChanged = 1 });
|
||||
}
|
||||
}
|
||||
|
||||
private static bool GetSettings(out ADL_RIS_SETTINGS settings)
|
||||
{
|
||||
ADL_RIS_SETTINGS settings2 = default;
|
||||
|
||||
var result = ADLContext.WithSafe((context) =>
|
||||
{
|
||||
int res = ADL.ADL2_RIS_Settings_Get(
|
||||
context.Context,
|
||||
ADL.ADL_DEFAULT_ADAPTER,
|
||||
out settings2);
|
||||
return res == 0;
|
||||
});
|
||||
|
||||
settings = settings2;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static bool SetSettings(ADL_RIS_SETTINGS settings, ADL_RIS_NOTFICATION_REASON reason)
|
||||
{
|
||||
return ADLContext.WithSafe((context) =>
|
||||
{
|
||||
int res = ADL.ADL2_RIS_Settings_Set(
|
||||
context.Context,
|
||||
ADL.ADL_DEFAULT_ADAPTER,
|
||||
settings, reason);
|
||||
return res == 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue