mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Visual Modes
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
using GHelper.Helpers;
|
||||
using GHelper.Mode;
|
||||
using GHelper.USB;
|
||||
using System.Management;
|
||||
|
||||
namespace GHelper.Display
|
||||
{
|
||||
enum SplendidCommand: int
|
||||
public enum SplendidCommand: int
|
||||
{
|
||||
Init = 10,
|
||||
DimmingAsus = 9,
|
||||
DimmingVisual = 19
|
||||
DimmingVisual = 19,
|
||||
GamutMode = 200,
|
||||
|
||||
Default = 11,
|
||||
Racing = 21,
|
||||
Scenery = 22,
|
||||
RTS = 23,
|
||||
FPS = 24,
|
||||
Cinema = 25,
|
||||
Vivid = 13,
|
||||
Eyecare = 17,
|
||||
}
|
||||
|
||||
public static class ScreenControl
|
||||
@@ -24,10 +35,56 @@ namespace GHelper.Display
|
||||
|
||||
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(100);
|
||||
|
||||
|
||||
static ScreenControl () {
|
||||
brightnessTimer.Elapsed += BrightnessTimerTimer_Elapsed;
|
||||
}
|
||||
|
||||
|
||||
public static Dictionary<int, string> GetGamutModes ()
|
||||
{
|
||||
Dictionary<int, string> _modes = new Dictionary<int, string>();
|
||||
|
||||
DirectoryInfo d = new DirectoryInfo("C:\\ProgramData\\ASUS\\GameVisual");
|
||||
FileInfo[] icms = d.GetFiles("*.icm");
|
||||
|
||||
if (icms.Length == 0) return _modes;
|
||||
|
||||
_modes.Add(50, "Native");
|
||||
foreach (FileInfo icm in icms)
|
||||
{
|
||||
if (icm.Name.Contains("sRGB")) _modes.Add(51, "sRGB");
|
||||
if (icm.Name.Contains("DCIP3")) _modes.Add(53, "DCIP3");
|
||||
if (icm.Name.Contains("DisplayP3")) _modes.Add(54, "DisplayP3");
|
||||
}
|
||||
return _modes;
|
||||
}
|
||||
|
||||
public static Dictionary<SplendidCommand, string> GetVisualModes()
|
||||
{
|
||||
return new Dictionary<SplendidCommand, string>
|
||||
{
|
||||
{ SplendidCommand.Default, "Default"},
|
||||
{ SplendidCommand.Racing, "Racing"},
|
||||
{ SplendidCommand.Scenery, "Scenery"},
|
||||
{ SplendidCommand.RTS, "RTS/RPG"},
|
||||
{ SplendidCommand.FPS, "FPS"},
|
||||
{ SplendidCommand.Cinema, "Cinema"},
|
||||
{ SplendidCommand.Vivid, "Vivid" },
|
||||
{ SplendidCommand.Eyecare, "Eyecare"}
|
||||
};
|
||||
}
|
||||
|
||||
public static void SetGamut(int mode = 50)
|
||||
{
|
||||
RunSplendid(SplendidCommand.GamutMode, 0, mode);
|
||||
}
|
||||
|
||||
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default)
|
||||
{
|
||||
RunSplendid(mode, 0, 50);
|
||||
}
|
||||
|
||||
private static string GetSplendidPath()
|
||||
{
|
||||
if (_splendidPath == null)
|
||||
|
||||
85
app/Settings.Designer.cs
generated
85
app/Settings.Designer.cs
generated
@@ -83,6 +83,8 @@ namespace GHelper
|
||||
labelGPUFan = new Label();
|
||||
panelScreen = new Panel();
|
||||
labelTipScreen = new Label();
|
||||
tableVisual = new TableLayoutPanel();
|
||||
comboGamut = new RComboBox();
|
||||
tableScreen = new TableLayoutPanel();
|
||||
buttonScreenAuto = new RButton();
|
||||
button60Hz = new RButton();
|
||||
@@ -128,6 +130,7 @@ namespace GHelper
|
||||
labelGamma = new Label();
|
||||
pictureGamma = new PictureBox();
|
||||
labelGammaTitle = new Label();
|
||||
comboVisual = new RComboBox();
|
||||
panelMatrix.SuspendLayout();
|
||||
panelMatrixAuto.SuspendLayout();
|
||||
tableLayoutMatrix.SuspendLayout();
|
||||
@@ -148,6 +151,7 @@ namespace GHelper
|
||||
panelGPUTitle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureGPU).BeginInit();
|
||||
panelScreen.SuspendLayout();
|
||||
tableVisual.SuspendLayout();
|
||||
tableScreen.SuspendLayout();
|
||||
panelScreenTitle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureScreen).BeginInit();
|
||||
@@ -181,7 +185,7 @@ namespace GHelper
|
||||
panelMatrix.Controls.Add(tableLayoutMatrix);
|
||||
panelMatrix.Controls.Add(panelMatrixTitle);
|
||||
panelMatrix.Dock = DockStyle.Top;
|
||||
panelMatrix.Location = new Point(11, 950);
|
||||
panelMatrix.Location = new Point(11, 1009);
|
||||
panelMatrix.Margin = new Padding(0);
|
||||
panelMatrix.Name = "panelMatrix";
|
||||
panelMatrix.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -356,7 +360,7 @@ namespace GHelper
|
||||
panelBattery.Controls.Add(sliderBattery);
|
||||
panelBattery.Controls.Add(panelBatteryTitle);
|
||||
panelBattery.Dock = DockStyle.Top;
|
||||
panelBattery.Location = new Point(11, 1626);
|
||||
panelBattery.Location = new Point(11, 1685);
|
||||
panelBattery.Margin = new Padding(0);
|
||||
panelBattery.Name = "panelBattery";
|
||||
panelBattery.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -448,7 +452,7 @@ namespace GHelper
|
||||
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelFooter.Controls.Add(tableButtons);
|
||||
panelFooter.Dock = DockStyle.Top;
|
||||
panelFooter.Location = new Point(11, 1801);
|
||||
panelFooter.Location = new Point(11, 1860);
|
||||
panelFooter.Margin = new Padding(0);
|
||||
panelFooter.Name = "panelFooter";
|
||||
panelFooter.Padding = new Padding(20);
|
||||
@@ -1021,6 +1025,7 @@ namespace GHelper
|
||||
panelScreen.AutoSize = true;
|
||||
panelScreen.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelScreen.Controls.Add(labelTipScreen);
|
||||
panelScreen.Controls.Add(tableVisual);
|
||||
panelScreen.Controls.Add(tableScreen);
|
||||
panelScreen.Controls.Add(panelScreenTitle);
|
||||
panelScreen.Dock = DockStyle.Top;
|
||||
@@ -1028,7 +1033,7 @@ namespace GHelper
|
||||
panelScreen.Margin = new Padding(0);
|
||||
panelScreen.Name = "panelScreen";
|
||||
panelScreen.Padding = new Padding(20, 20, 20, 0);
|
||||
panelScreen.Size = new Size(827, 176);
|
||||
panelScreen.Size = new Size(827, 235);
|
||||
panelScreen.TabIndex = 2;
|
||||
panelScreen.TabStop = true;
|
||||
//
|
||||
@@ -1036,12 +1041,49 @@ namespace GHelper
|
||||
//
|
||||
labelTipScreen.Dock = DockStyle.Top;
|
||||
labelTipScreen.ForeColor = SystemColors.GrayText;
|
||||
labelTipScreen.Location = new Point(20, 140);
|
||||
labelTipScreen.Location = new Point(20, 199);
|
||||
labelTipScreen.Margin = new Padding(4, 0, 4, 0);
|
||||
labelTipScreen.Name = "labelTipScreen";
|
||||
labelTipScreen.Size = new Size(787, 36);
|
||||
labelTipScreen.TabIndex = 24;
|
||||
//
|
||||
// tableVisual
|
||||
//
|
||||
tableVisual.AutoSize = true;
|
||||
tableVisual.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
tableVisual.ColumnCount = 3;
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.Controls.Add(comboVisual, 0, 0);
|
||||
tableVisual.Controls.Add(comboGamut, 0, 0);
|
||||
tableVisual.Dock = DockStyle.Top;
|
||||
tableVisual.Location = new Point(20, 140);
|
||||
tableVisual.Margin = new Padding(8);
|
||||
tableVisual.Name = "tableVisual";
|
||||
tableVisual.RowCount = 1;
|
||||
tableVisual.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||
tableVisual.Size = new Size(787, 59);
|
||||
tableVisual.TabIndex = 40;
|
||||
tableVisual.Visible = false;
|
||||
//
|
||||
// comboGamut
|
||||
//
|
||||
comboGamut.BorderColor = Color.White;
|
||||
comboGamut.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboGamut.Dock = DockStyle.Top;
|
||||
comboGamut.FlatStyle = FlatStyle.Flat;
|
||||
comboGamut.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboGamut.FormattingEnabled = true;
|
||||
comboGamut.ItemHeight = 32;
|
||||
comboGamut.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" });
|
||||
comboGamut.Location = new Point(4, 11);
|
||||
comboGamut.Margin = new Padding(4, 11, 4, 8);
|
||||
comboGamut.Name = "comboGamut";
|
||||
comboGamut.Size = new Size(254, 40);
|
||||
comboGamut.TabIndex = 13;
|
||||
comboGamut.Visible = false;
|
||||
//
|
||||
// tableScreen
|
||||
//
|
||||
tableScreen.AutoSize = true;
|
||||
@@ -1195,7 +1237,7 @@ namespace GHelper
|
||||
panelKeyboard.Controls.Add(tableLayoutKeyboard);
|
||||
panelKeyboard.Controls.Add(panelKeyboardTitle);
|
||||
panelKeyboard.Dock = DockStyle.Top;
|
||||
panelKeyboard.Location = new Point(11, 1284);
|
||||
panelKeyboard.Location = new Point(11, 1343);
|
||||
panelKeyboard.Margin = new Padding(0);
|
||||
panelKeyboard.Name = "panelKeyboard";
|
||||
panelKeyboard.Padding = new Padding(20);
|
||||
@@ -1371,7 +1413,7 @@ namespace GHelper
|
||||
panelVersion.Controls.Add(labelCharge);
|
||||
panelVersion.Controls.Add(checkStartup);
|
||||
panelVersion.Dock = DockStyle.Top;
|
||||
panelVersion.Location = new Point(11, 1745);
|
||||
panelVersion.Location = new Point(11, 1804);
|
||||
panelVersion.Margin = new Padding(4);
|
||||
panelVersion.Name = "panelVersion";
|
||||
panelVersion.Size = new Size(827, 56);
|
||||
@@ -1396,7 +1438,7 @@ namespace GHelper
|
||||
panelPeripherals.Controls.Add(tableLayoutPeripherals);
|
||||
panelPeripherals.Controls.Add(panelPeripheralsTile);
|
||||
panelPeripherals.Dock = DockStyle.Top;
|
||||
panelPeripherals.Location = new Point(11, 1428);
|
||||
panelPeripherals.Location = new Point(11, 1487);
|
||||
panelPeripherals.Margin = new Padding(0);
|
||||
panelPeripherals.Name = "panelPeripherals";
|
||||
panelPeripherals.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -1538,7 +1580,7 @@ namespace GHelper
|
||||
panelAlly.Controls.Add(tableLayoutAlly);
|
||||
panelAlly.Controls.Add(panelAllyTitle);
|
||||
panelAlly.Dock = DockStyle.Top;
|
||||
panelAlly.Location = new Point(11, 1144);
|
||||
panelAlly.Location = new Point(11, 1203);
|
||||
panelAlly.Margin = new Padding(0);
|
||||
panelAlly.Name = "panelAlly";
|
||||
panelAlly.Padding = new Padding(20, 20, 20, 0);
|
||||
@@ -1673,7 +1715,7 @@ namespace GHelper
|
||||
panelGamma.Controls.Add(sliderGamma);
|
||||
panelGamma.Controls.Add(panelGammaTitle);
|
||||
panelGamma.Dock = DockStyle.Top;
|
||||
panelGamma.Location = new Point(11, 827);
|
||||
panelGamma.Location = new Point(11, 886);
|
||||
panelGamma.Margin = new Padding(0);
|
||||
panelGamma.Name = "panelGamma";
|
||||
panelGamma.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -1740,13 +1782,30 @@ namespace GHelper
|
||||
labelGammaTitle.TabIndex = 37;
|
||||
labelGammaTitle.Text = "Flicker-free Dimming";
|
||||
//
|
||||
// comboVisual
|
||||
//
|
||||
comboVisual.BorderColor = Color.White;
|
||||
comboVisual.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboVisual.Dock = DockStyle.Top;
|
||||
comboVisual.FlatStyle = FlatStyle.Flat;
|
||||
comboVisual.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboVisual.FormattingEnabled = true;
|
||||
comboVisual.ItemHeight = 32;
|
||||
comboVisual.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" });
|
||||
comboVisual.Location = new Point(266, 11);
|
||||
comboVisual.Margin = new Padding(4, 11, 4, 8);
|
||||
comboVisual.Name = "comboVisual";
|
||||
comboVisual.Size = new Size(254, 40);
|
||||
comboVisual.TabIndex = 14;
|
||||
comboVisual.Visible = false;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(849, 2119);
|
||||
ClientSize = new Size(849, 1759);
|
||||
Controls.Add(panelFooter);
|
||||
Controls.Add(panelVersion);
|
||||
Controls.Add(panelBattery);
|
||||
@@ -1797,6 +1856,7 @@ namespace GHelper
|
||||
((System.ComponentModel.ISupportInitialize)pictureGPU).EndInit();
|
||||
panelScreen.ResumeLayout(false);
|
||||
panelScreen.PerformLayout();
|
||||
tableVisual.ResumeLayout(false);
|
||||
tableScreen.ResumeLayout(false);
|
||||
panelScreenTitle.ResumeLayout(false);
|
||||
panelScreenTitle.PerformLayout();
|
||||
@@ -1931,5 +1991,8 @@ namespace GHelper
|
||||
private Label labelGammaTitle;
|
||||
private CheckBox checkMatrixLid;
|
||||
private Panel panelMatrixAuto;
|
||||
private TableLayoutPanel tableVisual;
|
||||
private RComboBox comboGamut;
|
||||
private RComboBox comboVisual;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +258,7 @@ namespace GHelper
|
||||
panelPerformance.Focus();
|
||||
|
||||
InitBrightness();
|
||||
InitVisual();
|
||||
}
|
||||
|
||||
public void InitBrightness()
|
||||
@@ -270,6 +271,41 @@ namespace GHelper
|
||||
//sliderGamma.MouseUp += SliderGamma_ValueChanged;
|
||||
}
|
||||
|
||||
public void InitVisual()
|
||||
{
|
||||
var gamuts = ScreenControl.GetGamutModes();
|
||||
if (gamuts.Count < 1) return;
|
||||
|
||||
tableVisual.Visible = true;
|
||||
|
||||
comboVisual.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboVisual.DataSource = new BindingSource(ScreenControl.GetVisualModes(), null);
|
||||
comboVisual.DisplayMember = "Value";
|
||||
comboVisual.ValueMember = "Key";
|
||||
comboVisual.SelectedValueChanged += ComboVisual_SelectedValueChanged;
|
||||
comboVisual.Visible = true;
|
||||
|
||||
if (gamuts.Count <= 1) return;
|
||||
|
||||
comboGamut.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboGamut.DataSource = new BindingSource(gamuts, null);
|
||||
comboGamut.DisplayMember = "Value";
|
||||
comboGamut.ValueMember = "Key";
|
||||
comboGamut.SelectedValueChanged += ComboGamut_SelectedValueChanged;
|
||||
comboGamut.Visible = true;
|
||||
|
||||
}
|
||||
|
||||
private void ComboGamut_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
ScreenControl.SetGamut((int)comboGamut.SelectedValue);
|
||||
}
|
||||
|
||||
private void ComboVisual_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
ScreenControl.SetVisual((SplendidCommand)comboVisual.SelectedValue);
|
||||
}
|
||||
|
||||
public void VisualiseBrightness()
|
||||
{
|
||||
Invoke(delegate
|
||||
|
||||
Reference in New Issue
Block a user