From 6318d37247cb9065599eb6209345e6ec452275f7 Mon Sep 17 00:00:00 2001 From: Vincent Maas Date: Sat, 1 Apr 2023 10:29:31 +0200 Subject: [PATCH] add modules and make them configurable, enable page up/down shortcuts --- ColorControl/ColorControl.csproj | 4 +- ColorControl/Common/PipeUtils.cs | 4 +- ColorControl/Config.cs | 5 +- ColorControl/Forms/MessageForms.cs | 49 +- ColorControl/IModulePanel.cs | 7 + ColorControl/MainForm.Designer.cs | 289 +----- ColorControl/MainForm.cs | 288 +++--- ColorControl/Module.cs | 14 + ColorControl/Services/AMD/AmdPanel.cs | 4 +- .../Services/GameLauncher/GamePanel.cs | 2 +- ColorControl/Services/LG/LgPanel.Designer.cs | 50 +- ColorControl/Services/LG/LgPanel.cs | 144 ++- ColorControl/Services/LG/LgPanel.resx | 5 +- ColorControl/Services/LG/LgServiceConfig.cs | 1 + ColorControl/Services/NVIDIA/NvGpuInfo.cs | 302 ++++-- .../Services/NVIDIA/NvPanel.Designer.cs | 947 +++++++++--------- ColorControl/Services/NVIDIA/NvPanel.cs | 203 ++-- ColorControl/Services/NVIDIA/NvPanel.resx | 9 + ColorControl/Services/NVIDIA/NvService.cs | 37 +- .../GPU/Structures/PrivateThermalSensorsV2.cs | 10 +- 20 files changed, 1223 insertions(+), 1151 deletions(-) create mode 100644 ColorControl/IModulePanel.cs create mode 100644 ColorControl/Module.cs diff --git a/ColorControl/ColorControl.csproj b/ColorControl/ColorControl.csproj index 0ed7b4a..8cc4b1c 100644 --- a/ColorControl/ColorControl.csproj +++ b/ColorControl/ColorControl.csproj @@ -19,8 +19,8 @@ Maassoft Maassoft 0 - 8.5.0.0 - 8.5.0.0 + 9.0.0.0 + 9.0.0.0 false true false diff --git a/ColorControl/Common/PipeUtils.cs b/ColorControl/Common/PipeUtils.cs index d173640..bffb2b8 100644 --- a/ColorControl/Common/PipeUtils.cs +++ b/ColorControl/Common/PipeUtils.cs @@ -10,7 +10,7 @@ namespace ColorControl.Common { private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger(); - public static string SendMessage(string message, int timeout = 500) + public static string SendMessage(string message, int timeout = 2000) { var pipeClient = new NamedPipeClientStream(".", "testpipe", PipeDirection.InOut, PipeOptions.None, TokenImpersonationLevel.None); try @@ -39,7 +39,7 @@ namespace ColorControl.Common } } - public static SvcResultMessage SendMessage(SvcMessage message, int timeout = 500) + public static SvcResultMessage SendMessage(SvcMessage message, int timeout = 2000) { var messageJson = JsonConvert.SerializeObject(message); diff --git a/ColorControl/Config.cs b/ColorControl/Config.cs index b1eb9d1..80cd898 100644 --- a/ColorControl/Config.cs +++ b/ColorControl/Config.cs @@ -1,4 +1,5 @@ -using System.Windows.Forms; +using System.Collections.Generic; +using System.Windows.Forms; namespace ColorControl { @@ -42,6 +43,7 @@ namespace ColorControl public bool UseDedicatedElevatedProcess { get; set; } public ElevationMethod ElevationMethod { get; set; } public bool ElevationMethodAsked { get; set; } + public List Modules { get; set; } public Config() { @@ -60,6 +62,7 @@ namespace ColorControl NvPresetsSortState = new ListViewSortState(); AmdPresetsSortState = new ListViewSortState(); GamePresetsSortState = new ListViewSortState(); + Modules = new List(); } } } diff --git a/ColorControl/Forms/MessageForms.cs b/ColorControl/Forms/MessageForms.cs index 780d6dd..50e026c 100644 --- a/ColorControl/Forms/MessageForms.cs +++ b/ColorControl/Forms/MessageForms.cs @@ -25,6 +25,7 @@ namespace ColorControl.Forms public class FieldDefinition { public string Label { get; set; } + public string SubLabel { get; set; } public FieldType FieldType { get; set; } = FieldType.Text; public IEnumerable Values { get; set; } public decimal MinValue { get; set; } @@ -35,6 +36,7 @@ namespace ColorControl.Forms public int ValueAsInt => int.Parse(Value.ToString()); public uint ValueAsUInt => uint.Parse(Value.ToString()); + public bool ValueAsBool => bool.Parse(Value.ToString()); } public class MessageForm : Form @@ -120,14 +122,14 @@ namespace ColorControl.Forms return ShowDialog(caption, fieldDefinitions, validateFunc); } - public static List ShowDialog(string caption, IEnumerable fields, Func, string> validateFunc = null) + public static List ShowDialog(string caption, IEnumerable fields, Func, string> validateFunc = null, string okButtonText = "OK") { var values = new List(); var prompt = new MessageForm() { Width = 460, - Height = 106 + (fields.Count() * 50), + Height = 106, FormBorderStyle = FormBorderStyle.FixedDialog, Text = caption, StartPosition = FormStartPosition.CenterScreen @@ -152,9 +154,20 @@ namespace ColorControl.Forms foreach (var field in fields) { var label = field.Label; - var textLabel = new Label() { Left = DefaultLeft, Top = top, Text = label, AutoSize = true }; - top += 20; - groupBox.Controls.Add(textLabel); + + if (field.FieldType != FieldType.CheckBox) + { + var textLabel = new Label() { Left = DefaultLeft, Top = top, Text = label, AutoSize = true }; + top += 20; + groupBox.Controls.Add(textLabel); + } + + if (field.SubLabel != null) + { + var textSubLabel = new Label() { Left = DefaultLeft, Top = top, Text = field.SubLabel, AutoSize = true }; + top += 20; + groupBox.Controls.Add(textSubLabel); + } Control control; @@ -200,7 +213,7 @@ namespace ColorControl.Forms break; case FieldType.Numeric: - var numericEdit = new NumericUpDown() { Left = DefaultLeft, Top = top, Width = 400 }; + var numericEdit = new NumericUpDown() { Left = DefaultLeft, Top = top, Width = 200 }; if (field.MinValue != field.MaxValue) { @@ -240,11 +253,15 @@ namespace ColorControl.Forms break; case FieldType.CheckBox: + + top += 4; + var checkBox = new CheckBox { Left = DefaultLeft, Top = top, - Width = 24, + AutoSize = true, + Text = label }; checkBox.Checked = field.Value is bool boolValue && boolValue; @@ -339,7 +356,23 @@ namespace ColorControl.Forms counter++; } - var confirmation = new Button() { Text = "OK", Left = DefaultLeft + 400 - 75, Width = 75, Top = prompt.ClientRectangle.Height - 30 }; + var maxWidth = boxes.Max(c => c.Width + c.Left) + 20; + + if (groupBox.Width < maxWidth) + { + groupBox.Width = maxWidth; + prompt.Width = groupBox.Width; + } + + var maxHeight = boxes.Max(c => c.Height + c.Top) + 20; + + if (groupBox.Height < maxHeight) + { + prompt.Height = maxHeight + 80; + groupBox.Height = maxHeight; + } + + var confirmation = new Button() { Text = okButtonText, Left = prompt.ClientRectangle.Width - 75 - 20, Width = 75, Top = prompt.ClientRectangle.Height - 30 }; confirmation.Click += (sender, e) => { foreach (var box in boxes) diff --git a/ColorControl/IModulePanel.cs b/ColorControl/IModulePanel.cs new file mode 100644 index 0000000..d4ec004 --- /dev/null +++ b/ColorControl/IModulePanel.cs @@ -0,0 +1,7 @@ +namespace ColorControl +{ + internal interface IModulePanel + { + public void UpdateInfo(); + } +} diff --git a/ColorControl/MainForm.Designer.cs b/ColorControl/MainForm.Designer.cs index 57eb1fb..a2d96d7 100644 --- a/ColorControl/MainForm.Designer.cs +++ b/ColorControl/MainForm.Designer.cs @@ -30,29 +30,16 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.tcMain = new System.Windows.Forms.TabControl(); - this.tabNVIDIA = new System.Windows.Forms.TabPage(); - this.tabAMD = new System.Windows.Forms.TabPage(); - this.tabLG = new System.Windows.Forms.TabPage(); - this.tabGameLauncher = new System.Windows.Forms.TabPage(); this.tabOptions = new System.Windows.Forms.TabPage(); + this.grpOptionsModules = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.chkModules = new System.Windows.Forms.CheckedListBox(); this.grpMiscellaneousOptions = new System.Windows.Forms.GroupBox(); this.btnSetShortcutScreenSaver = new System.Windows.Forms.Button(); this.label11 = new System.Windows.Forms.Label(); this.edtBlankScreenSaverShortcut = new System.Windows.Forms.TextBox(); this.lblFixChromeFontsDescription = new System.Windows.Forms.Label(); this.chkFixChromeFonts = new System.Windows.Forms.CheckBox(); - this.grpLGOptions = new System.Windows.Forms.GroupBox(); - this.chkLgSetSelectedDeviceByPowerOn = new System.Windows.Forms.CheckBox(); - this.lblGameBarShortcut = new System.Windows.Forms.Label(); - this.edtLgGameBarShortcut = new System.Windows.Forms.TextBox(); - this.lblLgOptionShutdownDelayHelp = new System.Windows.Forms.Label(); - this.edtLgOptionShutdownDelay = new System.Windows.Forms.NumericUpDown(); - this.lblLgOptionShutdownDelay = new System.Windows.Forms.Label(); - this.chkLgShowAdvancedActions = new System.Windows.Forms.CheckBox(); - this.btnLGTestPower = new System.Windows.Forms.Button(); - this.lblLgMaxPowerOnRetriesDescription = new System.Windows.Forms.Label(); - this.edtLgMaxPowerOnRetries = new System.Windows.Forms.NumericUpDown(); - this.lblLgMaxPowerOnRetries = new System.Windows.Forms.Label(); this.grpGeneralOptions = new System.Windows.Forms.GroupBox(); this.chkAutoInstallUpdates = new System.Windows.Forms.CheckBox(); this.btnStartStopService = new System.Windows.Forms.Button(); @@ -84,10 +71,8 @@ this.btnUpdate = new System.Windows.Forms.Button(); this.tcMain.SuspendLayout(); this.tabOptions.SuspendLayout(); + this.grpOptionsModules.SuspendLayout(); this.grpMiscellaneousOptions.SuspendLayout(); - this.grpLGOptions.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.edtLgOptionShutdownDelay)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.edtLgMaxPowerOnRetries)).BeginInit(); this.grpGeneralOptions.SuspendLayout(); this.tabLog.SuspendLayout(); this.tabInfo.SuspendLayout(); @@ -100,10 +85,6 @@ this.tcMain.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tcMain.Controls.Add(this.tabNVIDIA); - this.tcMain.Controls.Add(this.tabAMD); - this.tcMain.Controls.Add(this.tabLG); - this.tcMain.Controls.Add(this.tabGameLauncher); this.tcMain.Controls.Add(this.tabOptions); this.tcMain.Controls.Add(this.tabLog); this.tcMain.Controls.Add(this.tabInfo); @@ -115,53 +96,10 @@ this.tcMain.TabIndex = 1; this.tcMain.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged); // - // tabNVIDIA - // - this.tabNVIDIA.Location = new System.Drawing.Point(4, 24); - this.tabNVIDIA.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.tabNVIDIA.Name = "tabNVIDIA"; - this.tabNVIDIA.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.tabNVIDIA.Size = new System.Drawing.Size(1114, 539); - this.tabNVIDIA.TabIndex = 0; - this.tabNVIDIA.Text = "NVIDIA controller"; - this.tabNVIDIA.UseVisualStyleBackColor = true; - // - // tabAMD - // - this.tabAMD.Location = new System.Drawing.Point(4, 24); - this.tabAMD.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.tabAMD.Name = "tabAMD"; - this.tabAMD.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.tabAMD.Size = new System.Drawing.Size(1114, 539); - this.tabAMD.TabIndex = 5; - this.tabAMD.Text = "AMD controller"; - this.tabAMD.UseVisualStyleBackColor = true; - // - // tabLG - // - this.tabLG.Location = new System.Drawing.Point(4, 24); - this.tabLG.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.tabLG.Name = "tabLG"; - this.tabLG.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.tabLG.Size = new System.Drawing.Size(1114, 539); - this.tabLG.TabIndex = 1; - this.tabLG.Text = "LG controller"; - this.tabLG.UseVisualStyleBackColor = true; - // - // tabGameLauncher - // - this.tabGameLauncher.Location = new System.Drawing.Point(4, 24); - this.tabGameLauncher.Name = "tabGameLauncher"; - this.tabGameLauncher.Padding = new System.Windows.Forms.Padding(3); - this.tabGameLauncher.Size = new System.Drawing.Size(1114, 539); - this.tabGameLauncher.TabIndex = 6; - this.tabGameLauncher.Text = "Game Launcher"; - this.tabGameLauncher.UseVisualStyleBackColor = true; - // // tabOptions // + this.tabOptions.Controls.Add(this.grpOptionsModules); this.tabOptions.Controls.Add(this.grpMiscellaneousOptions); - this.tabOptions.Controls.Add(this.grpLGOptions); this.tabOptions.Controls.Add(this.grpGeneralOptions); this.tabOptions.Location = new System.Drawing.Point(4, 24); this.tabOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); @@ -172,6 +110,39 @@ this.tabOptions.Text = "Options"; this.tabOptions.UseVisualStyleBackColor = true; // + // grpOptionsModules + // + this.grpOptionsModules.Controls.Add(this.label1); + this.grpOptionsModules.Controls.Add(this.chkModules); + this.grpOptionsModules.Location = new System.Drawing.Point(7, 187); + this.grpOptionsModules.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.grpOptionsModules.Name = "grpOptionsModules"; + this.grpOptionsModules.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.grpOptionsModules.Size = new System.Drawing.Size(522, 131); + this.grpOptionsModules.TabIndex = 11; + this.grpOptionsModules.TabStop = false; + this.grpOptionsModules.Text = "Modules"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(7, 19); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(511, 15); + this.label1.TabIndex = 7; + this.label1.Text = "Here you can disable modules you do not want. A restart is required for a change " + + "to have effect."; + // + // chkModules + // + this.chkModules.FormattingEnabled = true; + this.chkModules.Location = new System.Drawing.Point(7, 40); + this.chkModules.Name = "chkModules"; + this.chkModules.Size = new System.Drawing.Size(507, 76); + this.chkModules.TabIndex = 0; + this.chkModules.SelectedIndexChanged += new System.EventHandler(this.chkModules_SelectedIndexChanged); + // // grpMiscellaneousOptions // this.grpMiscellaneousOptions.Controls.Add(this.btnSetShortcutScreenSaver); @@ -179,7 +150,7 @@ this.grpMiscellaneousOptions.Controls.Add(this.edtBlankScreenSaverShortcut); this.grpMiscellaneousOptions.Controls.Add(this.lblFixChromeFontsDescription); this.grpMiscellaneousOptions.Controls.Add(this.chkFixChromeFonts); - this.grpMiscellaneousOptions.Location = new System.Drawing.Point(7, 402); + this.grpMiscellaneousOptions.Location = new System.Drawing.Point(7, 324); this.grpMiscellaneousOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.grpMiscellaneousOptions.Name = "grpMiscellaneousOptions"; this.grpMiscellaneousOptions.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); @@ -242,163 +213,6 @@ this.chkFixChromeFonts.UseVisualStyleBackColor = true; this.chkFixChromeFonts.CheckedChanged += new System.EventHandler(this.chkFixChromeFonts_CheckedChanged); // - // grpLGOptions - // - this.grpLGOptions.Controls.Add(this.chkLgSetSelectedDeviceByPowerOn); - this.grpLGOptions.Controls.Add(this.lblGameBarShortcut); - this.grpLGOptions.Controls.Add(this.edtLgGameBarShortcut); - this.grpLGOptions.Controls.Add(this.lblLgOptionShutdownDelayHelp); - this.grpLGOptions.Controls.Add(this.edtLgOptionShutdownDelay); - this.grpLGOptions.Controls.Add(this.lblLgOptionShutdownDelay); - this.grpLGOptions.Controls.Add(this.chkLgShowAdvancedActions); - this.grpLGOptions.Controls.Add(this.btnLGTestPower); - this.grpLGOptions.Controls.Add(this.lblLgMaxPowerOnRetriesDescription); - this.grpLGOptions.Controls.Add(this.edtLgMaxPowerOnRetries); - this.grpLGOptions.Controls.Add(this.lblLgMaxPowerOnRetries); - this.grpLGOptions.Location = new System.Drawing.Point(8, 187); - this.grpLGOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.grpLGOptions.Name = "grpLGOptions"; - this.grpLGOptions.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.grpLGOptions.Size = new System.Drawing.Size(522, 209); - this.grpLGOptions.TabIndex = 4; - this.grpLGOptions.TabStop = false; - this.grpLGOptions.Text = "LG controller"; - // - // chkLgSetSelectedDeviceByPowerOn - // - this.chkLgSetSelectedDeviceByPowerOn.AutoSize = true; - this.chkLgSetSelectedDeviceByPowerOn.Location = new System.Drawing.Point(8, 180); - this.chkLgSetSelectedDeviceByPowerOn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.chkLgSetSelectedDeviceByPowerOn.Name = "chkLgSetSelectedDeviceByPowerOn"; - this.chkLgSetSelectedDeviceByPowerOn.Size = new System.Drawing.Size(302, 19); - this.chkLgSetSelectedDeviceByPowerOn.TabIndex = 60; - this.chkLgSetSelectedDeviceByPowerOn.Text = "Automatically set selected device to last powered on"; - this.chkLgSetSelectedDeviceByPowerOn.UseVisualStyleBackColor = true; - this.chkLgSetSelectedDeviceByPowerOn.CheckedChanged += new System.EventHandler(this.chkLgSetSelectedDeviceByWol_CheckedChanged); - // - // lblGameBarShortcut - // - this.lblGameBarShortcut.AutoSize = true; - this.lblGameBarShortcut.Location = new System.Drawing.Point(266, 127); - this.lblGameBarShortcut.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblGameBarShortcut.Name = "lblGameBarShortcut"; - this.lblGameBarShortcut.Size = new System.Drawing.Size(108, 15); - this.lblGameBarShortcut.TabIndex = 59; - this.lblGameBarShortcut.Text = "Game Bar shortcut:"; - // - // edtLgGameBarShortcut - // - this.edtLgGameBarShortcut.Location = new System.Drawing.Point(386, 121); - this.edtLgGameBarShortcut.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtLgGameBarShortcut.Name = "edtLgGameBarShortcut"; - this.edtLgGameBarShortcut.ReadOnly = true; - this.edtLgGameBarShortcut.Size = new System.Drawing.Size(128, 23); - this.edtLgGameBarShortcut.TabIndex = 58; - this.edtLgGameBarShortcut.TextChanged += new System.EventHandler(this.edtLgGameBarShortcut_TextChanged); - this.edtLgGameBarShortcut.KeyDown += new System.Windows.Forms.KeyEventHandler(this.edtLgGameBarShortcut_KeyDown); - this.edtLgGameBarShortcut.KeyUp += new System.Windows.Forms.KeyEventHandler(this.edtLgGameBarShortcut_KeyUp); - // - // lblLgOptionShutdownDelayHelp - // - this.lblLgOptionShutdownDelayHelp.AutoSize = true; - this.lblLgOptionShutdownDelayHelp.Location = new System.Drawing.Point(7, 94); - this.lblLgOptionShutdownDelayHelp.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgOptionShutdownDelayHelp.Name = "lblLgOptionShutdownDelayHelp"; - this.lblLgOptionShutdownDelayHelp.Size = new System.Drawing.Size(385, 15); - this.lblLgOptionShutdownDelayHelp.TabIndex = 11; - this.lblLgOptionShutdownDelayHelp.Text = "This delay may prevent the tv from powering off when restarting the pc."; - // - // edtLgOptionShutdownDelay - // - this.edtLgOptionShutdownDelay.Increment = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.edtLgOptionShutdownDelay.Location = new System.Drawing.Point(428, 68); - this.edtLgOptionShutdownDelay.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtLgOptionShutdownDelay.Maximum = new decimal(new int[] { - 5000, - 0, - 0, - 0}); - this.edtLgOptionShutdownDelay.Name = "edtLgOptionShutdownDelay"; - this.edtLgOptionShutdownDelay.ReadOnly = true; - this.edtLgOptionShutdownDelay.Size = new System.Drawing.Size(86, 23); - this.edtLgOptionShutdownDelay.TabIndex = 10; - this.edtLgOptionShutdownDelay.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.edtLgOptionShutdownDelay.ValueChanged += new System.EventHandler(this.edtLgOptionShutdownDelay_ValueChanged); - // - // lblLgOptionShutdownDelay - // - this.lblLgOptionShutdownDelay.AutoSize = true; - this.lblLgOptionShutdownDelay.Location = new System.Drawing.Point(7, 70); - this.lblLgOptionShutdownDelay.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgOptionShutdownDelay.Name = "lblLgOptionShutdownDelay"; - this.lblLgOptionShutdownDelay.Size = new System.Drawing.Size(249, 15); - this.lblLgOptionShutdownDelay.TabIndex = 9; - this.lblLgOptionShutdownDelay.Text = "Delay when shutting down/restarting pc (ms):"; - // - // chkLgShowAdvancedActions - // - this.chkLgShowAdvancedActions.AutoSize = true; - this.chkLgShowAdvancedActions.Location = new System.Drawing.Point(8, 155); - this.chkLgShowAdvancedActions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.chkLgShowAdvancedActions.Name = "chkLgShowAdvancedActions"; - this.chkLgShowAdvancedActions.Size = new System.Drawing.Size(419, 19); - this.chkLgShowAdvancedActions.TabIndex = 8; - this.chkLgShowAdvancedActions.Text = "Show advanced actions under the Expert-button (InStart, Software Update)"; - this.chkLgShowAdvancedActions.UseVisualStyleBackColor = true; - this.chkLgShowAdvancedActions.CheckedChanged += new System.EventHandler(this.chkLgShowAdvancedActions_CheckedChanged); - // - // btnLGTestPower - // - this.btnLGTestPower.Location = new System.Drawing.Point(8, 121); - this.btnLGTestPower.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLGTestPower.Name = "btnLGTestPower"; - this.btnLGTestPower.Size = new System.Drawing.Size(167, 27); - this.btnLGTestPower.TabIndex = 6; - this.btnLGTestPower.Text = "Test power off/on"; - this.btnLGTestPower.UseVisualStyleBackColor = true; - this.btnLGTestPower.Click += new System.EventHandler(this.btnLGTestPower_Click); - // - // lblLgMaxPowerOnRetriesDescription - // - this.lblLgMaxPowerOnRetriesDescription.AutoSize = true; - this.lblLgMaxPowerOnRetriesDescription.Location = new System.Drawing.Point(7, 46); - this.lblLgMaxPowerOnRetriesDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgMaxPowerOnRetriesDescription.Name = "lblLgMaxPowerOnRetriesDescription"; - this.lblLgMaxPowerOnRetriesDescription.Size = new System.Drawing.Size(415, 15); - this.lblLgMaxPowerOnRetriesDescription.TabIndex = 5; - this.lblLgMaxPowerOnRetriesDescription.Text = "Retries are necessary to wait for the network link of your pc to be established. " + - ""; - // - // edtLgMaxPowerOnRetries - // - this.edtLgMaxPowerOnRetries.Location = new System.Drawing.Point(428, 20); - this.edtLgMaxPowerOnRetries.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtLgMaxPowerOnRetries.Maximum = new decimal(new int[] { - 25, - 0, - 0, - 0}); - this.edtLgMaxPowerOnRetries.Name = "edtLgMaxPowerOnRetries"; - this.edtLgMaxPowerOnRetries.ReadOnly = true; - this.edtLgMaxPowerOnRetries.Size = new System.Drawing.Size(86, 23); - this.edtLgMaxPowerOnRetries.TabIndex = 1; - this.edtLgMaxPowerOnRetries.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.edtLgMaxPowerOnRetries.ValueChanged += new System.EventHandler(this.edtLgPowerOnAfterResumeDelay_ValueChanged); - // - // lblLgMaxPowerOnRetries - // - this.lblLgMaxPowerOnRetries.AutoSize = true; - this.lblLgMaxPowerOnRetries.Location = new System.Drawing.Point(7, 22); - this.lblLgMaxPowerOnRetries.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgMaxPowerOnRetries.Name = "lblLgMaxPowerOnRetries"; - this.lblLgMaxPowerOnRetries.Size = new System.Drawing.Size(340, 15); - this.lblLgMaxPowerOnRetries.TabIndex = 0; - this.lblLgMaxPowerOnRetries.Text = "Maximum number of retries powering on after startup/resume:"; - // // grpGeneralOptions // this.grpGeneralOptions.Controls.Add(this.chkAutoInstallUpdates); @@ -794,12 +608,10 @@ this.Resize += new System.EventHandler(this.MainForm_Resize); this.tcMain.ResumeLayout(false); this.tabOptions.ResumeLayout(false); + this.grpOptionsModules.ResumeLayout(false); + this.grpOptionsModules.PerformLayout(); this.grpMiscellaneousOptions.ResumeLayout(false); this.grpMiscellaneousOptions.PerformLayout(); - this.grpLGOptions.ResumeLayout(false); - this.grpLGOptions.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.edtLgOptionShutdownDelay)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.edtLgMaxPowerOnRetries)).EndInit(); this.grpGeneralOptions.ResumeLayout(false); this.grpGeneralOptions.PerformLayout(); this.tabLog.ResumeLayout(false); @@ -815,7 +627,6 @@ #endregion private System.Windows.Forms.TabControl tcMain; - private System.Windows.Forms.TabPage tabLG; private System.Windows.Forms.TabPage tabOptions; private System.Windows.Forms.GroupBox grpGeneralOptions; private System.Windows.Forms.CheckBox chkStartMinimized; @@ -830,11 +641,6 @@ private System.Windows.Forms.GroupBox grpNVIDIAInfo; private System.Windows.Forms.TreeView tvNVIDIAInfo; private System.Windows.Forms.Button btnRefreshNVIDIAInfo; - private System.Windows.Forms.GroupBox grpLGOptions; - private System.Windows.Forms.NumericUpDown edtLgMaxPowerOnRetries; - private System.Windows.Forms.Label lblLgMaxPowerOnRetries; - private System.Windows.Forms.Button btnLGTestPower; - private System.Windows.Forms.Label lblLgMaxPowerOnRetriesDescription; private System.Windows.Forms.GroupBox grpMiscellaneousOptions; private System.Windows.Forms.CheckBox chkFixChromeFonts; private System.Windows.Forms.Label lblFixChromeFontsDescription; @@ -842,19 +648,10 @@ private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox edtBlankScreenSaverShortcut; private System.Windows.Forms.CheckBox chkMinimizeOnClose; - private System.Windows.Forms.TabPage tabNVIDIA; - private System.Windows.Forms.TabPage tabAMD; private System.Windows.Forms.Button btnClearLog; private System.Windows.Forms.CheckBox chkMinimizeToSystemTray; private System.Windows.Forms.CheckBox chkCheckForUpdates; - private System.Windows.Forms.CheckBox chkLgShowAdvancedActions; private System.Windows.Forms.CheckBox chkGdiScaling; - private System.Windows.Forms.Label lblLgOptionShutdownDelayHelp; - private System.Windows.Forms.NumericUpDown edtLgOptionShutdownDelay; - private System.Windows.Forms.Label lblLgOptionShutdownDelay; - private System.Windows.Forms.Label lblGameBarShortcut; - private System.Windows.Forms.TextBox edtLgGameBarShortcut; - private System.Windows.Forms.TabPage tabGameLauncher; private System.Windows.Forms.RadioButton rbElevationService; private System.Windows.Forms.RadioButton rbElevationProcess; private System.Windows.Forms.RadioButton rbElevationAdmin; @@ -865,8 +662,10 @@ private System.Windows.Forms.Label lblShowLog; private System.Windows.Forms.ComboBox cbxLogType; private System.Windows.Forms.CheckBox chkAutoInstallUpdates; - private System.Windows.Forms.CheckBox chkLgSetSelectedDeviceByPowerOn; private System.Windows.Forms.Button btnUpdate; + private System.Windows.Forms.GroupBox grpOptionsModules; + private System.Windows.Forms.CheckedListBox chkModules; + private System.Windows.Forms.Label label1; } } diff --git a/ColorControl/MainForm.cs b/ColorControl/MainForm.cs index 826acb5..bd94fd5 100644 --- a/ColorControl/MainForm.cs +++ b/ColorControl/MainForm.cs @@ -69,6 +69,7 @@ namespace ColorControl private IntPtr _screenStateNotify; private Dictionary _shortcuts = new(); + private Dictionary> _modules = new(); public MainForm(AppContext appContext) { @@ -80,6 +81,8 @@ namespace ColorControl LoadConfig(); + LoadModules(); + MessageForms.MainForm = this; _nvTrayMenu = new ToolStripMenuItem("NVIDIA presets"); @@ -127,10 +130,12 @@ namespace ColorControl //Utils.StartService(); - InitNvService(); - InitAmdService(); - InitLgService(); - InitGameService(); + InitModules(); + + //InitNvService(); + //InitAmdService(); + //InitLgService(); + //InitGameService(); InitInfo(); UpdateServiceInfo(); @@ -147,6 +152,64 @@ namespace ColorControl AfterInitialized(); } + private void MainForm_Load(object sender, EventArgs e) + { + InitModules(); + } + + private void LoadModules() + { + _modules.Add("NVIDIA controller", InitNvService); + _modules.Add("AMD controller", InitAmdService); + _modules.Add("LG controller", InitLgService); + _modules.Add("Game launcher", InitGameService); + + foreach (var keyValue in _modules) + { + var existingModule = _config.Modules.FirstOrDefault(m => m.DisplayName == keyValue.Key); + + if (existingModule == null) + { + existingModule = new Module { DisplayName = keyValue.Key, IsActive = true, InitAction = keyValue.Value }; + _config.Modules.Add(existingModule); + } + else + { + existingModule.InitAction = keyValue.Value; + } + } + } + + private void InitModules() + { + var tabIndex = 0; + + var _ = tcMain.Handle; + + foreach (var module in _config.Modules.Where(m => m.IsActive)) + { + var control = module.InitAction(); + + if (control == null) + { + continue; + } + + var tabPage = new TabPage(module.DisplayName); + tcMain.TabPages.Insert(tabIndex, tabPage); + //tcMain.TabPages.Add(tabPage); + + tabPage.Controls.Add(control); + + control.Size = tabPage.ClientSize; + control.BackColor = SystemColors.Window; + + tabIndex++; + } + + tcMain.SelectedIndex = 0; + } + private void UpdateServiceInfo() { var text = "Use Windows Service"; @@ -172,7 +235,7 @@ namespace ColorControl rbElevationService.Text = text; } - private void InitNvService() + private UserControl InitNvService() { try { @@ -185,19 +248,20 @@ namespace ColorControl _nvPanel = new NvPanel(_nvService, _trayIcon, Handle); _nvPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - tabNVIDIA.Controls.Add(_nvPanel); - InitShortcut(NvPanel.SHORTCUTID_NVQA, _config.NvQuickAccessShortcut, _nvService.ToggleQuickAccessForm); + + return _nvPanel; } catch (Exception ex) { //Logger.Error("Error initializing NvService: " + e.ToLogString()); Logger.Debug($"No NVIDIA device detected: {ex.ToLogString()}"); - tcMain.TabPages.Remove(tabNVIDIA); + + return null; } } - private void InitAmdService() + private UserControl InitAmdService() { try { @@ -207,19 +271,20 @@ namespace ColorControl _amdPanel = new AmdPanel(_amdService, _trayIcon, Handle); _amdPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - tabAMD.Controls.Add(_amdPanel); - InitShortcut(AmdPanel.SHORTCUTID_AMDQA, _config.AmdQuickAccessShortcut, _amdService.ToggleQuickAccessForm); + + return _amdPanel; } catch (Exception) { //Logger.Error("Error initializing AmdService: " + e.ToLogString()); Logger.Debug("No AMD device detected"); - tcMain.TabPages.Remove(tabAMD); + + return null; } } - private void InitGameService() + private UserControl InitGameService() { try { @@ -229,14 +294,15 @@ namespace ColorControl _gamePanel = new GamePanel(_gameService, _nvService, _amdService, _lgService, _trayIcon, Handle); _gamePanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - tabGameLauncher.Controls.Add(_gamePanel); - InitShortcut(GamePanel.SHORTCUTID_GAMEQA, _config.GameQuickAccessShortcut, _gameService.ToggleQuickAccessForm); + + return _gamePanel; } catch (Exception e) { Logger.Error("Error initializing GameService: " + e.ToLogString()); - tcMain.TabPages.Remove(tabGameLauncher); + + return null; } } @@ -250,7 +316,7 @@ namespace ColorControl } } - private void InitLgService() + private UserControl InitLgService() { try { @@ -261,23 +327,13 @@ namespace ColorControl _lgPanel = new LgPanel(_lgService, _nvService, _amdService, _trayIcon, Handle); _lgPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - tabLG.Controls.Add(_lgPanel); - _lgPanel.Init(); - edtLgMaxPowerOnRetries.Value = _lgService.Config.PowerOnRetries; - edtLgOptionShutdownDelay.Value = _lgService.Config.ShutdownDelay; - chkLgShowAdvancedActions.Checked = _lgService.Config.ShowAdvancedActions; - chkLgSetSelectedDeviceByPowerOn.Checked = _lgService.Config.SetSelectedDeviceByPowerOn; - LgDevice.ExternalServiceHandler = HandleExternalServiceForLgDevice; InitShortcut(LgPanel.SHORTCUTID_GAMEBAR, _lgService.Config.GameBarShortcut, _lgPanel.ToggleGameBar); - InitShortcut(LgPanel.SHORTCUTID_LGQA, _config.LgQuickAccessShortcut, _lgService.ToggleQuickAccessForm); + InitShortcut(LgPanel.SHORTCUTID_LGQA, _lgService.Config.QuickAccessShortcut, _lgService.ToggleQuickAccessForm); - if (!string.IsNullOrEmpty(_lgService.Config.GameBarShortcut)) - { - edtLgGameBarShortcut.Text = _lgService.Config.GameBarShortcut; - } + return _lgPanel; // New shortcut manager, not working yet //if (_keyboardHookManager == null) @@ -290,6 +346,8 @@ namespace ColorControl catch (Exception e) { Logger.Error("Error initializing LgService: " + e.ToLogString()); + + return null; } } @@ -343,14 +401,7 @@ namespace ColorControl { _currentVersionInfo = FileVersionInfo.GetVersionInfo(Path.GetFileName(Application.ExecutablePath)); - //if (ApplicationDeployment.IsNetworkDeployed) - //{ - // Text = Application.ProductName + " " + ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(); - //} - //else - //{ Text = Application.ProductName + " " + Application.ProductVersion; - //} if (Utils.IsAdministrator()) { @@ -366,6 +417,7 @@ namespace ColorControl lbPlugins.Items.Add("NWin32 by zmjack"); lbPlugins.Items.Add("TaskScheduler by David Hall"); lbPlugins.Items.Add("NVIDIA Profile Inspector by Orbmu2k"); + lbPlugins.Items.Add("NvidiaML wrapper by LibreHardwareMonitor"); } private void OpenForm(object sender, EventArgs e) @@ -632,29 +684,6 @@ namespace ColorControl private void MainForm_Shown(object sender, EventArgs e) { - if (_nvService == null) - { - //FormUtils.ShowControls(tabNVIDIA, false, lblError); - - //lblError.Text = "Error while initializing the NVIDIA-wrapper. You either don't have a NVIDIA GPU or it is disabled. NVIDIA controls will not be available."; - //lblError.Visible = true; - } - - if (_amdService == null) - { - //FormUtils.ShowControls(tabAMD, false, lblErrorAMD); - - //lblErrorAMD.Text = "Error while initializing the ADL-wrapper. You either don't have a AMD GPU or it is disabled. AMD controls will not be available."; - //lblErrorAMD.Visible = true; - } - - if (_lgService == null) - { - //FormUtils.ShowControls(tabLG, false, lblLgError); - //lblLgError.Text = "Error while initializing the LG-controller. You either don't have a LG TV, it is disabled or a configuration file is corrupt."; - //lblLgError.Visible = true; - } - InitSelectedTab(); CheckForUpdates(); @@ -704,7 +733,7 @@ NOTE: installing the service may cause a User Account Control popup."); protected override void SetVisibleCore(bool value) { - if (!_setVisibleCalled && _config.StartMinimized) + if (!_setVisibleCalled && _config.StartMinimized && !Debugger.IsAttached) { _setVisibleCalled = true; if (_config.MinimizeToTray) @@ -734,11 +763,7 @@ NOTE: installing the service may cause a User Account Control popup."); private void InitSelectedTab() { - if (tcMain.SelectedTab == tabLG) - { - _lgPanel?.UpdateInfo(); - } - else if (tcMain.SelectedTab == tabLog) + if (tcMain.SelectedTab == tabLog) { LoadLog(); } @@ -750,18 +775,22 @@ NOTE: installing the service may cause a User Account Control popup."); { InitOptionsTab(); } - else if (tcMain.SelectedTab == tabNVIDIA) + else if (tcMain.SelectedTab?.Controls.Count > 0 && tcMain.SelectedTab.Controls[0] is IModulePanel panel) { - _nvPanel?.UpdateInfo(); - } - else if (tcMain.SelectedTab == tabGameLauncher) - { - _gamePanel?.UpdateInfo(); + panel.UpdateInfo(); } } private void InitOptionsTab() { + if (chkModules.Items.Count == 0) + { + foreach (var module in _config.Modules) + { + chkModules.Items.Add(module.DisplayName, module.IsActive); + } + } + if (_nvService != null && _nvDitherPanel == null) { _nvDitherPanel = new NvDitherPanel(_nvService); @@ -998,18 +1027,14 @@ Do you want to continue?"; private void MainForm_Activated(object sender, EventArgs e) { - if (tcMain.SelectedTab == tabNVIDIA) - { - _nvPanel?.UpdateInfo(); - } - else if (tcMain.SelectedTab == tabAMD) - { - _amdPanel?.UpdateInfo(); - } - else if (tcMain.SelectedTab == tabLog) + if (tcMain.SelectedTab == tabLog) { LoadLog(); } + else if (tcMain.SelectedTab?.Controls.Count > 0 && tcMain.SelectedTab.Controls[0] is IModulePanel panel) + { + panel.UpdateInfo(); + } } private void btnClearLog_Click(object sender, EventArgs e) @@ -1122,7 +1147,7 @@ Do you want to continue?"; ClientPath = new FileInfo(Application.ExecutablePath).Directory.FullName }; - var result = PipeUtils.SendMessage(message, 10000); + var result = PipeUtils.SendMessage(message, 30000); if (result != null && !result.Result) { @@ -1175,38 +1200,6 @@ Do you want to continue?"; } } - private void chkLgShowAdvancedActions_CheckedChanged(object sender, EventArgs e) - { - if (!_initialized) - { - return; - } - - if (chkLgShowAdvancedActions.Checked) - { - if (MessageForms.QuestionYesNo( -@"Are you sure you want to enable the advanced actions under the Expert-button? -These actions include: -- InStart service menu -- EzAdjust service menu -- Software Update-app with firmware downgrade functionality enabled - -These features may cause irreversible damage to your tv and will void your warranty. -This app and its creator are in no way accountable for any damages it may cause to your tv." - ) != DialogResult.Yes) - { - chkLgShowAdvancedActions.Checked = false; - return; - } - MessageForms.InfoOk( -@"Advanced actions activated. -The InStart and Software Update items are now visible under the Expert-button." - ); - } - - _lgService.Config.ShowAdvancedActions = chkLgShowAdvancedActions.Checked; - } - private void chkGdiScaling_CheckedChanged(object sender, EventArgs e) { _config.UseGdiScaling = chkGdiScaling.Checked; @@ -1222,11 +1215,6 @@ The InStart and Software Update items are now visible under the Expert-button." ResumeLayout(true); } - private void edtLgOptionShutdownDelay_ValueChanged(object sender, EventArgs e) - { - _lgService.Config.ShutdownDelay = (int)edtLgOptionShutdownDelay.Value; - } - private void rbElevationNone_CheckedChanged(object sender, EventArgs e) { if (!_initialized) @@ -1405,11 +1393,6 @@ Currently ColorControl is {(Utils.IsAdministrator() ? "" : "not ")}running as ad _trayIcon.Visible = false; } - private void edtLgPowerOnAfterResumeDelay_ValueChanged(object sender, EventArgs e) - { - _lgService.Config.PowerOnRetries = (int)edtLgMaxPowerOnRetries.Value; - } - private void chkFixChromeFonts_CheckedChanged(object sender, EventArgs e) { if (_initialized) @@ -1426,46 +1409,43 @@ Currently ColorControl is {(Utils.IsAdministrator() ? "" : "not ")}running as ad } } - private void chkLgSetSelectedDeviceByWol_CheckedChanged(object sender, EventArgs e) + private void chkModules_SelectedIndexChanged(object sender, EventArgs e) { if (!_initialized) { return; } - _lgService.Config.SetSelectedDeviceByPowerOn = chkLgSetSelectedDeviceByPowerOn.Checked; - } - - private void edtLgGameBarShortcut_KeyDown(object sender, KeyEventArgs e) - { - ((TextBox)sender).Text = Utils.FormatKeyboardShortcut(e); - } - - private void edtLgGameBarShortcut_KeyUp(object sender, KeyEventArgs e) - { - Utils.HandleKeyboardShortcutUp(e); - } - - private void edtLgGameBarShortcut_TextChanged(object sender, EventArgs e) - { - var text = edtLgGameBarShortcut.Text; - - var blnOk = string.IsNullOrEmpty(text) || !ShortCutExists(text); - edtLgGameBarShortcut.ForeColor = blnOk ? Color.Red : SystemColors.WindowText; - - if (blnOk) + for (var i = 0; i < chkModules.Items.Count; i++) { - _lgService.Config.GameBarShortcut = text; + var item = chkModules.Items[i].ToString(); - if (string.IsNullOrEmpty(text)) - { - WinApi.UnregisterHotKey(Handle, LgPanel.SHORTCUTID_GAMEBAR); - } - else - { - Utils.RegisterShortcut(Handle, LgPanel.SHORTCUTID_GAMEBAR, text); - } + var module = _config.Modules.First(m => m.DisplayName == item.ToString()); + + module.IsActive = chkModules.GetItemChecked(i); } } + + private void MainForm_KeyDown(object sender, KeyEventArgs e) + { + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if ((keyData == (Keys.Control | Keys.PageUp) || keyData == (Keys.Control | Keys.PageDown)) && IsShortcutControlFocused()) + { + var control = FindFocusedControl() as TextBox; + + if (control != null) + { + var keyEvent = new KeyEventArgs(keyData); + + control.Text = Utils.FormatKeyboardShortcut(keyEvent); + } + + return true; + } + return base.ProcessCmdKey(ref msg, keyData); + } } } \ No newline at end of file diff --git a/ColorControl/Module.cs b/ColorControl/Module.cs new file mode 100644 index 0000000..a19b816 --- /dev/null +++ b/ColorControl/Module.cs @@ -0,0 +1,14 @@ +using Newtonsoft.Json; +using System; +using System.Windows.Forms; + +namespace ColorControl +{ + public class Module + { + public bool IsActive { get; set; } + public string DisplayName { get; set; } + [JsonIgnore] + public Func InitAction { get; set; } + } +} diff --git a/ColorControl/Services/AMD/AmdPanel.cs b/ColorControl/Services/AMD/AmdPanel.cs index f95af44..c6813b1 100644 --- a/ColorControl/Services/AMD/AmdPanel.cs +++ b/ColorControl/Services/AMD/AmdPanel.cs @@ -13,7 +13,7 @@ using System.Windows.Forms; namespace ColorControl.Services.AMD { - public partial class AmdPanel : UserControl + public partial class AmdPanel : UserControl, IModulePanel { public static readonly int SHORTCUTID_AMDQA = -201; @@ -166,7 +166,7 @@ namespace ColorControl.Services.AMD FormUtils.SaveSortState(lvAmdPresets.ListViewItemSorter, _config.AmdPresetsSortState); } - internal void UpdateInfo() + public void UpdateInfo() { UpdateDisplayInfoItemsAmd(); } diff --git a/ColorControl/Services/GameLauncher/GamePanel.cs b/ColorControl/Services/GameLauncher/GamePanel.cs index 0bac8b0..9b48f9f 100644 --- a/ColorControl/Services/GameLauncher/GamePanel.cs +++ b/ColorControl/Services/GameLauncher/GamePanel.cs @@ -17,7 +17,7 @@ using System.Windows.Forms; namespace ColorControl.Services.GameLauncher { - public partial class GamePanel : UserControl + public partial class GamePanel : UserControl, IModulePanel { public static readonly int SHORTCUTID_GAMEQA = -203; diff --git a/ColorControl/Services/LG/LgPanel.Designer.cs b/ColorControl/Services/LG/LgPanel.Designer.cs index 3c71281..6cc86b0 100644 --- a/ColorControl/Services/LG/LgPanel.Designer.cs +++ b/ColorControl/Services/LG/LgPanel.Designer.cs @@ -88,11 +88,15 @@ this.btnLgDeviceFilterRefresh = new System.Windows.Forms.Button(); this.clbLgPower = new System.Windows.Forms.CheckedListBox(); this.lblLgError = new System.Windows.Forms.Label(); + this.mnuLgSettings = new System.Windows.Forms.ContextMenuStrip(this.components); + this.miTestPowerOffOn = new System.Windows.Forms.ToolStripMenuItem(); + this.miNvSettings = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.scLgController)).BeginInit(); this.scLgController.Panel1.SuspendLayout(); this.scLgController.SuspendLayout(); this.mnuLgExpert.SuspendLayout(); this.mnuLgButtons.SuspendLayout(); + this.mnuLgSettings.SuspendLayout(); this.SuspendLayout(); // // scLgController @@ -154,14 +158,14 @@ this.scLgController.Panel1MinSize = 750; this.scLgController.Panel2MinSize = 150; this.scLgController.Size = new System.Drawing.Size(1114, 539); - this.scLgController.SplitterDistance = 900; + this.scLgController.SplitterDistance = 899; this.scLgController.SplitterWidth = 5; this.scLgController.TabIndex = 43; // // btnLgSettings // this.btnLgSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnLgSettings.Location = new System.Drawing.Point(808, 284); + this.btnLgSettings.Location = new System.Drawing.Point(807, 284); this.btnLgSettings.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.btnLgSettings.Name = "btnLgSettings"; this.btnLgSettings.Size = new System.Drawing.Size(88, 27); @@ -219,7 +223,7 @@ this.edtLgPresetDescription.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.edtLgPresetDescription.Multiline = true; this.edtLgPresetDescription.Name = "edtLgPresetDescription"; - this.edtLgPresetDescription.Size = new System.Drawing.Size(700, 43); + this.edtLgPresetDescription.Size = new System.Drawing.Size(699, 43); this.edtLgPresetDescription.TabIndex = 60; // // lblLgPresetDescription @@ -236,7 +240,7 @@ // btnLgDeviceOptionsHelp // this.btnLgDeviceOptionsHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnLgDeviceOptionsHelp.Location = new System.Drawing.Point(873, 70); + this.btnLgDeviceOptionsHelp.Location = new System.Drawing.Point(872, 70); this.btnLgDeviceOptionsHelp.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.btnLgDeviceOptionsHelp.Name = "btnLgDeviceOptionsHelp"; this.btnLgDeviceOptionsHelp.Size = new System.Drawing.Size(22, 27); @@ -411,7 +415,7 @@ this.chkLgRemoteControlShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.chkLgRemoteControlShow.Appearance = System.Windows.Forms.Appearance.Button; this.chkLgRemoteControlShow.AutoSize = true; - this.chkLgRemoteControlShow.Location = new System.Drawing.Point(794, 8); + this.chkLgRemoteControlShow.Location = new System.Drawing.Point(793, 8); this.chkLgRemoteControlShow.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.chkLgRemoteControlShow.Name = "chkLgRemoteControlShow"; this.chkLgRemoteControlShow.Size = new System.Drawing.Size(101, 25); @@ -478,7 +482,7 @@ this.lvLgPresets.MultiSelect = false; this.lvLgPresets.Name = "lvLgPresets"; this.lvLgPresets.ShowItemToolTips = true; - this.lvLgPresets.Size = new System.Drawing.Size(889, 126); + this.lvLgPresets.Size = new System.Drawing.Size(888, 126); this.lvLgPresets.TabIndex = 8; this.lvLgPresets.UseCompatibleStateImageBehavior = false; this.lvLgPresets.View = System.Windows.Forms.View.Details; @@ -681,7 +685,7 @@ this.edtStepsLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.edtStepsLg.Multiline = true; this.edtStepsLg.Name = "edtStepsLg"; - this.edtStepsLg.Size = new System.Drawing.Size(700, 43); + this.edtStepsLg.Size = new System.Drawing.Size(699, 43); this.edtStepsLg.TabIndex = 17; // // btnLgAddButton @@ -689,7 +693,7 @@ this.btnLgAddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnLgAddButton.ContextMenuStrip = this.mnuLgButtons; this.btnLgAddButton.Enabled = false; - this.btnLgAddButton.Location = new System.Drawing.Point(808, 439); + this.btnLgAddButton.Location = new System.Drawing.Point(807, 439); this.btnLgAddButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.btnLgAddButton.Name = "btnLgAddButton"; this.btnLgAddButton.Size = new System.Drawing.Size(88, 27); @@ -800,7 +804,7 @@ this.clbLgPower.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.clbLgPower.MultiColumn = true; this.clbLgPower.Name = "clbLgPower"; - this.clbLgPower.Size = new System.Drawing.Size(862, 76); + this.clbLgPower.Size = new System.Drawing.Size(861, 76); this.clbLgPower.TabIndex = 34; this.clbLgPower.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.clbLgPower_ItemCheck); // @@ -815,6 +819,29 @@ this.lblLgError.Text = "ErrorText"; this.lblLgError.Visible = false; // + // mnuLgSettings + // + this.mnuLgSettings.ImageScalingSize = new System.Drawing.Size(20, 20); + this.mnuLgSettings.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.miTestPowerOffOn, + this.miNvSettings}); + this.mnuLgSettings.Name = "mnuLgButtons"; + this.mnuLgSettings.Size = new System.Drawing.Size(168, 48); + // + // miTestPowerOffOn + // + this.miTestPowerOffOn.Name = "miTestPowerOffOn"; + this.miTestPowerOffOn.Size = new System.Drawing.Size(167, 22); + this.miTestPowerOffOn.Text = "Test power off/on"; + this.miTestPowerOffOn.Click += new System.EventHandler(this.miTestPowerOffOn_Click); + // + // miNvSettings + // + this.miNvSettings.Name = "miNvSettings"; + this.miNvSettings.Size = new System.Drawing.Size(167, 22); + this.miNvSettings.Text = "Settings"; + this.miNvSettings.Click += new System.EventHandler(this.miNvSettings_Click); + // // LgPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -829,6 +856,7 @@ this.scLgController.ResumeLayout(false); this.mnuLgExpert.ResumeLayout(false); this.mnuLgButtons.ResumeLayout(false); + this.mnuLgSettings.ResumeLayout(false); this.ResumeLayout(false); } @@ -894,6 +922,8 @@ private System.Windows.Forms.ToolStripMenuItem mnuLgProgram; private System.Windows.Forms.CheckBox chkLgQuickAccess; private System.Windows.Forms.Button btnLgSettings; - + private System.Windows.Forms.ContextMenuStrip mnuLgSettings; + private System.Windows.Forms.ToolStripMenuItem miTestPowerOffOn; + private System.Windows.Forms.ToolStripMenuItem miNvSettings; } } diff --git a/ColorControl/Services/LG/LgPanel.cs b/ColorControl/Services/LG/LgPanel.cs index 0fa13ce..be6c447 100644 --- a/ColorControl/Services/LG/LgPanel.cs +++ b/ColorControl/Services/LG/LgPanel.cs @@ -17,7 +17,7 @@ using System.Windows.Forms; namespace ColorControl.Services.LG { - public partial class LgPanel : UserControl + public partial class LgPanel : UserControl, IModulePanel { public static readonly int SHORTCUTID_LGQA = -202; public static readonly int SHORTCUTID_GAMEBAR = -101; @@ -1143,23 +1143,141 @@ Do you want to continue?" private void btnLgSettings_Click(object sender, EventArgs e) { - var shortcut = FormUtils.EditShortcut(_config.LgQuickAccessShortcut, "Quick Access shortcut", "LG controller settings"); - - if (shortcut == null) - { - return; - } - - var clear = !string.IsNullOrEmpty(_config.LgQuickAccessShortcut); - - _config.LgQuickAccessShortcut = shortcut; - - Utils.RegisterShortcut(_mainHandle, SHORTCUTID_LGQA, _config.LgQuickAccessShortcut, clear); + mnuLgSettings.Show(btnLgSettings, btnLgSettings.PointToClient(Cursor.Position)); } private void lvLgPresets_ItemChecked(object sender, ItemCheckedEventArgs e) { FormUtils.ListViewItemChecked(lvLgPresets, e); } + + private void miTestPowerOffOn_Click(object sender, EventArgs e) + { + var text = +@"The TV will now power off. Please wait for the TV to be powered off completely (relay click) and press ENTER to wake it again. +For waking up to work, you need to activate the following setting on the TV: + +Connection > Mobile TV On > Turn on via Wi-Fi + +It will also work over a wired connection. +You can also activate this option by using the Expert-button and selecting Wake-On-LAN > Enabled. + +Do you want to continue?"; + + if (MessageForms.QuestionYesNo(text) == DialogResult.Yes) + { + Utils.WaitForTask(_lgService.PowerOff()); + + MessageForms.InfoOk("Press ENTER to wake the TV."); + + _lgService.WakeSelectedDevice(); + } + } + + private void miNvSettings_Click(object sender, EventArgs e) + { + var advancedWasEnabled = _lgService.Config.ShowAdvancedActions; + + var fields = new MessageForms.FieldDefinition[] + { + new() + { + FieldType = MessageForms.FieldType.Numeric, + Label = "Maximum number of retries powering on after startup/resume.", + SubLabel = "Retries are necessary to wait for the network link of your pc to be established.", + MinValue = 1, + MaxValue = 40, + Value = _lgService.Config.PowerOnRetries + }, + new() + { + FieldType = MessageForms.FieldType.Numeric, + Label = "Delay when shutting down/restarting PC (milli seconds).", + SubLabel = "This delay may prevent the tv from powering off when restarting the pc.", + MinValue = 0, + MaxValue = 5000, + Value = _lgService.Config.ShutdownDelay + }, + new() + { + FieldType = MessageForms.FieldType.Shortcut, + Label = "Quick Access shortcut", + Value = _lgService.Config.QuickAccessShortcut + }, + new() + { + FieldType = MessageForms.FieldType.Shortcut, + Label = "Game Bar shortcut", + Value = _lgService.Config.GameBarShortcut + }, + new() + { + FieldType = MessageForms.FieldType.CheckBox, + Label = "Show advanced actions under the Expert-button (InStart, EzAdjust, Software Update)", + Value = _lgService.Config.ShowAdvancedActions + }, + new() + { + FieldType = MessageForms.FieldType.CheckBox, + Label = "Automatically set selected device to last powered on", + Value = _lgService.Config.SetSelectedDeviceByPowerOn + } + }; + + var values = MessageForms.ShowDialog("LG controller settings", fields); + + if (values?.Any() != true) + { + return; + } + + _lgService.Config.PowerOnRetries = values[0].ValueAsInt; + _lgService.Config.ShutdownDelay = values[1].ValueAsInt; + + var shortcutQA = values[2].Value.ToString(); + var clear = !string.IsNullOrEmpty(_lgService.Config.QuickAccessShortcut); + + _lgService.Config.QuickAccessShortcut = shortcutQA; + + Utils.RegisterShortcut(_mainHandle, SHORTCUTID_LGQA, _lgService.Config.QuickAccessShortcut, clear); + + var shortcutGB = values[3].Value.ToString(); + _lgService.Config.GameBarShortcut = shortcutGB; + + if (string.IsNullOrEmpty(shortcutGB)) + { + WinApi.UnregisterHotKey(_mainHandle, SHORTCUTID_GAMEBAR); + } + else + { + Utils.RegisterShortcut(_mainHandle, SHORTCUTID_GAMEBAR, shortcutGB); + } + + _lgService.Config.ShowAdvancedActions = values[4].ValueAsBool; + _lgService.Config.SetSelectedDeviceByPowerOn = values[5].ValueAsBool; + + if (!advancedWasEnabled && _lgService.Config.ShowAdvancedActions) + { + if (MessageForms.QuestionYesNo( +@"Are you sure you want to enable the advanced actions under the Expert-button? +These actions include: +- InStart service menu +- EzAdjust service menu +- Software Update-app with firmware downgrade functionality enabled + +These features may cause irreversible damage to your tv and will void your warranty. +This app and its creator are in no way accountable for any damages it may cause to your tv." + ) != DialogResult.Yes) + { + _lgService.Config.ShowAdvancedActions = false; + return; + } + MessageForms.InfoOk( +@"Advanced actions activated. +The InStart, EzAdjust and Software Update items are now visible under the Expert-button." + ); + } + + } } } diff --git a/ColorControl/Services/LG/LgPanel.resx b/ColorControl/Services/LG/LgPanel.resx index 444659f..6a20818 100644 --- a/ColorControl/Services/LG/LgPanel.resx +++ b/ColorControl/Services/LG/LgPanel.resx @@ -61,6 +61,9 @@ 17, 17 - 140, 17 + 288, 16 + + + 147, 17 \ No newline at end of file diff --git a/ColorControl/Services/LG/LgServiceConfig.cs b/ColorControl/Services/LG/LgServiceConfig.cs index 90e5600..30f2bff 100644 --- a/ColorControl/Services/LG/LgServiceConfig.cs +++ b/ColorControl/Services/LG/LgServiceConfig.cs @@ -17,6 +17,7 @@ namespace ColorControl.Services.LG public int GameBarLeft { get; set; } public int ShutdownDelay { get; set; } public bool SetSelectedDeviceByPowerOn { get; set; } + public string QuickAccessShortcut { get; set; } public LgServiceConfig() { diff --git a/ColorControl/Services/NVIDIA/NvGpuInfo.cs b/ColorControl/Services/NVIDIA/NvGpuInfo.cs index 11a3d03..8dce388 100644 --- a/ColorControl/Services/NVIDIA/NvGpuInfo.cs +++ b/ColorControl/Services/NVIDIA/NvGpuInfo.cs @@ -8,6 +8,7 @@ using NvAPIWrapper.Native.Interfaces.GPU; using System; using System.Collections.Generic; using System.Linq; +using System.Text; using static NvAPIWrapper.Native.GPU.Structures.PerformanceStates20ClockEntryV1; using static NvAPIWrapper.Native.GPU.Structures.PrivateClockBoostLockV2; @@ -21,6 +22,13 @@ namespace ColorControl.Services.NVIDIA BoostLock = 3 } + public enum NvThermalSensorType + { + Gpu = 0, + HotSpot = 1, + Memory = 3 + } + public class NvGpuOcSettings { public static readonly uint DefaultPowerPCM = 100000; @@ -31,6 +39,7 @@ namespace ColorControl.Services.NVIDIA public int GraphicsOffsetKHz { get; set; } public uint MaximumFrequencyKHz { get; set; } public uint MaximumVoltageUv { get; set; } + public bool FrequencyPreferred { get; set; } public uint VoltageBoostPercent { get; set; } public uint PowerPCM { get; set; } = DefaultPowerPCM; @@ -40,7 +49,7 @@ namespace ColorControl.Services.NVIDIA if (Type == NvGpuOcType.BoostLock) { - value += $"GPU: Locked: {(GraphicsOffsetKHz >= 0 ? "+" : "-")}{GraphicsOffsetKHz.ToUnitString()} @ {MaximumVoltageUv}uv"; + value += $"GPU: Locked: {(GraphicsOffsetKHz >= 0 ? "+" : "-")}{GraphicsOffsetKHz.ToUnitString()} = {MaximumFrequencyKHz.ToUnitString()} @ {MaximumVoltageUv / 1000}mV"; } else if (Type == NvGpuOcType.Curve) { @@ -48,7 +57,7 @@ namespace ColorControl.Services.NVIDIA if (MaximumVoltageUv > 0) { - value += $", UV: {MaximumFrequencyKHz.ToUnitString()} @ {MaximumVoltageUv / 1000}mv"; + value += $", UV: {MaximumFrequencyKHz.ToUnitString()} @ {MaximumVoltageUv / 1000}mV"; } } else if (Type == NvGpuOcType.Offset) @@ -100,8 +109,8 @@ namespace ColorControl.Services.NVIDIA private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger(); public PhysicalGPU GPU { get; } - public List ClockBoostLocks { get; private set; } - public List ClockEntries { get; private set; } + public List ClockBoostLocks { get; private set; } = new(); + public List ClockEntries { get; private set; } = new(); public ClockDomainInfo StockGraphicsClock { get; private set; } public ClockDomainInfo StockMemoryClock { get; private set; } public PrivateVFPCurveV3 CurveV3 { get; private set; } @@ -111,6 +120,10 @@ namespace ColorControl.Services.NVIDIA public int MaxPowerInMilliWatts { get; private set; } public int MinCoreStepInMHz { get; private set; } = 15; + public List SupportedOcTypes { get; private set; } = new(); + + public string PCIIdentifier { get; private set; } + public static readonly PublicClockDomain[] Domains = new[] { PublicClockDomain.Graphics, PublicClockDomain.Memory }; @@ -138,33 +151,15 @@ namespace ColorControl.Services.NVIDIA private NvGpuInfo(PhysicalGPU gpu) { GPU = gpu; + PCIIdentifier = GPU.BusInformation.PCIIdentifiers.ToString(); - StockGraphicsClock = GPU.BoostClockFrequencies.GraphicsClock; - StockMemoryClock = GPU.BoostClockFrequencies.MemoryClock; - - var handle = gpu.Handle; - - //var xx = GPUApi.ClientPowerTopologyGetStatus(handle); - - var perf = GPUApi.GetPerformanceStates20(handle); - var clock3D = perf.Clocks.FirstOrDefault(c => c.Key == PerformanceStateId.P0_3DPerformance); - - var boostLock = GPUApi.GetClockBoostLock(handle); - - ReadCurve(); - - if (NvidiaML.IsAvailable || NvidiaML.Initialize()) - { - var device = NvidiaML.NvmlDeviceGetHandleByIndex(0); - DefaultPowerInMilliWatts = NvidiaML.NvmlDeviceGetPowerManagementDefaultLimit(device.Value); - - var powerLimits = GetPowerLimits(); - - MinPowerInMilliWatts = (int)((decimal)DefaultPowerInMilliWatts / 100000 * powerLimits.Item1); - MaxPowerInMilliWatts = (int)((decimal)DefaultPowerInMilliWatts / 100000 * powerLimits.Item2); - - } + Logger.Swallow(ReadStockClocks); + Logger.Swallow(ReadClockEntries); + Logger.Swallow(ReadBoostLocks); + ReadCurves(); + Logger.Swallow(ReadMinMaxPower); + //var handle = gpu.Handle; //var bla2 = GPUApi.GetClockBoostRanges(handle); //var bla3 = GPUApi.GetClockBoostTableV2(handle); @@ -185,13 +180,58 @@ namespace ColorControl.Services.NVIDIA //var bla4 = GPUApi.GetAllClockFrequencies(handle); - ClockBoostLocks = boostLock.ClockBoostLocks.Where(l => l.LockMode == ClockLockMode.Manual).ToList(); + SetSupportedOcTypes(); + } + + private void ReadMinMaxPower() + { + if (NvidiaML.IsAvailable || NvidiaML.Initialize()) + { + var device = NvidiaML.NvmlDeviceGetHandleByIndex(0); + DefaultPowerInMilliWatts = NvidiaML.NvmlDeviceGetPowerManagementDefaultLimit(device.Value); + + var powerLimits = GetPowerLimits(); + + MinPowerInMilliWatts = (int)((decimal)DefaultPowerInMilliWatts / 100000 * powerLimits.Item1); + MaxPowerInMilliWatts = (int)((decimal)DefaultPowerInMilliWatts / 100000 * powerLimits.Item2); + } + } + + private void ReadClockEntries() + { + var perf = GPUApi.GetPerformanceStates20(GPU.Handle); + var clock3D = perf.Clocks.FirstOrDefault(c => c.Key == PerformanceStateId.P0_3DPerformance); ClockEntries = clock3D.Value.ToList(); } + private void ReadStockClocks() + { + StockGraphicsClock = GPU.BoostClockFrequencies.GraphicsClock; + StockMemoryClock = GPU.BoostClockFrequencies.MemoryClock; + } + + private void SetSupportedOcTypes() + { + SupportedOcTypes.Clear(); + SupportedOcTypes.Add(NvGpuOcType.None); + SupportedOcTypes.Add(NvGpuOcType.Offset); + + if (CurveV3.GPUCurveEntries?.Length > 0) + { + SupportedOcTypes.Add(NvGpuOcType.Curve); + SupportedOcTypes.Add(NvGpuOcType.BoostLock); + } + } + + private void ReadBoostLocks() + { + var boostLock = GPUApi.GetClockBoostLock(GPU.Handle); + ClockBoostLocks = boostLock.ClockBoostLocks.Where(l => l.LockMode == ClockLockMode.Manual).ToList(); + } + public (uint, uint) GetPowerLimits() { - var power = GPU.PerformanceControl.PowerLimitInformation.FirstOrDefault(); + var power = Logger.Swallow(() => GPU.PerformanceControl.PowerLimitInformation.FirstOrDefault(), default); if (power == null) { @@ -214,42 +254,54 @@ namespace ColorControl.Services.NVIDIA return 0; } - private void ReadCurve() + private void ReadCurves() { - try + if (!Logger.Swallow(ReadCurveV3, false)) { - CurveV3 = GPUApi.GetVFPCurveV3(GPU.Handle); + Logger.Swallow(ReadCurveV1); } - catch (Exception ex) + } + + private bool ReadCurveV3() + { + CurveV3 = GPUApi.GetVFPCurveV3(GPU.Handle); + + return true; + } + + private bool ReadCurveV1() + { + Logger.Debug($"{GPU.FullName}: CurveV3 not available, falling back to V1"); + + MinCoreStepInMHz = 12; + + var bla = GPUApi.GetClockBoostMask(GPU.Handle); + + var masks = bla._Masks; + Logger.Debug("MASKS: " + masks[0]); + Logger.Debug("MASK: " + bla._Unknown1[0]); + + CurveV1 = GPUApi.GetVFPCurve(GPU.Handle, masks); + + var length = CurveV1.GPUCurveEntries.Length; + var minFreq = CurveV1.GPUCurveEntries.Min(e => e.FrequencyInkHz); + var maxFreq = CurveV1.GPUCurveEntries.Max(e => e.FrequencyInkHz); + var minV = CurveV1.GPUCurveEntries.Min(e => e.VoltageInMicroV); + var maxV = CurveV1.GPUCurveEntries.Max(e => e.VoltageInMicroV); + + Logger.Debug($"CurveV1: L: {length}, MinF: {minFreq}, MaxF: {maxFreq}, MinV: {minV}, MaxV: {maxV}"); + + foreach (var entry in CurveV1.GPUCurveEntries) { - Logger.Debug(ex); - - MinCoreStepInMHz = 12; - - var bla = GPUApi.GetClockBoostMask(GPU.Handle); - - var masks = bla._Masks; - Logger.Debug("MASKS: " + masks[0]); - - Logger.Debug("MASK: " + bla._Unknown1[0]); - - CurveV1 = GPUApi.GetVFPCurve(GPU.Handle, masks); - - var length = CurveV1.GPUCurveEntries.Length; - var minFreq = CurveV1.GPUCurveEntries.Min(e => e.FrequencyInkHz); - var maxFreq = CurveV1.GPUCurveEntries.Max(e => e.FrequencyInkHz); - var minV = CurveV1.GPUCurveEntries.Min(e => e.VoltageInMicroV); - var maxV = CurveV1.GPUCurveEntries.Max(e => e.VoltageInMicroV); - - Logger.Debug($"CurveV1: L: {length}, MinF: {minFreq}, MaxF: {maxFreq}, MinV: {minV}, MaxV: {maxV}"); + Logger.Debug($"CurveV1: Freq: {entry.FrequencyInkHz}, Volt: {entry.VoltageInMicroV}"); } + + return true; } public bool ApplyOcSettings(NvGpuOcSettings settings) { - var pciId = GPU.BusInformation.PCIIdentifiers.ToString(); - - if (settings.PCIIdentifier != pciId) + if (settings.PCIIdentifier != PCIIdentifier) { Logger.Warn($"Cannot apply OC-settings: PCI-identifier does not match GPU: {settings.PCIIdentifier}"); @@ -263,6 +315,11 @@ namespace ColorControl.Services.NVIDIA SetPower(settings.PowerPCM); } + if (settings.Type == NvGpuOcType.None) + { + return true; + } + if (settings.MemoryOffsetKHz != 0) { SetMemoryClockOffsetDelta(settings.MemoryOffsetKHz); @@ -273,11 +330,6 @@ namespace ColorControl.Services.NVIDIA SetVoltageBoostPercent(settings.VoltageBoostPercent); } - if (settings.Type == NvGpuOcType.None) - { - return true; - } - if (settings.Type == NvGpuOcType.BoostLock) { LockGpuClock(settings.MaximumVoltageUv, settings.GraphicsOffsetKHz); @@ -312,21 +364,55 @@ namespace ColorControl.Services.NVIDIA public override string ToString() { - var gpuThermal = GPU.ThermalInformation.ThermalSensors.FirstOrDefault(s => s.Target == ThermalSettingsTarget.GPU); var gpuVoltage = GPUApi.GetCurrentVoltage(GPU.Handle).ValueInMicroVolt; + var temps = GetTemperatures(); + var power = GetPowerUsageInMilliWatts(); + + var sb = new StringBuilder(); + + sb.Append($"GPU: {GPU.CurrentClockFrequencies.GraphicsClock.Frequency.ToUnitString()} @ {gpuVoltage / 1000} mV, {temps[NvThermalSensorType.Gpu]}°"); + + if (temps.TryGetValue(NvThermalSensorType.HotSpot, out var hotSpotTemp)) + { + sb.Append($"/{hotSpotTemp}°"); + } + + sb.Append($", Mem: {GPU.CurrentClockFrequencies.MemoryClock.Frequency.ToUnitString()}"); + + if (temps.TryGetValue(NvThermalSensorType.Memory, out var memoryTemp)) + { + sb.Append($", {memoryTemp}°"); + } + + sb.Append($", Pwr: {Math.Round(power / 1000.0, 1)}W"); + + return sb.ToString(); + } + + public Dictionary GetTemperatures() + { + var temperatures = new Dictionary(); + try { var temps = GPUApi.QueryThermalSensors(GPU.Handle, 255u); - var hotspotTemp = Math.Round(temps.Temperatures[1]); - var memoryTemp = temps.Temperatures[7]; - var power = GetPowerUsageInMilliWatts(); - return $"GPU: {GPU.CurrentClockFrequencies.GraphicsClock.Frequency.ToUnitString()} @ {gpuVoltage / 1000}mv, {gpuThermal.CurrentTemperature}°/{hotspotTemp}°C, Mem: {GPU.CurrentClockFrequencies.MemoryClock.Frequency.ToUnitString()}, {memoryTemp}°C, Pwr: {power / 1000}W"; + var gpuTemp = Math.Round(temps.Temperatures[0], 1); + var hotspotTemp = Math.Round(temps.Temperatures[1], 1); + var memoryTemp = temps.Temperatures.Last(l => l != 0); + + temperatures.Add(NvThermalSensorType.Gpu, gpuTemp); + temperatures.Add(NvThermalSensorType.HotSpot, hotspotTemp); + temperatures.Add(NvThermalSensorType.Memory, memoryTemp); + } + catch (Exception) + { + var gpuThermal = GPU.ThermalInformation.ThermalSensors.FirstOrDefault(s => s.Target == ThermalSettingsTarget.GPU); + temperatures.Add(NvThermalSensorType.Gpu, gpuThermal.CurrentTemperature); } - catch (Exception) { } - return $"GPU: {GPU.CurrentClockFrequencies.GraphicsClock.Frequency.ToUnitString()} @ {gpuVoltage / 1000}mv, {gpuThermal.CurrentTemperature}°C, Mem: {GPU.CurrentClockFrequencies.MemoryClock.Frequency.ToUnitString()}"; + return temperatures; } public (int, int) GetDeltaClockMinMax(PublicClockDomain domain) @@ -343,7 +429,7 @@ namespace ColorControl.Services.NVIDIA public bool HasLock(PublicClockDomain domain) { - return ClockBoostLocks.Any(l => l.ClockDomain == domain && l.LockMode == ClockLockMode.Manual); + return ClockBoostLocks.Any(l => l.ClockDomain == domain && l.LockMode == ClockLockMode.Manual) == true; } public int GetOffset(PublicClockDomain domain) @@ -379,7 +465,7 @@ namespace ColorControl.Services.NVIDIA public NvGpuOcSettings GetOverclockSettings() { - var ocSettings = new NvGpuOcSettings(); + var ocSettings = new NvGpuOcSettings { PCIIdentifier = PCIIdentifier }; var power = GPUApi.ClientPowerPoliciesGetStatus(GPU.Handle); @@ -405,6 +491,17 @@ namespace ColorControl.Services.NVIDIA if (domain == PublicClockDomain.Graphics) { ocSettings.GraphicsOffsetKHz = locked.Item2; + + if (CurveV3.GPUCurveEntries?.Length > 0) + { + var voltItem = CurveV3.GPUCurveEntries.FirstOrDefault(e => e.DefaultVoltageInMicroV == ocSettings.MaximumVoltageUv); + + if (voltItem.DefaultFrequencyInkHz > 0) + { + var freq = voltItem.DefaultFrequencyInkHz + ocSettings.GraphicsOffsetKHz; + ocSettings.MaximumFrequencyKHz = (uint)freq; + } + } } else { @@ -432,6 +529,7 @@ namespace ColorControl.Services.NVIDIA { ocSettings.MaximumVoltageUv = maxOcEntry.VoltageInMicroV; ocSettings.MaximumFrequencyKHz = maxDefEntry.FrequencyInkHz; + ocSettings.FrequencyPreferred = ocSettings.MaximumFrequencyKHz > 0; } } } @@ -580,7 +678,12 @@ namespace ColorControl.Services.NVIDIA public void SetCurveOffset(int offsetKHz = 0, uint maxVoltageUv = 0, uint maxFreqKHz = 0) { - var normalizedOffset = (offsetKHz / 15000) * 15000; + if ((CurveV3.GPUCurveEntries?.Length ?? 0) == 0) + { + return; + } + + var normalizedOffset = (offsetKHz / MinCoreStepInMHz) * MinCoreStepInMHz; var handle = GPU.Handle; @@ -621,7 +724,7 @@ namespace ColorControl.Services.NVIDIA } GPUApi.SetClockBoostTableV2(handle, boostTable); - ReadCurve(); + ReadCurves(); } public void ResetGpuClocks() @@ -752,11 +855,11 @@ namespace ColorControl.Services.NVIDIA var powerField = defaultPowerLimitMw > 0 ? new MessageForms.FieldDefinition { - Label = $"Power limit in milli watts. Min: {MinPowerInMilliWatts}, max: {MaxPowerInMilliWatts}", + Label = $"Power limit in watts. Min: {MinPowerInMilliWatts / 1000}, max: {MaxPowerInMilliWatts / 1000}", FieldType = MessageForms.FieldType.TrackBar, - Value = (int)((decimal)defaultPowerLimitMw / 100000 * settings.PowerPCM), - MinValue = MinPowerInMilliWatts, - MaxValue = MaxPowerInMilliWatts + Value = (int)Math.Round((decimal)defaultPowerLimitMw / 100000000 * settings.PowerPCM), + MinValue = MinPowerInMilliWatts / 1000, + MaxValue = MaxPowerInMilliWatts / 1000 } : new MessageForms.FieldDefinition { @@ -783,5 +886,48 @@ namespace ColorControl.Services.NVIDIA return field; } + + internal (MessageForms.FieldDefinition, MessageForms.FieldDefinition) GetCurveVoltFreqFields(NvGpuOcSettings settings) + { + var curveEntries = CurveV3.GPUCurveEntries; + + var graphicsDelta = GetDeltaClockMinMax(PublicClockDomain.Graphics); + + var minCurveFreq = curveEntries.Max(e => e.DefaultFrequencyInkHz) + graphicsDelta.Item1; + var freqValues = curveEntries + .Where(e => e.DefaultFrequencyInkHz == 0 || e.DefaultFrequencyInkHz >= minCurveFreq) + .Select(e => (e.DefaultFrequencyInkHz / 1000).ToString()).Distinct() + .OrderBy(x => x) + .ToList(); + var voltValues = curveEntries + .Where(e => (e.DefaultVoltageInMicroV == 0 || e.DefaultFrequencyInkHz >= minCurveFreq) && e.DefaultVoltageInMicroV <= 1100000) + .OrderBy(e => e.DefaultVoltageInMicroV) + .Select(e => (e.DefaultVoltageInMicroV / 1000).ToString()) + .Distinct() + .ToList(); + + var voltField = new MessageForms.FieldDefinition + { + Label = "Optional undervolt: maximum voltage in millivolt (0 = disabled)", + SubLabel = "If both UV voltage and UV frequency are set, frequency is derived from voltage.", + FieldType = MessageForms.FieldType.DropDown, + Value = settings.FrequencyPreferred ? 0 : settings.MaximumVoltageUv / 1000, + Values = voltValues, + }; + var freqField = new MessageForms.FieldDefinition + { + Label = "Optional undervolt: maximum core frequency in MHz (0 = disabled)", + FieldType = MessageForms.FieldType.DropDown, + Value = !settings.FrequencyPreferred ? 0 : settings.MaximumFrequencyKHz / 1000, + Values = freqValues, + }; + + return (voltField, freqField); + } + + public uint PowerToPCM(uint power, bool powerInMilliWatts) + { + return powerInMilliWatts ? (uint)((decimal)power / DefaultPowerInMilliWatts * 100000000) : power * 1000; + } } } diff --git a/ColorControl/Services/NVIDIA/NvPanel.Designer.cs b/ColorControl/Services/NVIDIA/NvPanel.Designer.cs index 62d85ef..6555710 100644 --- a/ColorControl/Services/NVIDIA/NvPanel.Designer.cs +++ b/ColorControl/Services/NVIDIA/NvPanel.Designer.cs @@ -29,676 +29,630 @@ namespace ColorControl.Services.NVIDIA /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - this.lblNvOverclock = new System.Windows.Forms.Label(); - this.edtNvOverclock = new System.Windows.Forms.TextBox(); - this.btnNvSetClocks = new System.Windows.Forms.Button(); - this.lblNvGpuInfo = new System.Windows.Forms.Label(); - this.edtNvGpuInfo = new System.Windows.Forms.TextBox(); - this.lblNvGPU = new System.Windows.Forms.Label(); - this.cbxNvGPU = new System.Windows.Forms.ComboBox(); - this.btnNvSettings = new System.Windows.Forms.Button(); - this.chkNvShowInQuickAccess = new System.Windows.Forms.CheckBox(); - this.lblNvPresetName = new System.Windows.Forms.Label(); - this.edtNvPresetName = new System.Windows.Forms.TextBox(); - this.btnAddModesNv = new System.Windows.Forms.Button(); - this.btnNvPresetDelete = new System.Windows.Forms.Button(); - this.lblError = new System.Windows.Forms.Label(); - this.btnClone = new System.Windows.Forms.Button(); - this.btnNvPresetSave = new System.Windows.Forms.Button(); - this.lblShortcut = new System.Windows.Forms.Label(); - this.edtShortcut = new System.Windows.Forms.TextBox(); - this.btnChange = new System.Windows.Forms.Button(); - this.mnuNvPresets = new System.Windows.Forms.ContextMenuStrip(this.components); - this.miNvApply = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvPresetApplyOnStartup = new System.Windows.Forms.ToolStripMenuItem(); - this.tssNvPresetMenu = new System.Windows.Forms.ToolStripSeparator(); - this.mnuNvDisplay = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvPrimaryDisplay = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuNvPresetsColorSettings = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvPresetColorSettings = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuRefreshRate = new System.Windows.Forms.ToolStripMenuItem(); - this.miRefreshRateIncluded = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuNvResolution = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvResolutionIncluded = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvPresetDithering = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvPresetApplyDithering = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvPresetDitheringEnabled = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuNvDitheringBitDepth = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvDithering6bit = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvDithering8bit = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvDithering10bit = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuNvDitheringMode = new System.Windows.Forms.ToolStripMenuItem(); - this.spatial1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.spatial2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.spatialDynamic2x2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.spatialStatic2x2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.temporalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvHDR = new System.Windows.Forms.ToolStripMenuItem(); - this.miHDRIncluded = new System.Windows.Forms.ToolStripMenuItem(); - this.miToggleHDR = new System.Windows.Forms.ToolStripMenuItem(); - this.miHDREnabled = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuNvDriverSettings = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvDriverSettingsIncluded = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuNvOverclocking = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvOverclockingIncluded = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvCopyId = new System.Windows.Forms.ToolStripMenuItem(); - this.btnApply = new System.Windows.Forms.Button(); - this.lvNvPresets = new System.Windows.Forms.ListView(); - this.mnuNvSettings = new System.Windows.Forms.ContextMenuStrip(this.components); - this.miNvProfileInspector = new System.Windows.Forms.ToolStripMenuItem(); - this.miNvSettings = new System.Windows.Forms.ToolStripMenuItem(); - this.lvNvPresetsToolTip = new System.Windows.Forms.ToolTip(this.components); - - this.mnuNvPresets.SuspendLayout(); - this.mnuNvSettings.SuspendLayout(); - this.SuspendLayout(); - // - // NvPanel - // - - this.Controls.Add(this.lblNvOverclock); - this.Controls.Add(this.edtNvOverclock); - this.Controls.Add(this.btnNvSetClocks); - this.Controls.Add(this.lblNvGpuInfo); - this.Controls.Add(this.edtNvGpuInfo); - this.Controls.Add(this.lblNvGPU); - this.Controls.Add(this.cbxNvGPU); - this.Controls.Add(this.btnNvSettings); - this.Controls.Add(this.chkNvShowInQuickAccess); - this.Controls.Add(this.lblNvPresetName); - this.Controls.Add(this.edtNvPresetName); - this.Controls.Add(this.btnAddModesNv); - this.Controls.Add(this.btnNvPresetDelete); - this.Controls.Add(this.lblError); - this.Controls.Add(this.btnClone); - this.Controls.Add(this.btnNvPresetSave); - this.Controls.Add(this.lblShortcut); - this.Controls.Add(this.edtShortcut); - this.Controls.Add(this.btnChange); - this.Controls.Add(this.btnApply); - this.Controls.Add(this.lvNvPresets); - - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.Name = "NvPanel"; - this.Size = new System.Drawing.Size(1114, 539); - this.Load += new System.EventHandler(this.RemoteControlPanel_Load); - + components = new System.ComponentModel.Container(); + lblNvOverclock = new System.Windows.Forms.Label(); + edtNvOverclock = new System.Windows.Forms.TextBox(); + btnNvSetClocks = new System.Windows.Forms.Button(); + lblNvGpuInfo = new System.Windows.Forms.Label(); + edtNvGpuInfo = new System.Windows.Forms.TextBox(); + lblNvGPU = new System.Windows.Forms.Label(); + cbxNvGPU = new System.Windows.Forms.ComboBox(); + btnNvSettings = new System.Windows.Forms.Button(); + chkNvShowInQuickAccess = new System.Windows.Forms.CheckBox(); + lblNvPresetName = new System.Windows.Forms.Label(); + edtNvPresetName = new System.Windows.Forms.TextBox(); + btnAddModesNv = new System.Windows.Forms.Button(); + btnNvPresetDelete = new System.Windows.Forms.Button(); + lblError = new System.Windows.Forms.Label(); + btnClone = new System.Windows.Forms.Button(); + btnNvPresetSave = new System.Windows.Forms.Button(); + lblShortcut = new System.Windows.Forms.Label(); + edtShortcut = new System.Windows.Forms.TextBox(); + btnChange = new System.Windows.Forms.Button(); + mnuNvPresets = new System.Windows.Forms.ContextMenuStrip(components); + miNvApply = new System.Windows.Forms.ToolStripMenuItem(); + miNvPresetApplyOnStartup = new System.Windows.Forms.ToolStripMenuItem(); + tssNvPresetMenu = new System.Windows.Forms.ToolStripSeparator(); + mnuNvDisplay = new System.Windows.Forms.ToolStripMenuItem(); + miNvPrimaryDisplay = new System.Windows.Forms.ToolStripMenuItem(); + mnuNvPresetsColorSettings = new System.Windows.Forms.ToolStripMenuItem(); + miNvPresetColorSettings = new System.Windows.Forms.ToolStripMenuItem(); + mnuRefreshRate = new System.Windows.Forms.ToolStripMenuItem(); + miRefreshRateIncluded = new System.Windows.Forms.ToolStripMenuItem(); + mnuNvResolution = new System.Windows.Forms.ToolStripMenuItem(); + miNvResolutionIncluded = new System.Windows.Forms.ToolStripMenuItem(); + miNvPresetDithering = new System.Windows.Forms.ToolStripMenuItem(); + miNvPresetApplyDithering = new System.Windows.Forms.ToolStripMenuItem(); + miNvPresetDitheringEnabled = new System.Windows.Forms.ToolStripMenuItem(); + mnuNvDitheringBitDepth = new System.Windows.Forms.ToolStripMenuItem(); + miNvDithering6bit = new System.Windows.Forms.ToolStripMenuItem(); + miNvDithering8bit = new System.Windows.Forms.ToolStripMenuItem(); + miNvDithering10bit = new System.Windows.Forms.ToolStripMenuItem(); + mnuNvDitheringMode = new System.Windows.Forms.ToolStripMenuItem(); + spatial1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + spatial2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + spatialDynamic2x2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + spatialStatic2x2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + temporalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + miNvHDR = new System.Windows.Forms.ToolStripMenuItem(); + miHDRIncluded = new System.Windows.Forms.ToolStripMenuItem(); + miToggleHDR = new System.Windows.Forms.ToolStripMenuItem(); + miHDREnabled = new System.Windows.Forms.ToolStripMenuItem(); + mnuNvDriverSettings = new System.Windows.Forms.ToolStripMenuItem(); + miNvDriverSettingsIncluded = new System.Windows.Forms.ToolStripMenuItem(); + mnuNvOverclocking = new System.Windows.Forms.ToolStripMenuItem(); + miNvOverclockingIncluded = new System.Windows.Forms.ToolStripMenuItem(); + miNvCopyId = new System.Windows.Forms.ToolStripMenuItem(); + btnApply = new System.Windows.Forms.Button(); + lvNvPresets = new System.Windows.Forms.ListView(); + mnuNvSettings = new System.Windows.Forms.ContextMenuStrip(components); + miNvProfileInspector = new System.Windows.Forms.ToolStripMenuItem(); + miNvSettings = new System.Windows.Forms.ToolStripMenuItem(); + lvNvPresetsToolTip = new System.Windows.Forms.ToolTip(components); + mnuNvPresets.SuspendLayout(); + mnuNvSettings.SuspendLayout(); + SuspendLayout(); // // lblNvOverclock // - this.lblNvOverclock.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblNvOverclock.AutoSize = true; - this.lblNvOverclock.Location = new System.Drawing.Point(578, 496); - this.lblNvOverclock.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblNvOverclock.Name = "lblNvOverclock"; - this.lblNvOverclock.Size = new System.Drawing.Size(51, 15); - this.lblNvOverclock.TabIndex = 66; - this.lblNvOverclock.Text = "OC info:"; + lblNvOverclock.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + lblNvOverclock.AutoSize = true; + lblNvOverclock.Location = new System.Drawing.Point(578, 496); + lblNvOverclock.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblNvOverclock.Name = "lblNvOverclock"; + lblNvOverclock.Size = new System.Drawing.Size(51, 15); + lblNvOverclock.TabIndex = 66; + lblNvOverclock.Text = "OC info:"; // // edtNvOverclock // - this.edtNvOverclock.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.edtNvOverclock.Enabled = false; - this.edtNvOverclock.Location = new System.Drawing.Point(648, 493); - this.edtNvOverclock.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtNvOverclock.Name = "edtNvOverclock"; - this.edtNvOverclock.Size = new System.Drawing.Size(457, 23); - this.edtNvOverclock.TabIndex = 65; + edtNvOverclock.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + edtNvOverclock.Enabled = false; + edtNvOverclock.Location = new System.Drawing.Point(648, 493); + edtNvOverclock.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + edtNvOverclock.Name = "edtNvOverclock"; + edtNvOverclock.Size = new System.Drawing.Size(457, 23); + edtNvOverclock.TabIndex = 65; // // btnNvSetClocks // - this.btnNvSetClocks.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnNvSetClocks.Location = new System.Drawing.Point(868, 433); - this.btnNvSetClocks.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnNvSetClocks.Name = "btnNvSetClocks"; - this.btnNvSetClocks.Size = new System.Drawing.Size(88, 27); - this.btnNvSetClocks.TabIndex = 64; - this.btnNvSetClocks.Text = "Change..."; - this.btnNvSetClocks.UseVisualStyleBackColor = true; - this.btnNvSetClocks.Click += new System.EventHandler(this.btnNvSetClocks_Click); + btnNvSetClocks.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + btnNvSetClocks.Location = new System.Drawing.Point(868, 433); + btnNvSetClocks.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnNvSetClocks.Name = "btnNvSetClocks"; + btnNvSetClocks.Size = new System.Drawing.Size(88, 27); + btnNvSetClocks.TabIndex = 64; + btnNvSetClocks.Text = "Change OC..."; + btnNvSetClocks.UseVisualStyleBackColor = true; + btnNvSetClocks.Click += btnNvSetClocks_Click; // // lblNvGpuInfo // - this.lblNvGpuInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblNvGpuInfo.AutoSize = true; - this.lblNvGpuInfo.Location = new System.Drawing.Point(578, 469); - this.lblNvGpuInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblNvGpuInfo.Name = "lblNvGpuInfo"; - this.lblNvGpuInfo.Size = new System.Drawing.Size(31, 15); - this.lblNvGpuInfo.TabIndex = 63; - this.lblNvGpuInfo.Text = "Info:"; + lblNvGpuInfo.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + lblNvGpuInfo.AutoSize = true; + lblNvGpuInfo.Location = new System.Drawing.Point(578, 469); + lblNvGpuInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblNvGpuInfo.Name = "lblNvGpuInfo"; + lblNvGpuInfo.Size = new System.Drawing.Size(31, 15); + lblNvGpuInfo.TabIndex = 63; + lblNvGpuInfo.Text = "Info:"; // // edtNvGpuInfo // - this.edtNvGpuInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.edtNvGpuInfo.Enabled = false; - this.edtNvGpuInfo.Location = new System.Drawing.Point(648, 466); - this.edtNvGpuInfo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtNvGpuInfo.Name = "edtNvGpuInfo"; - this.edtNvGpuInfo.Size = new System.Drawing.Size(457, 23); - this.edtNvGpuInfo.TabIndex = 62; + edtNvGpuInfo.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + edtNvGpuInfo.Enabled = false; + edtNvGpuInfo.Location = new System.Drawing.Point(648, 466); + edtNvGpuInfo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + edtNvGpuInfo.Name = "edtNvGpuInfo"; + edtNvGpuInfo.Size = new System.Drawing.Size(457, 23); + edtNvGpuInfo.TabIndex = 62; // // lblNvGPU // - this.lblNvGPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblNvGPU.AutoSize = true; - this.lblNvGPU.Location = new System.Drawing.Point(578, 439); - this.lblNvGPU.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblNvGPU.Name = "lblNvGPU"; - this.lblNvGPU.Size = new System.Drawing.Size(33, 15); - this.lblNvGPU.TabIndex = 61; - this.lblNvGPU.Text = "GPU:"; + lblNvGPU.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + lblNvGPU.AutoSize = true; + lblNvGPU.Location = new System.Drawing.Point(578, 439); + lblNvGPU.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblNvGPU.Name = "lblNvGPU"; + lblNvGPU.Size = new System.Drawing.Size(33, 15); + lblNvGPU.TabIndex = 61; + lblNvGPU.Text = "GPU:"; // // cbxNvGPU // - this.cbxNvGPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbxNvGPU.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxNvGPU.FormattingEnabled = true; - this.cbxNvGPU.Location = new System.Drawing.Point(648, 436); - this.cbxNvGPU.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.cbxNvGPU.Name = "cbxNvGPU"; - this.cbxNvGPU.Size = new System.Drawing.Size(212, 23); - this.cbxNvGPU.TabIndex = 60; - this.cbxNvGPU.SelectedIndexChanged += new System.EventHandler(this.cbxNvGPU_SelectedIndexChanged); + cbxNvGPU.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + cbxNvGPU.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + cbxNvGPU.FormattingEnabled = true; + cbxNvGPU.Location = new System.Drawing.Point(648, 436); + cbxNvGPU.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + cbxNvGPU.Name = "cbxNvGPU"; + cbxNvGPU.Size = new System.Drawing.Size(212, 23); + cbxNvGPU.TabIndex = 60; + cbxNvGPU.SelectedIndexChanged += cbxNvGPU_SelectedIndexChanged; // // btnNvSettings // - this.btnNvSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnNvSettings.Location = new System.Drawing.Point(1017, 428); - this.btnNvSettings.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnNvSettings.Name = "btnNvSettings"; - this.btnNvSettings.Size = new System.Drawing.Size(88, 27); - this.btnNvSettings.TabIndex = 59; - this.btnNvSettings.Text = "Settings..."; - this.btnNvSettings.UseVisualStyleBackColor = true; - this.btnNvSettings.Click += new System.EventHandler(this.btnNvSettings_Click); + btnNvSettings.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; + btnNvSettings.Location = new System.Drawing.Point(1017, 428); + btnNvSettings.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnNvSettings.Name = "btnNvSettings"; + btnNvSettings.Size = new System.Drawing.Size(88, 27); + btnNvSettings.TabIndex = 59; + btnNvSettings.Text = "Settings..."; + btnNvSettings.UseVisualStyleBackColor = true; + btnNvSettings.Click += btnNvSettings_Click; // // chkNvShowInQuickAccess // - this.chkNvShowInQuickAccess.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.chkNvShowInQuickAccess.AutoSize = true; - this.chkNvShowInQuickAccess.Enabled = false; - this.chkNvShowInQuickAccess.Location = new System.Drawing.Point(343, 465); - this.chkNvShowInQuickAccess.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.chkNvShowInQuickAccess.Name = "chkNvShowInQuickAccess"; - this.chkNvShowInQuickAccess.Size = new System.Drawing.Size(141, 19); - this.chkNvShowInQuickAccess.TabIndex = 45; - this.chkNvShowInQuickAccess.Text = "Show in Quick Access"; - this.chkNvShowInQuickAccess.UseVisualStyleBackColor = true; + chkNvShowInQuickAccess.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + chkNvShowInQuickAccess.AutoSize = true; + chkNvShowInQuickAccess.Enabled = false; + chkNvShowInQuickAccess.Location = new System.Drawing.Point(343, 465); + chkNvShowInQuickAccess.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + chkNvShowInQuickAccess.Name = "chkNvShowInQuickAccess"; + chkNvShowInQuickAccess.Size = new System.Drawing.Size(141, 19); + chkNvShowInQuickAccess.TabIndex = 45; + chkNvShowInQuickAccess.Text = "Show in Quick Access"; + chkNvShowInQuickAccess.UseVisualStyleBackColor = true; // // lblNvPresetName // - this.lblNvPresetName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblNvPresetName.AutoSize = true; - this.lblNvPresetName.Location = new System.Drawing.Point(7, 466); - this.lblNvPresetName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblNvPresetName.Name = "lblNvPresetName"; - this.lblNvPresetName.Size = new System.Drawing.Size(42, 15); - this.lblNvPresetName.TabIndex = 22; - this.lblNvPresetName.Text = "Name:"; + lblNvPresetName.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + lblNvPresetName.AutoSize = true; + lblNvPresetName.Location = new System.Drawing.Point(7, 466); + lblNvPresetName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblNvPresetName.Name = "lblNvPresetName"; + lblNvPresetName.Size = new System.Drawing.Size(42, 15); + lblNvPresetName.TabIndex = 22; + lblNvPresetName.Text = "Name:"; // // edtNvPresetName // - this.edtNvPresetName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.edtNvPresetName.Enabled = false; - this.edtNvPresetName.Location = new System.Drawing.Point(102, 463); - this.edtNvPresetName.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtNvPresetName.Name = "edtNvPresetName"; - this.edtNvPresetName.Size = new System.Drawing.Size(233, 23); - this.edtNvPresetName.TabIndex = 21; + edtNvPresetName.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + edtNvPresetName.Enabled = false; + edtNvPresetName.Location = new System.Drawing.Point(102, 463); + edtNvPresetName.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + edtNvPresetName.Name = "edtNvPresetName"; + edtNvPresetName.Size = new System.Drawing.Size(233, 23); + edtNvPresetName.TabIndex = 21; // // btnAddModesNv // - this.btnAddModesNv.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnAddModesNv.Location = new System.Drawing.Point(385, 429); - this.btnAddModesNv.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnAddModesNv.Name = "btnAddModesNv"; - this.btnAddModesNv.Size = new System.Drawing.Size(88, 27); - this.btnAddModesNv.TabIndex = 9; - this.btnAddModesNv.Text = "Add modes"; - this.btnAddModesNv.UseVisualStyleBackColor = true; - this.btnAddModesNv.Click += new System.EventHandler(this.btnAddModesNv_Click); + btnAddModesNv.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + btnAddModesNv.Location = new System.Drawing.Point(385, 429); + btnAddModesNv.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnAddModesNv.Name = "btnAddModesNv"; + btnAddModesNv.Size = new System.Drawing.Size(88, 27); + btnAddModesNv.TabIndex = 9; + btnAddModesNv.Text = "Add modes"; + btnAddModesNv.UseVisualStyleBackColor = true; + btnAddModesNv.Click += btnAddModesNv_Click; // // btnNvPresetDelete // - this.btnNvPresetDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnNvPresetDelete.Enabled = false; - this.btnNvPresetDelete.Location = new System.Drawing.Point(290, 429); - this.btnNvPresetDelete.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnNvPresetDelete.Name = "btnNvPresetDelete"; - this.btnNvPresetDelete.Size = new System.Drawing.Size(88, 27); - this.btnNvPresetDelete.TabIndex = 8; - this.btnNvPresetDelete.Text = "Delete"; - this.btnNvPresetDelete.UseVisualStyleBackColor = true; - this.btnNvPresetDelete.Click += new System.EventHandler(this.btnNvPresetDelete_Click); + btnNvPresetDelete.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + btnNvPresetDelete.Enabled = false; + btnNvPresetDelete.Location = new System.Drawing.Point(290, 429); + btnNvPresetDelete.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnNvPresetDelete.Name = "btnNvPresetDelete"; + btnNvPresetDelete.Size = new System.Drawing.Size(88, 27); + btnNvPresetDelete.TabIndex = 8; + btnNvPresetDelete.Text = "Delete"; + btnNvPresetDelete.UseVisualStyleBackColor = true; + btnNvPresetDelete.Click += btnNvPresetDelete_Click; // // lblError // - this.lblError.AutoSize = true; - this.lblError.Location = new System.Drawing.Point(7, 7); - this.lblError.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblError.Name = "lblError"; - this.lblError.Size = new System.Drawing.Size(53, 15); - this.lblError.TabIndex = 7; - this.lblError.Text = "ErrorText"; - this.lblError.Visible = false; + lblError.AutoSize = true; + lblError.Location = new System.Drawing.Point(7, 7); + lblError.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblError.Name = "lblError"; + lblError.Size = new System.Drawing.Size(53, 15); + lblError.TabIndex = 7; + lblError.Text = "ErrorText"; + lblError.Visible = false; // // btnClone // - this.btnClone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnClone.Enabled = false; - this.btnClone.Location = new System.Drawing.Point(196, 429); - this.btnClone.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnClone.Name = "btnClone"; - this.btnClone.Size = new System.Drawing.Size(88, 27); - this.btnClone.TabIndex = 6; - this.btnClone.Text = "Clone"; - this.btnClone.UseVisualStyleBackColor = true; - this.btnClone.Click += new System.EventHandler(this.btnClone_Click); + btnClone.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + btnClone.Enabled = false; + btnClone.Location = new System.Drawing.Point(196, 429); + btnClone.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnClone.Name = "btnClone"; + btnClone.Size = new System.Drawing.Size(88, 27); + btnClone.TabIndex = 6; + btnClone.Text = "Clone"; + btnClone.UseVisualStyleBackColor = true; + btnClone.Click += btnClone_Click; // // btnNvPresetSave // - this.btnNvPresetSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnNvPresetSave.Enabled = false; - this.btnNvPresetSave.Location = new System.Drawing.Point(479, 429); - this.btnNvPresetSave.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnNvPresetSave.Name = "btnNvPresetSave"; - this.btnNvPresetSave.Size = new System.Drawing.Size(88, 27); - this.btnNvPresetSave.TabIndex = 5; - this.btnNvPresetSave.Text = "Save"; - this.btnNvPresetSave.UseVisualStyleBackColor = true; - this.btnNvPresetSave.Click += new System.EventHandler(this.btnSetShortcut_Click); + btnNvPresetSave.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + btnNvPresetSave.Enabled = false; + btnNvPresetSave.Location = new System.Drawing.Point(479, 429); + btnNvPresetSave.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnNvPresetSave.Name = "btnNvPresetSave"; + btnNvPresetSave.Size = new System.Drawing.Size(88, 27); + btnNvPresetSave.TabIndex = 5; + btnNvPresetSave.Text = "Save"; + btnNvPresetSave.UseVisualStyleBackColor = true; + btnNvPresetSave.Click += btnSetShortcut_Click; // // lblShortcut // - this.lblShortcut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblShortcut.AutoSize = true; - this.lblShortcut.Location = new System.Drawing.Point(7, 496); - this.lblShortcut.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblShortcut.Name = "lblShortcut"; - this.lblShortcut.Size = new System.Drawing.Size(55, 15); - this.lblShortcut.TabIndex = 4; - this.lblShortcut.Text = "Shortcut:"; + lblShortcut.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + lblShortcut.AutoSize = true; + lblShortcut.Location = new System.Drawing.Point(7, 496); + lblShortcut.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lblShortcut.Name = "lblShortcut"; + lblShortcut.Size = new System.Drawing.Size(55, 15); + lblShortcut.TabIndex = 4; + lblShortcut.Text = "Shortcut:"; // // edtShortcut // - this.edtShortcut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.edtShortcut.Enabled = false; - this.edtShortcut.Location = new System.Drawing.Point(102, 493); - this.edtShortcut.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtShortcut.Name = "edtShortcut"; - this.edtShortcut.ReadOnly = true; - this.edtShortcut.Size = new System.Drawing.Size(233, 23); - this.edtShortcut.TabIndex = 3; - this.edtShortcut.TextChanged += new System.EventHandler(this.edtShortcut_TextChanged); - this.edtShortcut.KeyDown += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyDown); - this.edtShortcut.KeyUp += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyUp); + edtShortcut.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + edtShortcut.Enabled = false; + edtShortcut.Location = new System.Drawing.Point(102, 493); + edtShortcut.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + edtShortcut.Name = "edtShortcut"; + edtShortcut.ReadOnly = true; + edtShortcut.Size = new System.Drawing.Size(233, 23); + edtShortcut.TabIndex = 3; + edtShortcut.TextChanged += edtShortcut_TextChanged; + edtShortcut.KeyDown += edtShortcut_KeyDown; + edtShortcut.KeyUp += edtShortcut_KeyUp; // // btnChange // - this.btnChange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnChange.ContextMenuStrip = this.mnuNvPresets; - this.btnChange.Location = new System.Drawing.Point(102, 429); - this.btnChange.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnChange.Name = "btnChange"; - this.btnChange.Size = new System.Drawing.Size(88, 27); - this.btnChange.TabIndex = 2; - this.btnChange.Text = "Change..."; - this.btnChange.UseVisualStyleBackColor = true; - this.btnChange.Click += new System.EventHandler(this.btnChange_Click); + btnChange.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + btnChange.ContextMenuStrip = mnuNvPresets; + btnChange.Location = new System.Drawing.Point(102, 429); + btnChange.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnChange.Name = "btnChange"; + btnChange.Size = new System.Drawing.Size(88, 27); + btnChange.TabIndex = 2; + btnChange.Text = "Change..."; + btnChange.UseVisualStyleBackColor = true; + btnChange.Click += btnChange_Click; // // mnuNvPresets // - this.mnuNvPresets.ImageScalingSize = new System.Drawing.Size(20, 20); - this.mnuNvPresets.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvApply, - this.miNvPresetApplyOnStartup, - this.tssNvPresetMenu, - this.mnuNvDisplay, - this.mnuNvPresetsColorSettings, - this.mnuRefreshRate, - this.mnuNvResolution, - this.miNvPresetDithering, - this.miNvHDR, - this.mnuNvDriverSettings, - this.mnuNvOverclocking, - this.miNvCopyId}); - this.mnuNvPresets.Name = "mnuNvPresets"; - this.mnuNvPresets.Size = new System.Drawing.Size(185, 252); - this.mnuNvPresets.Opening += new System.ComponentModel.CancelEventHandler(this.mnuNvPresets_Opening); + mnuNvPresets.ImageScalingSize = new System.Drawing.Size(20, 20); + mnuNvPresets.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvApply, miNvPresetApplyOnStartup, tssNvPresetMenu, mnuNvDisplay, mnuNvPresetsColorSettings, mnuRefreshRate, mnuNvResolution, miNvPresetDithering, miNvHDR, mnuNvDriverSettings, mnuNvOverclocking, miNvCopyId }); + mnuNvPresets.Name = "mnuNvPresets"; + mnuNvPresets.Size = new System.Drawing.Size(185, 252); + mnuNvPresets.Opening += mnuNvPresets_Opening; // // miNvApply // - this.miNvApply.Name = "miNvApply"; - this.miNvApply.Size = new System.Drawing.Size(184, 22); - this.miNvApply.Text = "Apply"; - this.miNvApply.Click += new System.EventHandler(this.btnApply_Click); + miNvApply.Name = "miNvApply"; + miNvApply.Size = new System.Drawing.Size(184, 22); + miNvApply.Text = "Apply"; + miNvApply.Click += btnApply_Click; // // miNvPresetApplyOnStartup // - this.miNvPresetApplyOnStartup.CheckOnClick = true; - this.miNvPresetApplyOnStartup.Name = "miNvPresetApplyOnStartup"; - this.miNvPresetApplyOnStartup.Size = new System.Drawing.Size(184, 22); - this.miNvPresetApplyOnStartup.Text = "Apply on startup"; - this.miNvPresetApplyOnStartup.Click += new System.EventHandler(this.miNvPresetApplyOnStartup_Click); + miNvPresetApplyOnStartup.CheckOnClick = true; + miNvPresetApplyOnStartup.Name = "miNvPresetApplyOnStartup"; + miNvPresetApplyOnStartup.Size = new System.Drawing.Size(184, 22); + miNvPresetApplyOnStartup.Text = "Apply on startup"; + miNvPresetApplyOnStartup.Click += miNvPresetApplyOnStartup_Click; // // tssNvPresetMenu // - this.tssNvPresetMenu.Name = "tssNvPresetMenu"; - this.tssNvPresetMenu.Size = new System.Drawing.Size(181, 6); + tssNvPresetMenu.Name = "tssNvPresetMenu"; + tssNvPresetMenu.Size = new System.Drawing.Size(181, 6); // // mnuNvDisplay // - this.mnuNvDisplay.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvPrimaryDisplay}); - this.mnuNvDisplay.Name = "mnuNvDisplay"; - this.mnuNvDisplay.Size = new System.Drawing.Size(184, 22); - this.mnuNvDisplay.Text = "Display"; + mnuNvDisplay.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvPrimaryDisplay }); + mnuNvDisplay.Name = "mnuNvDisplay"; + mnuNvDisplay.Size = new System.Drawing.Size(184, 22); + mnuNvDisplay.Text = "Display"; // // miNvPrimaryDisplay // - this.miNvPrimaryDisplay.Name = "miNvPrimaryDisplay"; - this.miNvPrimaryDisplay.Size = new System.Drawing.Size(155, 22); - this.miNvPrimaryDisplay.Text = "Primary display"; - this.miNvPrimaryDisplay.Click += new System.EventHandler(this.displayMenuItem_Click); + miNvPrimaryDisplay.Name = "miNvPrimaryDisplay"; + miNvPrimaryDisplay.Size = new System.Drawing.Size(155, 22); + miNvPrimaryDisplay.Text = "Primary display"; + miNvPrimaryDisplay.Click += displayMenuItem_Click; // // mnuNvPresetsColorSettings // - this.mnuNvPresetsColorSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvPresetColorSettings}); - this.mnuNvPresetsColorSettings.Name = "mnuNvPresetsColorSettings"; - this.mnuNvPresetsColorSettings.Size = new System.Drawing.Size(184, 22); - this.mnuNvPresetsColorSettings.Text = "Color Settings"; + mnuNvPresetsColorSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvPresetColorSettings }); + mnuNvPresetsColorSettings.Name = "mnuNvPresetsColorSettings"; + mnuNvPresetsColorSettings.Size = new System.Drawing.Size(184, 22); + mnuNvPresetsColorSettings.Text = "Color Settings"; // // miNvPresetColorSettings // - this.miNvPresetColorSettings.Name = "miNvPresetColorSettings"; - this.miNvPresetColorSettings.Size = new System.Drawing.Size(120, 22); - this.miNvPresetColorSettings.Text = "Included"; - this.miNvPresetColorSettings.Click += new System.EventHandler(this.miNvPresetColorSettings_Click); + miNvPresetColorSettings.Name = "miNvPresetColorSettings"; + miNvPresetColorSettings.Size = new System.Drawing.Size(120, 22); + miNvPresetColorSettings.Text = "Included"; + miNvPresetColorSettings.Click += miNvPresetColorSettings_Click; // // mnuRefreshRate // - this.mnuRefreshRate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miRefreshRateIncluded}); - this.mnuRefreshRate.Name = "mnuRefreshRate"; - this.mnuRefreshRate.Size = new System.Drawing.Size(184, 22); - this.mnuRefreshRate.Text = "Refresh Rate"; + mnuRefreshRate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miRefreshRateIncluded }); + mnuRefreshRate.Name = "mnuRefreshRate"; + mnuRefreshRate.Size = new System.Drawing.Size(184, 22); + mnuRefreshRate.Text = "Refresh Rate"; // // miRefreshRateIncluded // - this.miRefreshRateIncluded.Name = "miRefreshRateIncluded"; - this.miRefreshRateIncluded.Size = new System.Drawing.Size(120, 22); - this.miRefreshRateIncluded.Text = "Included"; - this.miRefreshRateIncluded.Click += new System.EventHandler(this.includedToolStripMenuItem_Click); + miRefreshRateIncluded.Name = "miRefreshRateIncluded"; + miRefreshRateIncluded.Size = new System.Drawing.Size(120, 22); + miRefreshRateIncluded.Text = "Included"; + miRefreshRateIncluded.Click += includedToolStripMenuItem_Click; // // mnuNvResolution // - this.mnuNvResolution.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvResolutionIncluded}); - this.mnuNvResolution.Name = "mnuNvResolution"; - this.mnuNvResolution.Size = new System.Drawing.Size(184, 22); - this.mnuNvResolution.Text = "Resolution"; + mnuNvResolution.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvResolutionIncluded }); + mnuNvResolution.Name = "mnuNvResolution"; + mnuNvResolution.Size = new System.Drawing.Size(184, 22); + mnuNvResolution.Text = "Resolution"; // // miNvResolutionIncluded // - this.miNvResolutionIncluded.CheckOnClick = true; - this.miNvResolutionIncluded.Name = "miNvResolutionIncluded"; - this.miNvResolutionIncluded.Size = new System.Drawing.Size(120, 22); - this.miNvResolutionIncluded.Text = "Included"; - this.miNvResolutionIncluded.Click += new System.EventHandler(this.miNvResolutionIncluded_Click); + miNvResolutionIncluded.CheckOnClick = true; + miNvResolutionIncluded.Name = "miNvResolutionIncluded"; + miNvResolutionIncluded.Size = new System.Drawing.Size(120, 22); + miNvResolutionIncluded.Text = "Included"; + miNvResolutionIncluded.Click += miNvResolutionIncluded_Click; // // miNvPresetDithering // - this.miNvPresetDithering.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvPresetApplyDithering, - this.miNvPresetDitheringEnabled, - this.mnuNvDitheringBitDepth, - this.mnuNvDitheringMode}); - this.miNvPresetDithering.Name = "miNvPresetDithering"; - this.miNvPresetDithering.Size = new System.Drawing.Size(184, 22); - this.miNvPresetDithering.Text = "Dithering"; + miNvPresetDithering.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvPresetApplyDithering, miNvPresetDitheringEnabled, mnuNvDitheringBitDepth, mnuNvDitheringMode }); + miNvPresetDithering.Name = "miNvPresetDithering"; + miNvPresetDithering.Size = new System.Drawing.Size(184, 22); + miNvPresetDithering.Text = "Dithering"; // // miNvPresetApplyDithering // - this.miNvPresetApplyDithering.Name = "miNvPresetApplyDithering"; - this.miNvPresetApplyDithering.Size = new System.Drawing.Size(122, 22); - this.miNvPresetApplyDithering.Text = "Included"; - this.miNvPresetApplyDithering.Click += new System.EventHandler(this.miNvPresetApplyDithering_Click); + miNvPresetApplyDithering.Name = "miNvPresetApplyDithering"; + miNvPresetApplyDithering.Size = new System.Drawing.Size(122, 22); + miNvPresetApplyDithering.Text = "Included"; + miNvPresetApplyDithering.Click += miNvPresetApplyDithering_Click; // // miNvPresetDitheringEnabled // - this.miNvPresetDitheringEnabled.Name = "miNvPresetDitheringEnabled"; - this.miNvPresetDitheringEnabled.Size = new System.Drawing.Size(122, 22); - this.miNvPresetDitheringEnabled.Text = "Enabled"; - this.miNvPresetDitheringEnabled.Click += new System.EventHandler(this.miNvPresetDitheringEnabled_Click); + miNvPresetDitheringEnabled.Name = "miNvPresetDitheringEnabled"; + miNvPresetDitheringEnabled.Size = new System.Drawing.Size(122, 22); + miNvPresetDitheringEnabled.Text = "Enabled"; + miNvPresetDitheringEnabled.Click += miNvPresetDitheringEnabled_Click; // // mnuNvDitheringBitDepth // - this.mnuNvDitheringBitDepth.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvDithering6bit, - this.miNvDithering8bit, - this.miNvDithering10bit}); - this.mnuNvDitheringBitDepth.Name = "mnuNvDitheringBitDepth"; - this.mnuNvDitheringBitDepth.Size = new System.Drawing.Size(122, 22); - this.mnuNvDitheringBitDepth.Text = "Bit depth"; + mnuNvDitheringBitDepth.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvDithering6bit, miNvDithering8bit, miNvDithering10bit }); + mnuNvDitheringBitDepth.Name = "mnuNvDitheringBitDepth"; + mnuNvDitheringBitDepth.Size = new System.Drawing.Size(122, 22); + mnuNvDitheringBitDepth.Text = "Bit depth"; // // miNvDithering6bit // - this.miNvDithering6bit.Name = "miNvDithering6bit"; - this.miNvDithering6bit.Size = new System.Drawing.Size(105, 22); - this.miNvDithering6bit.Tag = "0"; - this.miNvDithering6bit.Text = "6-bit"; - this.miNvDithering6bit.Click += new System.EventHandler(this.miNvDithering6bit_Click); + miNvDithering6bit.Name = "miNvDithering6bit"; + miNvDithering6bit.Size = new System.Drawing.Size(105, 22); + miNvDithering6bit.Tag = "0"; + miNvDithering6bit.Text = "6-bit"; + miNvDithering6bit.Click += miNvDithering6bit_Click; // // miNvDithering8bit // - this.miNvDithering8bit.Name = "miNvDithering8bit"; - this.miNvDithering8bit.Size = new System.Drawing.Size(105, 22); - this.miNvDithering8bit.Tag = "1"; - this.miNvDithering8bit.Text = "8-bit"; - this.miNvDithering8bit.Click += new System.EventHandler(this.miNvDithering6bit_Click); + miNvDithering8bit.Name = "miNvDithering8bit"; + miNvDithering8bit.Size = new System.Drawing.Size(105, 22); + miNvDithering8bit.Tag = "1"; + miNvDithering8bit.Text = "8-bit"; + miNvDithering8bit.Click += miNvDithering6bit_Click; // // miNvDithering10bit // - this.miNvDithering10bit.Name = "miNvDithering10bit"; - this.miNvDithering10bit.Size = new System.Drawing.Size(105, 22); - this.miNvDithering10bit.Tag = "2"; - this.miNvDithering10bit.Text = "10-bit"; - this.miNvDithering10bit.Click += new System.EventHandler(this.miNvDithering6bit_Click); + miNvDithering10bit.Name = "miNvDithering10bit"; + miNvDithering10bit.Size = new System.Drawing.Size(105, 22); + miNvDithering10bit.Tag = "2"; + miNvDithering10bit.Text = "10-bit"; + miNvDithering10bit.Click += miNvDithering6bit_Click; // // mnuNvDitheringMode // - this.mnuNvDitheringMode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.spatial1ToolStripMenuItem, - this.spatial2ToolStripMenuItem, - this.spatialDynamic2x2ToolStripMenuItem, - this.spatialStatic2x2ToolStripMenuItem, - this.temporalToolStripMenuItem}); - this.mnuNvDitheringMode.Name = "mnuNvDitheringMode"; - this.mnuNvDitheringMode.Size = new System.Drawing.Size(122, 22); - this.mnuNvDitheringMode.Text = "Mode"; + mnuNvDitheringMode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { spatial1ToolStripMenuItem, spatial2ToolStripMenuItem, spatialDynamic2x2ToolStripMenuItem, spatialStatic2x2ToolStripMenuItem, temporalToolStripMenuItem }); + mnuNvDitheringMode.Name = "mnuNvDitheringMode"; + mnuNvDitheringMode.Size = new System.Drawing.Size(122, 22); + mnuNvDitheringMode.Text = "Mode"; // // spatial1ToolStripMenuItem // - this.spatial1ToolStripMenuItem.Name = "spatial1ToolStripMenuItem"; - this.spatial1ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.spatial1ToolStripMenuItem.Tag = "0"; - this.spatial1ToolStripMenuItem.Text = "Spatial Dynamic"; - this.spatial1ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click); + spatial1ToolStripMenuItem.Name = "spatial1ToolStripMenuItem"; + spatial1ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + spatial1ToolStripMenuItem.Tag = "0"; + spatial1ToolStripMenuItem.Text = "Spatial Dynamic"; + spatial1ToolStripMenuItem.Click += spatial1ToolStripMenuItem_Click; // // spatial2ToolStripMenuItem // - this.spatial2ToolStripMenuItem.Name = "spatial2ToolStripMenuItem"; - this.spatial2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.spatial2ToolStripMenuItem.Tag = "1"; - this.spatial2ToolStripMenuItem.Text = "Spatial Static"; - this.spatial2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click); + spatial2ToolStripMenuItem.Name = "spatial2ToolStripMenuItem"; + spatial2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + spatial2ToolStripMenuItem.Tag = "1"; + spatial2ToolStripMenuItem.Text = "Spatial Static"; + spatial2ToolStripMenuItem.Click += spatial1ToolStripMenuItem_Click; // // spatialDynamic2x2ToolStripMenuItem // - this.spatialDynamic2x2ToolStripMenuItem.Name = "spatialDynamic2x2ToolStripMenuItem"; - this.spatialDynamic2x2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.spatialDynamic2x2ToolStripMenuItem.Tag = "2"; - this.spatialDynamic2x2ToolStripMenuItem.Text = "Spatial Dynamic 2x2"; - this.spatialDynamic2x2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click); + spatialDynamic2x2ToolStripMenuItem.Name = "spatialDynamic2x2ToolStripMenuItem"; + spatialDynamic2x2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + spatialDynamic2x2ToolStripMenuItem.Tag = "2"; + spatialDynamic2x2ToolStripMenuItem.Text = "Spatial Dynamic 2x2"; + spatialDynamic2x2ToolStripMenuItem.Click += spatial1ToolStripMenuItem_Click; // // spatialStatic2x2ToolStripMenuItem // - this.spatialStatic2x2ToolStripMenuItem.Name = "spatialStatic2x2ToolStripMenuItem"; - this.spatialStatic2x2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.spatialStatic2x2ToolStripMenuItem.Tag = "3"; - this.spatialStatic2x2ToolStripMenuItem.Text = "Spatial Static 2x2"; - this.spatialStatic2x2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click); + spatialStatic2x2ToolStripMenuItem.Name = "spatialStatic2x2ToolStripMenuItem"; + spatialStatic2x2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + spatialStatic2x2ToolStripMenuItem.Tag = "3"; + spatialStatic2x2ToolStripMenuItem.Text = "Spatial Static 2x2"; + spatialStatic2x2ToolStripMenuItem.Click += spatial1ToolStripMenuItem_Click; // // temporalToolStripMenuItem // - this.temporalToolStripMenuItem.Name = "temporalToolStripMenuItem"; - this.temporalToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.temporalToolStripMenuItem.Tag = "4"; - this.temporalToolStripMenuItem.Text = "Temporal"; - this.temporalToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click); + temporalToolStripMenuItem.Name = "temporalToolStripMenuItem"; + temporalToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + temporalToolStripMenuItem.Tag = "4"; + temporalToolStripMenuItem.Text = "Temporal"; + temporalToolStripMenuItem.Click += spatial1ToolStripMenuItem_Click; // // miNvHDR // - this.miNvHDR.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miHDRIncluded, - this.miToggleHDR, - this.miHDREnabled}); - this.miNvHDR.Name = "miNvHDR"; - this.miNvHDR.Size = new System.Drawing.Size(184, 22); - this.miNvHDR.Text = "HDR"; + miNvHDR.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miHDRIncluded, miToggleHDR, miHDREnabled }); + miNvHDR.Name = "miNvHDR"; + miNvHDR.Size = new System.Drawing.Size(184, 22); + miNvHDR.Text = "HDR"; // // miHDRIncluded // - this.miHDRIncluded.Name = "miHDRIncluded"; - this.miHDRIncluded.Size = new System.Drawing.Size(136, 22); - this.miHDRIncluded.Text = "Included"; - this.miHDRIncluded.Click += new System.EventHandler(this.miHDRIncluded_Click); + miHDRIncluded.Name = "miHDRIncluded"; + miHDRIncluded.Size = new System.Drawing.Size(136, 22); + miHDRIncluded.Text = "Included"; + miHDRIncluded.Click += miHDRIncluded_Click; // // miToggleHDR // - this.miToggleHDR.Name = "miToggleHDR"; - this.miToggleHDR.Size = new System.Drawing.Size(136, 22); - this.miToggleHDR.Text = "Toggle HDR"; - this.miToggleHDR.Click += new System.EventHandler(this.miToggleHDR_Click); + miToggleHDR.Name = "miToggleHDR"; + miToggleHDR.Size = new System.Drawing.Size(136, 22); + miToggleHDR.Text = "Toggle HDR"; + miToggleHDR.Click += miToggleHDR_Click; // // miHDREnabled // - this.miHDREnabled.Name = "miHDREnabled"; - this.miHDREnabled.Size = new System.Drawing.Size(136, 22); - this.miHDREnabled.Text = "Enabled"; - this.miHDREnabled.Click += new System.EventHandler(this.miHDREnabled_Click); + miHDREnabled.Name = "miHDREnabled"; + miHDREnabled.Size = new System.Drawing.Size(136, 22); + miHDREnabled.Text = "Enabled"; + miHDREnabled.Click += miHDREnabled_Click; // // mnuNvDriverSettings // - this.mnuNvDriverSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvDriverSettingsIncluded}); - this.mnuNvDriverSettings.Name = "mnuNvDriverSettings"; - this.mnuNvDriverSettings.Size = new System.Drawing.Size(184, 22); - this.mnuNvDriverSettings.Text = "Driver Settings"; + mnuNvDriverSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvDriverSettingsIncluded }); + mnuNvDriverSettings.Name = "mnuNvDriverSettings"; + mnuNvDriverSettings.Size = new System.Drawing.Size(184, 22); + mnuNvDriverSettings.Text = "Driver Settings"; // // miNvDriverSettingsIncluded // - this.miNvDriverSettingsIncluded.Name = "miNvDriverSettingsIncluded"; - this.miNvDriverSettingsIncluded.Size = new System.Drawing.Size(120, 22); - this.miNvDriverSettingsIncluded.Text = "Included"; - this.miNvDriverSettingsIncluded.Click += new System.EventHandler(this.miNvDriverSettingsIncluded_Click); + miNvDriverSettingsIncluded.Name = "miNvDriverSettingsIncluded"; + miNvDriverSettingsIncluded.Size = new System.Drawing.Size(120, 22); + miNvDriverSettingsIncluded.Text = "Included"; + miNvDriverSettingsIncluded.Click += miNvDriverSettingsIncluded_Click; // // mnuNvOverclocking // - this.mnuNvOverclocking.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvOverclockingIncluded}); - this.mnuNvOverclocking.Name = "mnuNvOverclocking"; - this.mnuNvOverclocking.Size = new System.Drawing.Size(184, 22); - this.mnuNvOverclocking.Text = "Overclocking"; + mnuNvOverclocking.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvOverclockingIncluded }); + mnuNvOverclocking.Name = "mnuNvOverclocking"; + mnuNvOverclocking.Size = new System.Drawing.Size(184, 22); + mnuNvOverclocking.Text = "Overclocking"; // // miNvOverclockingIncluded // - this.miNvOverclockingIncluded.Name = "miNvOverclockingIncluded"; - this.miNvOverclockingIncluded.Size = new System.Drawing.Size(120, 22); - this.miNvOverclockingIncluded.Text = "Included"; - this.miNvOverclockingIncluded.Click += new System.EventHandler(this.miNvOverclockingIncluded_Click); + miNvOverclockingIncluded.Name = "miNvOverclockingIncluded"; + miNvOverclockingIncluded.Size = new System.Drawing.Size(120, 22); + miNvOverclockingIncluded.Text = "Included"; + miNvOverclockingIncluded.Click += miNvOverclockingIncluded_Click; // // miNvCopyId // - this.miNvCopyId.Name = "miNvCopyId"; - this.miNvCopyId.Size = new System.Drawing.Size(184, 22); - this.miNvCopyId.Text = "Copy Id to Clipboard"; - this.miNvCopyId.Click += new System.EventHandler(this.miNvCopyId_Click); + miNvCopyId.Name = "miNvCopyId"; + miNvCopyId.Size = new System.Drawing.Size(184, 22); + miNvCopyId.Text = "Copy Id to Clipboard"; + miNvCopyId.Click += miNvCopyId_Click; // // btnApply // - this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnApply.Enabled = false; - this.btnApply.Location = new System.Drawing.Point(7, 429); - this.btnApply.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnApply.Name = "btnApply"; - this.btnApply.Size = new System.Drawing.Size(88, 27); - this.btnApply.TabIndex = 1; - this.btnApply.Text = "Apply"; - this.btnApply.UseVisualStyleBackColor = true; - this.btnApply.Click += new System.EventHandler(this.btnApply_Click); + btnApply.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left; + btnApply.Enabled = false; + btnApply.Location = new System.Drawing.Point(7, 429); + btnApply.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + btnApply.Name = "btnApply"; + btnApply.Size = new System.Drawing.Size(88, 27); + btnApply.TabIndex = 1; + btnApply.Text = "Apply"; + btnApply.UseVisualStyleBackColor = true; + btnApply.Click += btnApply_Click; // // lvNvPresets // - this.lvNvPresets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lvNvPresets.CheckBoxes = true; - this.lvNvPresets.ContextMenuStrip = this.mnuNvPresets; - this.lvNvPresets.FullRowSelect = true; - this.lvNvPresets.Location = new System.Drawing.Point(7, 7); - this.lvNvPresets.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.lvNvPresets.MultiSelect = false; - this.lvNvPresets.Name = "lvNvPresets"; - this.lvNvPresets.Size = new System.Drawing.Size(1098, 415); - this.lvNvPresets.TabIndex = 0; - this.lvNvPresets.UseCompatibleStateImageBehavior = false; - this.lvNvPresets.View = System.Windows.Forms.View.Details; - this.lvNvPresets.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvLgPresets_ColumnClick); - this.lvNvPresets.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvNvPresets_ItemCheck); - this.lvNvPresets.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvNvPresets_ItemChecked); - this.lvNvPresets.SelectedIndexChanged += new System.EventHandler(this.lvNvPresets_SelectedIndexChanged); - this.lvNvPresets.DoubleClick += new System.EventHandler(this.btnApply_Click); - this.lvNvPresets.MouseLeave += new System.EventHandler(this.lvNvPresets_MouseLeave); - this.lvNvPresets.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lvNvPresets_MouseMove); - + lvNvPresets.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + lvNvPresets.CheckBoxes = true; + lvNvPresets.ContextMenuStrip = mnuNvPresets; + lvNvPresets.FullRowSelect = true; + lvNvPresets.Location = new System.Drawing.Point(7, 7); + lvNvPresets.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + lvNvPresets.MultiSelect = false; + lvNvPresets.Name = "lvNvPresets"; + lvNvPresets.Size = new System.Drawing.Size(1098, 415); + lvNvPresets.TabIndex = 0; + lvNvPresets.UseCompatibleStateImageBehavior = false; + lvNvPresets.View = System.Windows.Forms.View.Details; + lvNvPresets.ColumnClick += lvLgPresets_ColumnClick; + lvNvPresets.ItemCheck += lvNvPresets_ItemCheck; + lvNvPresets.ItemChecked += lvNvPresets_ItemChecked; + lvNvPresets.SelectedIndexChanged += lvNvPresets_SelectedIndexChanged; + lvNvPresets.DoubleClick += btnApply_Click; + lvNvPresets.MouseLeave += lvNvPresets_MouseLeave; + lvNvPresets.MouseMove += lvNvPresets_MouseMove; // // mnuNvSettings // - this.mnuNvSettings.ImageScalingSize = new System.Drawing.Size(20, 20); - this.mnuNvSettings.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNvProfileInspector, - this.miNvSettings}); - this.mnuNvSettings.Name = "mnuLgButtons"; - this.mnuNvSettings.Size = new System.Drawing.Size(202, 48); + mnuNvSettings.ImageScalingSize = new System.Drawing.Size(20, 20); + mnuNvSettings.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvProfileInspector, miNvSettings }); + mnuNvSettings.Name = "mnuLgButtons"; + mnuNvSettings.Size = new System.Drawing.Size(202, 48); // // miNvProfileInspector // - this.miNvProfileInspector.Name = "miNvProfileInspector"; - this.miNvProfileInspector.Size = new System.Drawing.Size(201, 22); - this.miNvProfileInspector.Text = "NVIDIA Profile Inspector"; - this.miNvProfileInspector.Click += new System.EventHandler(this.miNvProfileInspector_Click); + miNvProfileInspector.Name = "miNvProfileInspector"; + miNvProfileInspector.Size = new System.Drawing.Size(201, 22); + miNvProfileInspector.Text = "NVIDIA Profile Inspector"; + miNvProfileInspector.Click += miNvProfileInspector_Click; // // miNvSettings // - this.miNvSettings.Name = "miNvSettings"; - this.miNvSettings.Size = new System.Drawing.Size(201, 22); - this.miNvSettings.Text = "Settings"; - this.miNvSettings.Click += new System.EventHandler(this.miNvSettings_Click); - - this.mnuNvPresets.ResumeLayout(false); - this.mnuNvSettings.ResumeLayout(false); - this.ResumeLayout(false); - + miNvSettings.Name = "miNvSettings"; + miNvSettings.Size = new System.Drawing.Size(201, 22); + miNvSettings.Text = "Settings"; + miNvSettings.Click += miNvSettings_Click; + // + // NvPanel + // + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + BackColor = System.Drawing.Color.White; + Controls.Add(lblNvOverclock); + Controls.Add(edtNvOverclock); + Controls.Add(btnNvSetClocks); + Controls.Add(lblNvGpuInfo); + Controls.Add(edtNvGpuInfo); + Controls.Add(lblNvGPU); + Controls.Add(cbxNvGPU); + Controls.Add(btnNvSettings); + Controls.Add(chkNvShowInQuickAccess); + Controls.Add(lblNvPresetName); + Controls.Add(edtNvPresetName); + Controls.Add(btnAddModesNv); + Controls.Add(btnNvPresetDelete); + Controls.Add(lblError); + Controls.Add(btnClone); + Controls.Add(btnNvPresetSave); + Controls.Add(lblShortcut); + Controls.Add(edtShortcut); + Controls.Add(btnChange); + Controls.Add(btnApply); + Controls.Add(lvNvPresets); + Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + Name = "NvPanel"; + Size = new System.Drawing.Size(1114, 539); + Load += RemoteControlPanel_Load; + mnuNvPresets.ResumeLayout(false); + mnuNvSettings.ResumeLayout(false); + ResumeLayout(false); + PerformLayout(); } #endregion @@ -709,7 +663,6 @@ namespace ColorControl.Services.NVIDIA private System.Windows.Forms.Button btnNvPresetSave; private System.Windows.Forms.Label lblShortcut; private System.Windows.Forms.TextBox edtShortcut; - private System.Windows.Forms.TabPage tabOptions; private System.Windows.Forms.Button btnClone; private System.Windows.Forms.ContextMenuStrip mnuNvPresets; private System.Windows.Forms.ToolStripMenuItem miNvPresetDithering; diff --git a/ColorControl/Services/NVIDIA/NvPanel.cs b/ColorControl/Services/NVIDIA/NvPanel.cs index d3c776c..9b82d05 100644 --- a/ColorControl/Services/NVIDIA/NvPanel.cs +++ b/ColorControl/Services/NVIDIA/NvPanel.cs @@ -20,7 +20,7 @@ using System.Windows.Forms; namespace ColorControl.Services.NVIDIA { - partial class NvPanel : UserControl + partial class NvPanel : UserControl, IModulePanel { public static readonly int SHORTCUTID_NVQA = -200; @@ -176,6 +176,8 @@ namespace ColorControl.Services.NVIDIA { cbxNvGPU.SelectedIndex = 0; } + + btnNvSetClocks.Visible = _nvService.Config.ShowOverclocking; } private void AddOrUpdateItem(NvPreset preset = null) @@ -198,7 +200,7 @@ namespace ColorControl.Services.NVIDIA var preset = GetSelectedNvPreset(); var enabled = preset != null; - FormUtils.EnableControls(this, enabled, new List { lvNvPresets, btnAddModesNv, btnChange, edtNvGpuInfo, btnNvSetClocks, btnNvSettings, edtNvOverclock }); + FormUtils.EnableControls(this, enabled, new List { lvNvPresets, btnAddModesNv, btnChange, edtNvGpuInfo, btnNvSetClocks, btnNvSettings, edtNvOverclock, btnNvSetClocks }); if (enabled) { @@ -410,6 +412,7 @@ namespace ColorControl.Services.NVIDIA private void BuildNvOverclockingMenu(NvPreset preset) { miNvOverclockingIncluded.Checked = preset.applyOverclocking; + miNvOverclockingIncluded.Visible = !preset.IsDisplayPreset; var gpus = _nvService.GetGPUs(); @@ -435,6 +438,14 @@ namespace ColorControl.Services.NVIDIA { var preset = GetSelectedNvPreset(); + if (preset == null) + { + btnNvSetClocks_Click(btnNvSetClocks, new EventArgs()); + + return; + } + + var menuItem = (ToolStripItem)sender; var currentSettings = (NvGpuOcSettings)menuItem.Tag; @@ -1097,6 +1108,8 @@ namespace ColorControl.Services.NVIDIA Utils.RegisterShortcut(_mainHandle, SHORTCUTID_NVQA, _config.NvQuickAccessShortcut, clear); _nvService.Config.ShowOverclocking = enableOc; + + UpdateInfo(); } private void btnNvSettings_Click(object sender, EventArgs e) @@ -1183,7 +1196,7 @@ namespace ColorControl.Services.NVIDIA public NvGpuOcSettings AskNvOcSettings(NvGpuInfo gpuInfo, NvGpuOcSettings currentSettings) { - var overclockTypes = Utils.GetDescriptions(); + var overclockTypes = gpuInfo.SupportedOcTypes.Select(t => Utils.GetDescription(t)); var values = MessageForms.ShowDialog($"Overclock settings - {gpuInfo.GPU.FullName}", new[] { new MessageForms.FieldDefinition @@ -1192,7 +1205,7 @@ namespace ColorControl.Services.NVIDIA FieldType = MessageForms.FieldType.DropDown, Values = overclockTypes, Value = currentSettings.Type - } }); + } }, okButtonText: "Next >"); if (!values.Any()) { return null; @@ -1209,12 +1222,16 @@ namespace ColorControl.Services.NVIDIA { newSettings = AskNvOffsetOcSettings(gpuInfo, currentSettings); } + else if (overclockType == NvGpuOcType.BoostLock) + { + newSettings = AskNvBoostLockSettings(gpuInfo, currentSettings); + } else { newSettings = new NvGpuOcSettings { Type = overclockType, - PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString() + PCIIdentifier = gpuInfo.PCIIdentifier }; } @@ -1226,70 +1243,33 @@ namespace ColorControl.Services.NVIDIA var nvOverclockSettings = new NvGpuOcSettings { Type = NvGpuOcType.Curve, - PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString() + PCIIdentifier = gpuInfo.PCIIdentifier }; - var curveEntries = gpuInfo.CurveV3.GPUCurveEntries; - - var graphicsDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics); - - var minCurveFreq = curveEntries.Max(e => e.DefaultFrequencyInkHz) + graphicsDelta.Item1; - var freqValues = curveEntries - .Where(e => e.DefaultFrequencyInkHz == 0 || e.DefaultFrequencyInkHz >= minCurveFreq) - .Select(e => (e.DefaultFrequencyInkHz / 1000).ToString()).Distinct() - .OrderBy(x => x) - .ToList(); - var voltValues = curveEntries - .Where(e => (e.DefaultVoltageInMicroV == 0 || e.DefaultFrequencyInkHz >= minCurveFreq) && e.DefaultVoltageInMicroV <= 1100000) - .OrderBy(e => e.DefaultVoltageInMicroV) - .Select(e => (e.DefaultVoltageInMicroV / 1000).ToString()) - .Distinct() - .ToList(); - - var currentGraphicsVoltage = currentSettings.MaximumVoltageUv > 0 ? currentSettings.MaximumVoltageUv : 1050000; - - var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage); - var currentGpuFreq = curveEntry.FrequencyInkHz; - var coreOffsetField = gpuInfo.GetCoreOffsetField(currentSettings); var memoryOffsetField = gpuInfo.GetMemoryOffsetField(currentSettings); + var (voltField, freqField) = gpuInfo.GetCurveVoltFreqFields(currentSettings); + var voltageBoostField = gpuInfo.GetVoltageBoostField(currentSettings); var powerField = gpuInfo.GetPowerField(currentSettings); - var values = MessageForms.ShowDialog($"Overclock settings - {gpuInfo.GPU.FullName}", new[] { - coreOffsetField, - new MessageForms.FieldDefinition - { - Label = "Optional undervolt: maximum voltage in milli volt", - FieldType = MessageForms.FieldType.DropDown, - Value = currentSettings.MaximumVoltageUv / 1000, - Values = voltValues, - }, - new MessageForms.FieldDefinition - { - Label = "Optional undervolt: maximum core frequency in MHz", - FieldType = MessageForms.FieldType.DropDown, - Value = currentSettings.MaximumFrequencyKHz / 1000, - Values = freqValues, - }, - memoryOffsetField, - voltageBoostField, - powerField, + var values = MessageForms.ShowDialog($"Curve overclock settings - {gpuInfo.GPU.FullName}", new[] + { + coreOffsetField, voltField, freqField, memoryOffsetField, voltageBoostField, powerField, }); if (!values.Any()) { return null; } - nvOverclockSettings.GraphicsOffsetKHz = values[0].ValueAsInt * 1000; - nvOverclockSettings.MaximumVoltageUv = values[1].ValueAsUInt * 1000; - nvOverclockSettings.MaximumFrequencyKHz = values[2].ValueAsUInt * 1000; - nvOverclockSettings.MemoryOffsetKHz = values[3].ValueAsInt * 1000; - nvOverclockSettings.VoltageBoostPercent = values[4].ValueAsUInt; - - var power = values[5].ValueAsUInt; - nvOverclockSettings.PowerPCM = powerField.FieldType == MessageForms.FieldType.TrackBar ? (uint)((decimal)power / gpuInfo.DefaultPowerInMilliWatts * 100000) : power; + nvOverclockSettings.GraphicsOffsetKHz = coreOffsetField.ValueAsInt * 1000; + nvOverclockSettings.MaximumVoltageUv = voltField.ValueAsUInt * 1000; + nvOverclockSettings.MaximumFrequencyKHz = freqField.ValueAsUInt * 1000; + nvOverclockSettings.MemoryOffsetKHz = memoryOffsetField.ValueAsInt * 1000; + nvOverclockSettings.VoltageBoostPercent = voltageBoostField.ValueAsUInt; + nvOverclockSettings.PowerPCM = gpuInfo.PowerToPCM(powerField.ValueAsUInt, powerField.FieldType == MessageForms.FieldType.TrackBar); + nvOverclockSettings.FrequencyPreferred = nvOverclockSettings.MaximumFrequencyKHz > 0 && nvOverclockSettings.MaximumVoltageUv == 0; return nvOverclockSettings; } @@ -1299,7 +1279,7 @@ namespace ColorControl.Services.NVIDIA var nvOverclockSettings = new NvGpuOcSettings { Type = NvGpuOcType.Offset, - PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString() + PCIIdentifier = gpuInfo.PCIIdentifier }; var coreOffsetField = gpuInfo.GetCoreOffsetField(currentSettings); @@ -1308,7 +1288,7 @@ namespace ColorControl.Services.NVIDIA var voltageBoostField = gpuInfo.GetVoltageBoostField(currentSettings); var powerField = gpuInfo.GetPowerField(currentSettings); - var values = MessageForms.ShowDialog($"Overclock settings - {gpuInfo.GPU.FullName}", new[] { + var values = MessageForms.ShowDialog($"Offset overclock settings - {gpuInfo.GPU.FullName}", new[] { coreOffsetField, memoryOffsetField, voltageBoostField, @@ -1319,92 +1299,65 @@ namespace ColorControl.Services.NVIDIA return null; } - nvOverclockSettings.GraphicsOffsetKHz = values[0].ValueAsInt * 1000; - nvOverclockSettings.MemoryOffsetKHz = values[1].ValueAsInt * 1000; - nvOverclockSettings.VoltageBoostPercent = values[2].ValueAsUInt; - - var power = values[3].ValueAsUInt; - nvOverclockSettings.PowerPCM = powerField.FieldType == MessageForms.FieldType.TrackBar ? (uint)((decimal)power / gpuInfo.DefaultPowerInMilliWatts * 100000) : power; + nvOverclockSettings.GraphicsOffsetKHz = coreOffsetField.ValueAsInt * 1000; + nvOverclockSettings.MemoryOffsetKHz = memoryOffsetField.ValueAsInt * 1000; + nvOverclockSettings.VoltageBoostPercent = voltageBoostField.ValueAsUInt; + nvOverclockSettings.PowerPCM = gpuInfo.PowerToPCM(powerField.ValueAsUInt, powerField.FieldType == MessageForms.FieldType.TrackBar); + nvOverclockSettings.FrequencyPreferred = nvOverclockSettings.MaximumFrequencyKHz > 0 && nvOverclockSettings.MaximumVoltageUv == 0; return nvOverclockSettings; } - public void SetClocks() + public NvGpuOcSettings AskNvBoostLockSettings(NvGpuInfo gpuInfo, NvGpuOcSettings currentSettings) { - var gpu = cbxNvGPU.SelectedItem as PhysicalGPU; - - var gpuInfo = NvGpuInfo.GetGpuInfo(gpu); + var nvOverclockSettings = new NvGpuOcSettings + { + Type = NvGpuOcType.BoostLock, + PCIIdentifier = gpuInfo.PCIIdentifier + }; var curveEntries = gpuInfo.CurveV3.GPUCurveEntries; - var freqValues = curveEntries.Select(e => e.DefaultFrequencyInkHz.ToString()).Distinct().ToList(); - var voltValues = curveEntries.Select(e => e.DefaultVoltageInMicroV.ToString()).Distinct().ToList(); - - var lockedGraphics = gpuInfo.GetLockedBoost(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics); - - var currentGraphicsVoltage = lockedGraphics.Item1 > 0 ? lockedGraphics.Item1 : 1050000; - - var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage); - var currentGpuFreq = curveEntry.FrequencyInkHz; - - var graphicsDelta = gpuInfo.GetDeltaClockLimits(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics); - var memoryDelta = gpuInfo.GetDeltaClockLimits(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory); - - var graphicsMinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000; - var graphicsMaxValue = graphicsDelta?.DeltaRange.Maximum ?? 1000000; - var memoryMinValue = memoryDelta?.DeltaRange.Minimum ?? -502000; - var memoryMaxValue = memoryDelta?.DeltaRange.Maximum ?? 3000000; - var currentGraphicsOffset = gpuInfo.GetOffset(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics); - var currentMemoryOffset = gpuInfo.GetOffset(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory); - var values = MessageForms.ShowDialog($"Overclock settings - {gpuInfo.GPU.FullName}", new[] { - new MessageForms.FieldDefinition - { - Label = $"Core offset in MHz ({graphicsMinValue}KHz to {graphicsMaxValue}KHz)", - FieldType = MessageForms.FieldType.Numeric, - MinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000, - MaxValue = graphicsDelta?.DeltaRange.Maximum ?? 1000000, - Value = currentGraphicsOffset - }, - new MessageForms.FieldDefinition - { - Label = "Voltage in micro volt", - FieldType = MessageForms.FieldType.DropDown, - Values = voltValues, - }, - new MessageForms.FieldDefinition - { - Label = "Core frequency in KHz", - FieldType = MessageForms.FieldType.DropDown, - Values = freqValues, - }, - new MessageForms.FieldDefinition - { - Label = $"Memory offset in KHz ({memoryMinValue}KHz to {memoryMaxValue}KHz)", - FieldType = MessageForms.FieldType.Numeric, - MinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000, - MaxValue = 2500000, - Value = currentMemoryOffset - }, + var coreOffsetField = gpuInfo.GetCoreOffsetField(currentSettings); + var memoryOffsetField = gpuInfo.GetMemoryOffsetField(currentSettings); + + var (voltField, freqField) = gpuInfo.GetCurveVoltFreqFields(currentSettings); + voltField.Label = "Locked voltage in mV"; + freqField.Label = "Locked boost frequency in MHz"; + + var voltageBoostField = gpuInfo.GetVoltageBoostField(currentSettings); + var powerField = gpuInfo.GetPowerField(currentSettings); + + var values = MessageForms.ShowDialog($"Boost lock overclock settings - {gpuInfo.GPU.FullName}", new[] { + voltField, + freqField, + memoryOffsetField, + voltageBoostField, + powerField }); if (!values.Any()) { - return; + return null; } - var voltage = (uint)values[0].ValueAsInt; - //var coreOffset = values[1].ValueAsInt; - var coreFreq = values[1].ValueAsInt; - var memoryOffset = values[2].ValueAsInt; + var newVolt = voltField.ValueAsUInt * 1000; + var newFreq = freqField.ValueAsUInt * 1000; - var normalized = (coreFreq / 15000) * 15000; - var newCurveEntryFreq = curveEntries.FirstOrDefault(e => e.DefaultFrequencyInkHz == normalized); - var newCurveEntryVolt = curveEntries.FirstOrDefault(e => e.DefaultVoltageInMicroV == voltage); + var newCurveEntryFreq = curveEntries.FirstOrDefault(e => e.DefaultFrequencyInkHz == newFreq); + var newCurveEntryVolt = curveEntries.FirstOrDefault(e => e.DefaultVoltageInMicroV == newVolt); var coreOffset = (int)(newCurveEntryFreq.DefaultFrequencyInkHz - newCurveEntryVolt.DefaultFrequencyInkHz); - gpuInfo.SetGpuClocks(voltage, coreOffset, memoryOffset); + nvOverclockSettings.GraphicsOffsetKHz = coreOffset; + nvOverclockSettings.MaximumFrequencyKHz = newFreq; + nvOverclockSettings.MaximumVoltageUv = newVolt; + nvOverclockSettings.MemoryOffsetKHz = memoryOffsetField.ValueAsInt * 1000; + nvOverclockSettings.VoltageBoostPercent = voltageBoostField.ValueAsUInt; + nvOverclockSettings.PowerPCM = gpuInfo.PowerToPCM(powerField.ValueAsUInt, powerField.FieldType == MessageForms.FieldType.TrackBar); + + return nvOverclockSettings; } private void miNvOverclockingIncluded_Click(object sender, EventArgs e) @@ -1545,7 +1498,7 @@ namespace ColorControl.Services.NVIDIA FormUtils.SaveSortState(lvNvPresets.ListViewItemSorter, _config.NvPresetsSortState); } - internal void UpdateInfo() + public void UpdateInfo() { UpdateDisplayInfoItems(); } diff --git a/ColorControl/Services/NVIDIA/NvPanel.resx b/ColorControl/Services/NVIDIA/NvPanel.resx index f298a7b..e5d9137 100644 --- a/ColorControl/Services/NVIDIA/NvPanel.resx +++ b/ColorControl/Services/NVIDIA/NvPanel.resx @@ -57,4 +57,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 147, 17 + + + 282, 17 + \ No newline at end of file diff --git a/ColorControl/Services/NVIDIA/NvService.cs b/ColorControl/Services/NVIDIA/NvService.cs index 3f586f1..3692ce8 100644 --- a/ColorControl/Services/NVIDIA/NvService.cs +++ b/ColorControl/Services/NVIDIA/NvService.cs @@ -322,7 +322,7 @@ namespace ColorControl.Services.NVIDIA if (preset.applyOverclocking) { - ApplyOverclocking(preset.ocSettings); + result = ApplyOverclocking(preset.ocSettings); } _lastAppliedPreset = preset; @@ -332,23 +332,30 @@ namespace ColorControl.Services.NVIDIA return result; } - public void ApplyOverclocking(NvGpuOcSettings setting) + public bool ApplyOverclocking(NvGpuOcSettings setting) { - ApplyOverclocking(new List { setting }); + return ApplyOverclocking(new List { setting }); } - public void ApplyOverclocking(List settings) + public bool ApplyOverclocking(List settings) { if (!Utils.IsAdministrator()) { - PipeUtils.SendMessage(new SvcNvOverclockingMessage + var result = PipeUtils.SendMessage(new SvcNvOverclockingMessage { OverclockingSettings = settings }); - return; + if (result == null) + { + return false; + } + + return true; } + var result2 = true; + foreach (var ocSetting in settings) { var gpuInfo = NvGpuInfo.GetGpuInfo(ocSetting.PCIIdentifier); @@ -358,8 +365,10 @@ namespace ColorControl.Services.NVIDIA continue; } - gpuInfo.ApplyOcSettings(ocSetting); + result2 = gpuInfo.ApplyOcSettings(ocSetting); } + + return result2; } public bool SetColorData(Display display, ColorData colorData) @@ -802,6 +811,20 @@ namespace ColorControl.Services.NVIDIA preset.HDREnabled = IsHDREnabled(display); + if (Config.ShowOverclocking) + { + var gpus = GetGPUs(); + + foreach (var gpu in gpus) + { + var gpuInfo = NvGpuInfo.GetGpuInfo(gpu); + + var settings = gpuInfo.GetOverclockSettings(); + + preset.ocSettings.Add(settings); + } + } + return preset; } diff --git a/NvAPIWrapper/Native/GPU/Structures/PrivateThermalSensorsV2.cs b/NvAPIWrapper/Native/GPU/Structures/PrivateThermalSensorsV2.cs index bdbcbec..9b3b4b0 100644 --- a/NvAPIWrapper/Native/GPU/Structures/PrivateThermalSensorsV2.cs +++ b/NvAPIWrapper/Native/GPU/Structures/PrivateThermalSensorsV2.cs @@ -1,9 +1,9 @@ -using System.Linq; -using System.Runtime.InteropServices; -using NvAPIWrapper.Native.Attributes; +using NvAPIWrapper.Native.Attributes; using NvAPIWrapper.Native.General.Structures; using NvAPIWrapper.Native.Helpers; using NvAPIWrapper.Native.Interfaces; +using System.Linq; +using System.Runtime.InteropServices; namespace NvAPIWrapper.Native.GPU.Structures { @@ -36,11 +36,11 @@ namespace NvAPIWrapper.Native.GPU.Structures _Mask = mask; } - public float[] Temperatures + public double[] Temperatures { get { - return _Temperatures.Select((t) => t / 256.0f).ToArray(); + return _Temperatures.Select((t) => t / 256.0D).ToArray(); } } }