From b2ed390bdfee8a1c5a5504fab7ad0c7d9f91fbd9 Mon Sep 17 00:00:00 2001 From: seerge Date: Wed, 19 Apr 2023 17:41:59 +0200 Subject: [PATCH] XGMobile support --- app/Properties/Resources.Designer.cs | 10 ++++++++ app/Properties/Resources.resx | 3 +++ app/Resources/icons8-video-48.png | Bin 0 -> 635 bytes app/Settings.Designer.cs | 37 ++++++++++++++++++++++++--- app/Settings.cs | 29 +++++++++++++++++++++ 5 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 app/Resources/icons8-video-48.png diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 3a7831aa..c7831a70 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -330,6 +330,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_video_48 { + get { + object obj = ResourceManager.GetObject("icons8_video_48", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 9dbe76e7..7d70d000 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -211,4 +211,7 @@ ..\Resources\icons8-help-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-video-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/app/Resources/icons8-video-48.png b/app/Resources/icons8-video-48.png new file mode 100644 index 0000000000000000000000000000000000000000..94a689db1b3e2bebc145ac0ebc3eb3806f120c3e GIT binary patch literal 635 zcmV->0)+jEP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf6951U69E94oEQKA0uV_=K~z{r?UqkV z6;T+6ubL=Q1R{lmwo!yM7j8lXSK^|LV2B`X{TwdLm7l;5Pz%8zR4`IBglOSXF+#yq z5JWLS3-j;uJ9l0`e)E@Ext5Gka zfRvF@H0(K%gadeuA8^`J75o^DP1HTTu9b_5S?AVVD@&>X@9RZrARn)mLbp+UR97(G{ zHSiWySjI1WhgQ{HIEPPh0Y70Cj$jX}M*8pog$-V?eL&Or3U|@o&isj5j{abF&XJUX zG&JBaDkGYUvsjy^Vc!7`8r?f-hd{)0qf0TkPh7)h}M&^JPZKf_4=HwE^Pe9@kv z>s1G_ByB`RCmg^v#=WWa+4&^x&9x$82?sEP`kbD)RxV#q4^D%=g!-RQrc4Z(%pE7+ V>=_MVN__wT002ovPDHLkV1jzF2}}S0 literal 0 HcmV?d00001 diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 93304ddb..5d88c4e7 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -68,6 +68,7 @@ namespace GHelper buttonStandard = new RButton(); buttonOptimized = new RButton(); buttonUltimate = new RButton(); + buttonXGM = new RButton(); panelScreen = new Panel(); labelMidFan = new Label(); labelTipScreen = new Label(); @@ -534,19 +535,21 @@ namespace GHelper panelGPU.Location = new Point(10, 210); panelGPU.Margin = new Padding(8); panelGPU.Name = "panelGPU"; - panelGPU.Padding = new Padding(0, 0, 0, 10); + panelGPU.Padding = new Padding(0, 0, 0, 45); panelGPU.Size = new Size(810, 237); panelGPU.TabIndex = 37; // // labelTipGPU // labelTipGPU.ForeColor = SystemColors.GrayText; - labelTipGPU.Location = new Point(24, 191); + labelTipGPU.Location = new Point(44, 191); labelTipGPU.Margin = new Padding(4, 0, 4, 0); labelTipGPU.Name = "labelTipGPU"; labelTipGPU.Size = new Size(760, 36); labelTipGPU.TabIndex = 20; - labelTipGPU.Text = " "; + labelTipGPU.Text = ""; + labelTipGPU.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; + // // pictureGPU // @@ -593,8 +596,9 @@ namespace GHelper tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableGPU.Controls.Add(buttonEco, 0, 0); tableGPU.Controls.Add(buttonStandard, 1, 0); - tableGPU.Controls.Add(buttonOptimized, 2, 0); tableGPU.Controls.Add(buttonUltimate, 2, 0); + tableGPU.Controls.Add(buttonXGM, 3, 0); + tableGPU.Controls.Add(buttonOptimized, 3, 0); tableGPU.Location = new Point(16, 60); tableGPU.Margin = new Padding(8, 4, 8, 4); tableGPU.Name = "tableGPU"; @@ -691,6 +695,30 @@ namespace GHelper buttonUltimate.Text = Properties.Strings.UltimateMode; buttonUltimate.TextImageRelation = TextImageRelation.ImageAboveText; buttonUltimate.UseVisualStyleBackColor = false; + // + // buttonXGM + // + buttonXGM.Activated = false; + buttonXGM.BackColor = SystemColors.ControlLightLight; + buttonXGM.BorderColor = Color.Transparent; + buttonXGM.BorderRadius = 5; + buttonXGM.Dock = DockStyle.Top; + buttonXGM.FlatAppearance.BorderSize = 0; + buttonXGM.FlatStyle = FlatStyle.Flat; + buttonXGM.ForeColor = SystemColors.ControlText; + buttonXGM.Image = Properties.Resources.icons8_video_48; + buttonXGM.ImageAlign = ContentAlignment.BottomCenter; + buttonXGM.Location = new Point(390, 4); + buttonXGM.Margin = new Padding(4); + buttonXGM.Name = "buttonXGM"; + buttonXGM.Secondary = false; + buttonXGM.Size = new Size(185, 120); + buttonXGM.TabIndex = 2; + buttonXGM.Text = "XG Mobile"; + buttonXGM.TextImageRelation = TextImageRelation.ImageAboveText; + buttonXGM.UseVisualStyleBackColor = false; + buttonXGM.Visible = false; + // // panelScreen // @@ -1078,6 +1106,7 @@ namespace GHelper private Label labelGPU; private Label labelGPUFan; private TableLayoutPanel tableGPU; + private RButton buttonXGM; private RButton buttonUltimate; private RButton buttonStandard; private RButton buttonEco; diff --git a/app/Settings.cs b/app/Settings.cs index 01394f81..67c88fee 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -50,6 +50,7 @@ namespace GHelper buttonStandard.BorderColor = colorStandard; buttonUltimate.BorderColor = colorTurbo; buttonOptimized.BorderColor = colorEco; + buttonXGM.BorderColor = colorTurbo; button60Hz.BorderColor = SystemColors.ActiveBorder; button120Hz.BorderColor = SystemColors.ActiveBorder; @@ -112,6 +113,8 @@ namespace GHelper buttonUltimate.MouseMove += ButtonUltimate_MouseHover; buttonUltimate.MouseLeave += ButtonGPU_MouseLeave; + buttonXGM.Click += ButtonXGM_Click; + buttonScreenAuto.MouseMove += ButtonScreenAuto_MouseHover; buttonScreenAuto.MouseLeave += ButtonScreen_MouseLeave; @@ -146,6 +149,18 @@ namespace GHelper } + private void ButtonXGM_Click(object? sender, EventArgs e) + { + if (Program.wmi.DeviceGet(ASUSWmi.GPUXG) == 1) + { + Program.wmi.DeviceSet(ASUSWmi.GPUXG, 0, "GPU XGM"); + } else + { + Program.wmi.DeviceSet(ASUSWmi.GPUXG, 1, "GPU XGM"); + } + InitXGM(); + } + private void SliderBattery_ValueChanged(object? sender, EventArgs e) { SetBatteryChargeLimit(sliderBattery.Value); @@ -856,6 +871,7 @@ namespace GHelper if (this.Visible) { InitScreen(); + InitXGM(); this.Left = Screen.FromControl(this).WorkingArea.Width - 10 - this.Width; this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height; @@ -1171,6 +1187,17 @@ namespace GHelper } + public void InitXGM() + { + int connected = Program.wmi.DeviceGet(ASUSWmi.GPUXGConnected); + int enabled = Program.wmi.DeviceGet(ASUSWmi.GPUXG); + + buttonXGM.Visible = (connected == 1); + buttonXGM.Activated = (enabled == 1); + + } + + public int InitGPUMode() { @@ -1202,6 +1229,8 @@ namespace GHelper ButtonEnabled(buttonStandard, true); ButtonEnabled(buttonUltimate, true); + InitXGM(); + VisualiseGPUMode(GpuMode); return GpuMode;