Compare commits

...

22 Commits

Author SHA1 Message Date
Serge
274c773a8b Init fallbacks 2024-03-07 22:23:12 +01:00
Serge
93399288bf Save visuals in UI 2024-03-07 22:00:27 +01:00
Serge
f42b91b408 Eye-care mode 2024-03-07 21:50:52 +01:00
Serge
9bf7400f69 UI Tweaks 2024-03-07 21:31:41 +01:00
Serge
dff69d48ce Visual Modes 2024-03-07 20:56:06 +01:00
Serge
816988eb6c Added K650 to OLED list 2024-03-07 18:32:48 +01:00
Serge
312028f97c Path detection 2024-03-07 18:22:30 +01:00
Serge
211b855e8a No overdrive for OLED 2024-03-07 15:19:41 +01:00
Serge
d3d2f3189f Dimming init fallback 2024-03-07 14:46:28 +01:00
Serge
4120113cbe Merge branch 'main' of https://github.com/seerge/g-helper 2024-03-07 14:34:02 +01:00
Serge
1191208f70 Dimming init 2024-03-07 14:33:39 +01:00
IceStormNG
c7db5a403c Mouse UI Fixes (#2173)
* Support for Strix Carry (P508)

* Fixes polling rate, angle snapping and debounce for Gladius II Origin.

* The Gen2 version of the TuF M3 uses 0-100 for brightness.

* Adds support for ROG Strix Impact III (P518)

* Import/Export feature for mice.

* Suppor for Strix Impact (P303)

* Support for Strix Impact II Electro Punk

* Strix Carry has 50 DPI minimum and increments of 50.

* Respect top-most setting of GHelper

* Fixes to the buttons to be wider to fit longer translations.
2024-03-07 14:15:01 +01:00
Serge
35ceea878f Brightness fallback 2024-03-07 14:12:20 +01:00
Serge
06378162c8 Ambient mode tweak for 2024 models 2024-03-07 13:39:34 +01:00
Serge
a688275ca2 Lower ambient mode refresh rate for single-zone models 2024-03-07 12:06:11 +01:00
Serge
4c5e05d6f8 Brightness slider UI tweaks 2024-03-07 11:39:54 +01:00
Serge
d77acfd97a Version bump 2024-03-07 11:28:21 +01:00
Serge
092ecc7ede Dimming hotkeys 2024-03-07 11:00:38 +01:00
Serge
0b3d52fc0e UI Tweaks 2024-03-07 00:27:36 +01:00
Serge
2797807d7b Improved dimming 2024-03-06 23:28:21 +01:00
Serge
6075676372 Max GPU Power param in config 2024-03-06 10:46:28 +01:00
Serge
0705edd83d Overdrive UI tweak https://github.com/seerge/g-helper/issues/2166 2024-03-05 22:19:23 +01:00
16 changed files with 462 additions and 145 deletions

View File

@@ -405,7 +405,12 @@ public static class AppConfig
public static bool IsOLED() public static bool IsOLED()
{ {
return ContainsModel("OLED") || IsSlash() || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150"); return ContainsModel("OLED") || IsSlash() || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150") || ContainsModel("M3500") || ContainsModel("K650");
}
public static bool IsNoOverdrive()
{
return Is("no_overdrive") || IsOLED();
} }
public static bool IsStrix() public static bool IsStrix()
@@ -431,7 +436,7 @@ public static class AppConfig
public static bool IsNoDirectRGB() public static bool IsNoDirectRGB()
{ {
return ContainsModel("GA503") || ContainsModel("G533Q"); return ContainsModel("GA503") || ContainsModel("G533Q") || IsSlash();
} }
public static bool IsStrixNumpad() public static bool IsStrixNumpad()
@@ -572,6 +577,10 @@ public static class AppConfig
return ContainsModel("G834") || ContainsModel("G614") || ContainsModel("G834") || ContainsModel("G634"); return ContainsModel("G834") || ContainsModel("G614") || ContainsModel("G834") || ContainsModel("G634");
} }
public static bool IsROG()
{
return ContainsModel("ROG");
}
public static bool IsASUS() public static bool IsASUS()
{ {
return ContainsModel("ROG") || ContainsModel("TUF") || ContainsModel("Vivobook") || ContainsModel("Zenbook"); return ContainsModel("ROG") || ContainsModel("TUF") || ContainsModel("Vivobook") || ContainsModel("Zenbook");

View File

@@ -296,7 +296,7 @@ public class AsusACPI
if (AppConfig.IsSlash()) if (AppConfig.IsSlash())
{ {
MaxGPUPower = 25; MaxGPUPower = AppConfig.Get("max_gpu_power", 25);
} }
if (AppConfig.DynamicBoost5()) if (AppConfig.DynamicBoost5())

View File

@@ -152,7 +152,7 @@
// //
panelProfiles.Controls.Add(comboProfile); panelProfiles.Controls.Add(comboProfile);
panelProfiles.Controls.Add(labelProfile); panelProfiles.Controls.Add(labelProfile);
panelProfiles.Location = new Point(212, 2); panelProfiles.Location = new Point(220, 2);
panelProfiles.Margin = new Padding(2); panelProfiles.Margin = new Padding(2);
panelProfiles.MinimumSize = new Size(227, 0); panelProfiles.MinimumSize = new Size(227, 0);
panelProfiles.Name = "panelProfiles"; panelProfiles.Name = "panelProfiles";
@@ -197,7 +197,7 @@
panelPerformance.Margin = new Padding(2); panelPerformance.Margin = new Padding(2);
panelPerformance.Name = "panelPerformance"; panelPerformance.Name = "panelPerformance";
panelPerformance.Padding = new Padding(0, 7, 0, 17); panelPerformance.Padding = new Padding(0, 7, 0, 17);
panelPerformance.Size = new Size(420, 370); panelPerformance.Size = new Size(437, 370);
panelPerformance.TabIndex = 1; panelPerformance.TabIndex = 1;
// //
// panelPerformanceOther // panelPerformanceOther
@@ -215,7 +215,7 @@
panelPerformanceOther.Margin = new Padding(2); panelPerformanceOther.Margin = new Padding(2);
panelPerformanceOther.Name = "panelPerformanceOther"; panelPerformanceOther.Name = "panelPerformanceOther";
panelPerformanceOther.Padding = new Padding(0, 7, 0, 7); panelPerformanceOther.Padding = new Padding(0, 7, 0, 7);
panelPerformanceOther.Size = new Size(420, 192); panelPerformanceOther.Size = new Size(437, 192);
panelPerformanceOther.TabIndex = 49; panelPerformanceOther.TabIndex = 49;
// //
// panelDeceleration // panelDeceleration
@@ -230,7 +230,7 @@
panelDeceleration.Margin = new Padding(2); panelDeceleration.Margin = new Padding(2);
panelDeceleration.Name = "panelDeceleration"; panelDeceleration.Name = "panelDeceleration";
panelDeceleration.Padding = new Padding(3); panelDeceleration.Padding = new Padding(3);
panelDeceleration.Size = new Size(420, 31); panelDeceleration.Size = new Size(437, 31);
panelDeceleration.TabIndex = 58; panelDeceleration.TabIndex = 58;
// //
// labelDeceleration // labelDeceleration
@@ -279,7 +279,7 @@
panelAcceleration.Margin = new Padding(2); panelAcceleration.Margin = new Padding(2);
panelAcceleration.Name = "panelAcceleration"; panelAcceleration.Name = "panelAcceleration";
panelAcceleration.Padding = new Padding(3); panelAcceleration.Padding = new Padding(3);
panelAcceleration.Size = new Size(420, 31); panelAcceleration.Size = new Size(437, 31);
panelAcceleration.TabIndex = 57; panelAcceleration.TabIndex = 57;
// //
// labelAcceleration // labelAcceleration
@@ -327,7 +327,7 @@
panelLiftOffDistance.Margin = new Padding(2); panelLiftOffDistance.Margin = new Padding(2);
panelLiftOffDistance.Name = "panelLiftOffDistance"; panelLiftOffDistance.Name = "panelLiftOffDistance";
panelLiftOffDistance.Padding = new Padding(3); panelLiftOffDistance.Padding = new Padding(3);
panelLiftOffDistance.Size = new Size(420, 29); panelLiftOffDistance.Size = new Size(437, 29);
panelLiftOffDistance.TabIndex = 56; panelLiftOffDistance.TabIndex = 56;
// //
// labelLiftOffDistance // labelLiftOffDistance
@@ -364,7 +364,7 @@
panelDebounce.Margin = new Padding(2); panelDebounce.Margin = new Padding(2);
panelDebounce.Name = "panelDebounce"; panelDebounce.Name = "panelDebounce";
panelDebounce.Padding = new Padding(3); panelDebounce.Padding = new Padding(3);
panelDebounce.Size = new Size(420, 31); panelDebounce.Size = new Size(437, 31);
panelDebounce.TabIndex = 55; panelDebounce.TabIndex = 55;
// //
// labelButtonDebounce // labelButtonDebounce
@@ -413,7 +413,7 @@
panelAngleSnapping.Margin = new Padding(2); panelAngleSnapping.Margin = new Padding(2);
panelAngleSnapping.Name = "panelAngleSnapping"; panelAngleSnapping.Name = "panelAngleSnapping";
panelAngleSnapping.Padding = new Padding(3); panelAngleSnapping.Padding = new Padding(3);
panelAngleSnapping.Size = new Size(420, 29); panelAngleSnapping.Size = new Size(437, 29);
panelAngleSnapping.TabIndex = 54; panelAngleSnapping.TabIndex = 54;
// //
// sliderAngleAdjustment // sliderAngleAdjustment
@@ -464,7 +464,7 @@
panelPollingRate.Margin = new Padding(2); panelPollingRate.Margin = new Padding(2);
panelPollingRate.Name = "panelPollingRate"; panelPollingRate.Name = "panelPollingRate";
panelPollingRate.Padding = new Padding(3); panelPollingRate.Padding = new Padding(3);
panelPollingRate.Size = new Size(420, 27); panelPollingRate.Size = new Size(437, 27);
panelPollingRate.TabIndex = 53; panelPollingRate.TabIndex = 53;
// //
// labelPollingRate // labelPollingRate
@@ -500,7 +500,7 @@
panelDPISettings.Location = new Point(0, 91); panelDPISettings.Location = new Point(0, 91);
panelDPISettings.Margin = new Padding(2); panelDPISettings.Margin = new Padding(2);
panelDPISettings.Name = "panelDPISettings"; panelDPISettings.Name = "panelDPISettings";
panelDPISettings.Size = new Size(420, 70); panelDPISettings.Size = new Size(437, 70);
panelDPISettings.TabIndex = 44; panelDPISettings.TabIndex = 44;
// //
// sliderDPI // sliderDPI
@@ -512,7 +512,7 @@
sliderDPI.Max = 35000; sliderDPI.Max = 35000;
sliderDPI.Min = 100; sliderDPI.Min = 100;
sliderDPI.Name = "sliderDPI"; sliderDPI.Name = "sliderDPI";
sliderDPI.Size = new Size(420, 20); sliderDPI.Size = new Size(437, 20);
sliderDPI.Step = 50; sliderDPI.Step = 50;
sliderDPI.TabIndex = 43; sliderDPI.TabIndex = 43;
sliderDPI.TabStop = false; sliderDPI.TabStop = false;
@@ -537,7 +537,7 @@
tableLayoutPanel1.Name = "tableLayoutPanel1"; tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.RowCount = 1; tableLayoutPanel1.RowCount = 1;
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutPanel1.Size = new Size(420, 23); tableLayoutPanel1.Size = new Size(437, 23);
tableLayoutPanel1.TabIndex = 47; tableLayoutPanel1.TabIndex = 47;
// //
// labelMinDPI // labelMinDPI
@@ -547,7 +547,7 @@
labelMinDPI.Location = new Point(4, 0); labelMinDPI.Location = new Point(4, 0);
labelMinDPI.Margin = new Padding(4, 0, 4, 0); labelMinDPI.Margin = new Padding(4, 0, 4, 0);
labelMinDPI.Name = "labelMinDPI"; labelMinDPI.Name = "labelMinDPI";
labelMinDPI.Size = new Size(151, 23); labelMinDPI.Size = new Size(158, 23);
labelMinDPI.TabIndex = 45; labelMinDPI.TabIndex = 45;
labelMinDPI.Text = "100"; labelMinDPI.Text = "100";
// //
@@ -555,10 +555,10 @@
// //
labelMaxDPI.Dock = DockStyle.Fill; labelMaxDPI.Dock = DockStyle.Fill;
labelMaxDPI.ForeColor = SystemColors.GrayText; labelMaxDPI.ForeColor = SystemColors.GrayText;
labelMaxDPI.Location = new Point(263, 0); labelMaxDPI.Location = new Point(274, 0);
labelMaxDPI.Margin = new Padding(4, 0, 4, 0); labelMaxDPI.Margin = new Padding(4, 0, 4, 0);
labelMaxDPI.Name = "labelMaxDPI"; labelMaxDPI.Name = "labelMaxDPI";
labelMaxDPI.Size = new Size(153, 23); labelMaxDPI.Size = new Size(159, 23);
labelMaxDPI.TabIndex = 46; labelMaxDPI.TabIndex = 46;
labelMaxDPI.Text = " 35000"; labelMaxDPI.Text = " 35000";
labelMaxDPI.TextAlign = ContentAlignment.TopRight; labelMaxDPI.TextAlign = ContentAlignment.TopRight;
@@ -568,12 +568,12 @@
numericUpDownCurrentDPI.BorderStyle = BorderStyle.None; numericUpDownCurrentDPI.BorderStyle = BorderStyle.None;
numericUpDownCurrentDPI.Dock = DockStyle.Fill; numericUpDownCurrentDPI.Dock = DockStyle.Fill;
numericUpDownCurrentDPI.Increment = new decimal(new int[] { 50, 0, 0, 0 }); numericUpDownCurrentDPI.Increment = new decimal(new int[] { 50, 0, 0, 0 });
numericUpDownCurrentDPI.Location = new Point(161, 2); numericUpDownCurrentDPI.Location = new Point(168, 2);
numericUpDownCurrentDPI.Margin = new Padding(2); numericUpDownCurrentDPI.Margin = new Padding(2);
numericUpDownCurrentDPI.Maximum = new decimal(new int[] { 35000, 0, 0, 0 }); numericUpDownCurrentDPI.Maximum = new decimal(new int[] { 35000, 0, 0, 0 });
numericUpDownCurrentDPI.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownCurrentDPI.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownCurrentDPI.Name = "numericUpDownCurrentDPI"; numericUpDownCurrentDPI.Name = "numericUpDownCurrentDPI";
numericUpDownCurrentDPI.Size = new Size(96, 19); numericUpDownCurrentDPI.Size = new Size(100, 19);
numericUpDownCurrentDPI.TabIndex = 47; numericUpDownCurrentDPI.TabIndex = 47;
numericUpDownCurrentDPI.TextAlign = HorizontalAlignment.Center; numericUpDownCurrentDPI.TextAlign = HorizontalAlignment.Center;
numericUpDownCurrentDPI.Value = new decimal(new int[] { 2000, 0, 0, 0 }); numericUpDownCurrentDPI.Value = new decimal(new int[] { 2000, 0, 0, 0 });
@@ -588,13 +588,13 @@
panelDPITile.Margin = new Padding(2); panelDPITile.Margin = new Padding(2);
panelDPITile.Name = "panelDPITile"; panelDPITile.Name = "panelDPITile";
panelDPITile.Padding = new Padding(0, 3, 0, 3); panelDPITile.Padding = new Padding(0, 3, 0, 3);
panelDPITile.Size = new Size(420, 27); panelDPITile.Size = new Size(437, 27);
panelDPITile.TabIndex = 48; panelDPITile.TabIndex = 48;
// //
// pictureDPIColor // pictureDPIColor
// //
pictureDPIColor.Anchor = AnchorStyles.Top | AnchorStyles.Right; pictureDPIColor.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pictureDPIColor.Location = new Point(395, 7); pictureDPIColor.Location = new Point(412, 7);
pictureDPIColor.Margin = new Padding(4); pictureDPIColor.Margin = new Padding(4);
pictureDPIColor.Name = "pictureDPIColor"; pictureDPIColor.Name = "pictureDPIColor";
pictureDPIColor.Size = new Size(10, 10); pictureDPIColor.Size = new Size(10, 10);
@@ -612,7 +612,7 @@
buttonDPIColor.BorderRadius = 2; buttonDPIColor.BorderRadius = 2;
buttonDPIColor.FlatStyle = FlatStyle.Flat; buttonDPIColor.FlatStyle = FlatStyle.Flat;
buttonDPIColor.ForeColor = SystemColors.ControlText; buttonDPIColor.ForeColor = SystemColors.ControlText;
buttonDPIColor.Location = new Point(291, 1); buttonDPIColor.Location = new Point(308, 1);
buttonDPIColor.Margin = new Padding(2, 4, 2, 4); buttonDPIColor.Margin = new Padding(2, 4, 2, 4);
buttonDPIColor.Name = "buttonDPIColor"; buttonDPIColor.Name = "buttonDPIColor";
buttonDPIColor.Secondary = false; buttonDPIColor.Secondary = false;
@@ -653,7 +653,7 @@
tableDPI.RowCount = 1; tableDPI.RowCount = 1;
tableDPI.RowStyles.Add(new RowStyle(SizeType.Absolute, 64F)); tableDPI.RowStyles.Add(new RowStyle(SizeType.Absolute, 64F));
tableDPI.RowStyles.Add(new RowStyle(SizeType.Absolute, 64F)); tableDPI.RowStyles.Add(new RowStyle(SizeType.Absolute, 64F));
tableDPI.Size = new Size(420, 64); tableDPI.Size = new Size(437, 64);
tableDPI.TabIndex = 42; tableDPI.TabIndex = 42;
// //
// buttonDPI2 // buttonDPI2
@@ -669,11 +669,11 @@
buttonDPI2.ForeColor = SystemColors.ControlText; buttonDPI2.ForeColor = SystemColors.ControlText;
buttonDPI2.Image = Properties.Resources.lighting_dot_32; buttonDPI2.Image = Properties.Resources.lighting_dot_32;
buttonDPI2.ImageAlign = ContentAlignment.BottomCenter; buttonDPI2.ImageAlign = ContentAlignment.BottomCenter;
buttonDPI2.Location = new Point(107, 2); buttonDPI2.Location = new Point(111, 2);
buttonDPI2.Margin = new Padding(2); buttonDPI2.Margin = new Padding(2);
buttonDPI2.Name = "buttonDPI2"; buttonDPI2.Name = "buttonDPI2";
buttonDPI2.Secondary = false; buttonDPI2.Secondary = false;
buttonDPI2.Size = new Size(101, 60); buttonDPI2.Size = new Size(105, 60);
buttonDPI2.TabIndex = 4; buttonDPI2.TabIndex = 4;
buttonDPI2.Text = "DPI 2\r\n1000"; buttonDPI2.Text = "DPI 2\r\n1000";
buttonDPI2.TextImageRelation = TextImageRelation.ImageAboveText; buttonDPI2.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -696,7 +696,7 @@
buttonDPI1.Margin = new Padding(2); buttonDPI1.Margin = new Padding(2);
buttonDPI1.Name = "buttonDPI1"; buttonDPI1.Name = "buttonDPI1";
buttonDPI1.Secondary = false; buttonDPI1.Secondary = false;
buttonDPI1.Size = new Size(101, 60); buttonDPI1.Size = new Size(105, 60);
buttonDPI1.TabIndex = 4; buttonDPI1.TabIndex = 4;
buttonDPI1.Text = "DPI 1\r\n800"; buttonDPI1.Text = "DPI 1\r\n800";
buttonDPI1.TextImageRelation = TextImageRelation.ImageAboveText; buttonDPI1.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -715,11 +715,11 @@
buttonDPI3.ForeColor = SystemColors.ControlText; buttonDPI3.ForeColor = SystemColors.ControlText;
buttonDPI3.Image = Properties.Resources.lighting_dot_32; buttonDPI3.Image = Properties.Resources.lighting_dot_32;
buttonDPI3.ImageAlign = ContentAlignment.BottomCenter; buttonDPI3.ImageAlign = ContentAlignment.BottomCenter;
buttonDPI3.Location = new Point(212, 2); buttonDPI3.Location = new Point(220, 2);
buttonDPI3.Margin = new Padding(2); buttonDPI3.Margin = new Padding(2);
buttonDPI3.Name = "buttonDPI3"; buttonDPI3.Name = "buttonDPI3";
buttonDPI3.Secondary = false; buttonDPI3.Secondary = false;
buttonDPI3.Size = new Size(101, 60); buttonDPI3.Size = new Size(105, 60);
buttonDPI3.TabIndex = 5; buttonDPI3.TabIndex = 5;
buttonDPI3.Text = "DPI 3\r\n1200"; buttonDPI3.Text = "DPI 3\r\n1200";
buttonDPI3.TextImageRelation = TextImageRelation.ImageAboveText; buttonDPI3.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -738,11 +738,11 @@
buttonDPI4.ForeColor = SystemColors.ControlText; buttonDPI4.ForeColor = SystemColors.ControlText;
buttonDPI4.Image = Properties.Resources.lighting_dot_32; buttonDPI4.Image = Properties.Resources.lighting_dot_32;
buttonDPI4.ImageAlign = ContentAlignment.BottomCenter; buttonDPI4.ImageAlign = ContentAlignment.BottomCenter;
buttonDPI4.Location = new Point(317, 2); buttonDPI4.Location = new Point(329, 2);
buttonDPI4.Margin = new Padding(2); buttonDPI4.Margin = new Padding(2);
buttonDPI4.Name = "buttonDPI4"; buttonDPI4.Name = "buttonDPI4";
buttonDPI4.Secondary = false; buttonDPI4.Secondary = false;
buttonDPI4.Size = new Size(101, 60); buttonDPI4.Size = new Size(106, 60);
buttonDPI4.TabIndex = 6; buttonDPI4.TabIndex = 6;
buttonDPI4.Text = "DPI 4\r\n1400"; buttonDPI4.Text = "DPI 4\r\n1400";
buttonDPI4.TextImageRelation = TextImageRelation.ImageAboveText; buttonDPI4.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -757,7 +757,7 @@
panelPerformanceHeader.Location = new Point(0, 7); panelPerformanceHeader.Location = new Point(0, 7);
panelPerformanceHeader.Margin = new Padding(2); panelPerformanceHeader.Margin = new Padding(2);
panelPerformanceHeader.Name = "panelPerformanceHeader"; panelPerformanceHeader.Name = "panelPerformanceHeader";
panelPerformanceHeader.Size = new Size(420, 20); panelPerformanceHeader.Size = new Size(437, 20);
panelPerformanceHeader.TabIndex = 41; panelPerformanceHeader.TabIndex = 41;
// //
// pictureKeyboard // pictureKeyboard
@@ -793,7 +793,7 @@
panelLighting.Margin = new Padding(2); panelLighting.Margin = new Padding(2);
panelLighting.Name = "panelLighting"; panelLighting.Name = "panelLighting";
panelLighting.Padding = new Padding(0, 0, 0, 17); panelLighting.Padding = new Padding(0, 0, 0, 17);
panelLighting.Size = new Size(420, 220); panelLighting.Size = new Size(437, 220);
panelLighting.TabIndex = 42; panelLighting.TabIndex = 42;
// //
// panelLightingContent // panelLightingContent
@@ -814,7 +814,7 @@
panelLightingContent.Margin = new Padding(2); panelLightingContent.Margin = new Padding(2);
panelLightingContent.Name = "panelLightingContent"; panelLightingContent.Name = "panelLightingContent";
panelLightingContent.Padding = new Padding(0, 0, 0, 7); panelLightingContent.Padding = new Padding(0, 0, 0, 7);
panelLightingContent.Size = new Size(420, 183); panelLightingContent.Size = new Size(437, 183);
panelLightingContent.TabIndex = 42; panelLightingContent.TabIndex = 42;
// //
// tableLayoutLightingZones // tableLayoutLightingZones
@@ -838,7 +838,7 @@
tableLayoutLightingZones.Name = "tableLayoutLightingZones"; tableLayoutLightingZones.Name = "tableLayoutLightingZones";
tableLayoutLightingZones.RowCount = 1; tableLayoutLightingZones.RowCount = 1;
tableLayoutLightingZones.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F)); tableLayoutLightingZones.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableLayoutLightingZones.Size = new Size(420, 40); tableLayoutLightingZones.Size = new Size(437, 40);
tableLayoutLightingZones.TabIndex = 56; tableLayoutLightingZones.TabIndex = 56;
// //
// buttonLightingZoneScroll // buttonLightingZoneScroll
@@ -855,11 +855,11 @@
buttonLightingZoneScroll.FlatStyle = FlatStyle.Flat; buttonLightingZoneScroll.FlatStyle = FlatStyle.Flat;
buttonLightingZoneScroll.ForeColor = SystemColors.ControlText; buttonLightingZoneScroll.ForeColor = SystemColors.ControlText;
buttonLightingZoneScroll.ImageAlign = ContentAlignment.BottomCenter; buttonLightingZoneScroll.ImageAlign = ContentAlignment.BottomCenter;
buttonLightingZoneScroll.Location = new Point(170, 2); buttonLightingZoneScroll.Location = new Point(176, 2);
buttonLightingZoneScroll.Margin = new Padding(2); buttonLightingZoneScroll.Margin = new Padding(2);
buttonLightingZoneScroll.Name = "buttonLightingZoneScroll"; buttonLightingZoneScroll.Name = "buttonLightingZoneScroll";
buttonLightingZoneScroll.Secondary = false; buttonLightingZoneScroll.Secondary = false;
buttonLightingZoneScroll.Size = new Size(80, 36); buttonLightingZoneScroll.Size = new Size(83, 36);
buttonLightingZoneScroll.TabIndex = 7; buttonLightingZoneScroll.TabIndex = 7;
buttonLightingZoneScroll.Text = "Scrollwheel"; buttonLightingZoneScroll.Text = "Scrollwheel";
buttonLightingZoneScroll.TextImageRelation = TextImageRelation.ImageAboveText; buttonLightingZoneScroll.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -879,11 +879,11 @@
buttonLightingZoneLogo.FlatStyle = FlatStyle.Flat; buttonLightingZoneLogo.FlatStyle = FlatStyle.Flat;
buttonLightingZoneLogo.ForeColor = SystemColors.ControlText; buttonLightingZoneLogo.ForeColor = SystemColors.ControlText;
buttonLightingZoneLogo.ImageAlign = ContentAlignment.BottomCenter; buttonLightingZoneLogo.ImageAlign = ContentAlignment.BottomCenter;
buttonLightingZoneLogo.Location = new Point(86, 2); buttonLightingZoneLogo.Location = new Point(89, 2);
buttonLightingZoneLogo.Margin = new Padding(2); buttonLightingZoneLogo.Margin = new Padding(2);
buttonLightingZoneLogo.Name = "buttonLightingZoneLogo"; buttonLightingZoneLogo.Name = "buttonLightingZoneLogo";
buttonLightingZoneLogo.Secondary = false; buttonLightingZoneLogo.Secondary = false;
buttonLightingZoneLogo.Size = new Size(80, 36); buttonLightingZoneLogo.Size = new Size(83, 36);
buttonLightingZoneLogo.TabIndex = 4; buttonLightingZoneLogo.TabIndex = 4;
buttonLightingZoneLogo.Text = "Logo"; buttonLightingZoneLogo.Text = "Logo";
buttonLightingZoneLogo.TextImageRelation = TextImageRelation.ImageAboveText; buttonLightingZoneLogo.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -907,7 +907,7 @@
buttonLightingZoneAll.Margin = new Padding(2); buttonLightingZoneAll.Margin = new Padding(2);
buttonLightingZoneAll.Name = "buttonLightingZoneAll"; buttonLightingZoneAll.Name = "buttonLightingZoneAll";
buttonLightingZoneAll.Secondary = false; buttonLightingZoneAll.Secondary = false;
buttonLightingZoneAll.Size = new Size(80, 36); buttonLightingZoneAll.Size = new Size(83, 36);
buttonLightingZoneAll.TabIndex = 4; buttonLightingZoneAll.TabIndex = 4;
buttonLightingZoneAll.Text = "All"; buttonLightingZoneAll.Text = "All";
buttonLightingZoneAll.TextImageRelation = TextImageRelation.ImageAboveText; buttonLightingZoneAll.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -927,11 +927,11 @@
buttonLightingZoneUnderglow.FlatStyle = FlatStyle.Flat; buttonLightingZoneUnderglow.FlatStyle = FlatStyle.Flat;
buttonLightingZoneUnderglow.ForeColor = SystemColors.ControlText; buttonLightingZoneUnderglow.ForeColor = SystemColors.ControlText;
buttonLightingZoneUnderglow.ImageAlign = ContentAlignment.BottomCenter; buttonLightingZoneUnderglow.ImageAlign = ContentAlignment.BottomCenter;
buttonLightingZoneUnderglow.Location = new Point(254, 2); buttonLightingZoneUnderglow.Location = new Point(263, 2);
buttonLightingZoneUnderglow.Margin = new Padding(2); buttonLightingZoneUnderglow.Margin = new Padding(2);
buttonLightingZoneUnderglow.Name = "buttonLightingZoneUnderglow"; buttonLightingZoneUnderglow.Name = "buttonLightingZoneUnderglow";
buttonLightingZoneUnderglow.Secondary = false; buttonLightingZoneUnderglow.Secondary = false;
buttonLightingZoneUnderglow.Size = new Size(80, 36); buttonLightingZoneUnderglow.Size = new Size(83, 36);
buttonLightingZoneUnderglow.TabIndex = 5; buttonLightingZoneUnderglow.TabIndex = 5;
buttonLightingZoneUnderglow.Text = "Underglow"; buttonLightingZoneUnderglow.Text = "Underglow";
buttonLightingZoneUnderglow.TextImageRelation = TextImageRelation.ImageAboveText; buttonLightingZoneUnderglow.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -951,11 +951,11 @@
buttonLightingZoneDock.FlatStyle = FlatStyle.Flat; buttonLightingZoneDock.FlatStyle = FlatStyle.Flat;
buttonLightingZoneDock.ForeColor = SystemColors.ControlText; buttonLightingZoneDock.ForeColor = SystemColors.ControlText;
buttonLightingZoneDock.ImageAlign = ContentAlignment.BottomCenter; buttonLightingZoneDock.ImageAlign = ContentAlignment.BottomCenter;
buttonLightingZoneDock.Location = new Point(338, 2); buttonLightingZoneDock.Location = new Point(350, 2);
buttonLightingZoneDock.Margin = new Padding(2); buttonLightingZoneDock.Margin = new Padding(2);
buttonLightingZoneDock.Name = "buttonLightingZoneDock"; buttonLightingZoneDock.Name = "buttonLightingZoneDock";
buttonLightingZoneDock.Secondary = false; buttonLightingZoneDock.Secondary = false;
buttonLightingZoneDock.Size = new Size(80, 36); buttonLightingZoneDock.Size = new Size(85, 36);
buttonLightingZoneDock.TabIndex = 6; buttonLightingZoneDock.TabIndex = 6;
buttonLightingZoneDock.Text = "Dock"; buttonLightingZoneDock.Text = "Dock";
buttonLightingZoneDock.TextImageRelation = TextImageRelation.ImageAboveText; buttonLightingZoneDock.TextImageRelation = TextImageRelation.ImageAboveText;
@@ -968,10 +968,10 @@
comboBoxAnimationDirection.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxAnimationDirection.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxAnimationDirection.FlatStyle = FlatStyle.Flat; comboBoxAnimationDirection.FlatStyle = FlatStyle.Flat;
comboBoxAnimationDirection.FormattingEnabled = true; comboBoxAnimationDirection.FormattingEnabled = true;
comboBoxAnimationDirection.Location = new Point(244, 153); comboBoxAnimationDirection.Location = new Point(245, 153);
comboBoxAnimationDirection.Margin = new Padding(11, 0, 11, 0); comboBoxAnimationDirection.Margin = new Padding(11, 0, 11, 0);
comboBoxAnimationDirection.Name = "comboBoxAnimationDirection"; comboBoxAnimationDirection.Name = "comboBoxAnimationDirection";
comboBoxAnimationDirection.Size = new Size(191, 23); comboBoxAnimationDirection.Size = new Size(190, 23);
comboBoxAnimationDirection.TabIndex = 54; comboBoxAnimationDirection.TabIndex = 54;
// //
// labelAnimationDirection // labelAnimationDirection
@@ -1000,10 +1000,10 @@
comboBoxAnimationSpeed.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxAnimationSpeed.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxAnimationSpeed.FlatStyle = FlatStyle.Flat; comboBoxAnimationSpeed.FlatStyle = FlatStyle.Flat;
comboBoxAnimationSpeed.FormattingEnabled = true; comboBoxAnimationSpeed.FormattingEnabled = true;
comboBoxAnimationSpeed.Location = new Point(244, 125); comboBoxAnimationSpeed.Location = new Point(245, 125);
comboBoxAnimationSpeed.Margin = new Padding(11, 0, 11, 0); comboBoxAnimationSpeed.Margin = new Padding(11, 0, 11, 0);
comboBoxAnimationSpeed.Name = "comboBoxAnimationSpeed"; comboBoxAnimationSpeed.Name = "comboBoxAnimationSpeed";
comboBoxAnimationSpeed.Size = new Size(191, 23); comboBoxAnimationSpeed.Size = new Size(190, 23);
comboBoxAnimationSpeed.TabIndex = 51; comboBoxAnimationSpeed.TabIndex = 51;
// //
// labelAnimationSpeed // labelAnimationSpeed
@@ -1018,7 +1018,7 @@
// pictureBoxLightingColor // pictureBoxLightingColor
// //
pictureBoxLightingColor.Anchor = AnchorStyles.Top | AnchorStyles.Right; pictureBoxLightingColor.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pictureBoxLightingColor.Location = new Point(304, 80); pictureBoxLightingColor.Location = new Point(321, 80);
pictureBoxLightingColor.Margin = new Padding(4); pictureBoxLightingColor.Margin = new Padding(4);
pictureBoxLightingColor.Name = "pictureBoxLightingColor"; pictureBoxLightingColor.Name = "pictureBoxLightingColor";
pictureBoxLightingColor.Size = new Size(13, 13); pictureBoxLightingColor.Size = new Size(13, 13);
@@ -1035,11 +1035,11 @@
buttonLightingColor.BorderRadius = 2; buttonLightingColor.BorderRadius = 2;
buttonLightingColor.FlatStyle = FlatStyle.Flat; buttonLightingColor.FlatStyle = FlatStyle.Flat;
buttonLightingColor.ForeColor = SystemColors.ControlText; buttonLightingColor.ForeColor = SystemColors.ControlText;
buttonLightingColor.Location = new Point(233, 74); buttonLightingColor.Location = new Point(252, 74);
buttonLightingColor.Margin = new Padding(2, 4, 2, 4); buttonLightingColor.Margin = new Padding(2, 4, 2, 4);
buttonLightingColor.Name = "buttonLightingColor"; buttonLightingColor.Name = "buttonLightingColor";
buttonLightingColor.Secondary = false; buttonLightingColor.Secondary = false;
buttonLightingColor.Size = new Size(94, 25); buttonLightingColor.Size = new Size(90, 25);
buttonLightingColor.TabIndex = 49; buttonLightingColor.TabIndex = 49;
buttonLightingColor.Text = Properties.Strings.Color; buttonLightingColor.Text = Properties.Strings.Color;
buttonLightingColor.TextAlign = ContentAlignment.MiddleLeft; buttonLightingColor.TextAlign = ContentAlignment.MiddleLeft;
@@ -1077,13 +1077,13 @@
panelLightingHeader.Location = new Point(0, 0); panelLightingHeader.Location = new Point(0, 0);
panelLightingHeader.Margin = new Padding(2); panelLightingHeader.Margin = new Padding(2);
panelLightingHeader.Name = "panelLightingHeader"; panelLightingHeader.Name = "panelLightingHeader";
panelLightingHeader.Size = new Size(420, 20); panelLightingHeader.Size = new Size(437, 20);
panelLightingHeader.TabIndex = 41; panelLightingHeader.TabIndex = 41;
// //
// sliderBrightness // sliderBrightness
// //
sliderBrightness.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; sliderBrightness.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
sliderBrightness.Location = new Point(229, 1); sliderBrightness.Location = new Point(246, 1);
sliderBrightness.Margin = new Padding(1); sliderBrightness.Margin = new Padding(1);
sliderBrightness.Max = 100; sliderBrightness.Max = 100;
sliderBrightness.Min = 0; sliderBrightness.Min = 0;
@@ -1131,7 +1131,7 @@
panelEnergy.Margin = new Padding(2); panelEnergy.Margin = new Padding(2);
panelEnergy.Name = "panelEnergy"; panelEnergy.Name = "panelEnergy";
panelEnergy.Padding = new Padding(0, 0, 0, 17); panelEnergy.Padding = new Padding(0, 0, 0, 17);
panelEnergy.Size = new Size(420, 96); panelEnergy.Size = new Size(437, 96);
panelEnergy.TabIndex = 43; panelEnergy.TabIndex = 43;
// //
// labelLowBatteryWarningValue // labelLowBatteryWarningValue
@@ -1199,7 +1199,7 @@
panelEnergyHeader.Location = new Point(0, 0); panelEnergyHeader.Location = new Point(0, 0);
panelEnergyHeader.Margin = new Padding(2); panelEnergyHeader.Margin = new Padding(2);
panelEnergyHeader.Name = "panelEnergyHeader"; panelEnergyHeader.Name = "panelEnergyHeader";
panelEnergyHeader.Size = new Size(420, 20); panelEnergyHeader.Size = new Size(437, 20);
panelEnergyHeader.TabIndex = 41; panelEnergyHeader.TabIndex = 41;
// //
// pictureBoxEnergy // pictureBoxEnergy
@@ -1240,7 +1240,7 @@
tableLayoutProfiles.RowCount = 1; tableLayoutProfiles.RowCount = 1;
tableLayoutProfiles.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); tableLayoutProfiles.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutProfiles.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); tableLayoutProfiles.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutProfiles.Size = new Size(420, 38); tableLayoutProfiles.Size = new Size(437, 38);
tableLayoutProfiles.TabIndex = 44; tableLayoutProfiles.TabIndex = 44;
// //
// panelBatteryState // panelBatteryState
@@ -1302,11 +1302,11 @@
buttonSync.BorderRadius = 2; buttonSync.BorderRadius = 2;
buttonSync.FlatStyle = FlatStyle.Flat; buttonSync.FlatStyle = FlatStyle.Flat;
buttonSync.ForeColor = SystemColors.ControlText; buttonSync.ForeColor = SystemColors.ControlText;
buttonSync.Location = new Point(223, 5); buttonSync.Location = new Point(5, 37);
buttonSync.Margin = new Padding(2, 4, 2, 4); buttonSync.Margin = new Padding(2, 4, 2, 4);
buttonSync.Name = "buttonSync"; buttonSync.Name = "buttonSync";
buttonSync.Secondary = false; buttonSync.Secondary = false;
buttonSync.Size = new Size(195, 25); buttonSync.Size = new Size(431, 25);
buttonSync.TabIndex = 46; buttonSync.TabIndex = 46;
buttonSync.Text = "Synchronize with Mouse"; buttonSync.Text = "Synchronize with Mouse";
buttonSync.UseVisualStyleBackColor = false; buttonSync.UseVisualStyleBackColor = false;
@@ -1322,7 +1322,7 @@
panelBottomButtons.Location = new Point(7, 731); panelBottomButtons.Location = new Point(7, 731);
panelBottomButtons.Margin = new Padding(2); panelBottomButtons.Margin = new Padding(2);
panelBottomButtons.Name = "panelBottomButtons"; panelBottomButtons.Name = "panelBottomButtons";
panelBottomButtons.Size = new Size(420, 45); panelBottomButtons.Size = new Size(437, 66);
panelBottomButtons.TabIndex = 47; panelBottomButtons.TabIndex = 47;
// //
// buttonImport // buttonImport
@@ -1335,11 +1335,11 @@
buttonImport.BorderRadius = 2; buttonImport.BorderRadius = 2;
buttonImport.FlatStyle = FlatStyle.Flat; buttonImport.FlatStyle = FlatStyle.Flat;
buttonImport.ForeColor = SystemColors.ControlText; buttonImport.ForeColor = SystemColors.ControlText;
buttonImport.Location = new Point(106, 6); buttonImport.Location = new Point(222, 6);
buttonImport.Margin = new Padding(2, 4, 2, 4); buttonImport.Margin = new Padding(2, 4, 2, 4);
buttonImport.Name = "buttonImport"; buttonImport.Name = "buttonImport";
buttonImport.Secondary = false; buttonImport.Secondary = false;
buttonImport.Size = new Size(102, 25); buttonImport.Size = new Size(214, 25);
buttonImport.TabIndex = 48; buttonImport.TabIndex = 48;
buttonImport.Text = "Import Profile"; buttonImport.Text = "Import Profile";
buttonImport.UseVisualStyleBackColor = false; buttonImport.UseVisualStyleBackColor = false;
@@ -1355,11 +1355,11 @@
buttonExport.BorderRadius = 2; buttonExport.BorderRadius = 2;
buttonExport.FlatStyle = FlatStyle.Flat; buttonExport.FlatStyle = FlatStyle.Flat;
buttonExport.ForeColor = SystemColors.ControlText; buttonExport.ForeColor = SystemColors.ControlText;
buttonExport.Location = new Point(2, 6); buttonExport.Location = new Point(5, 6);
buttonExport.Margin = new Padding(2, 4, 2, 4); buttonExport.Margin = new Padding(2, 4, 2, 4);
buttonExport.Name = "buttonExport"; buttonExport.Name = "buttonExport";
buttonExport.Secondary = false; buttonExport.Secondary = false;
buttonExport.Size = new Size(103, 25); buttonExport.Size = new Size(197, 25);
buttonExport.TabIndex = 47; buttonExport.TabIndex = 47;
buttonExport.Text = "Export Profile"; buttonExport.Text = "Export Profile";
buttonExport.UseVisualStyleBackColor = false; buttonExport.UseVisualStyleBackColor = false;
@@ -1433,7 +1433,7 @@
AutoScroll = true; AutoScroll = true;
AutoSize = true; AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink; AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new Size(451, 699); ClientSize = new Size(451, 803);
Controls.Add(panelBottomButtons); Controls.Add(panelBottomButtons);
Controls.Add(panelEnergy); Controls.Add(panelEnergy);
Controls.Add(panelLighting); Controls.Add(panelLighting);

View File

@@ -1,15 +1,174 @@
using System.Runtime.InteropServices; using GHelper.Helpers;
using GHelper.Mode;
using GHelper.USB;
using System.Management;
namespace GHelper.Display namespace GHelper.Display
{ {
public class ScreenControl public enum SplendidGamut : int
{
Native = 50,
sRGB = 51,
DCIP3 = 53,
DisplayP3 = 54
}
public enum SplendidCommand: int
{
Init = 10,
DimmingAsus = 9,
DimmingVisual = 19,
GamutMode = 200,
Default = 11,
Racing = 21,
Scenery = 22,
RTS = 23,
FPS = 24,
Cinema = 25,
Vivid = 13,
Eyecare = 17,
}
public static class ScreenControl
{ {
public const int MAX_REFRESH = 1000; public const int MAX_REFRESH = 1000;
public static DisplayGammaRamp? gammaRamp; public static DisplayGammaRamp? gammaRamp;
public void AutoScreen(bool force = false) private static int _brightness = 100;
private static bool _init = true;
private static string? _splendidPath = null;
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(100);
static ScreenControl () {
brightnessTimer.Elapsed += BrightnessTimerTimer_Elapsed;
}
public static Dictionary<SplendidGamut, string> GetGamutModes ()
{
Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>();
DirectoryInfo d = new DirectoryInfo("C:\\ProgramData\\ASUS\\GameVisual");
FileInfo[] icms = d.GetFiles("*.icm");
if (icms.Length == 0) return _modes;
_modes.Add(SplendidGamut.Native, "Gamut - Native");
foreach (FileInfo icm in icms)
{
if (icm.Name.Contains("sRGB")) _modes.Add(SplendidGamut.sRGB, "Gamut - sRGB");
if (icm.Name.Contains("DCIP3")) _modes.Add(SplendidGamut.DCIP3, "Gamut - DCIP3");
if (icm.Name.Contains("DisplayP3")) _modes.Add(SplendidGamut.DisplayP3, "Gamut - 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)
{
if (RunSplendid(SplendidCommand.GamutMode, 0, mode)) return;
if (_init)
{
_init = false;
RunSplendid(SplendidCommand.Init);
RunSplendid(SplendidCommand.GamutMode, 0, mode);
}
}
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = 50)
{
int balance = mode == SplendidCommand.Eyecare ? 2 : whiteBalance;
RunSplendid(mode, 0, balance);
if (_init)
{
_init = false;
RunSplendid(SplendidCommand.Init);
RunSplendid(mode, 0, balance);
}
}
private static string GetSplendidPath()
{
if (_splendidPath == null)
{
try
{
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_SystemDriver WHERE Name='ATKWMIACPIIO'"))
{
foreach (var driver in searcher.Get())
{
string path = driver["PathName"].ToString();
_splendidPath = Path.GetDirectoryName(path) + "\\AsusSplendid.exe";
break;
}
}
}
catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}
}
return _splendidPath;
}
private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null)
{
var splendid = GetSplendidPath();
bool isGameVisual = Directory.Exists("C:\\ProgramData\\ASUS\\GameVisual");
bool isSplenddid = File.Exists(splendid);
if (isSplenddid)
{
if (command == SplendidCommand.DimmingVisual && !isGameVisual) command = SplendidCommand.DimmingAsus;
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
if (result.Contains("file not exist") || (result.Length == 0 && isGameVisual)) return false;
}
return true;
}
private static void BrightnessTimerTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
brightnessTimer.Stop();
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
if (_init)
{
_init = false;
RunSplendid(SplendidCommand.Init);
RunSplendid(SplendidCommand.Init, 4);
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
}
// GammaRamp Fallback
SetGamma(_brightness);
}
public static void AutoScreen(bool force = false)
{ {
if (force || AppConfig.Is("screen_auto")) if (force || AppConfig.Is("screen_auto"))
{ {
@@ -24,18 +183,25 @@ namespace GHelper.Display
} }
} }
public void SetBrightness(int brightness = -1) public static int SetBrightness(int brightness = -1, int delta = 0)
{ {
if (!AppConfig.IsOLED()) return; if (!AppConfig.IsOLED()) return -1;
if (brightness >= 0) AppConfig.Set("brightness", brightness); if (brightness < 0) brightness = AppConfig.Get("brightness", 100);
else brightness = AppConfig.Get("brightness");
if (brightness >= 0) SetGamma(brightness); _brightness = Math.Max(0, Math.Min(100, brightness + delta));
AppConfig.Set("brightness", _brightness);
brightnessTimer.Start();
Program.settingsForm.VisualiseBrightness();
return _brightness;
} }
public void SetGamma(int brightness = 100)
public static void SetGamma(int brightness = 100)
{ {
var bright = Math.Round((float)brightness / 200 + 0.5, 2); var bright = Math.Round((float)brightness / 200 + 0.5, 2);
@@ -66,9 +232,10 @@ namespace GHelper.Display
var ramp = gammaRamp.AsBrightnessRamp(bright); var ramp = gammaRamp.AsBrightnessRamp(bright);
bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp); bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp);
Logger.WriteLine("Brightness " + bright.ToString() + ": " + result); Logger.WriteLine("Gamma " + bright.ToString() + ": " + result);
} catch (Exception ex) }
catch (Exception ex)
{ {
Logger.WriteLine(ex.ToString()); Logger.WriteLine(ex.ToString());
} }
@@ -76,7 +243,7 @@ namespace GHelper.Display
//ScreenBrightness.Set(60 + (int)(40 * bright)); //ScreenBrightness.Set(60 + (int)(40 * bright));
} }
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1) public static void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
{ {
var laptopScreen = ScreenNative.FindLaptopScreen(true); var laptopScreen = ScreenNative.FindLaptopScreen(true);
@@ -96,8 +263,8 @@ namespace GHelper.Display
if (overdrive >= 0) if (overdrive >= 0)
{ {
if (AppConfig.Get("no_overdrive") == 1) overdrive = 0; if (AppConfig.IsNoOverdrive()) overdrive = 0;
Program.acpi.DeviceSet(AsusACPI.ScreenOverdrive, overdrive, "ScreenOverdrive"); if (!AppConfig.IsOLED()) Program.acpi.DeviceSet(AsusACPI.ScreenOverdrive, overdrive, "ScreenOverdrive");
} }
@@ -113,7 +280,7 @@ namespace GHelper.Display
} }
public int ToogleMiniled() public static int ToogleMiniled()
{ {
int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1); int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1);
int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2); int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2);
@@ -141,7 +308,7 @@ namespace GHelper.Display
return miniled; return miniled;
} }
public void InitScreen() public static void InitScreen()
{ {
var laptopScreen = ScreenNative.FindLaptopScreen(); var laptopScreen = ScreenNative.FindLaptopScreen();
@@ -149,9 +316,9 @@ namespace GHelper.Display
int maxFrequency = ScreenNative.GetMaxRefreshRate(laptopScreen); int maxFrequency = ScreenNative.GetMaxRefreshRate(laptopScreen);
bool screenAuto = AppConfig.Is("screen_auto"); bool screenAuto = AppConfig.Is("screen_auto");
bool overdriveSetting = !AppConfig.Is("no_overdrive"); bool overdriveSetting = !AppConfig.IsNoOverdrive();
int overdrive = Program.acpi.DeviceGet(AsusACPI.ScreenOverdrive); int overdrive = AppConfig.IsNoOverdrive() ? 0 : Program.acpi.DeviceGet(AsusACPI.ScreenOverdrive);
int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1); int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1);
int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2); int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2);

View File

@@ -12,7 +12,6 @@ namespace GHelper
public partial class Extra : RForm public partial class Extra : RForm
{ {
ScreenControl screenControl = new ScreenControl();
ClamshellModeControl clamshellControl = new ClamshellModeControl(); ClamshellModeControl clamshellControl = new ClamshellModeControl();
const string EMPTY = "--------------"; const string EMPTY = "--------------";
@@ -210,6 +209,11 @@ namespace GHelper
checkUSBC.Visible = false; checkUSBC.Visible = false;
} }
if (AppConfig.IsOLED())
{
checkNoOverdrive.Visible = false;
}
// Change text and hide irrelevant options on the ROG Ally, // Change text and hide irrelevant options on the ROG Ally,
// which is a bit of a special case piece of hardware. // which is a bit of a special case piece of hardware.
if (AppConfig.IsAlly()) if (AppConfig.IsAlly())
@@ -357,7 +361,7 @@ namespace GHelper
checkTopmost.Checked = AppConfig.Is("topmost"); checkTopmost.Checked = AppConfig.Is("topmost");
checkTopmost.CheckedChanged += CheckTopmost_CheckedChanged; ; checkTopmost.CheckedChanged += CheckTopmost_CheckedChanged; ;
checkNoOverdrive.Checked = AppConfig.Is("no_overdrive"); checkNoOverdrive.Checked = AppConfig.IsNoOverdrive();
checkNoOverdrive.CheckedChanged += CheckNoOverdrive_CheckedChanged; checkNoOverdrive.CheckedChanged += CheckNoOverdrive_CheckedChanged;
checkUSBC.Checked = AppConfig.Is("optimized_usbc"); checkUSBC.Checked = AppConfig.Is("optimized_usbc");
@@ -679,7 +683,7 @@ namespace GHelper
private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e) private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e)
{ {
AppConfig.Set("no_overdrive", (checkNoOverdrive.Checked ? 1 : 0)); AppConfig.Set("no_overdrive", (checkNoOverdrive.Checked ? 1 : 0));
screenControl.AutoScreen(true); ScreenControl.AutoScreen(true);
} }

View File

@@ -48,7 +48,7 @@ namespace GHelper
labelPowerLimits.Text = Properties.Strings.PowerLimits; labelPowerLimits.Text = Properties.Strings.PowerLimits;
checkApplyPower.Text = Properties.Strings.ApplyPowerLimits; checkApplyPower.Text = Properties.Strings.ApplyPowerLimits;
labelFans.Text = Properties.Strings.FanCurves; labelFans.Text = "BIOS " + Properties.Strings.FanCurves;
labelBoost.Text = Properties.Strings.CPUBoost; labelBoost.Text = Properties.Strings.CPUBoost;
buttonReset.Text = Properties.Strings.FactoryDefaults; buttonReset.Text = Properties.Strings.FactoryDefaults;
checkApplyFans.Text = Properties.Strings.ApplyFanCurve; checkApplyFans.Text = Properties.Strings.ApplyFanCurve;

View File

@@ -15,7 +15,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.156</AssemblyVersion> <AssemblyVersion>0.157</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -9,7 +9,6 @@ namespace GHelper.Gpu
public class GPUModeControl public class GPUModeControl
{ {
SettingsForm settings; SettingsForm settings;
ScreenControl screenControl = new ScreenControl();
public static int gpuMode; public static int gpuMode;
public static bool? gpuExists = null; public static bool? gpuExists = null;
@@ -159,7 +158,7 @@ namespace GHelper.Gpu
settings.Invoke(delegate settings.Invoke(delegate
{ {
InitGPUMode(); InitGPUMode();
screenControl.AutoScreen(); ScreenControl.AutoScreen();
}); });
if (eco == 0) if (eco == 0)

View File

@@ -99,9 +99,7 @@ namespace GHelper.Helpers
ToggleLidAction(); ToggleLidAction();
if (Program.settingsForm.Visible) if (Program.settingsForm.Visible)
Program.screenControl.InitScreen(); ScreenControl.InitScreen();
Program.screenControl.SetBrightness();
} }

View File

@@ -122,7 +122,7 @@ namespace GHelper.Helpers
} }
} }
public static void RunCMD(string name, string args) public static string RunCMD(string name, string args)
{ {
var cmd = new Process(); var cmd = new Process();
cmd.StartInfo.UseShellExecute = false; cmd.StartInfo.UseShellExecute = false;
@@ -133,13 +133,13 @@ namespace GHelper.Helpers
cmd.StartInfo.Arguments = args; cmd.StartInfo.Arguments = args;
cmd.Start(); cmd.Start();
Logger.WriteLine(args); Logger.WriteLine(name + " " + args);
string result = cmd.StandardOutput.ReadToEnd().Replace(Environment.NewLine, " ").Trim(' '); string result = cmd.StandardOutput.ReadToEnd().Replace(Environment.NewLine, " ").Trim(' ');
Logger.WriteLine(result); Logger.WriteLine(result);
cmd.WaitForExit(); cmd.WaitForExit();
return result;
} }

View File

@@ -19,8 +19,7 @@ namespace GHelper.Input
public static Keys keyApp = Keys.F12; public static Keys keyApp = Keys.F12;
static ModeControl modeControl = Program.modeControl; static ModeControl modeControl = Program.modeControl;
static ScreenControl screenControl = new ScreenControl();
static bool isTUF = AppConfig.IsTUF(); static bool isTUF = AppConfig.IsTUF();
KeyboardListener listener; KeyboardListener listener;
@@ -244,6 +243,13 @@ namespace GHelper.Input
} }
static void SetBrightnessDimming(int delta)
{
int brightness = ScreenControl.SetBrightness(delta: delta);
if (brightness >= 0)
Program.toast.RunToast(brightness + "%", (delta < 0) ? ToastIcon.BrightnessDown : ToastIcon.BrightnessUp);
}
public void KeyPressed(object sender, KeyPressedEventArgs e) public void KeyPressed(object sender, KeyPressedEventArgs e)
{ {
@@ -472,7 +478,7 @@ namespace GHelper.Input
break; break;
case "miniled": case "miniled":
if (ScreenCCD.GetHDRStatus()) return; if (ScreenCCD.GetHDRStatus()) return;
int miniled = screenControl.ToogleMiniled(); int miniled = ScreenControl.ToogleMiniled();
Program.toast.RunToast(miniled == 1 ? "Multi-Zone" : "Single-Zone", miniled == 1 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); Program.toast.RunToast(miniled == 1 ? "Multi-Zone" : "Single-Zone", miniled == 1 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
break; break;
case "aura": case "aura":
@@ -698,8 +704,14 @@ namespace GHelper.Input
if (AppConfig.IsDUO()) SetScreenpad(-10); if (AppConfig.IsDUO()) SetScreenpad(-10);
else Program.settingsForm.BeginInvoke(Program.settingsForm.CycleMatrix, -1); else Program.settingsForm.BeginInvoke(Program.settingsForm.CycleMatrix, -1);
} }
else if (Control.ModifierKeys == Keys.Control && AppConfig.IsOLED())
{
SetBrightnessDimming(-10);
}
else else
{
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Down, "Brightness"); Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Down, "Brightness");
}
break; break;
case 32: // FN+F8 case 32: // FN+F8
if (Control.ModifierKeys == Keys.Shift) if (Control.ModifierKeys == Keys.Shift)
@@ -707,8 +719,14 @@ namespace GHelper.Input
if (AppConfig.IsDUO()) SetScreenpad(10); if (AppConfig.IsDUO()) SetScreenpad(10);
else Program.settingsForm.BeginInvoke(Program.settingsForm.CycleMatrix, 1); else Program.settingsForm.BeginInvoke(Program.settingsForm.CycleMatrix, 1);
} }
else if (Control.ModifierKeys == Keys.Control && AppConfig.IsOLED())
{
SetBrightnessDimming(10);
}
else else
{
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness"); Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness");
}
break; break;
case 133: // Camera Toggle case 133: // Camera Toggle
ToggleCamera(); ToggleCamera();

View File

@@ -32,7 +32,6 @@ namespace GHelper
public static ModeControl modeControl = new ModeControl(); public static ModeControl modeControl = new ModeControl();
public static GPUModeControl gpuControl = new GPUModeControl(settingsForm); public static GPUModeControl gpuControl = new GPUModeControl(settingsForm);
public static AllyControl allyControl = new AllyControl(settingsForm); public static AllyControl allyControl = new AllyControl(settingsForm);
public static ScreenControl screenControl = new ScreenControl();
public static ClamshellModeControl clamshellControl = new ClamshellModeControl(); public static ClamshellModeControl clamshellControl = new ClamshellModeControl();
public static ToastForm toast = new ToastForm(); public static ToastForm toast = new ToastForm();
@@ -166,7 +165,7 @@ namespace GHelper
if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock) if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock)
{ {
Logger.WriteLine("Session:" + e.Reason.ToString()); Logger.WriteLine("Session:" + e.Reason.ToString());
screenControl.AutoScreen(); ScreenControl.AutoScreen();
} }
} }
@@ -224,7 +223,7 @@ namespace GHelper
if (!switched) if (!switched)
{ {
gpuControl.InitGPUMode(); gpuControl.InitGPUMode();
screenControl.AutoScreen(); ScreenControl.AutoScreen();
} }
BatteryControl.AutoBattery(init); BatteryControl.AutoBattery(init);

View File

@@ -123,6 +123,9 @@ namespace GHelper
pictureAlly = new PictureBox(); pictureAlly = new PictureBox();
labelAlly = new Label(); labelAlly = new Label();
panelGamma = new Panel(); panelGamma = new Panel();
tableVisual = new TableLayoutPanel();
comboVisual = new RComboBox();
comboGamut = new RComboBox();
sliderGamma = new Slider(); sliderGamma = new Slider();
panelGammaTitle = new Panel(); panelGammaTitle = new Panel();
labelGamma = new Label(); labelGamma = new Label();
@@ -168,6 +171,7 @@ namespace GHelper
panelAllyTitle.SuspendLayout(); panelAllyTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit();
panelGamma.SuspendLayout(); panelGamma.SuspendLayout();
tableVisual.SuspendLayout();
panelGammaTitle.SuspendLayout(); panelGammaTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureGamma).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureGamma).BeginInit();
SuspendLayout(); SuspendLayout();
@@ -181,7 +185,7 @@ namespace GHelper
panelMatrix.Controls.Add(tableLayoutMatrix); panelMatrix.Controls.Add(tableLayoutMatrix);
panelMatrix.Controls.Add(panelMatrixTitle); panelMatrix.Controls.Add(panelMatrixTitle);
panelMatrix.Dock = DockStyle.Top; panelMatrix.Dock = DockStyle.Top;
panelMatrix.Location = new Point(11, 950); panelMatrix.Location = new Point(11, 1000);
panelMatrix.Margin = new Padding(0); panelMatrix.Margin = new Padding(0);
panelMatrix.Name = "panelMatrix"; panelMatrix.Name = "panelMatrix";
panelMatrix.Padding = new Padding(20, 20, 20, 10); panelMatrix.Padding = new Padding(20, 20, 20, 10);
@@ -356,7 +360,7 @@ namespace GHelper
panelBattery.Controls.Add(sliderBattery); panelBattery.Controls.Add(sliderBattery);
panelBattery.Controls.Add(panelBatteryTitle); panelBattery.Controls.Add(panelBatteryTitle);
panelBattery.Dock = DockStyle.Top; panelBattery.Dock = DockStyle.Top;
panelBattery.Location = new Point(11, 1626); panelBattery.Location = new Point(11, 1676);
panelBattery.Margin = new Padding(0); panelBattery.Margin = new Padding(0);
panelBattery.Name = "panelBattery"; panelBattery.Name = "panelBattery";
panelBattery.Padding = new Padding(20, 20, 20, 10); panelBattery.Padding = new Padding(20, 20, 20, 10);
@@ -448,7 +452,7 @@ namespace GHelper
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelFooter.Controls.Add(tableButtons); panelFooter.Controls.Add(tableButtons);
panelFooter.Dock = DockStyle.Top; panelFooter.Dock = DockStyle.Top;
panelFooter.Location = new Point(11, 1801); panelFooter.Location = new Point(11, 1851);
panelFooter.Margin = new Padding(0); panelFooter.Margin = new Padding(0);
panelFooter.Name = "panelFooter"; panelFooter.Name = "panelFooter";
panelFooter.Padding = new Padding(20); panelFooter.Padding = new Padding(20);
@@ -1195,7 +1199,7 @@ namespace GHelper
panelKeyboard.Controls.Add(tableLayoutKeyboard); panelKeyboard.Controls.Add(tableLayoutKeyboard);
panelKeyboard.Controls.Add(panelKeyboardTitle); panelKeyboard.Controls.Add(panelKeyboardTitle);
panelKeyboard.Dock = DockStyle.Top; panelKeyboard.Dock = DockStyle.Top;
panelKeyboard.Location = new Point(11, 1284); panelKeyboard.Location = new Point(11, 1334);
panelKeyboard.Margin = new Padding(0); panelKeyboard.Margin = new Padding(0);
panelKeyboard.Name = "panelKeyboard"; panelKeyboard.Name = "panelKeyboard";
panelKeyboard.Padding = new Padding(20); panelKeyboard.Padding = new Padding(20);
@@ -1371,7 +1375,7 @@ namespace GHelper
panelVersion.Controls.Add(labelCharge); panelVersion.Controls.Add(labelCharge);
panelVersion.Controls.Add(checkStartup); panelVersion.Controls.Add(checkStartup);
panelVersion.Dock = DockStyle.Top; panelVersion.Dock = DockStyle.Top;
panelVersion.Location = new Point(11, 1745); panelVersion.Location = new Point(11, 1795);
panelVersion.Margin = new Padding(4); panelVersion.Margin = new Padding(4);
panelVersion.Name = "panelVersion"; panelVersion.Name = "panelVersion";
panelVersion.Size = new Size(827, 56); panelVersion.Size = new Size(827, 56);
@@ -1396,7 +1400,7 @@ namespace GHelper
panelPeripherals.Controls.Add(tableLayoutPeripherals); panelPeripherals.Controls.Add(tableLayoutPeripherals);
panelPeripherals.Controls.Add(panelPeripheralsTile); panelPeripherals.Controls.Add(panelPeripheralsTile);
panelPeripherals.Dock = DockStyle.Top; panelPeripherals.Dock = DockStyle.Top;
panelPeripherals.Location = new Point(11, 1428); panelPeripherals.Location = new Point(11, 1478);
panelPeripherals.Margin = new Padding(0); panelPeripherals.Margin = new Padding(0);
panelPeripherals.Name = "panelPeripherals"; panelPeripherals.Name = "panelPeripherals";
panelPeripherals.Padding = new Padding(20, 20, 20, 10); panelPeripherals.Padding = new Padding(20, 20, 20, 10);
@@ -1538,7 +1542,7 @@ namespace GHelper
panelAlly.Controls.Add(tableLayoutAlly); panelAlly.Controls.Add(tableLayoutAlly);
panelAlly.Controls.Add(panelAllyTitle); panelAlly.Controls.Add(panelAllyTitle);
panelAlly.Dock = DockStyle.Top; panelAlly.Dock = DockStyle.Top;
panelAlly.Location = new Point(11, 1144); panelAlly.Location = new Point(11, 1194);
panelAlly.Margin = new Padding(0); panelAlly.Margin = new Padding(0);
panelAlly.Name = "panelAlly"; panelAlly.Name = "panelAlly";
panelAlly.Padding = new Padding(20, 20, 20, 0); panelAlly.Padding = new Padding(20, 20, 20, 0);
@@ -1670,6 +1674,7 @@ namespace GHelper
// //
panelGamma.AutoSize = true; panelGamma.AutoSize = true;
panelGamma.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelGamma.AutoSizeMode = AutoSizeMode.GrowAndShrink;
panelGamma.Controls.Add(tableVisual);
panelGamma.Controls.Add(sliderGamma); panelGamma.Controls.Add(sliderGamma);
panelGamma.Controls.Add(panelGammaTitle); panelGamma.Controls.Add(panelGammaTitle);
panelGamma.Dock = DockStyle.Top; panelGamma.Dock = DockStyle.Top;
@@ -1677,23 +1682,78 @@ namespace GHelper
panelGamma.Margin = new Padding(0); panelGamma.Margin = new Padding(0);
panelGamma.Name = "panelGamma"; panelGamma.Name = "panelGamma";
panelGamma.Padding = new Padding(20, 20, 20, 10); panelGamma.Padding = new Padding(20, 20, 20, 10);
panelGamma.Size = new Size(827, 123); panelGamma.Size = new Size(827, 173);
panelGamma.TabIndex = 9; panelGamma.TabIndex = 9;
panelGamma.Visible = false; panelGamma.Visible = false;
// //
// 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, 104);
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 = 41;
tableVisual.Visible = false;
//
// 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;
//
// 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;
//
// sliderGamma // sliderGamma
// //
sliderGamma.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; sliderGamma.Dock = DockStyle.Top;
sliderGamma.Location = new Point(40, 69); sliderGamma.Location = new Point(20, 64);
sliderGamma.Margin = new Padding(4); sliderGamma.Margin = new Padding(4);
sliderGamma.Max = 100; sliderGamma.Max = 100;
sliderGamma.Min = 0; sliderGamma.Min = 0;
sliderGamma.Name = "sliderGamma"; sliderGamma.Name = "sliderGamma";
sliderGamma.Size = new Size(752, 40); sliderGamma.Size = new Size(787, 40);
sliderGamma.Step = 10; sliderGamma.Step = 10;
sliderGamma.TabIndex = 20; sliderGamma.TabIndex = 20;
sliderGamma.Text = "sliderGamma"; sliderGamma.Text = "sliderGamma";
sliderGamma.Value = 100; sliderGamma.Value = 100;
sliderGamma.Visible = false;
// //
// panelGammaTitle // panelGammaTitle
// //
@@ -1736,7 +1796,7 @@ namespace GHelper
labelGammaTitle.Location = new Point(43, 0); labelGammaTitle.Location = new Point(43, 0);
labelGammaTitle.Margin = new Padding(8, 0, 8, 0); labelGammaTitle.Margin = new Padding(8, 0, 8, 0);
labelGammaTitle.Name = "labelGammaTitle"; labelGammaTitle.Name = "labelGammaTitle";
labelGammaTitle.Size = new Size(307, 32); labelGammaTitle.Size = new Size(506, 32);
labelGammaTitle.TabIndex = 37; labelGammaTitle.TabIndex = 37;
labelGammaTitle.Text = "Flicker-free Dimming"; labelGammaTitle.Text = "Flicker-free Dimming";
// //
@@ -1746,7 +1806,7 @@ namespace GHelper
AutoScaleMode = AutoScaleMode.Dpi; AutoScaleMode = AutoScaleMode.Dpi;
AutoSize = true; AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink; AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new Size(849, 2119); ClientSize = new Size(849, 1759);
Controls.Add(panelFooter); Controls.Add(panelFooter);
Controls.Add(panelVersion); Controls.Add(panelVersion);
Controls.Add(panelBattery); Controls.Add(panelBattery);
@@ -1826,6 +1886,8 @@ namespace GHelper
panelAllyTitle.PerformLayout(); panelAllyTitle.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit();
panelGamma.ResumeLayout(false); panelGamma.ResumeLayout(false);
panelGamma.PerformLayout();
tableVisual.ResumeLayout(false);
panelGammaTitle.ResumeLayout(false); panelGammaTitle.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pictureGamma).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureGamma).EndInit();
ResumeLayout(false); ResumeLayout(false);
@@ -1931,5 +1993,8 @@ namespace GHelper
private Label labelGammaTitle; private Label labelGammaTitle;
private CheckBox checkMatrixLid; private CheckBox checkMatrixLid;
private Panel panelMatrixAuto; private Panel panelMatrixAuto;
private TableLayoutPanel tableVisual;
private RComboBox comboVisual;
private RComboBox comboGamut;
} }
} }

View File

@@ -24,7 +24,6 @@ namespace GHelper
public GPUModeControl gpuControl; public GPUModeControl gpuControl;
public AllyControl allyControl; public AllyControl allyControl;
ScreenControl screenControl = new ScreenControl();
AutoUpdateControl updateControl; AutoUpdateControl updateControl;
AsusMouseSettings? mouseSettings; AsusMouseSettings? mouseSettings;
@@ -48,6 +47,8 @@ namespace GHelper
bool batteryMouseOver = false; bool batteryMouseOver = false;
bool batteryFullMouseOver = false; bool batteryFullMouseOver = false;
bool sliderGammaIgnore = false;
public SettingsForm() public SettingsForm()
{ {
@@ -116,7 +117,7 @@ namespace GHelper
buttonScreenAuto.AccessibleName = Properties.Strings.AutoMode; buttonScreenAuto.AccessibleName = Properties.Strings.AutoMode;
//button60Hz.AccessibleName = "60Hz Refresh Rate"; //button60Hz.AccessibleName = "60Hz Refresh Rate";
//button120Hz.AccessibleName = "Maximum Refresh Rate"; //button120Hz.AccessibleName = "Maximum Refresh Rate";
panelKeyboard.AccessibleName = Properties.Strings.LaptopKeyboard; panelKeyboard.AccessibleName = Properties.Strings.LaptopKeyboard;
buttonKeyboard.AccessibleName = Properties.Strings.ExtraSettings; buttonKeyboard.AccessibleName = Properties.Strings.ExtraSettings;
buttonKeyboardColor.AccessibleName = Properties.Strings.LaptopKeyboard + " " + Properties.Strings.Color; buttonKeyboardColor.AccessibleName = Properties.Strings.LaptopKeyboard + " " + Properties.Strings.Color;
@@ -219,7 +220,7 @@ namespace GHelper
sliderBattery.ValueChanged += SliderBattery_ValueChanged; sliderBattery.ValueChanged += SliderBattery_ValueChanged;
Program.trayIcon.MouseMove += TrayIcon_MouseMove; Program.trayIcon.MouseMove += TrayIcon_MouseMove;
sensorTimer = new System.Timers.Timer(AppConfig.Get("sensor_timer",1000)); sensorTimer = new System.Timers.Timer(AppConfig.Get("sensor_timer", 1000));
sensorTimer.Elapsed += OnTimedEvent; sensorTimer.Elapsed += OnTimedEvent;
sensorTimer.Enabled = true; sensorTimer.Enabled = true;
@@ -255,28 +256,83 @@ namespace GHelper
buttonFnLock.Click += ButtonFnLock_Click; buttonFnLock.Click += ButtonFnLock_Click;
panelPerformance.Focus(); panelPerformance.Focus();
InitVisual();
InitBrightness();
} }
public void InitBrightness()
public void InitVisual()
{ {
if (!AppConfig.IsOLED()) return;
bool dimming = false;
if (AppConfig.IsOLED())
{
dimming = true;
labelGammaTitle.Text = "Flicker-free Dimming";
panelGamma.Visible = true;
sliderGamma.Visible = true;
VisualiseBrightness();
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
}
var gamuts = ScreenControl.GetGamutModes();
if (gamuts.Count < 1) return;
if (!dimming) labelGammaTitle.Text = "Visual Mode";
else labelGammaTitle.Text += " / Visual";
panelGamma.Visible = true; panelGamma.Visible = true;
tableVisual.Visible = true;
int brightness = AppConfig.Get("brightness"); comboVisual.DropDownStyle = ComboBoxStyle.DropDownList;
if (brightness >= 0) sliderGamma.Value = brightness; comboVisual.DataSource = new BindingSource(ScreenControl.GetVisualModes(), null);
comboVisual.DisplayMember = "Value";
comboVisual.ValueMember = "Key";
comboVisual.SelectedValue = (SplendidCommand)AppConfig.Get("visual", (int)SplendidCommand.Default);
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.SelectedValue = (SplendidGamut)AppConfig.Get("gamut", (int)SplendidGamut.Native);
comboGamut.SelectedValueChanged += ComboGamut_SelectedValueChanged;
comboGamut.Visible = true;
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
labelGamma.Text = sliderGamma.Value + "%";
} }
private void ComboGamut_SelectedValueChanged(object? sender, EventArgs e)
{
AppConfig.Set("gamut", (int)comboGamut.SelectedValue);
ScreenControl.SetGamut((int)comboGamut.SelectedValue);
}
private void ComboVisual_SelectedValueChanged(object? sender, EventArgs e)
{
AppConfig.Set("visual", (int)comboVisual.SelectedValue);
ScreenControl.SetVisual((SplendidCommand)comboVisual.SelectedValue);
}
public void VisualiseBrightness()
{
Invoke(delegate
{
sliderGammaIgnore = true;
sliderGamma.Value = AppConfig.Get("brightness", 100);
labelGamma.Text = sliderGamma.Value + "%";
sliderGammaIgnore = false;
});
}
private void SliderGamma_ValueChanged(object? sender, EventArgs e) private void SliderGamma_ValueChanged(object? sender, EventArgs e)
{ {
screenControl.SetBrightness(sliderGamma.Value); if (sliderGammaIgnore) return;
labelGamma.Text = sliderGamma.Value + "%"; ScreenControl.SetBrightness(sliderGamma.Value);
} }
private void ButtonOverlay_Click(object? sender, EventArgs e) private void ButtonOverlay_Click(object? sender, EventArgs e)
@@ -350,7 +406,7 @@ namespace GHelper
public void VisualiseBacklight(int backlight) public void VisualiseBacklight(int backlight)
{ {
buttonBacklight.Text = Math.Round((double)backlight*33.33).ToString() + "%"; buttonBacklight.Text = Math.Round((double)backlight * 33.33).ToString() + "%";
} }
public void VisualiseFPSLimit(int limit) public void VisualiseFPSLimit(int limit)
@@ -418,7 +474,7 @@ namespace GHelper
sensorTimer.Enabled = this.Visible; sensorTimer.Enabled = this.Visible;
if (this.Visible) if (this.Visible)
{ {
screenControl.InitScreen(); ScreenControl.InitScreen();
VisualizeXGM(); VisualizeXGM();
Task.Run((Action)RefreshPeripheralsBattery); Task.Run((Action)RefreshPeripheralsBattery);
@@ -697,7 +753,7 @@ namespace GHelper
private void ButtonScreenAuto_Click(object? sender, EventArgs e) private void ButtonScreenAuto_Click(object? sender, EventArgs e)
{ {
AppConfig.Set("screen_auto", 1); AppConfig.Set("screen_auto", 1);
screenControl.AutoScreen(); ScreenControl.AutoScreen();
} }
@@ -847,7 +903,7 @@ namespace GHelper
FansToggle(); FansToggle();
} }
private void SetColorPicker(string colorField = "aura_color") private void SetColorPicker(string colorField = "aura_color")
{ {
ColorDialog colorDlg = new ColorDialog(); ColorDialog colorDlg = new ColorDialog();
colorDlg.AllowFullOpen = true; colorDlg.AllowFullOpen = true;
@@ -952,7 +1008,7 @@ namespace GHelper
buttonMatrix.Visible = false; buttonMatrix.Visible = false;
checkMatrixLid.Visible = true; checkMatrixLid.Visible = true;
} }
comboMatrix.SelectedIndex = Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1); comboMatrix.SelectedIndex = Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1);
comboMatrixRunning.SelectedIndex = Math.Min(AppConfig.Get("matrix_running", 0), comboMatrixRunning.Items.Count - 1); comboMatrixRunning.SelectedIndex = Math.Min(AppConfig.Get("matrix_running", 0), comboMatrixRunning.Items.Count - 1);
@@ -997,19 +1053,19 @@ namespace GHelper
private void Button120Hz_Click(object? sender, EventArgs e) private void Button120Hz_Click(object? sender, EventArgs e)
{ {
AppConfig.Set("screen_auto", 0); AppConfig.Set("screen_auto", 0);
screenControl.SetScreen(ScreenControl.MAX_REFRESH, 1); ScreenControl.SetScreen(ScreenControl.MAX_REFRESH, 1);
} }
private void Button60Hz_Click(object? sender, EventArgs e) private void Button60Hz_Click(object? sender, EventArgs e)
{ {
AppConfig.Set("screen_auto", 0); AppConfig.Set("screen_auto", 0);
screenControl.SetScreen(60, 0); ScreenControl.SetScreen(60, 0);
} }
private void ButtonMiniled_Click(object? sender, EventArgs e) private void ButtonMiniled_Click(object? sender, EventArgs e)
{ {
screenControl.ToogleMiniled(); ScreenControl.ToogleMiniled();
} }
@@ -1285,11 +1341,13 @@ namespace GHelper
{ {
if (InvokeRequired) if (InvokeRequired)
{ {
Invoke(delegate { Invoke(delegate
{
labelPerf.Text = modeText; labelPerf.Text = modeText;
panelPerformance.AccessibleName = labelPerf.Text; panelPerformance.AccessibleName = labelPerf.Text;
}); });
} else }
else
{ {
labelPerf.Text = modeText; labelPerf.Text = modeText;
panelPerformance.AccessibleName = labelPerf.Text; panelPerformance.AccessibleName = labelPerf.Text;
@@ -1464,7 +1522,7 @@ namespace GHelper
break; break;
} }
VisualizeXGM(GPUMode); VisualizeXGM(GPUMode);
@@ -1638,7 +1696,7 @@ namespace GHelper
return; return;
} }
mouseSettings = new AsusMouseSettings(am); mouseSettings = new AsusMouseSettings(am);
mouseSettings.TopMost = true; mouseSettings.TopMost = AppConfig.Is("topmost");
mouseSettings.FormClosed += MouseSettings_FormClosed; mouseSettings.FormClosed += MouseSettings_FormClosed;
mouseSettings.Disposed += MouseSettings_Disposed; mouseSettings.Disposed += MouseSettings_Disposed;
if (!mouseSettings.IsDisposed) if (!mouseSettings.IsDisposed)

View File

@@ -97,16 +97,16 @@ public static class AsusHid
try try
{ {
stream.Write(data); stream.Write(data);
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}"); if (log is not null) Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} "); if (log is not null) Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} ");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine($"Error opening {log} {device.ProductID.ToString("X")}: {ex.Message}"); if (log is not null) Logger.WriteLine($"Error opening {log} {device.ProductID.ToString("X")}: {ex.Message}");
} }
} }

View File

@@ -598,7 +598,7 @@ namespace GHelper.USB
if (AppConfig.IsNoDirectRGB()) if (AppConfig.IsNoDirectRGB())
{ {
AsusHid.Write(new List<byte[]> { AuraMessage(AuraMode.AuraStatic, color, color, 0xeb, isSingleColor), MESSAGE_SET }); AsusHid.Write(new List<byte[]> { AuraMessage(AuraMode.AuraStatic, color, color, 0xeb, isSingleColor), MESSAGE_SET }, null);
return; return;
} }
@@ -670,7 +670,7 @@ namespace GHelper.USB
{ {
CustomRGB.ApplyAmbient(true); CustomRGB.ApplyAmbient(true);
timer.Enabled = true; timer.Enabled = true;
timer.Interval = AppConfig.Get("aura_refresh", AppConfig.ContainsModel("GU604") ? 400 : 120); timer.Interval = AppConfig.Get("aura_refresh", AppConfig.IsStrix() ? 100 : 300);
return; return;
} }