diff --git a/app/ASUSWmi.cs b/app/ASUSWmi.cs index a0a7796d..709ca1d8 100644 --- a/app/ASUSWmi.cs +++ b/app/ASUSWmi.cs @@ -12,6 +12,7 @@ public class ASUSWmi public const uint CPU_Fan = 0x00110013; public const uint GPU_Fan = 0x00110014; + public const uint Mid_Fan = 0x00110031; public const uint PerformanceMode = 0x00120075; // Thermal Control diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index aa798fe4..7f9e7d47 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -62,8 +62,7 @@ namespace Starlight.AnimeMatrix Off = 0, Dim = 1, Medium = 2, - Full = 3, - Super = 4, //test, doesn't work + Full = 3 } @@ -79,7 +78,7 @@ namespace Starlight.AnimeMatrix public int MaxRows = 61; public int FullRows = 11; - public int EmptyFirstRow = 1; + public int EmptyFirstRow = 0; private int frameIndex = 0; @@ -87,9 +86,6 @@ namespace Starlight.AnimeMatrix : base(0x0B05, 0x193B, 640) { string model = GetModel(); - - Logger.WriteLine("Animatrix: " + model); - if (model.Contains("401")) { EmptyFirstRow = 1; @@ -199,15 +195,12 @@ namespace Starlight.AnimeMatrix { EnsureRowInRange(y); var start = RowToLinearAddress(y) - XStart(y); - if (x >= XStart(y) && x < XEnd(y)) { //Debug.Write((start + x).ToString("D4") + ","); SetLedLinear(start + x, value); return start + x; } - - //Debug.Write(" "); return -1; } @@ -320,12 +313,8 @@ namespace Starlight.AnimeMatrix Debug.Write("ERROR"); counter++; } - - - } } - //Debug.Write("\n"); } } diff --git a/app/ControlHelper.cs b/app/ControlHelper.cs index c264df17..b769f0cc 100644 --- a/app/ControlHelper.cs +++ b/app/ControlHelper.cs @@ -45,6 +45,7 @@ public static class ControlHelper _invert = invert; AdjustControls(container.Controls); _invert = false; + } public static void Resize(RForm container, float baseScale = 2) @@ -92,7 +93,7 @@ public static class ControlHelper if (pictureBox != null && pictureBox.BackgroundImage is not null) pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage); - + var combo = control as RComboBox; if (combo != null) { diff --git a/app/CustomControls.cs b/app/CustomControls.cs index 34a68868..6bd2d876 100644 --- a/app/CustomControls.cs +++ b/app/CustomControls.cs @@ -1,4 +1,5 @@ -using Microsoft.Win32; +using GHelper; +using Microsoft.Win32; using System.ComponentModel; using System.Drawing.Drawing2D; using System.Runtime.InteropServices; @@ -19,7 +20,7 @@ namespace CustomControls [DllImport("DwmApi")] //System.Runtime.InteropServices private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize); - public bool darkTheme = false; + public bool darkTheme; private static bool IsDarkTheme() { @@ -39,8 +40,12 @@ namespace CustomControls if (setDPI) ControlHelper.Resize(this); - DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4); - ControlHelper.Adjust(this, darkTheme, changed); + if (changed) + { + DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4); + ControlHelper.Adjust(this, darkTheme, changed); + } + } } @@ -235,13 +240,18 @@ namespace CustomControls { //Fields private int borderSize = 5; + private int borderRadius = 5; - - private bool activated = false; - private bool secondary = false; + public int BorderRadius + { + get { return borderRadius; } + set + { + borderRadius = value; + } + } private Color borderColor = Color.Transparent; - public Color BorderColor { get { return borderColor; } @@ -252,6 +262,7 @@ namespace CustomControls } + private bool activated = false; public bool Activated { get { return activated; } @@ -264,6 +275,7 @@ namespace CustomControls } } + private bool secondary = false; public bool Secondary { get { return secondary; } diff --git a/app/Fans.Designer.cs b/app/Fans.Designer.cs index a47a5b69..472f7996 100644 --- a/app/Fans.Designer.cs +++ b/app/Fans.Designer.cs @@ -203,6 +203,7 @@ namespace GHelper chartMid.Text = "chartMid"; title3.Name = "Title3"; chartMid.Titles.Add(title3); + chartMid.Visible = false; // // labelFans // @@ -233,6 +234,7 @@ namespace GHelper buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; buttonReset.BackColor = SystemColors.ControlLight; buttonReset.BorderColor = Color.Transparent; + buttonReset.BorderRadius = 2; buttonReset.FlatStyle = FlatStyle.Flat; buttonReset.Location = new Point(30, 1081); buttonReset.Margin = new Padding(4, 2, 4, 2); @@ -249,6 +251,7 @@ namespace GHelper buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonApply.BackColor = SystemColors.ControlLight; buttonApply.BorderColor = Color.Transparent; + buttonApply.BorderRadius = 2; buttonApply.FlatStyle = FlatStyle.Flat; buttonApply.Location = new Point(542, 1081); buttonApply.Margin = new Padding(4, 2, 4, 2); @@ -319,6 +322,7 @@ namespace GHelper buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; buttonApplyPower.BackColor = SystemColors.ControlLight; buttonApplyPower.BorderColor = Color.Transparent; + buttonApplyPower.BorderRadius = 2; buttonApplyPower.FlatStyle = FlatStyle.Flat; buttonApplyPower.Location = new Point(20, 1081); buttonApplyPower.Margin = new Padding(4, 2, 4, 2); diff --git a/app/Fans.cs b/app/Fans.cs index 8581c7ec..bda4a86c 100644 --- a/app/Fans.cs +++ b/app/Fans.cs @@ -273,15 +273,16 @@ namespace GHelper { byte[] curve = Program.wmi.GetFanCurve(2); - + if (curve.All(singleByte => singleByte == 0)) { Program.config.setConfig("mid_fan", 0); - chartMid.Visible = false; - } else + } + else { Program.config.setConfig("mid_fan", 1); + chartMid.Visible = true; SetChart(chartMid, 2); LoadProfile(seriesMid, 2); } @@ -351,7 +352,7 @@ namespace GHelper { ApplyProfile(seriesCPU, 0); ApplyProfile(seriesGPU, 1); - if (Program.config.getConfig("mid_fan") == 1) + if (Program.config.getConfig("mid_fan") == 1) ApplyProfile(seriesMid, 2); } @@ -360,7 +361,7 @@ namespace GHelper LoadProfile(seriesCPU, 0, 1); LoadProfile(seriesGPU, 1, 1); - if (Program.config.getConfig("mid_fan") == 1) + if (Program.config.getConfig("mid_fan") == 1) LoadProfile(seriesMid, 2, 1); checkAuto.Checked = false; diff --git a/app/GHelper.csproj b/app/GHelper.csproj index b9f60cff..db50f5ff 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -16,7 +16,7 @@ x64 False True - 0.35 + 0.36 diff --git a/app/HardwareMonitor.cs b/app/HardwareMonitor.cs index bb5327ee..d5148e0f 100644 --- a/app/HardwareMonitor.cs +++ b/app/HardwareMonitor.cs @@ -86,9 +86,5 @@ public static class HardwareMonitor catch (Exception ex) { } - finally - { - Logger.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}"); - } } } diff --git a/app/Program.cs b/app/Program.cs index c7b958ed..d71b810b 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -77,8 +77,15 @@ namespace GHelper SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; CheckForUpdates(); + + if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\')) + { + SettingsToggle(); + } + Application.Run(); + } diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index fe13ff0e..2e7b0866 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -68,11 +68,13 @@ namespace GHelper buttonOptimized = new RButton(); buttonUltimate = new RButton(); panelScreen = new Panel(); + labelMidFan = new Label(); labelTipScreen = new Label(); tableScreen = new TableLayoutPanel(); buttonScreenAuto = new RButton(); button60Hz = new RButton(); button120Hz = new RButton(); + buttonMiniled = new RButton(); pictureScreen = new PictureBox(); labelSreen = new Label(); panelKeyboard = new Panel(); @@ -85,7 +87,6 @@ namespace GHelper buttonKeyboardColor = new RButton(); pictureKeyboard = new PictureBox(); labelKeyboard = new Label(); - buttonMiniled = new RButton(); panelMatrix.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit(); @@ -180,6 +181,7 @@ namespace GHelper buttonMatrix.Activated = false; buttonMatrix.BackColor = SystemColors.ControlLight; buttonMatrix.BorderColor = Color.Transparent; + buttonMatrix.BorderRadius = 2; buttonMatrix.Dock = DockStyle.Top; buttonMatrix.FlatAppearance.BorderSize = 0; buttonMatrix.FlatStyle = FlatStyle.Flat; @@ -327,12 +329,13 @@ namespace GHelper buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonQuit.BackColor = SystemColors.ControlLight; buttonQuit.BorderColor = Color.Transparent; + buttonQuit.BorderRadius = 2; buttonQuit.FlatStyle = FlatStyle.Flat; - buttonQuit.Location = new Point(578, 16); + buttonQuit.Location = new Point(599, 16); buttonQuit.Margin = new Padding(8, 4, 8, 4); buttonQuit.Name = "buttonQuit"; buttonQuit.Secondary = true; - buttonQuit.Size = new Size(208, 44); + buttonQuit.Size = new Size(185, 44); buttonQuit.TabIndex = 18; buttonQuit.Text = "Quit"; buttonQuit.UseVisualStyleBackColor = false; @@ -426,6 +429,7 @@ namespace GHelper buttonSilent.BackColor = SystemColors.ControlLightLight; buttonSilent.BackgroundImageLayout = ImageLayout.None; buttonSilent.BorderColor = Color.Transparent; + buttonSilent.BorderRadius = 5; buttonSilent.CausesValidation = false; buttonSilent.Dock = DockStyle.Fill; buttonSilent.FlatAppearance.BorderSize = 0; @@ -448,6 +452,7 @@ namespace GHelper buttonBalanced.Activated = false; buttonBalanced.BackColor = SystemColors.ControlLightLight; buttonBalanced.BorderColor = Color.Transparent; + buttonBalanced.BorderRadius = 5; buttonBalanced.Dock = DockStyle.Fill; buttonBalanced.FlatAppearance.BorderSize = 0; buttonBalanced.FlatStyle = FlatStyle.Flat; @@ -469,6 +474,7 @@ namespace GHelper buttonTurbo.Activated = false; buttonTurbo.BackColor = SystemColors.ControlLightLight; buttonTurbo.BorderColor = Color.Transparent; + buttonTurbo.BorderRadius = 5; buttonTurbo.Dock = DockStyle.Fill; buttonTurbo.FlatAppearance.BorderSize = 0; buttonTurbo.FlatStyle = FlatStyle.Flat; @@ -490,6 +496,7 @@ namespace GHelper buttonFans.Activated = false; buttonFans.BackColor = SystemColors.ControlLight; buttonFans.BorderColor = Color.Transparent; + buttonFans.BorderRadius = 5; buttonFans.Dock = DockStyle.Fill; buttonFans.FlatAppearance.BorderSize = 0; buttonFans.FlatStyle = FlatStyle.Flat; @@ -592,6 +599,7 @@ namespace GHelper buttonEco.Activated = false; buttonEco.BackColor = SystemColors.ControlLightLight; buttonEco.BorderColor = Color.Transparent; + buttonEco.BorderRadius = 5; buttonEco.CausesValidation = false; buttonEco.Dock = DockStyle.Top; buttonEco.FlatAppearance.BorderSize = 0; @@ -614,6 +622,7 @@ namespace GHelper buttonStandard.Activated = false; buttonStandard.BackColor = SystemColors.ControlLightLight; buttonStandard.BorderColor = Color.Transparent; + buttonStandard.BorderRadius = 5; buttonStandard.Dock = DockStyle.Top; buttonStandard.FlatAppearance.BorderSize = 0; buttonStandard.FlatStyle = FlatStyle.Flat; @@ -635,6 +644,7 @@ namespace GHelper buttonOptimized.Activated = false; buttonOptimized.BackColor = SystemColors.ControlLightLight; buttonOptimized.BorderColor = Color.Transparent; + buttonOptimized.BorderRadius = 5; buttonOptimized.Dock = DockStyle.Top; buttonOptimized.FlatAppearance.BorderSize = 0; buttonOptimized.FlatStyle = FlatStyle.Flat; @@ -656,6 +666,7 @@ namespace GHelper buttonUltimate.Activated = false; buttonUltimate.BackColor = SystemColors.ControlLightLight; buttonUltimate.BorderColor = Color.Transparent; + buttonUltimate.BorderRadius = 5; buttonUltimate.Dock = DockStyle.Top; buttonUltimate.FlatAppearance.BorderSize = 0; buttonUltimate.FlatStyle = FlatStyle.Flat; @@ -676,6 +687,7 @@ namespace GHelper // panelScreen.AutoSize = true; panelScreen.AutoSizeMode = AutoSizeMode.GrowAndShrink; + panelScreen.Controls.Add(labelMidFan); panelScreen.Controls.Add(labelTipScreen); panelScreen.Controls.Add(tableScreen); panelScreen.Controls.Add(pictureScreen); @@ -688,6 +700,17 @@ namespace GHelper panelScreen.Size = new Size(810, 181); panelScreen.TabIndex = 38; // + // labelMidFan + // + labelMidFan.Anchor = AnchorStyles.Top | AnchorStyles.Right; + labelMidFan.Location = new Point(488, 13); + labelMidFan.Margin = new Padding(8, 0, 8, 0); + labelMidFan.Name = "labelMidFan"; + labelMidFan.Size = new Size(296, 34); + labelMidFan.TabIndex = 25; + labelMidFan.Text = " "; + labelMidFan.TextAlign = ContentAlignment.TopRight; + // // labelTipScreen // labelTipScreen.ForeColor = SystemColors.GrayText; @@ -711,7 +734,6 @@ namespace GHelper tableScreen.Controls.Add(button60Hz, 1, 0); tableScreen.Controls.Add(button120Hz, 2, 0); tableScreen.Controls.Add(buttonMiniled, 3, 0); - tableScreen.Location = new Point(16, 51); tableScreen.Margin = new Padding(8, 4, 8, 4); tableScreen.Name = "tableScreen"; @@ -725,6 +747,7 @@ namespace GHelper buttonScreenAuto.Activated = false; buttonScreenAuto.BackColor = SystemColors.ControlLightLight; buttonScreenAuto.BorderColor = Color.Transparent; + buttonScreenAuto.BorderRadius = 5; buttonScreenAuto.Dock = DockStyle.Fill; buttonScreenAuto.FlatAppearance.BorderSize = 0; buttonScreenAuto.FlatStyle = FlatStyle.Flat; @@ -743,6 +766,7 @@ namespace GHelper button60Hz.Activated = false; button60Hz.BackColor = SystemColors.ControlLightLight; button60Hz.BorderColor = Color.Transparent; + button60Hz.BorderRadius = 5; button60Hz.CausesValidation = false; button60Hz.Dock = DockStyle.Fill; button60Hz.FlatAppearance.BorderSize = 0; @@ -762,6 +786,7 @@ namespace GHelper button120Hz.Activated = false; button120Hz.BackColor = SystemColors.ControlLightLight; button120Hz.BorderColor = Color.Transparent; + button120Hz.BorderRadius = 5; button120Hz.Dock = DockStyle.Fill; button120Hz.FlatAppearance.BorderSize = 0; button120Hz.FlatStyle = FlatStyle.Flat; @@ -775,6 +800,26 @@ namespace GHelper button120Hz.Text = "120Hz + OD"; button120Hz.UseVisualStyleBackColor = false; // + // buttonMiniled + // + buttonMiniled.Activated = false; + buttonMiniled.BackColor = SystemColors.ControlLightLight; + buttonMiniled.BorderColor = Color.Transparent; + buttonMiniled.BorderRadius = 5; + buttonMiniled.CausesValidation = false; + buttonMiniled.Dock = DockStyle.Fill; + buttonMiniled.FlatAppearance.BorderSize = 0; + buttonMiniled.FlatStyle = FlatStyle.Flat; + buttonMiniled.ForeColor = SystemColors.ControlText; + buttonMiniled.Location = new Point(583, 4); + buttonMiniled.Margin = new Padding(4); + buttonMiniled.Name = "buttonMiniled"; + buttonMiniled.Secondary = false; + buttonMiniled.Size = new Size(185, 72); + buttonMiniled.TabIndex = 3; + buttonMiniled.Text = "Miniled"; + buttonMiniled.UseVisualStyleBackColor = false; + // // pictureScreen // pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage"); @@ -838,6 +883,7 @@ namespace GHelper buttonKeyboard.Activated = false; buttonKeyboard.BackColor = SystemColors.ControlLight; buttonKeyboard.BorderColor = Color.Transparent; + buttonKeyboard.BorderRadius = 2; buttonKeyboard.Dock = DockStyle.Top; buttonKeyboard.FlatAppearance.BorderSize = 0; buttonKeyboard.FlatStyle = FlatStyle.Flat; @@ -905,6 +951,7 @@ namespace GHelper buttonKeyboardColor.Activated = false; buttonKeyboardColor.BackColor = SystemColors.ButtonHighlight; buttonKeyboardColor.BorderColor = Color.Transparent; + buttonKeyboardColor.BorderRadius = 2; buttonKeyboardColor.Dock = DockStyle.Top; buttonKeyboardColor.FlatStyle = FlatStyle.Flat; buttonKeyboardColor.ForeColor = SystemColors.ControlText; @@ -939,25 +986,6 @@ namespace GHelper labelKeyboard.TabIndex = 32; labelKeyboard.Text = "Laptop Keyboard"; // - // buttonMiniled - // - buttonMiniled.Activated = false; - buttonMiniled.BackColor = SystemColors.ControlLightLight; - buttonMiniled.BorderColor = Color.Transparent; - buttonMiniled.CausesValidation = false; - buttonMiniled.Dock = DockStyle.Fill; - buttonMiniled.FlatAppearance.BorderSize = 0; - buttonMiniled.FlatStyle = FlatStyle.Flat; - buttonMiniled.ForeColor = SystemColors.ControlText; - buttonMiniled.Location = new Point(197, 4); - buttonMiniled.Margin = new Padding(4); - buttonMiniled.Name = "buttonMiniled"; - buttonMiniled.Secondary = false; - buttonMiniled.Size = new Size(185, 72); - buttonMiniled.TabIndex = 3; - buttonMiniled.Text = "Miniled"; - buttonMiniled.UseVisualStyleBackColor = false; - // // SettingsForm // AutoScaleDimensions = new SizeF(192F, 192F); @@ -1073,5 +1101,6 @@ namespace GHelper private RButton buttonKeyboard; private RButton buttonKeyboardColor; private RButton buttonFans; + private Label labelMidFan; } } \ No newline at end of file diff --git a/app/Settings.cs b/app/Settings.cs index 5e231d00..63a695cf 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -532,7 +532,7 @@ namespace GHelper int brightness = Program.config.getConfig("matrix_brightness"); int running = Program.config.getConfig("matrix_running"); - comboMatrix.SelectedIndex = (brightness != -1) ? Math.Min(brightness, comboMatrix.Items.Count-1) : 0; + comboMatrix.SelectedIndex = (brightness != -1) ? Math.Min(brightness, comboMatrix.Items.Count - 1) : 0; comboMatrixRunning.SelectedIndex = (running != -1) ? Math.Min(running, comboMatrixRunning.Items.Count - 1) : 0; checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1); @@ -707,7 +707,8 @@ namespace GHelper { buttonMiniled.Activated = (miniled == 1); Program.config.setConfig("miniled", miniled); - } else + } + else { buttonMiniled.Visible = false; } @@ -758,6 +759,8 @@ namespace GHelper private static string FormatFan(int fan) { + if (fan < 0) return null; + if (Program.config.getConfig("fan_rpm") == 1) return " Fan: " + (fan * 100).ToString() + "RPM"; else @@ -769,6 +772,7 @@ namespace GHelper string cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan)); string gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan)); + string midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan)); string cpuTemp = ""; string gpuTemp = ""; @@ -791,6 +795,7 @@ namespace GHelper { Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan; Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan; + if (midFan is not null) Program.settingsForm.labelMidFan.Text = "Mid" + midFan; Program.settingsForm.labelBattery.Text = battery; }); } @@ -996,12 +1001,6 @@ namespace GHelper if (!ultimate) { tableGPU.Controls.Remove(buttonUltimate); - - /* - * buttonFans.Image = null; - buttonFans.Height = 44; - */ - tablePerf.ColumnCount = 0; tableGPU.ColumnCount = 0; tableScreen.ColumnCount = 0;