mirror of
https://github.com/Maassoft/ColorControl.git
synced 2026-10-21 08:09:49 -05:00
add modules and make them configurable, enable page up/down shortcuts
This commit is contained in:
1 parent
dd083a5e9f
commit
6318d37247
20 files changed
+1223
-1151
No files matched your search
@@ -19,8 +19,8 @@
|
||||
<PublisherName>Maassoft</PublisherName>
|
||||
<Company>Maassoft</Company>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>8.5.0.0</ApplicationVersion>
|
||||
<Version>8.5.0.0</Version>
|
||||
<ApplicationVersion>9.0.0.0</ApplicationVersion>
|
||||
<Version>9.0.0.0</Version>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>false</BootstrapperEnabled>
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<Module> Modules { get; set; }
|
||||
|
||||
public Config()
|
||||
{
|
||||
@@ -60,6 +62,7 @@ namespace ColorControl
|
||||
NvPresetsSortState = new ListViewSortState();
|
||||
AmdPresetsSortState = new ListViewSortState();
|
||||
GamePresetsSortState = new ListViewSortState();
|
||||
Modules = new List<Module>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<string> 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<FieldDefinition> ShowDialog(string caption, IEnumerable<FieldDefinition> fields, Func<IEnumerable<FieldDefinition>, string> validateFunc = null)
|
||||
public static List<FieldDefinition> ShowDialog(string caption, IEnumerable<FieldDefinition> fields, Func<IEnumerable<FieldDefinition>, string> validateFunc = null, string okButtonText = "OK")
|
||||
{
|
||||
var values = new List<FieldDefinition>();
|
||||
|
||||
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)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace ColorControl
|
||||
{
|
||||
internal interface IModulePanel
|
||||
{
|
||||
public void UpdateInfo();
|
||||
}
|
||||
}
|
||||
Generated
+44
-245
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+134
-154
@@ -69,6 +69,7 @@ namespace ColorControl
|
||||
private IntPtr _screenStateNotify;
|
||||
|
||||
private Dictionary<int, Action> _shortcuts = new();
|
||||
private Dictionary<string, Func<UserControl>> _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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<UserControl> InitAction { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
+40
-10
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<LgPreset>(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."
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,9 @@
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="mnuLgButtons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>140, 17</value>
|
||||
<value>288, 16</value>
|
||||
</metadata>
|
||||
<metadata name="mnuLgSettings.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>147, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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<ClockBoostLock> ClockBoostLocks { get; private set; }
|
||||
public List<IPerformanceStates20ClockEntry> ClockEntries { get; private set; }
|
||||
public List<ClockBoostLock> ClockBoostLocks { get; private set; } = new();
|
||||
public List<IPerformanceStates20ClockEntry> 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<NvGpuOcType> 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<NvThermalSensorType, double> GetTemperatures()
|
||||
{
|
||||
var temperatures = new Dictionary<NvThermalSensorType, double>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+450
-497
File diff suppressed because it is too large.
Load diff
@@ -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<Control> { lvNvPresets, btnAddModesNv, btnChange, edtNvGpuInfo, btnNvSetClocks, btnNvSettings, edtNvOverclock });
|
||||
FormUtils.EnableControls(this, enabled, new List<Control> { 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<NvGpuOcType>();
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -57,4 +57,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="mnuNvPresets.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="mnuNvSettings.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>147, 17</value>
|
||||
</metadata>
|
||||
<metadata name="lvNvPresetsToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>282, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -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<NvGpuOcSettings> { setting });
|
||||
return ApplyOverclocking(new List<NvGpuOcSettings> { setting });
|
||||
}
|
||||
|
||||
public void ApplyOverclocking(List<NvGpuOcSettings> settings)
|
||||
public bool ApplyOverclocking(List<NvGpuOcSettings> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user