diff --git a/app/Fans.Designer.cs b/app/Fans.Designer.cs
index cb7bfb9f..d61a7e1c 100644
--- a/app/Fans.Designer.cs
+++ b/app/Fans.Designer.cs
@@ -31,12 +31,12 @@ namespace GHelper
///
private void InitializeComponent()
{
- ChartArea chartArea13 = new ChartArea();
- Title title13 = new Title();
- ChartArea chartArea14 = new ChartArea();
- Title title14 = new Title();
- ChartArea chartArea15 = new ChartArea();
- Title title15 = new Title();
+ ChartArea chartArea1 = new ChartArea();
+ Title title1 = new Title();
+ ChartArea chartArea2 = new ChartArea();
+ Title title2 = new Title();
+ ChartArea chartArea3 = new ChartArea();
+ Title title3 = new Title();
panelFans = new Panel();
labelFansResult = new Label();
labelTip = new Label();
@@ -67,6 +67,14 @@ namespace GHelper
pictureBox1 = new PictureBox();
labelPowerLimits = new Label();
panelGPU = new Panel();
+ panelGPUTemp = new Panel();
+ labelGPUTemp = new Label();
+ labelGPUTempTitle = new Label();
+ trackGPUTemp = new TrackBar();
+ panelGPUBoost = new Panel();
+ labelGPUBoost = new Label();
+ labelGPUBoostTitle = new Label();
+ trackGPUBoost = new TrackBar();
panelGPUMemory = new Panel();
labelGPUMemory = new Label();
labelGPUMemoryTitle = new Label();
@@ -78,14 +86,6 @@ namespace GHelper
panelTitleGPU = new Panel();
pictureGPU = new PictureBox();
labelGPU = new Label();
- panelGPUBoost = new Panel();
- labelGPUBoost = new Label();
- labelGPUBoostTitle = new Label();
- trackGPUBoost = new TrackBar();
- panelGPUTemp = new Panel();
- labelGPUTemp = new Label();
- labelGPUTempTitle = new Label();
- trackGPUTemp = new TrackBar();
panelFans.SuspendLayout();
((System.ComponentModel.ISupportInitialize)picturePerf).BeginInit();
tableFanCharts.SuspendLayout();
@@ -102,16 +102,16 @@ namespace GHelper
panelTitleCPU.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
panelGPU.SuspendLayout();
+ panelGPUTemp.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)trackGPUTemp).BeginInit();
+ panelGPUBoost.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)trackGPUBoost).BeginInit();
panelGPUMemory.SuspendLayout();
((System.ComponentModel.ISupportInitialize)trackGPUMemory).BeginInit();
panelGPUCore.SuspendLayout();
((System.ComponentModel.ISupportInitialize)trackGPUCore).BeginInit();
panelTitleGPU.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureGPU).BeginInit();
- panelGPUBoost.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)trackGPUBoost).BeginInit();
- panelGPUTemp.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)trackGPUTemp).BeginInit();
SuspendLayout();
//
// panelFans
@@ -211,8 +211,8 @@ namespace GHelper
//
// chartGPU
//
- chartArea13.Name = "ChartArea1";
- chartGPU.ChartAreas.Add(chartArea13);
+ chartArea1.Name = "ChartArea1";
+ chartGPU.ChartAreas.Add(chartArea1);
chartGPU.Dock = DockStyle.Fill;
chartGPU.Location = new Point(2, 350);
chartGPU.Margin = new Padding(2, 10, 2, 10);
@@ -220,13 +220,13 @@ namespace GHelper
chartGPU.Size = new Size(760, 320);
chartGPU.TabIndex = 17;
chartGPU.Text = "chartGPU";
- title13.Name = "Title1";
- chartGPU.Titles.Add(title13);
+ title1.Name = "Title1";
+ chartGPU.Titles.Add(title1);
//
// chartCPU
//
- chartArea14.Name = "ChartArea1";
- chartCPU.ChartAreas.Add(chartArea14);
+ chartArea2.Name = "ChartArea1";
+ chartCPU.ChartAreas.Add(chartArea2);
chartCPU.Dock = DockStyle.Fill;
chartCPU.Location = new Point(2, 10);
chartCPU.Margin = new Padding(2, 10, 2, 10);
@@ -234,13 +234,13 @@ namespace GHelper
chartCPU.Size = new Size(760, 320);
chartCPU.TabIndex = 14;
chartCPU.Text = "chartCPU";
- title14.Name = "Title1";
- chartCPU.Titles.Add(title14);
+ title2.Name = "Title1";
+ chartCPU.Titles.Add(title2);
//
// chartMid
//
- chartArea15.Name = "ChartArea3";
- chartMid.ChartAreas.Add(chartArea15);
+ chartArea3.Name = "ChartArea3";
+ chartMid.ChartAreas.Add(chartArea3);
chartMid.Dock = DockStyle.Fill;
chartMid.Location = new Point(2, 690);
chartMid.Margin = new Padding(2, 10, 2, 10);
@@ -248,8 +248,8 @@ namespace GHelper
chartMid.Size = new Size(760, 322);
chartMid.TabIndex = 14;
chartMid.Text = "chartMid";
- title15.Name = "Title3";
- chartMid.Titles.Add(title15);
+ title3.Name = "Title3";
+ chartMid.Titles.Add(title3);
chartMid.Visible = false;
//
// labelFans
@@ -505,6 +505,100 @@ namespace GHelper
panelGPU.Size = new Size(523, 634);
panelGPU.TabIndex = 44;
//
+ // panelGPUTemp
+ //
+ panelGPUTemp.AutoSize = true;
+ panelGPUTemp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ panelGPUTemp.Controls.Add(labelGPUTemp);
+ panelGPUTemp.Controls.Add(labelGPUTempTitle);
+ panelGPUTemp.Controls.Add(trackGPUTemp);
+ panelGPUTemp.Dock = DockStyle.Top;
+ panelGPUTemp.Location = new Point(0, 485);
+ panelGPUTemp.Name = "panelGPUTemp";
+ panelGPUTemp.Size = new Size(523, 149);
+ panelGPUTemp.TabIndex = 47;
+ //
+ // labelGPUTemp
+ //
+ labelGPUTemp.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ labelGPUTemp.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ labelGPUTemp.Location = new Point(378, 14);
+ labelGPUTemp.Name = "labelGPUTemp";
+ labelGPUTemp.Size = new Size(130, 32);
+ labelGPUTemp.TabIndex = 44;
+ labelGPUTemp.Text = "87C";
+ labelGPUTemp.TextAlign = ContentAlignment.TopRight;
+ //
+ // labelGPUTempTitle
+ //
+ labelGPUTempTitle.AutoSize = true;
+ labelGPUTempTitle.Location = new Point(10, 14);
+ labelGPUTempTitle.Name = "labelGPUTempTitle";
+ labelGPUTempTitle.Size = new Size(173, 32);
+ labelGPUTempTitle.TabIndex = 43;
+ labelGPUTempTitle.Text = "Thermal Target";
+ //
+ // trackGPUTemp
+ //
+ trackGPUTemp.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ trackGPUTemp.Location = new Point(6, 57);
+ trackGPUTemp.Margin = new Padding(4, 2, 4, 2);
+ trackGPUTemp.Maximum = 87;
+ trackGPUTemp.Minimum = 75;
+ trackGPUTemp.Name = "trackGPUTemp";
+ trackGPUTemp.Size = new Size(502, 90);
+ trackGPUTemp.TabIndex = 42;
+ trackGPUTemp.TickFrequency = 5;
+ trackGPUTemp.TickStyle = TickStyle.TopLeft;
+ trackGPUTemp.Value = 87;
+ //
+ // panelGPUBoost
+ //
+ panelGPUBoost.AutoSize = true;
+ panelGPUBoost.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ panelGPUBoost.Controls.Add(labelGPUBoost);
+ panelGPUBoost.Controls.Add(labelGPUBoostTitle);
+ panelGPUBoost.Controls.Add(trackGPUBoost);
+ panelGPUBoost.Dock = DockStyle.Top;
+ panelGPUBoost.Location = new Point(0, 345);
+ panelGPUBoost.Name = "panelGPUBoost";
+ panelGPUBoost.Size = new Size(523, 140);
+ panelGPUBoost.TabIndex = 46;
+ //
+ // labelGPUBoost
+ //
+ labelGPUBoost.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ labelGPUBoost.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ labelGPUBoost.Location = new Point(374, 14);
+ labelGPUBoost.Name = "labelGPUBoost";
+ labelGPUBoost.Size = new Size(130, 32);
+ labelGPUBoost.TabIndex = 44;
+ labelGPUBoost.Text = "25W";
+ labelGPUBoost.TextAlign = ContentAlignment.TopRight;
+ //
+ // labelGPUBoostTitle
+ //
+ labelGPUBoostTitle.AutoSize = true;
+ labelGPUBoostTitle.Location = new Point(10, 14);
+ labelGPUBoostTitle.Name = "labelGPUBoostTitle";
+ labelGPUBoostTitle.Size = new Size(174, 32);
+ labelGPUBoostTitle.TabIndex = 43;
+ labelGPUBoostTitle.Text = "Dynamic Boost";
+ //
+ // trackGPUBoost
+ //
+ trackGPUBoost.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ trackGPUBoost.Location = new Point(6, 48);
+ trackGPUBoost.Margin = new Padding(4, 2, 4, 2);
+ trackGPUBoost.Maximum = 25;
+ trackGPUBoost.Minimum = 5;
+ trackGPUBoost.Name = "trackGPUBoost";
+ trackGPUBoost.Size = new Size(502, 90);
+ trackGPUBoost.TabIndex = 42;
+ trackGPUBoost.TickFrequency = 5;
+ trackGPUBoost.TickStyle = TickStyle.TopLeft;
+ trackGPUBoost.Value = 25;
+ //
// panelGPUMemory
//
panelGPUMemory.AutoSize = true;
@@ -534,20 +628,20 @@ namespace GHelper
labelGPUMemoryTitle.AutoSize = true;
labelGPUMemoryTitle.Location = new Point(10, 14);
labelGPUMemoryTitle.Name = "labelGPUMemoryTitle";
- labelGPUMemoryTitle.Size = new Size(169, 32);
+ labelGPUMemoryTitle.Size = new Size(241, 32);
labelGPUMemoryTitle.TabIndex = 43;
labelGPUMemoryTitle.Text = "Memory Clock Offset";
//
// trackGPUMemory
//
trackGPUMemory.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- trackGPUMemory.LargeChange = 100;
+ trackGPUMemory.LargeChange = 50;
trackGPUMemory.Location = new Point(6, 48);
trackGPUMemory.Margin = new Padding(4, 2, 4, 2);
- trackGPUMemory.Maximum = 300;
+ trackGPUMemory.Maximum = 250;
+ trackGPUMemory.Minimum = -250;
trackGPUMemory.Name = "trackGPUMemory";
trackGPUMemory.Size = new Size(502, 90);
- trackGPUMemory.SmallChange = 10;
trackGPUMemory.TabIndex = 42;
trackGPUMemory.TickFrequency = 50;
trackGPUMemory.TickStyle = TickStyle.TopLeft;
@@ -579,14 +673,14 @@ namespace GHelper
// trackGPUCore
//
trackGPUCore.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- trackGPUCore.LargeChange = 100;
+ trackGPUCore.LargeChange = 50;
trackGPUCore.Location = new Point(6, 47);
trackGPUCore.Margin = new Padding(4, 2, 4, 2);
- trackGPUCore.Maximum = 300;
+ trackGPUCore.Maximum = 250;
+ trackGPUCore.Minimum = -250;
trackGPUCore.Name = "trackGPUCore";
trackGPUCore.RightToLeft = RightToLeft.No;
trackGPUCore.Size = new Size(502, 90);
- trackGPUCore.SmallChange = 10;
trackGPUCore.TabIndex = 18;
trackGPUCore.TickFrequency = 50;
trackGPUCore.TickStyle = TickStyle.TopLeft;
@@ -636,100 +730,6 @@ namespace GHelper
labelGPU.TabIndex = 40;
labelGPU.Text = "GPU Settings";
//
- // panelGPUBoost
- //
- panelGPUBoost.AutoSize = true;
- panelGPUBoost.AutoSizeMode = AutoSizeMode.GrowAndShrink;
- panelGPUBoost.Controls.Add(labelGPUBoost);
- panelGPUBoost.Controls.Add(labelGPUBoostTitle);
- panelGPUBoost.Controls.Add(trackGPUBoost);
- panelGPUBoost.Dock = DockStyle.Top;
- panelGPUBoost.Location = new Point(0, 345);
- panelGPUBoost.Name = "panelGPUBoost";
- panelGPUBoost.Size = new Size(523, 140);
- panelGPUBoost.TabIndex = 46;
- //
- // labelGPUBoost
- //
- labelGPUBoost.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- labelGPUBoost.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
- labelGPUBoost.Location = new Point(374, 14);
- labelGPUBoost.Name = "labelGPUBoost";
- labelGPUBoost.Size = new Size(130, 32);
- labelGPUBoost.TabIndex = 44;
- labelGPUBoost.Text = "25W";
- labelGPUBoost.TextAlign = ContentAlignment.TopRight;
- //
- // labelGPUBoostTitle
- //
- labelGPUBoostTitle.AutoSize = true;
- labelGPUBoostTitle.Location = new Point(10, 14);
- labelGPUBoostTitle.Name = "labelGPUBoostTitle";
- labelGPUBoostTitle.Size = new Size(174, 32);
- labelGPUBoostTitle.TabIndex = 43;
- labelGPUBoostTitle.Text = "Dynamic Boost";
- //
- // trackGPUBoost
- //
- trackGPUBoost.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- trackGPUBoost.Location = new Point(6, 48);
- trackGPUBoost.Margin = new Padding(4, 2, 4, 2);
- trackGPUBoost.Maximum = 25;
- trackGPUBoost.Minimum = 5;
- trackGPUBoost.Name = "trackGPUBoost";
- trackGPUBoost.Size = new Size(502, 90);
- trackGPUBoost.TabIndex = 42;
- trackGPUBoost.TickFrequency = 5;
- trackGPUBoost.TickStyle = TickStyle.TopLeft;
- trackGPUBoost.Value = 25;
- //
- // panelGPUTemp
- //
- panelGPUTemp.AutoSize = true;
- panelGPUTemp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
- panelGPUTemp.Controls.Add(labelGPUTemp);
- panelGPUTemp.Controls.Add(labelGPUTempTitle);
- panelGPUTemp.Controls.Add(trackGPUTemp);
- panelGPUTemp.Dock = DockStyle.Top;
- panelGPUTemp.Location = new Point(0, 485);
- panelGPUTemp.Name = "panelGPUTemp";
- panelGPUTemp.Size = new Size(523, 149);
- panelGPUTemp.TabIndex = 47;
- //
- // labelGPUTemp
- //
- labelGPUTemp.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- labelGPUTemp.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
- labelGPUTemp.Location = new Point(378, 14);
- labelGPUTemp.Name = "labelGPUTemp";
- labelGPUTemp.Size = new Size(130, 32);
- labelGPUTemp.TabIndex = 44;
- labelGPUTemp.Text = "87C";
- labelGPUTemp.TextAlign = ContentAlignment.TopRight;
- //
- // labelGPUTempTitle
- //
- labelGPUTempTitle.AutoSize = true;
- labelGPUTempTitle.Location = new Point(10, 14);
- labelGPUTempTitle.Name = "labelGPUTempTitle";
- labelGPUTempTitle.Size = new Size(173, 32);
- labelGPUTempTitle.TabIndex = 43;
- labelGPUTempTitle.Text = "Thermal Target";
- //
- // trackGPUTemp
- //
- trackGPUTemp.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- trackGPUTemp.Location = new Point(6, 57);
- trackGPUTemp.Margin = new Padding(4, 2, 4, 2);
- trackGPUTemp.Maximum = 87;
- trackGPUTemp.Minimum = 75;
- trackGPUTemp.Name = "trackGPUTemp";
- trackGPUTemp.Size = new Size(502, 90);
- trackGPUTemp.TabIndex = 42;
- trackGPUTemp.TickFrequency = 5;
- trackGPUTemp.TickStyle = TickStyle.TopLeft;
- trackGPUTemp.Value = 87;
- //
// Fans
//
AutoScaleDimensions = new SizeF(192F, 192F);
@@ -773,6 +773,12 @@ namespace GHelper
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
panelGPU.ResumeLayout(false);
panelGPU.PerformLayout();
+ panelGPUTemp.ResumeLayout(false);
+ panelGPUTemp.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)trackGPUTemp).EndInit();
+ panelGPUBoost.ResumeLayout(false);
+ panelGPUBoost.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)trackGPUBoost).EndInit();
panelGPUMemory.ResumeLayout(false);
panelGPUMemory.PerformLayout();
((System.ComponentModel.ISupportInitialize)trackGPUMemory).EndInit();
@@ -782,12 +788,6 @@ namespace GHelper
panelTitleGPU.ResumeLayout(false);
panelTitleGPU.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureGPU).EndInit();
- panelGPUBoost.ResumeLayout(false);
- panelGPUBoost.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)trackGPUBoost).EndInit();
- panelGPUTemp.ResumeLayout(false);
- panelGPUTemp.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)trackGPUTemp).EndInit();
ResumeLayout(false);
}
diff --git a/app/Fans.cs b/app/Fans.cs
index 4217fdf2..b7580988 100644
--- a/app/Fans.cs
+++ b/app/Fans.cs
@@ -15,6 +15,8 @@ namespace GHelper
static int MinRPM, MaxRPM;
+ NvidiaGpuControl? nvControl = null;
+
public Fans()
{
@@ -35,7 +37,7 @@ namespace GHelper
InitTheme();
MinRPM = 18;
- MaxRPM = HardwareMonitor.GetFanMax();
+ MaxRPM = HardwareControl.GetFanMax();
labelTip.Visible = false;
labelTip.BackColor = Color.Transparent;
@@ -89,8 +91,9 @@ namespace GHelper
trackGPUCore.Scroll += trackGPU_Scroll;
trackGPUMemory.Scroll += trackGPU_Scroll;
- trackGPUBoost.Scroll += trackGPU_Scroll;
- trackGPUTemp.Scroll += trackGPU_Scroll;
+
+ trackGPUBoost.Scroll += trackGPUPower_Scroll;
+ trackGPUTemp.Scroll += trackGPUPower_Scroll;
trackGPUCore.MouseUp += TrackGPU_MouseUp;
trackGPUMemory.MouseUp += TrackGPU_MouseUp;
@@ -110,7 +113,7 @@ namespace GHelper
Shown += Fans_Shown;
- InitGPUClocks();
+ InitGPUControl();
}
@@ -128,7 +131,7 @@ namespace GHelper
Program.config.setConfig("gpu_core", trackGPUCore.Value);
Program.config.setConfig("gpu_memory", trackGPUMemory.Value);
- int status = Program.nvControl.SetClocks(trackGPUCore.Value, trackGPUMemory.Value);
+ int status = nvControl.SetClocks(trackGPUCore.Value, trackGPUMemory.Value);
if (status == -1) Program.RunAsAdmin("gpu");
}
catch (Exception ex)
@@ -136,12 +139,16 @@ namespace GHelper
Logger.WriteLine("F:" + ex.ToString());
}
- InitGPUClocks();
+ InitGPUControl();
}
- private void InitGPUClocks()
+ private void InitGPUControl()
{
- if (Program.nvControl is null || !Program.nvControl.IsValid)
+ if (HardwareControl.GpuControl is not null && HardwareControl.GpuControl.IsNvidia)
+ {
+ nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
+ }
+ else
{
panelGPU.Visible = false;
return;
@@ -151,9 +158,11 @@ namespace GHelper
{
panelGPU.Visible = true;
- Program.nvControl.GetClocks(out int core, out int memory);
+ nvControl.GetClocks(out int core, out int memory, out string gpuTitle);
+
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
+ labelGPU.Text = gpuTitle;
int gpu_boost = Program.config.getConfig("gpu_boost");
int gpu_temp = Program.config.getConfig("gpu_temp");
@@ -187,6 +196,16 @@ namespace GHelper
}
private void trackGPU_Scroll(object? sender, EventArgs e)
+ {
+ if (sender is null) return;
+
+ TrackBar track = (TrackBar)sender;
+ track.Value = (int)Math.Round((float)track.Value / 5) * 5;
+ VisualiseGPUSettings();
+
+ }
+
+ private void trackGPUPower_Scroll(object? sender, EventArgs e)
{
VisualiseGPUSettings();
}
@@ -342,7 +361,7 @@ namespace GHelper
bool cpuBmode = (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0); // 2022 model +
bool cpuAmode = (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0); // 2021 model +
- panelSliders.Visible = cpuAmode;
+ panelPower.Visible = cpuAmode;
panelCPU.Visible = cpuBmode;
// Yes, that's stupid, but Total slider on 2021 model actually adjusts CPU PPT
@@ -487,6 +506,14 @@ namespace GHelper
checkApplyFans.Checked = false;
checkApplyPower.Checked = false;
+ trackGPUCore.Value = 0;
+ trackGPUMemory.Value = 0;
+ trackGPUBoost.Value = ASUSWmi.MaxGPUBoost;
+ trackGPUTemp.Value = ASUSWmi.MaxGPUTemp;
+
+ Program.config.setConfig("gpu_core", ASUSWmi.MaxGPUBoost);
+ Program.config.setConfig("gpu_memory", ASUSWmi.MaxGPUTemp);
+
Program.config.setConfigPerf("auto_apply", 0);
Program.config.setConfigPerf("auto_apply_power", 0);
diff --git a/app/GHelper.csproj b/app/GHelper.csproj
index 6d225211..120aca26 100644
--- a/app/GHelper.csproj
+++ b/app/GHelper.csproj
@@ -16,7 +16,7 @@
AnyCPU
False
True
- 0.58
+ 0.59
diff --git a/app/Gpu/IGpuControl.cs b/app/Gpu/IGpuControl.cs
index f54a7725..cd7d6639 100644
--- a/app/Gpu/IGpuControl.cs
+++ b/app/Gpu/IGpuControl.cs
@@ -1,6 +1,6 @@
namespace GHelper.Gpu;
-public interface IGpuControl : IDisposable {
+public interface IGpuControl : IDisposable {
bool IsNvidia { get; }
bool IsValid { get; }
int? GetCurrentTemperature();
diff --git a/app/Gpu/NvidiaGpuControl.cs b/app/Gpu/NvidiaGpuControl.cs
index 0a351be7..bbb5ce00 100644
--- a/app/Gpu/NvidiaGpuControl.cs
+++ b/app/Gpu/NvidiaGpuControl.cs
@@ -3,6 +3,7 @@ using NvAPIWrapper.Native;
using NvAPIWrapper.Native.GPU;
using NvAPIWrapper.Native.GPU.Structures;
using NvAPIWrapper.Native.Interfaces.GPU;
+using System.Diagnostics;
using static NvAPIWrapper.Native.GPU.Structures.PerformanceStates20InfoV1;
namespace GHelper.Gpu;
@@ -16,11 +17,36 @@ public class NvidiaGpuControl : IGpuControl
public const int MinCoreOffset = -250;
public const int MinMemoryOffset = -250;
- private readonly PhysicalGPU? _internalGpu;
+ private static PhysicalGPU? _internalGpu;
public NvidiaGpuControl()
{
- _internalGpu = GetInternalDiscreteGpu();
+ Create();
+ }
+
+
+ public static void Create()
+ {
+ try
+ {
+ _internalGpu = GetInternalDiscreteGpu();
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex);
+ _internalGpu = null;
+ }
+ }
+
+
+ public static void RecreateWithDelay(int delay = 5)
+ {
+ Task.Run(async () =>
+ {
+ await Task.Delay(TimeSpan.FromSeconds(delay));
+ Create();
+ });
+
}
public bool IsValid => _internalGpu != null;
@@ -46,9 +72,12 @@ public class NvidiaGpuControl : IGpuControl
- public void GetClocks(out int core, out int memory)
+ public void GetClocks(out int core, out int memory, out string gpu)
{
PhysicalGPU internalGpu = _internalGpu!;
+
+ gpu = internalGpu.FullName;
+
Logger.WriteLine(internalGpu.FullName);
Logger.WriteLine(internalGpu.ArchitectInformation.ToString());
@@ -96,7 +125,7 @@ public class NvidiaGpuControl : IGpuControl
}
catch (Exception ex)
{
- Logger.WriteLine(ex.ToString());
+ Logger.WriteLine(ex.Message);
return -1;
}
diff --git a/app/HardwareMonitor.cs b/app/HardwareControl.cs
similarity index 93%
rename from app/HardwareMonitor.cs
rename to app/HardwareControl.cs
index 15eb5f3b..6d5fe661 100644
--- a/app/HardwareMonitor.cs
+++ b/app/HardwareControl.cs
@@ -2,7 +2,7 @@
using GHelper.Gpu;
using System.Diagnostics;
-public static class HardwareMonitor
+public static class HardwareControl
{
public static IGpuControl? GpuControl;
@@ -124,9 +124,8 @@ public static class HardwareMonitor
return false;
}
- public static void RecreateGpuControlWithDelay(int delay = 5)
+ public static void RecreateGpuControlWithDelay(int delay = 3)
{
-
// Re-enabling the discrete GPU takes a bit of time,
// so a simple workaround is to refresh again after that happens
Task.Run(async () =>
@@ -134,9 +133,6 @@ public static class HardwareMonitor
await Task.Delay(TimeSpan.FromSeconds(delay));
RecreateGpuControl();
});
-
-
-
}
public static void RecreateGpuControl()
@@ -145,8 +141,6 @@ public static class HardwareMonitor
{
GpuControl?.Dispose();
- // Detect valid GPU temperature provider.
- // We start with NVIDIA because there's always at least an integrated AMD GPU
IGpuControl _gpuControl = new NvidiaGpuControl();
if (_gpuControl.IsValid)
{
@@ -156,7 +150,6 @@ public static class HardwareMonitor
_gpuControl.Dispose();
- /*
_gpuControl = new AmdGpuControl();
if (_gpuControl.IsValid)
{
@@ -164,7 +157,6 @@ public static class HardwareMonitor
return;
}
_gpuControl.Dispose();
- */
GpuControl = null;
}
diff --git a/app/NvAPIWrapper/DRS/DriverSettingsProfile.cs b/app/NvAPIWrapper/DRS/DriverSettingsProfile.cs
deleted file mode 100644
index 0fc24c4b..00000000
--- a/app/NvAPIWrapper/DRS/DriverSettingsProfile.cs
+++ /dev/null
@@ -1,481 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using NvAPIWrapper.Native;
-using NvAPIWrapper.Native.DRS;
-using NvAPIWrapper.Native.DRS.Structures;
-
-namespace NvAPIWrapper.DRS
-{
- ///
- /// Represents a NVIDIA driver settings profile
- ///
- public class DriverSettingsProfile
- {
- internal DriverSettingsProfile(DRSProfileHandle handle, DriverSettingsSession parentSession)
- {
- Handle = handle;
- Session = parentSession;
- }
-
- ///
- /// Gets a list of applications under this profile
- ///
- public IEnumerable Applications
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- return DRSApi.EnumApplications(Session.Handle, Handle)
- .Select(application => new ProfileApplication(application, this));
- }
- }
-
- ///
- /// Gets or sets the profile support value for GPU series
- ///
- public DRSGPUSupport GPUSupport
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
-
- return profileInfo.GPUSupport;
- }
- set
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
- profileInfo.GPUSupport = value;
- DRSApi.SetProfileInfo(Session.Handle, Handle, profileInfo);
- }
- }
-
- ///
- /// Gets the profile handle
- ///
- public DRSProfileHandle Handle { get; private set; }
-
- ///
- /// Gets a boolean value indicating if this profile is predefined
- ///
- public bool IsPredefined
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
-
- return profileInfo.IsPredefined;
- }
- }
-
- ///
- /// Gets a boolean value indicating if this profile is valid and contains a non-zero handle
- ///
- public bool IsValid
- {
- get => !Handle.IsNull;
- }
-
- ///
- /// Gets the name of the profile
- ///
- public string Name
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
-
- return profileInfo.Name;
- }
- }
-
- ///
- /// Gets the number of application registered under this profile
- ///
- public int NumberOfApplications
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
-
- return profileInfo.NumberOfApplications;
- }
- }
-
- ///
- /// Gets the number of settings under this profile
- ///
- public int NumberOfSettings
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
-
- return profileInfo.NumberOfSettings;
- }
- }
-
- ///
- /// Gets the session that had queried this profile
- ///
- public DriverSettingsSession Session { get; }
-
- ///
- /// Gets a list of settings under this profile
- ///
- public IEnumerable Settings
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- return DRSApi.EnumSettings(Session.Handle, Handle).Select(setting => new ProfileSetting(setting));
- }
- }
-
- ///
- /// Creates a new profile
- ///
- /// The session to create this profile in.
- /// The name of the profile.
- /// The supported GPU series for this profile.
- /// An instance of representing this newly created profile.
- public static DriverSettingsProfile CreateProfile(
- DriverSettingsSession session,
- string profileName,
- DRSGPUSupport? gpuSupport = null)
- {
- gpuSupport = gpuSupport ?? new DRSGPUSupport();
- var profileInfo = new DRSProfileV1(profileName, gpuSupport.Value);
- var profileHandle = DRSApi.CreateProfile(session.Handle, profileInfo);
-
- return new DriverSettingsProfile(profileHandle, session);
- }
-
- ///
- public override string ToString()
- {
- if (!IsValid)
- {
- return "[Invalid]";
- }
-
- if (IsPredefined)
- {
- return $"{Name} (Predefined)";
- }
-
- return Name;
- }
-
- ///
- /// Deletes this profile and makes this instance invalid.
- ///
- public void Delete()
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- DRSApi.DeleteProfile(Session.Handle, Handle);
- Handle = DRSProfileHandle.DefaultHandle;
- }
-
- ///
- /// Deletes an application by its name.
- ///
- /// The name of the application to be deleted.
- public void DeleteApplicationByName(string applicationName)
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- DRSApi.DeleteApplication(Session.Handle, Handle, applicationName);
- }
-
- ///
- /// Deletes a setting by its identification number
- ///
- /// The identification number of the setting to be deleted.
- public void DeleteSetting(uint settingId)
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- DRSApi.DeleteProfileSetting(Session.Handle, Handle, settingId);
- }
-
- ///
- /// Deletes a setting by its known identification number.
- ///
- /// The known identification number of the setting to be deleted.
- public void DeleteSetting(KnownSettingId settingId)
- {
- DeleteSetting(SettingInfo.GetSettingId(settingId));
- }
-
- ///
- /// Finds an application by its name.
- ///
- /// The name of the application to search for.
- ///
- /// An instance of if an application is found; otherwise
- /// .
- ///
- public ProfileApplication GetApplicationByName(string applicationName)
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var application = DRSApi.GetApplicationInfo(Session.Handle, Handle, applicationName);
-
- if (application == null)
- {
- return null;
- }
-
- return new ProfileApplication(application, this);
- }
-
- ///
- /// Searches for a setting using its identification number.
- ///
- /// The identification number of the setting to search for.
- /// An instance of if a setting is found; otherwise .
- public ProfileSetting GetSetting(uint settingId)
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var setting = DRSApi.GetSetting(Session.Handle, Handle, settingId);
-
- if (setting == null)
- {
- return null;
- }
-
- return new ProfileSetting(setting.Value);
- }
-
-
- ///
- /// Searches for a setting using its known identification number.
- ///
- /// The known identification number of the setting to search for.
- /// An instance of if a setting is found; otherwise .
- public ProfileSetting GetSetting(KnownSettingId settingId)
- {
- return GetSetting(SettingInfo.GetSettingId(settingId));
- }
-
- ///
- /// Restores applications and settings of this profile to their default. This also deletes custom profiles resulting in
- /// their handles becoming invalid.
- ///
- public void RestoreDefaults()
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var isPredefined = IsPredefined;
- DRSApi.RestoreDefaults(Session.Handle, Handle);
-
- if (!isPredefined)
- {
- Handle = DRSProfileHandle.DefaultHandle;
- }
- }
-
- ///
- /// Restores a setting to its default value.
- ///
- /// The identification number of the setting.
- public void RestoreSettingToDefault(uint settingId)
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- DRSApi.RestoreDefaults(Session.Handle, Handle, settingId);
- }
-
- ///
- /// Restores a setting to its default value.
- ///
- /// The known identification number of the setting.
- public void RestoreSettingToDefault(KnownSettingId settingId)
- {
- RestoreSettingToDefault(SettingInfo.GetSettingId(settingId));
- }
-
- ///
- /// Sets a new value for a setting or creates a new setting and sets its value
- ///
- /// The known identification number of the setting to change its value.
- /// The type of the setting value.
- /// The new value for the setting.
- public void SetSetting(KnownSettingId settingId, DRSSettingType settingType, object value)
- {
- SetSetting(SettingInfo.GetSettingId(settingId), settingType, value);
- }
-
- ///
- /// Sets a new value for a setting or creates a new setting and sets its value
- ///
- /// The known identification number of the setting to change its value.
- /// The new value for the setting.
- public void SetSetting(KnownSettingId settingId, string value)
- {
- SetSetting(SettingInfo.GetSettingId(settingId), value);
- }
-
- ///
- /// Sets a new value for a setting or creates a new setting and sets its value
- ///
- /// The known identification number of the setting to change its value.
- /// The new value for the setting.
- public void SetSetting(KnownSettingId settingId, byte[] value)
- {
- SetSetting(SettingInfo.GetSettingId(settingId), value);
- }
-
- ///
- /// Sets a new value for a setting or creates a new setting and sets its value
- ///
- /// The known identification number of the setting to change its value.
- /// The new value for the setting.
- public void SetSetting(KnownSettingId settingId, uint value)
- {
- SetSetting(SettingInfo.GetSettingId(settingId), value);
- }
-
- ///
- /// Sets a new value for a setting or creates a new setting and sets its value
- ///
- /// The identification number of the setting to change its value.
- /// The type of the setting value.
- /// The new value for the setting.
- public void SetSetting(uint settingId, DRSSettingType settingType, object value)
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid profile instance."
- );
- }
-
- var setting = new DRSSettingV1(settingId, settingType, value);
-
- DRSApi.SetSetting(Session.Handle, Handle, setting);
- }
-
- ///
- /// Sets a new value for a setting or creates a new setting and sets its value
- ///
- /// The identification number of the setting to change its value.
- /// The new value for the setting.
- public void SetSetting(uint settingId, string value)
- {
- SetSetting(settingId, DRSSettingType.UnicodeString, value);
- }
-
- ///
- /// Sets a new value for a setting or creates a new setting and sets its value
- ///
- /// The identification number of the setting to change its value.
- /// The new value for the setting.
- public void SetSetting(uint settingId, byte[] value)
- {
- SetSetting(settingId, DRSSettingType.Binary, value);
- }
-
- ///
- /// Sets a new value for a setting or creates a new setting and sets its value
- ///
- /// The identification number of the setting to change its value.
- /// The new value for the setting.
- public void SetSetting(uint settingId, uint value)
- {
- SetSetting(settingId, DRSSettingType.Integer, value);
- }
- }
-}
\ No newline at end of file
diff --git a/app/NvAPIWrapper/DRS/DriverSettingsSession.cs b/app/NvAPIWrapper/DRS/DriverSettingsSession.cs
deleted file mode 100644
index ce8ed6a1..00000000
--- a/app/NvAPIWrapper/DRS/DriverSettingsSession.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using NvAPIWrapper.Native;
-using NvAPIWrapper.Native.DRS.Structures;
-
-namespace NvAPIWrapper.DRS
-{
- ///
- /// Represents a driver settings session. This is the starting point for using DRS set of functionalities.
- ///
- public class DriverSettingsSession : IDisposable
- {
- internal DriverSettingsSession(DRSSessionHandle handle)
- {
- Handle = handle;
- }
-
- private DriverSettingsSession() : this(DRSApi.CreateSession())
- {
- }
-
- ///
- /// Gets the base settings profile
- ///
- public DriverSettingsProfile BaseProfile
- {
- get
- {
- var profileHandle = DRSApi.GetBaseProfile(Handle);
-
- if (profileHandle.IsNull)
- {
- return null;
- }
-
- return new DriverSettingsProfile(profileHandle, this);
- }
- }
-
- ///
- /// Gets the global settings profile
- ///
- public DriverSettingsProfile CurrentGlobalProfile
- {
- get
- {
- var profileHandle = DRSApi.GetCurrentGlobalProfile(Handle);
-
- if (profileHandle.IsNull)
- {
- return null;
- }
-
- return new DriverSettingsProfile(profileHandle, this);
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- if (string.IsNullOrEmpty(value.Name))
- {
- throw new ArgumentException("Profile name can not be empty.", nameof(value));
- }
-
- DRSApi.SetCurrentGlobalProfile(Handle, value.Name);
- }
- }
-
- ///
- /// Gets the session handle
- ///
- public DRSSessionHandle Handle { get; }
-
- ///
- /// Gets the number of registered profiles
- ///
- public int NumberOfProfiles
- {
- get => DRSApi.GetNumberOfProfiles(Handle);
- }
-
- ///
- /// Gets the list of all registered profiles
- ///
- public IEnumerable Profiles
- {
- get { return DRSApi.EnumProfiles(Handle).Select(handle => new DriverSettingsProfile(handle, this)); }
- }
-
- ///
- public void Dispose()
- {
- ReleaseUnmanagedResources();
- GC.SuppressFinalize(this);
- }
-
- ///
- /// Creates a new session and load the settings
- ///
- /// A new instance of representing a session.
- public static DriverSettingsSession CreateAndLoad()
- {
- var session = new DriverSettingsSession();
- session.Load();
-
- return session;
- }
-
- ///
- /// Creates a new session and load the settings from a file
- ///
- /// The full path of file to load settings from.
- /// A new instance of representing a session.
- public static DriverSettingsSession CreateAndLoad(string fileName)
- {
- var session = new DriverSettingsSession();
- session.Load(fileName);
-
- return session;
- }
-
- ///
- public override string ToString()
- {
- return $"{Handle} ({NumberOfProfiles} Profiles)";
- }
-
- ///
- /// Finds an application by name. This method is useful when passed a full path of a file as it does return an
- /// application almost always describing the NVIDIA driver behavior regarding the passed executable file.
- ///
- /// The name of the application (with extension) or the full path of an executable file.
- /// An instance of class.
- public ProfileApplication FindApplication(string applicationName)
- {
- var application = DRSApi.FindApplicationByName(Handle, applicationName, out var profileHandle);
-
- if (application == null || !profileHandle.HasValue || profileHandle.Value.IsNull)
- {
- return null;
- }
-
- var profile = new DriverSettingsProfile(profileHandle.Value, this);
-
- return new ProfileApplication(application, profile);
- }
-
- ///
- /// Finds a profile based on the application named passed. This method is useful when passed a full path of a file as
- /// it does return a profile almost always describing the NVIDIA driver behavior regarding the passed executable file.
- ///
- /// The name of the application (with extension) or the full path of an executable file.
- ///
- /// An instance of class describing the NVIDIA driver behavior regarding the
- /// passed executable file.
- ///
- public DriverSettingsProfile FindApplicationProfile(string applicationName)
- {
- var application = DRSApi.FindApplicationByName(Handle, applicationName, out var profileHandle);
-
- if (application == null || !profileHandle.HasValue || profileHandle.Value.IsNull)
- {
- return null;
- }
-
- return new DriverSettingsProfile(profileHandle.Value, this);
- }
-
- ///
- /// Finds a profile based on its name.
- ///
- /// The profile name to search for.
- /// An instance of class.
- public DriverSettingsProfile FindProfileByName(string profileName)
- {
- var profileHandle = DRSApi.FindProfileByName(Handle, profileName);
-
- if (profileHandle.IsNull)
- {
- return null;
- }
-
- return new DriverSettingsProfile(profileHandle, this);
- }
-
- ///
- /// Resets all settings to default.
- ///
- public void RestoreDefaults()
- {
- DRSApi.RestoreDefaults(Handle);
- }
-
- ///
- /// Saves the current session settings
- ///
- public void Save()
- {
- DRSApi.SaveSettings(Handle);
- }
-
- ///
- /// Saves the current session settings to a file
- ///
- /// The full path of file to save settings to.
- public void Save(string fileName)
- {
- DRSApi.SaveSettings(Handle, fileName);
- }
-
- private void Load()
- {
- DRSApi.LoadSettings(Handle);
- }
-
- private void Load(string fileName)
- {
- DRSApi.LoadSettings(Handle, fileName);
- }
-
- private void ReleaseUnmanagedResources()
- {
- DRSApi.DestroySession(Handle);
- }
-
- ///
- ~DriverSettingsSession()
- {
- ReleaseUnmanagedResources();
- }
- }
-}
\ No newline at end of file
diff --git a/app/NvAPIWrapper/DRS/KnownSettingId.cs b/app/NvAPIWrapper/DRS/KnownSettingId.cs
deleted file mode 100644
index 021ec6d7..00000000
--- a/app/NvAPIWrapper/DRS/KnownSettingId.cs
+++ /dev/null
@@ -1,555 +0,0 @@
-using System.ComponentModel;
-
-namespace NvAPIWrapper.DRS
-{
-#pragma warning disable 1591
- public enum KnownSettingId : uint
- {
- ///
- /// Antialiasing - Line gamma
- ///
- [Description("Antialiasing - Line gamma")]
- OpenGLAntiAliasingLineGamma = 0x2089BF6C,
-
- ///
- /// Deep color for 3D applications
- ///
- [Description("Deep color for 3D applications")]
- OpenGLDeepColorScanOut = 0x2097C2F6,
-
- ///
- /// OpenGL default swap interval
- ///
- [Description("OpenGL default swap interval")]
- OpenGLDefaultSwapInterval = 0x206A6582,
-
- ///
- /// OpenGL default swap interval fraction
- ///
- [Description("OpenGL default swap interval fraction")]
- OpenGLDefaultSwapIntervalFractional = 0x206C4581,
-
- ///
- /// OpenGL default swap interval sign
- ///
- [Description("OpenGL default swap interval sign")]
- OpenGLDefaultSwapIntervalSign = 0x20655CFA,
-
- ///
- /// Event Log Severity Threshold
- ///
- [Description("Event Log Severity Threshold")]
- OpenGLEventLogSeverityThreshold = 0x209DF23E,
-
- ///
- /// Extension String version
- ///
- [Description("Extension String version")]
- OpenGLExtensionStringVersion = 0x20FF7493,
-
- ///
- /// Buffer-flipping mode
- ///
- [Description("Buffer-flipping mode")] OpenGLForceBlit = 0x201F619F,
-
- ///
- /// Force Stereo shuttering
- ///
- [Description("Force Stereo shuttering")]
- OpenGLForceStereo = 0x204D9A0C,
-
- ///
- /// Preferred OpenGL GPU
- ///
- [Description("Preferred OpenGL GPU")] OpenGLImplicitGPUAffinity = 0x20D0F3E6,
-
- ///
- /// Maximum frames allowed
- ///
- [Description("Maximum frames allowed")]
- OpenGLMaximumFramesAllowed = 0x208E55E3,
-
- ///
- /// Exported Overlay pixel types
- ///
- [Description("Exported Overlay pixel types")]
- OpenGLOverlayPixelType = 0x209AE66F,
-
- ///
- /// Enable overlay
- ///
- [Description("Enable overlay")] OpenGLOverlaySupport = 0x206C28C4,
-
- ///
- /// High level control of the rendering quality on OpenGL
- ///
- [Description("High level control of the rendering quality on OpenGL")]
- OpenGLQualityEnhancements = 0x20797D6C,
-
- ///
- /// Unified back/depth buffer
- ///
- [Description("Unified back/depth buffer")]
- OpenGLSingleBackDepthBuffer = 0x20A29055,
-
- ///
- /// Enable NV_gpu_multicast extension
- ///
- [Description("Enable NV_gpu_multicast extension")]
- OpenGLSLIMulticast = 0x2092D3BE,
-
- ///
- /// Threaded optimization
- ///
- [Description("Threaded optimization")] OpenGLThreadControl = 0x20C1221E,
-
- ///
- /// Event Log Tmon Severity Threshold
- ///
- [Description("Event Log Tmon Severity Threshold")]
- OpenGLTMONLevel = 0x202888C1,
-
- ///
- /// Triple buffering
- ///
- [Description("Triple buffering")] OpenGLTripleBuffer = 0x20FDD1F9,
-
- ///
- /// Antialiasing - Behavior Flags
- ///
- [Description("Antialiasing - Behavior Flags")]
- AntiAliasingBehaviorFlags = 0x10ECDB82,
-
- ///
- /// Antialiasing - Transparency Multisampling
- ///
- [Description("Antialiasing - Transparency Multisampling")]
- AntiAliasingModeAlphaToCoverage = 0x10FC2D9C,
-
- ///
- /// Antialiasing - Gamma correction
- ///
- [Description("Antialiasing - Gamma correction")]
- AntiAliasingModeGammaCorrection = 0x107D639D,
-
- ///
- /// Antialiasing - Setting
- ///
- [Description("Antialiasing - Setting")]
- AntiAliasingModeMethod = 0x10D773D2,
-
- ///
- /// Antialiasing - Transparency Supersampling
- ///
- [Description("Antialiasing - Transparency Supersampling")]
- AntiAliasingModeReplay = 0x10D48A85,
-
- ///
- /// Antialiasing - Mode
- ///
- [Description("Antialiasing - Mode")] AntiAliasingModeSelector = 0x107EFC5B,
-
- ///
- /// Antialiasing - SLI AA
- ///
- [Description("Antialiasing - SLI AA")] AntiAliasingModeSelectorSLIAntiAliasing = 0x107AFC5B,
-
- ///
- /// Anisotropic filtering setting
- ///
- [Description("Anisotropic filtering setting")]
- AnisotropicModeLevel = 0x101E61A9,
-
- ///
- /// Anisotropic filtering mode
- ///
- [Description("Anisotropic filtering mode")]
- AnisotropicModeSelector = 0x10D2BB16,
-
- ///
- /// NVIDIA Predefined Ansel Usage
- ///
- [Description("NVIDIA Predefined Ansel Usage")]
- AnselAllow = 0x1035DB89,
-
- ///
- /// Enable Ansel
- ///
- [Description("Enable Ansel")] AnselEnable = 0x1075D972,
-
- ///
- /// Ansel flags for enabled applications
- ///
- [Description("Ansel flags for enabled applications")]
- AnselWhiteListed = 0x1085DA8A,
-
- ///
- /// Application Profile Notification Popup Timeout
- ///
- [Description("Application Profile Notification Popup Timeout")]
- ApplicationProfileNotificationTimeOut = 0x104554B6,
-
- ///
- /// Steam Application ID
- ///
- [Description("Steam Application ID")] ApplicationSteamId = 0x107CDDBC,
-
- ///
- /// Battery Boost
- ///
- [Description("Battery Boost")] BatteryBoost = 0x10115C89,
-
- ///
- /// Do not display this profile in the Control Panel
- ///
- [Description("Do not display this profile in the Control Panel")]
- ControlPanelHiddenProfile = 0x106D5CFF,
-
- ///
- /// List of Universal GPU ids
- ///
- [Description("List of Universal GPU ids")]
- CUDAExcludedGPUs = 0x10354FF8,
-
- ///
- /// Maximum GPU Power
- ///
- [Description("Maximum GPU Power")] D3DOpenGLGPUMaximumPower = 0x10D1EF29,
-
- ///
- /// Export Performance Counters
- ///
- [Description("Export Performance Counters")]
- ExportPerformanceCounters = 0x108F0841,
-
- ///
- /// NVIDIA Predefined FXAA Usage
- ///
- [Description("NVIDIA Predefined FXAA Usage")]
- FXAAAllow = 0x1034CB89,
-
- ///
- /// Enable FXAA
- ///
- [Description("Enable FXAA")] FXAAEnable = 0x1074C972,
-
- ///
- /// Enable FXAA Indicator
- ///
- [Description("Enable FXAA Indicator")] FXAAIndicatorEnable = 0x1068FB9C,
-
- ///
- /// SLI indicator
- ///
- [Description("SLI indicator")] MCSFRShowSplit = 0x10287051,
-
- ///
- /// NVIDIA Quality upscaling
- ///
- [Description("NVIDIA Quality upscaling")]
- NvidiaQualityUpScaling = 0x10444444,
-
- ///
- /// Maximum AA samples allowed for a given application
- ///
- [Description("Maximum AA samples allowed for a given application")]
- OptimusMaximumAntiAliasing = 0x10F9DC83,
-
- ///
- /// Display the PhysX indicator
- ///
- [Description("Display the PhysX indicator")]
- PhysxIndicator = 0x1094F16F,
-
- ///
- /// Power management mode
- ///
- [Description("Power management mode")] PreferredPerformanceState = 0x1057EB71,
-
- ///
- /// No override of Anisotropic filtering
- ///
- [Description("No override of Anisotropic filtering")]
- PreventUiAnisotropicOverride = 0x103BCCB5,
-
- ///
- /// Frame Rate Limiter
- ///
- [Description("Frame Rate Limiter")] PerformanceStateFrameRateLimiter = 0x10834FEE,
-
- ///
- /// Frame Rate Limiter 2 Control
- ///
- [Description("Frame Rate Limiter 2 Control")]
- PerformanceStateFrameRateLimiter2Control = 0x10834FFF,
-
- ///
- /// Frame Rate Monitor
- ///
- [Description("Frame Rate Monitor")] PerformanceStateFrameRateLimiterGpsControl = 0x10834F01,
-
- ///
- /// Frame Rate Monitor Control
- ///
- [Description("Frame Rate Monitor Control")]
- PerformanceStateFrameRateMonitorControl = 0x10834F05,
-
- ///
- /// Maximum resolution allowed for a given application
- ///
- [Description("Maximum resolution allowed for a given application")]
- ShimMaxResolution = 0x10F9DC82,
-
- ///
- /// Optimus flags for enabled applications
- ///
- [Description("Optimus flags for enabled applications")]
- ShimMCCOMPAT = 0x10F9DC80,
-
- ///
- /// Enable application for Optimus
- ///
- [Description("Enable application for Optimus")]
- ShimRenderingMode = 0x10F9DC81,
-
- ///
- /// Shim Rendering Mode Options per application for Optimus
- ///
- [Description("Shim Rendering Mode Options per application for Optimus")]
- ShimRenderingOptions = 0x10F9DC84,
-
- ///
- /// Number of GPUs to use on SLI rendering mode
- ///
- [Description("Number of GPUs to use on SLI rendering mode")]
- SLIGPUCount = 0x1033DCD1,
-
- ///
- /// NVIDIA predefined number of GPUs to use on SLI rendering mode
- ///
- [Description("NVIDIA predefined number of GPUs to use on SLI rendering mode")]
- SLIPredefinedGPUCount = 0x1033DCD2,
-
- ///
- /// NVIDIA predefined number of GPUs to use on SLI rendering mode on DirectX 10
- ///
- [Description("NVIDIA predefined number of GPUs to use on SLI rendering mode on DirectX 10")]
- SLIPredefinedGPUCountDX10 = 0x1033DCD3,
-
- ///
- /// NVIDIA predefined SLI mode
- ///
- [Description("NVIDIA predefined SLI mode")]
- SLIPredefinedMode = 0x1033CEC1,
-
- ///
- /// NVIDIA predefined SLI mode on DirectX 10
- ///
- [Description("NVIDIA predefined SLI mode on DirectX 10")]
- SLIPredefinedModeDX10 = 0x1033CEC2,
-
- ///
- /// SLI rendering mode
- ///
- [Description("SLI rendering mode")] SLIRenderingMode = 0x1033CED1,
-
- ///
- /// Virtual Reality pre-rendered frames
- ///
- [Description("Virtual Reality pre-rendered frames")]
- VRPreRenderLimit = 0x10111133,
-
- ///
- /// Toggle the VRR global feature
- ///
- [Description("Toggle the VRR global feature")]
- VRRFeatureIndicator = 0x1094F157,
-
- ///
- /// Display the VRR Overlay Indicator
- ///
- [Description("Display the VRR Overlay Indicator")]
- VRROverlayIndicator = 0x1095F16F,
-
- ///
- /// VRR requested state
- ///
- [Description("VRR requested state")] VRRRequestState = 0x1094F1F7,
-
- ///
- /// G-SYNC
- ///
- [Description("G-SYNC")] VRRApplicationOverride = 0x10A879CF,
-
- ///
- /// G-SYNC
- ///
- [Description("G-SYNC")] VRRApplicationOverrideRequestState = 0x10A879AC,
-
- ///
- /// Enable G-SYNC globally
- ///
- [Description("Enable G-SYNC globally")]
- VRRMode = 0x1194F158,
-
- ///
- /// Flag to control smooth AFR behavior
- ///
- [Description("Flag to control smooth AFR behavior")]
- VSyncSmoothAFR = 0x101AE763,
-
- ///
- /// Variable refresh Rate
- ///
- [Description("Variable refresh Rate")] VSyncVRRControl = 0x10A879CE,
-
- ///
- /// Vsync - Behavior Flags
- ///
- [Description("Vsync - Behavior Flags")]
- VSyncBehaviorFlags = 0x10FDEC23,
-
- ///
- /// Stereo - Swap eyes
- ///
- [Description("Stereo - Swap eyes")] WKSAPIStereoEyesExchange = 0x11AE435C,
-
- ///
- /// Stereo - Display mode
- ///
- [Description("Stereo - Display mode")] WKSAPIStereoMode = 0x11E91A61,
-
- ///
- /// Memory Allocation Policy
- ///
- [Description("Memory Allocation Policy")]
- WKSMemoryAllocationPolicy = 0x11112233,
-
- ///
- /// Stereo - Dongle Support
- ///
- [Description("Stereo - Dongle Support")]
- WKSStereoDongleSupport = 0x112493BD,
-
- ///
- /// Stereo - Enable
- ///
- [Description("Stereo - Enable")] WKSStereoSupport = 0x11AA9E99,
-
- ///
- /// Stereo � swap mode
- ///
- [Description("Stereo � swap mode")] WKSStereoSwapMode = 0x11333333,
-
- ///
- /// Ambient Occlusion
- ///
- [Description("Ambient Occlusion")] AmbientOcclusionMode = 0x667329,
-
- ///
- /// NVIDIA Predefined Ambient Occlusion Usage
- ///
- [Description("NVIDIA Predefined Ambient Occlusion Usage")]
- AmbientOcclusionModeActive = 0x664339,
-
- ///
- /// Texture filtering - Driver Controlled LOD Bias
- ///
- [Description("Texture filtering - Driver Controlled LOD Bias")]
- AutoLODBiasAdjust = 0x638E8F,
-
- ///
- /// Export Performance Counters for DX9 only
- ///
- [Description("Export Performance Counters for DX9 only")]
- ExportPerformanceCountersDX9Only = 0xB65E72,
-
- ///
- /// ICafe Settings
- ///
- [Description("ICafe Settings")] ICafeLogoConfig = 0xDB1337,
-
- ///
- /// Texture filtering - LOD Bias
- ///
- [Description("Texture filtering - LOD Bias")]
- LODBiasAdjust = 0x738E8F,
-
- ///
- /// Enable sample interleaving (MFAA)
- ///
- [Description("Enable sample interleaving (MFAA)")]
- MaxwellBSampleInterleave = 0x98C1AC,
-
- ///
- /// Maximum pre-rendered frames
- ///
- [Description("Maximum pre-rendered frames")]
- PreRenderLimit = 0x7BA09E,
-
- ///
- /// Shader Cache
- ///
- [Description("Shader Cache")] PerformanceStateShaderDiskCache = 0x198FFF,
-
- ///
- /// Texture filtering - Anisotropic sample optimization
- ///
- [Description("Texture filtering - Anisotropic sample optimization")]
- PerformanceStateTextureFilteringAnisotropicOptimization = 0xE73211,
-
- ///
- /// Texture filtering - Anisotropic filter optimization
- ///
- [Description("Texture filtering - Anisotropic filter optimization")]
- PerformanceStateTextureFilteringBiLinearInAnisotropic = 0x84CD70,
-
- ///
- /// Texture filtering - Trilinear optimization
- ///
- [Description("Texture filtering - Trilinear optimization")]
- PerformanceStateTextureFilteringDisableTrilinearSlope = 0x2ECAF2,
-
- ///
- /// Texture filtering - Negative LOD bias
- ///
- [Description("Texture filtering - Negative LOD bias")]
- PerformanceStateTextureFilteringNoNegativeLODBias = 0x19BB68,
-
- ///
- /// Texture filtering - Quality
- ///
- [Description("Texture filtering - Quality")]
- QualityEnhancements = 0xCE2691,
-
- ///
- /// Preferred refresh rate
- ///
- [Description("Preferred refresh rate")]
- RefreshRateOverride = 0x64B541,
-
- ///
- /// PowerThrottle
- ///
- [Description("PowerThrottle")] SetPowerThrottleForPCIeCompliance = 0xAE785C,
-
- ///
- /// VAB Default Data
- ///
- [Description("VAB Default Data")] SetVABData = 0xAB8687,
-
- ///
- /// Vertical Sync
- ///
- [Description("Vertical Sync")] VSyncMode = 0xA879CF,
-
- ///
- /// Vertical Sync Tear Control
- ///
- [Description("Vertical Sync Tear Control")]
- VSyncTearControl = 0x5A375C,
-
- InvalidSetting = 0xFFFFFFFF
- }
-#pragma warning restore 1591
-}
\ No newline at end of file
diff --git a/app/NvAPIWrapper/DRS/ProfileApplication.cs b/app/NvAPIWrapper/DRS/ProfileApplication.cs
deleted file mode 100644
index 04961b86..00000000
--- a/app/NvAPIWrapper/DRS/ProfileApplication.cs
+++ /dev/null
@@ -1,424 +0,0 @@
-using System;
-using NvAPIWrapper.Native;
-using NvAPIWrapper.Native.DRS.Structures;
-using NvAPIWrapper.Native.Exceptions;
-using NvAPIWrapper.Native.Interfaces.DRS;
-
-namespace NvAPIWrapper.DRS
-{
- ///
- /// Represents an application rule registered in a profile
- ///
- public class ProfileApplication
- {
- private IDRSApplication _application;
-
- internal ProfileApplication(IDRSApplication application, DriverSettingsProfile profile)
- {
- Profile = profile;
- _application = application;
- }
-
- ///
- /// Gets the application name
- ///
- public string ApplicationName
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- return _application.ApplicationName;
- }
- }
-
- ///
- /// Gets the application command line
- ///
- public string CommandLine
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- if (_application is DRSApplicationV4 applicationV4)
- {
- return applicationV4.ApplicationCommandLine;
- }
-
- return null;
- }
- }
-
- ///
- /// Gets a list of files that are necessary to be present inside the application parent directory
- ///
- public string[] FilesInFolder
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- if (_application is DRSApplicationV2 applicationV2)
- {
- return applicationV2.FilesInFolder;
- }
-
- if (_application is DRSApplicationV3 applicationV3)
- {
- return applicationV3.FilesInFolder;
- }
-
- if (_application is DRSApplicationV4 applicationV4)
- {
- return applicationV4.FilesInFolder;
- }
-
- return null;
- }
- }
-
- ///
- /// Gets the application friendly name
- ///
- public string FriendlyName
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- return _application.FriendlyName;
- }
- }
-
- ///
- /// Gets a boolean value indicating if this application rule needs a specific command line; or
- /// if this information is not available.
- ///
- public bool? HasCommandLine
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- if (_application is DRSApplicationV3 applicationV3)
- {
- return applicationV3.HasCommandLine;
- }
-
- if (_application is DRSApplicationV4 applicationV4)
- {
- return applicationV4.HasCommandLine;
- }
-
- return null;
- }
- }
-
- ///
- /// Gets a boolean value indicating if this application is a metro application; or if this
- /// information is not available.
- ///
- public bool? IsMetroApplication
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- if (_application is DRSApplicationV3 applicationV3)
- {
- return applicationV3.IsMetroApplication;
- }
-
- if (_application is DRSApplicationV4 applicationV4)
- {
- return applicationV4.IsMetroApplication;
- }
-
- return null;
- }
- }
-
- ///
- /// Gets a boolean value indicating if this application is predefined by the NVIDIA driver
- ///
- public bool IsPredefined
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- return _application.IsPredefined;
- }
- }
-
- ///
- /// Gets a boolean value indicating if this instance of is a valid instance
- /// representing an application in a profile
- ///
- public bool IsValid
- {
- get => _application != null && Profile.IsValid;
- }
-
- ///
- /// Gets the application launcher name
- ///
- public string LauncherName
- {
- get
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- return _application.LauncherName;
- }
- }
-
- ///
- /// Gets the parent profile instance
- ///
- public DriverSettingsProfile Profile { get; }
-
- ///
- /// Creates a new application
- ///
- /// The profile to create the new application in.
- /// The application name (with extension).
- /// The application friendly name.
- /// The application launcher name.
- /// An array of files necessary to be present inside the application parent directory.
- /// A boolean value indicating if this application is a metro application.
- /// The application command line string.
- /// A new instance of representing the newly created application.
- // ReSharper disable once TooManyArguments
- // ReSharper disable once FunctionComplexityOverflow
- public static ProfileApplication CreateApplication(
- DriverSettingsProfile profile,
- string applicationName,
- string friendlyName = null,
- string launcherName = null,
- string[] fileInFolders = null,
- bool isMetro = false,
- string commandLine = null
- )
- {
- var createDelegates = new Func[]
- {
- CreateApplicationInstanceV4,
- CreateApplicationInstanceV3,
- CreateApplicationInstanceV2,
- CreateApplicationInstanceV1
- };
-
- Exception lastException = null;
- IDRSApplication application = null;
-
- foreach (var func in createDelegates)
- {
- try
- {
- // ReSharper disable once EventExceptionNotDocumented
- application = func(
- applicationName,
- friendlyName,
- launcherName,
- fileInFolders,
- isMetro,
- commandLine
- );
-
- break;
- }
- catch (NVIDIANotSupportedException e)
- {
- // ignore
- lastException = e;
- }
- }
-
- if (application == null)
- {
- // ReSharper disable once ThrowingSystemException
- throw lastException;
- }
-
- application = DRSApi.CreateApplication(profile.Session.Handle, profile.Handle, application);
-
- return new ProfileApplication(application, profile);
- }
-
- // ReSharper disable once TooManyArguments
- private static IDRSApplication CreateApplicationInstanceV1(
- string applicationName,
- string friendlyName = null,
- string launcherName = null,
- string[] fileInFolders = null,
- bool isMetro = false,
- string commandLine = null
- )
- {
- if (!string.IsNullOrWhiteSpace(commandLine))
- {
- throw new NotSupportedException(
- "CommandLine is not supported with the current execution environment."
- );
- }
-
- if (fileInFolders?.Length > 0)
- {
- throw new NotSupportedException(
- "Same folder file presence check is not supported with the current execution environment."
- );
- }
-
- return new DRSApplicationV1(
- applicationName,
- friendlyName,
- launcherName
- );
- }
-
- // ReSharper disable once TooManyArguments
- private static IDRSApplication CreateApplicationInstanceV2(
- string applicationName,
- string friendlyName = null,
- string launcherName = null,
- string[] fileInFolders = null,
- bool isMetro = false,
- string commandLine = null
- )
- {
- if (!string.IsNullOrWhiteSpace(commandLine))
- {
- throw new NotSupportedException(
- "CommandLine is not supported with the current execution environment."
- );
- }
-
- return new DRSApplicationV2(
- applicationName,
- friendlyName,
- launcherName,
- fileInFolders
- );
- }
-
- // ReSharper disable once TooManyArguments
- private static IDRSApplication CreateApplicationInstanceV3(
- string applicationName,
- string friendlyName = null,
- string launcherName = null,
- string[] fileInFolders = null,
- bool isMetro = false,
- string commandLine = null
- )
- {
- if (!string.IsNullOrWhiteSpace(commandLine))
- {
- throw new NotSupportedException(
- "CommandLine is not supported with the current execution environment."
- );
- }
-
- return new DRSApplicationV3(
- applicationName,
- friendlyName,
- launcherName,
- fileInFolders,
- isMetro
- );
- }
-
- // ReSharper disable once TooManyArguments
- private static IDRSApplication CreateApplicationInstanceV4(
- string applicationName,
- string friendlyName = null,
- string launcherName = null,
- string[] fileInFolders = null,
- bool isMetro = false,
- string commandLine = null
- )
- {
- return new DRSApplicationV4(
- applicationName,
- friendlyName,
- launcherName,
- fileInFolders,
- isMetro,
- commandLine
- );
- }
-
- ///
- public override string ToString()
- {
- if (!IsValid)
- {
- return "[Invalid]";
- }
-
- if (IsPredefined)
- {
- return $"{ApplicationName} (Predefined)";
- }
-
- return ApplicationName;
- }
-
- ///
- /// Deletes this application and makes this instance invalid
- ///
- public void Delete()
- {
- if (!IsValid)
- {
- throw new InvalidOperationException(
- "Can not perform this operation with an invalid application instance."
- );
- }
-
- DRSApi.DeleteApplication(Profile.Session.Handle, Profile.Handle, _application);
- _application = null;
- }
- }
-}
\ No newline at end of file
diff --git a/app/NvAPIWrapper/DRS/ProfileSetting.cs b/app/NvAPIWrapper/DRS/ProfileSetting.cs
deleted file mode 100644
index bff491b4..00000000
--- a/app/NvAPIWrapper/DRS/ProfileSetting.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-using System;
-using NvAPIWrapper.Native.DRS;
-using NvAPIWrapper.Native.DRS.Structures;
-
-namespace NvAPIWrapper.DRS
-{
- ///
- /// Represents a profile setting and its value
- ///
- public class ProfileSetting
- {
- private readonly DRSSettingV1 _setting;
-
- internal ProfileSetting(DRSSettingV1 setting)
- {
- _setting = setting;
- }
-
- ///
- /// Gets the current value of the setting
- ///
- public object CurrentValue
- {
- get
- {
- if (IsPredefinedValueValid && IsCurrentValuePredefined)
- {
- return _setting.PredefinedValue;
- }
-
- return _setting.CurrentValue;
- }
- }
-
- ///
- /// Gets a boolean value indicating if the current value is the predefined value.
- ///
- public bool IsCurrentValuePredefined
- {
- get => _setting.IsCurrentValuePredefined;
- }
-
- ///
- /// Gets a boolean value indicating if this setting had a predefined valid value.
- ///
- public bool IsPredefinedValueValid
- {
- get => _setting.IsPredefinedValueValid;
- }
-
- ///
- /// Gets the predefined value of this setting.
- ///
- public object PredefinedValue
- {
- get
- {
- if (!IsPredefinedValueValid)
- {
- throw new InvalidOperationException("Predefined value is not valid.");
- }
-
- return _setting.PredefinedValue;
- }
- }
-
- ///
- /// Gets the setting identification number
- ///
- public uint SettingId
- {
- get => _setting.Id;
- }
-
- ///
- /// Gets additional information regarding this setting including possible valid values
- ///
- public SettingInfo SettingInfo
- {
- get => SettingInfo.FromId(SettingId);
- }
-
- ///
- /// Gets the profile location of this setting
- ///
- public DRSSettingLocation SettingLocation
- {
- get => _setting.SettingLocation;
- }
-
- ///
- /// Gets the value type of this setting
- ///
- public DRSSettingType SettingType
- {
- get => _setting.SettingType;
- }
-
- ///
- public override string ToString()
- {
- string settingName = null;
-
- try
- {
- settingName = SettingInfo.Name;
- }
- catch
- {
- // ignore;
- }
-
- if (string.IsNullOrWhiteSpace(settingName))
- {
- settingName = $"#{SettingId:X}";
- }
-
- if (IsCurrentValuePredefined)
- {
- return $"{settingName} = {CurrentValue ?? "[NULL]"} (Predefined)";
- }
-
- return $"{settingName} = {CurrentValue ?? "[NULL]"}";
- }
- }
-}
\ No newline at end of file
diff --git a/app/NvAPIWrapper/DRS/SettingInfo.cs b/app/NvAPIWrapper/DRS/SettingInfo.cs
deleted file mode 100644
index 30283169..00000000
--- a/app/NvAPIWrapper/DRS/SettingInfo.cs
+++ /dev/null
@@ -1,360 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
-using NvAPIWrapper.Native;
-using NvAPIWrapper.Native.DRS;
-
-namespace NvAPIWrapper.DRS
-{
- ///
- /// Contains information about a setting
- ///
- public class SettingInfo
- {
- private static uint[] _availableSettingIds;
-
- private SettingInfo(uint settingId)
- {
- SettingId = settingId;
- }
-
- ///
- /// Gets an array of available possible valid values.
- ///
- public object[] AvailableValues
- {
- get
- {
- if (!IsAvailable)
- {
- return null;
- }
-
- return DRSApi.EnumAvailableSettingValues(SettingId).Values;
- }
- }
-
- ///
- /// Gets the default value of this setting
- ///
- public object DefaultValue
- {
- get
- {
- if (!IsAvailable)
- {
- return null;
- }
-
- var values = DRSApi.EnumAvailableSettingValues(SettingId);
-
- return values.DefaultValue;
- }
- }
-
- ///
- /// Gets a boolean value indicating if this setting is available on this machine and with the current version of NVIDIA
- /// driver
- ///
- public bool IsAvailable
- {
- get => GetAvailableSetting().Any(info => info.SettingId == SettingId);
- }
-
- ///
- /// Gets a boolean value indicating if this setting is know by this library
- ///
- public bool IsKnown
- {
- get => IsSettingKnown(SettingId);
- }
-
- ///
- /// Gets the description of this setting from the library or if this setting is not known by
- /// the library.
- ///
- public string KnownDescription
- {
- get
- {
- if (!IsKnown || KnownSettingId == null)
- {
- return null;
- }
-
- return GetSettingDescription(KnownSettingId.Value);
- }
- }
-
- ///
- /// Gets the known identification number of this setting from the library or if this setting is
- /// not known by the library.
- ///
- public KnownSettingId? KnownSettingId
- {
- get
- {
- if (!IsKnown)
- {
- return null;
- }
-
- return GetKnownSettingId(SettingId);
- }
- }
-
- ///
- /// Gets the type of a static class or an enum containing possible known values for this setting from the library or
- /// if this setting is not known by the library
- ///
- public Type KnownValueType
- {
- get
- {
- if (!IsKnown || !IsAvailable)
- {
- return null;
- }
-
- var name = KnownSettingId.ToString();
- var nameSpace = typeof(SettingInfo).Namespace + ".SettingValues";
-
- if (SettingType == DRSSettingType.Integer)
- {
- return Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(type =>
- type.IsEnum &&
- type.Namespace?.Equals(nameSpace, StringComparison.InvariantCultureIgnoreCase) == true &&
- type.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
- }
-
- if (SettingType == DRSSettingType.String || SettingType == DRSSettingType.UnicodeString)
- {
- return Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(type =>
- type.IsClass &&
- type.Namespace?.Equals(nameSpace, StringComparison.InvariantCultureIgnoreCase) == true &&
- type.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
- }
-
- return null;
- }
- }
-
- ///
- /// Gets the name of the setting from NVIDIA driver or if the setting is not available on this
- /// machine.
- ///
- public string Name
- {
- get
- {
- if (!IsAvailable)
- {
- return null;
- }
-
- return DRSApi.GetSettingNameFromId(SettingId);
- }
- }
-
- ///
- /// Gets the setting identification number
- ///
- public uint SettingId { get; }
-
- ///
- /// Gets the value type of the setting from NVIDIA driver or if the setting is not available on
- /// this machine.
- ///
- public DRSSettingType? SettingType
- {
- get
- {
- if (!IsAvailable)
- {
- return null;
- }
-
- var values = DRSApi.EnumAvailableSettingValues(SettingId);
-
- return values.SettingType;
- }
- }
-
- ///
- /// Gets information regarding a setting from its identification number.
- ///
- /// The identification number of the setting to get information about.
- /// An instance of containing information about the setting.
- public static SettingInfo FromId(uint settingId)
- {
- return new SettingInfo(settingId);
- }
-
- ///
- /// Gets information regarding a setting from its known identification number.
- ///
- /// The known identification number of the setting to get information about.
- /// An instance of containing information about the setting.
- public static SettingInfo FromKnownSettingId(KnownSettingId settingId)
- {
- return FromId(GetSettingId(settingId));
- }
-
- ///
- /// Gets information regarding a setting from its name.
- ///
- /// The name of the setting to get information about.
- /// An instance of containing information about the setting.
- public static SettingInfo FromName(string settingName)
- {
- var settingId = DRSApi.GetSettingIdFromName(settingName);
-
- return FromId(settingId);
- }
-
- ///
- /// Gets a list of all available setting on this machine
- ///
- /// Instances of each representing a available setting on this machine.
- public static SettingInfo[] GetAvailableSetting()
- {
- if (_availableSettingIds == null)
- {
- _availableSettingIds = DRSApi.EnumAvailableSettingIds();
- }
-
- return _availableSettingIds.Select(FromId).ToArray();
- }
-
- ///
- /// Gets the known identification number of a setting from its identification number
- ///
- /// The setting identification number.
- /// The known setting identification number if the setting is known; otherwise .
- public static KnownSettingId? GetKnownSettingId(uint settingId)
- {
- if (!IsSettingKnown(settingId))
- {
- return null;
- }
-
- return (KnownSettingId) settingId;
- }
-
- ///
- /// Gets the known setting description from its identification number
- ///
- /// The known setting identification number.
- /// The known setting description if available; otherwise .
- public static string GetSettingDescription(KnownSettingId knownSettingId)
- {
- var enumName = Enum.GetName(typeof(KnownSettingId), knownSettingId);
-
- if (enumName == null)
- {
- return null;
- }
-
- var enumField = typeof(KnownSettingId).GetField(enumName);
-
- if (enumField == null)
- {
- return null;
- }
-
- var descriptionAttribute = enumField
- .GetCustomAttributes(typeof(DescriptionAttribute), false)
- .OfType()
- .FirstOrDefault();
-
- if (string.IsNullOrWhiteSpace(descriptionAttribute?.Description))
- {
- return null;
- }
-
- return descriptionAttribute.Description;
- }
-
- ///
- /// Gets the identification number of a setting from its known identification number
- ///
- /// The known setting identification number.
- /// The setting identification number.
- public static uint GetSettingId(KnownSettingId knownSettingId)
- {
- return (uint) knownSettingId;
- }
-
- ///
- /// Checks if a setting is known by this library.
- ///
- /// The setting identification number.
- /// true if setting is known by this library; otherwise false.
- public static bool IsSettingKnown(uint settingId)
- {
- return Enum.IsDefined(typeof(KnownSettingId), settingId);
- }
-
- ///
- public override string ToString()
- {
- try
- {
- var settingName = Name;
-
- if (!string.IsNullOrWhiteSpace(settingName))
- {
- return settingName;
- }
- }
- catch
- {
- // ignore;
- }
-
- return $"#{SettingId:X}";
- }
-
- ///
- /// Tries to resolve the name of a known value using its actual value
- ///
- /// The actual value
- /// The name of the known value member.
- public string ResolveKnownValueName(object value)
- {
- if (!IsKnown)
- {
- return null;
- }
-
- var valueType = KnownValueType;
-
- if (valueType == null)
- {
- return null;
- }
-
- if (valueType.IsEnum)
- {
- return Enum.GetName(valueType, value);
- }
-
- var comparerType = typeof(EqualityComparer<>).MakeGenericType(value.GetType());
- var comparer = comparerType.GetProperty(nameof(EqualityComparer