From 4ae3fb4e3dd15a3e7c41036424348cd5c1f15e53 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 7 Sep 2023 17:29:35 +0200 Subject: [PATCH] Boot Sound --- app/AsusACPI.cs | 2 ++ app/Extra.Designer.cs | 28 ++++++++++++++++++++++------ app/Extra.cs | 9 +++++++++ app/Properties/Strings.Designer.cs | 9 +++++++++ app/Properties/Strings.resx | 3 +++ 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index 0acad6cc..13b09785 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -104,6 +104,8 @@ public class AsusACPI public const int ScreenPadToggle = 0x00050031; public const int ScreenPadBrightness = 0x00050032; + public const int BootSound = 0x00130022; + public const int Tablet_Notebook = 0; public const int Tablet_Tablet = 1; public const int Tablet_Tent = 2; diff --git a/app/Extra.Designer.cs b/app/Extra.Designer.cs index ce22abce..9a0f7ce0 100644 --- a/app/Extra.Designer.cs +++ b/app/Extra.Designer.cs @@ -115,6 +115,7 @@ namespace GHelper labelHibernateAfter = new Label(); pictureHibernate = new PictureBox(); toolTip = new ToolTip(components); + checkBootSound = new CheckBox(); panelServices.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureService).BeginInit(); panelBindingsHeader.SuspendLayout(); @@ -147,7 +148,7 @@ namespace GHelper panelServices.Controls.Add(labelServices); panelServices.Controls.Add(buttonServices); panelServices.Dock = DockStyle.Top; - panelServices.Location = new Point(15, 1279); + panelServices.Location = new Point(15, 1321); panelServices.Name = "panelServices"; panelServices.Size = new Size(983, 75); panelServices.TabIndex = 5; @@ -1065,6 +1066,7 @@ namespace GHelper panelSettings.Controls.Add(checkAutoToggleClamshellMode); panelSettings.Controls.Add(checkTopmost); panelSettings.Controls.Add(checkNoOverdrive); + panelSettings.Controls.Add(checkBootSound); panelSettings.Controls.Add(checkUSBC); panelSettings.Controls.Add(checkVariBright); panelSettings.Controls.Add(checkGpuApps); @@ -1073,14 +1075,14 @@ namespace GHelper panelSettings.Location = new Point(15, 921); panelSettings.Name = "panelSettings"; panelSettings.Padding = new Padding(20, 5, 11, 5); - panelSettings.Size = new Size(983, 304); + panelSettings.Size = new Size(983, 346); panelSettings.TabIndex = 3; // // checkAutoToggleClamshellMode // checkAutoToggleClamshellMode.AutoSize = true; checkAutoToggleClamshellMode.Dock = DockStyle.Top; - checkAutoToggleClamshellMode.Location = new Point(20, 257); + checkAutoToggleClamshellMode.Location = new Point(20, 299); checkAutoToggleClamshellMode.Name = "checkAutoToggleClamshellMode"; checkAutoToggleClamshellMode.Padding = new Padding(3); checkAutoToggleClamshellMode.Size = new Size(952, 42); @@ -1092,7 +1094,7 @@ namespace GHelper // checkTopmost.AutoSize = true; checkTopmost.Dock = DockStyle.Top; - checkTopmost.Location = new Point(20, 215); + checkTopmost.Location = new Point(20, 257); checkTopmost.Margin = new Padding(4, 3, 4, 3); checkTopmost.Name = "checkTopmost"; checkTopmost.Padding = new Padding(3); @@ -1105,7 +1107,7 @@ namespace GHelper // checkNoOverdrive.AutoSize = true; checkNoOverdrive.Dock = DockStyle.Top; - checkNoOverdrive.Location = new Point(20, 173); + checkNoOverdrive.Location = new Point(20, 215); checkNoOverdrive.Margin = new Padding(4, 3, 4, 3); checkNoOverdrive.Name = "checkNoOverdrive"; checkNoOverdrive.Padding = new Padding(3); @@ -1172,7 +1174,7 @@ namespace GHelper panelPower.Controls.Add(labelHibernateAfter); panelPower.Controls.Add(pictureHibernate); panelPower.Dock = DockStyle.Top; - panelPower.Location = new Point(15, 1225); + panelPower.Location = new Point(15, 1267); panelPower.Name = "panelPower"; panelPower.Size = new Size(983, 54); panelPower.TabIndex = 4; @@ -1209,6 +1211,19 @@ namespace GHelper pictureHibernate.TabIndex = 22; pictureHibernate.TabStop = false; // + // checkBootSound + // + checkBootSound.AutoSize = true; + checkBootSound.Dock = DockStyle.Top; + checkBootSound.Location = new Point(20, 173); + checkBootSound.Margin = new Padding(4, 3, 4, 3); + checkBootSound.Name = "checkBootSound"; + checkBootSound.Padding = new Padding(3); + checkBootSound.Size = new Size(952, 42); + checkBootSound.TabIndex = 10; + checkBootSound.Text = "Boot Sound"; + checkBootSound.UseVisualStyleBackColor = true; + // // Extra // AutoScaleDimensions = new SizeF(192F, 192F); @@ -1356,5 +1371,6 @@ namespace GHelper private NumericUpDown numericHibernateAfter; private CheckBox checkGPUFix; private ToolTip toolTip; + private CheckBox checkBootSound; } } \ No newline at end of file diff --git a/app/Extra.cs b/app/Extra.cs index 8d8a62b1..fbfe00a9 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -108,6 +108,7 @@ namespace GHelper checkSleep.Text = Properties.Strings.Sleep; checkBoot.Text = Properties.Strings.Boot; checkShutdown.Text = Properties.Strings.Shutdown; + checkBootSound.Text = Properties.Strings.BootSound; labelSpeed.Text = Properties.Strings.AnimationSpeed; //labelBrightness.Text = Properties.Strings.Brightness; @@ -311,6 +312,9 @@ namespace GHelper checkGpuApps.Checked = AppConfig.Is("kill_gpu_apps"); checkGpuApps.CheckedChanged += CheckGpuApps_CheckedChanged; + checkBootSound.Checked = (Program.acpi.DeviceGet(AsusACPI.BootSound) == 1); + checkBootSound.CheckedChanged += CheckBootSound_CheckedChanged; + pictureHelp.Click += PictureHelp_Click; buttonServices.Click += ButtonServices_Click; @@ -327,6 +331,11 @@ namespace GHelper InitHibernate(); } + private void CheckBootSound_CheckedChanged(object? sender, EventArgs e) + { + Program.acpi.DeviceSet(AsusACPI.BootSound, (checkBootSound.Checked ? 1 : 0), "BootSound"); + } + private void CheckGPUFix_CheckedChanged(object? sender, EventArgs e) { AppConfig.Set("gpu_fix", (checkGPUFix.Checked ? 1 : 0)); diff --git a/app/Properties/Strings.Designer.cs b/app/Properties/Strings.Designer.cs index a2a77ee5..e76f06ec 100644 --- a/app/Properties/Strings.Designer.cs +++ b/app/Properties/Strings.Designer.cs @@ -483,6 +483,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Boot Sound. + /// + internal static string BootSound { + get { + return ResourceManager.GetString("BootSound", resourceCulture); + } + } + /// /// Looks up a localized string similar to Brightness. /// diff --git a/app/Properties/Strings.resx b/app/Properties/Strings.resx index 5170a065..ed864868 100644 --- a/app/Properties/Strings.resx +++ b/app/Properties/Strings.resx @@ -258,6 +258,9 @@ Boot + + Boot Sound + Brightness