Compare commits

..

65 Commits

Author SHA1 Message Date
Serge
f3fd590be4 Version Bump 2023-12-07 11:25:08 +01:00
Serge
6a9d47a61d UI Fixes https://github.com/seerge/g-helper/issues/1701 2023-12-07 11:12:57 +01:00
Serge
3848ef9a43 New translations strings.resx (Polish) (#1692) 2023-12-03 21:55:37 +01:00
Serge
84c7fdb3bf Removed ACPI requirement for non-asus models https://github.com/seerge/g-helper/issues/1676 2023-12-03 12:17:07 +01:00
Serge
013c83fd60 Merge branch 'main' of https://github.com/seerge/g-helper 2023-12-03 11:23:17 +01:00
Serge
b31ed8338a G14 2023 white-only / RGB detection https://github.com/seerge/g-helper/issues/1686 2023-12-03 11:23:14 +01:00
Serge
6f9eb1e9c5 New translations strings.resx (Spanish) (#1681) 2023-12-01 22:56:15 +01:00
Hamza Rizwan
f19ea5eaf6 Update AppConfig.cs (#1682)
Added "G713RC" to the list of limited Strix RGB models
2023-12-01 22:56:01 +01:00
Serge
0db3665dd2 New Crowdin updates (#1680)
* New translations strings.resx (Portuguese)

* New translations strings.resx (Romanian)

* New translations strings.resx (French)

* New translations strings.resx (Spanish)

* New translations strings.resx (German)

* New translations strings.resx (Hungarian)

* New translations strings.resx (Italian)

* New translations strings.resx (Korean)

* New translations strings.resx (Lithuanian)

* New translations strings.resx (Polish)

* New translations strings.resx (Turkish)

* New translations strings.resx (Ukrainian)

* New translations strings.resx (Chinese Simplified)

* New translations strings.resx (Chinese Traditional)

* New translations strings.resx (Vietnamese)

* New translations strings.resx (Portuguese, Brazilian)

* New translations strings.resx (Indonesian)
2023-12-01 16:52:24 +01:00
Serge
68c17368f0 Version bump 2023-12-01 16:52:13 +01:00
Serge
12a2a147d4 Hide APU memory setting for non-ally models 2023-12-01 16:50:53 +01:00
Serge
1b10be93ed UI fix https://github.com/seerge/g-helper/issues/1669 2023-12-01 16:44:55 +01:00
Serge Samusya
1e29aeda17 APU Mem value fixes 2023-12-01 16:26:07 +01:00
Serge Samusya
32c4f6168c Rog Ally GPU Memory setting 2023-12-01 14:38:50 +01:00
Serge
5d945d6b7c New translations strings.resx (Portuguese) (#1664) 2023-11-28 17:02:59 +01:00
Serge
1c27eee293 Merge branch 'main' of https://github.com/seerge/g-helper 2023-11-27 20:17:52 +01:00
Serge
1efc722f93 Improved single-color keyboard detection for G14 https://github.com/seerge/g-helper/issues/1646 2023-11-27 20:17:50 +01:00
IceStormNG
4a1e585c69 Added support for ROG Chakram Core (P511) (#1662) 2023-11-27 15:10:54 +01:00
Serge
3bab1a271b Moved action block to prevent unnecessary actions on main window toggle https://github.com/seerge/g-helper/pull/1651 2023-11-25 19:53:54 +01:00
Serge
5b2017299c Hotkeys for Eco/Standard modes https://github.com/seerge/g-helper/issues/1637 2023-11-24 10:12:11 +01:00
Serge
f4cc4b4ac5 Added G513QM to the list of models with limited RGB https://github.com/seerge/g-helper/issues/1641 2023-11-23 18:02:27 +01:00
Serge
36d6d6af48 Stirx Numpad fixes https://github.com/seerge/g-helper/pull/1638 2023-11-23 12:28:52 +01:00
David
93d639fc6f fix: ulterior fixes from #1636 (#1638)
* fix: Ambient Mode for 17 inch keyboards

* fix: removed debugging keys, added "skip" for 15inch, refactor

---------

Co-authored-by: Serge <5920850+seerge@users.noreply.github.com>
2023-11-23 12:16:10 +01:00
Serge
1f6a2a9ac5 Enable dGPU on shutdown for X13 2022 https://github.com/seerge/g-helper/discussions/1042#discussioncomment-7646782 2023-11-23 09:42:19 +01:00
David
8bcac73824 fix: Ambient Mode for 17 inch keyboards (#1636) 2023-11-23 09:34:28 +01:00
DLdota
4e46a20eff Ambient 1 zone improve (#1635)
* ....

* Amvietn: improved color for 1-zone
2023-11-22 20:51:11 +01:00
Serge
1d2f1d3bb2 Removed unsupported RGB modes for G513IE https://github.com/seerge/g-helper/issues/1627 2023-11-22 09:58:28 +01:00
Serge
eeaa906749 Aura num-pad buttons mapping 2023-11-21 22:51:05 +01:00
Serge
22bfc77a7a Icon Helper 2023-11-21 13:13:29 +01:00
Serge
267cf6387f Icons cleanup 2023-11-21 13:07:03 +01:00
Siddiqui Abdul Rahman
45e7e5551e setting different icon for taskbar and title bar (#1614)
* setting different icon for taskbar and title bar

* fixing variables
2023-11-21 12:45:54 +01:00
Serge
bb796b8818 Aura init fix 2023-11-21 12:43:10 +01:00
Serge
d9b615ce2d Z13 fix https://github.com/seerge/g-helper/issues/1622 2023-11-20 16:16:38 +01:00
Serge
035c60da2e Version bump 2023-11-20 10:32:47 +01:00
Serge
e096699909 Update README.md 2023-11-20 09:01:40 +01:00
DLdota
bf1ffddf15 Added map for Strix 4-Zone RGB (#1619)
* ....

* Strix 4 Zone RGB
2023-11-20 09:00:22 +01:00
Serge
fad7396c8f Cleanup 2023-11-19 23:20:24 +01:00
Serge
af4a5e8af7 Fix 2023-11-19 21:51:11 +01:00
Serge
3d2be97cf6 Experimental Per-key Aura 2023-11-19 21:49:25 +01:00
Serge
b6fe7c9ddf OpenRGB pey-key Aura implementation 2023-11-19 19:24:59 +01:00
Serge
f2085b836b Aura HID fixes https://github.com/seerge/g-helper/issues/1616 2023-11-19 15:15:19 +01:00
Serge
ccf2ae9eed Asus HID fixes https://github.com/seerge/g-helper/issues/1616 2023-11-19 13:17:07 +01:00
Serge
e4bcc8f66c Removed F12 binding completely 2023-11-18 09:30:03 +01:00
Serge
0f11ffe8f0 AsusHID tweaks 2023-11-17 20:21:54 +01:00
Serge
96cbcbaf7f Version Bump 2023-11-17 17:57:36 +01:00
Serge
0c1ababcf8 Ambient Aura tweaks 2023-11-17 17:56:40 +01:00
Serge
36eae610e8 Triple-key binding fix https://github.com/seerge/g-helper/issues/1608 2023-11-17 17:41:55 +01:00
Serge
69757ff460 Remove unsupported RGB modes for G513RM https://github.com/seerge/g-helper/issues/1603 2023-11-17 11:03:42 +01:00
Serge
744bce1819 Hide icon 2023-11-17 10:48:15 +01:00
Serge
fac145811e XGM fix for HidSharp 2023-11-16 14:40:47 +01:00
Serge
7eb6884aa4 Fn-lock tweaks https://github.com/seerge/g-helper/issues/1596#issuecomment-1811379482 2023-11-15 14:12:08 +01:00
Serge
f8df547afb Init FnLock for vivobooks on startup https://github.com/seerge/g-helper/issues/1596 2023-11-14 19:01:49 +01:00
Serge
6737af2da4 Average ambient color 2023-11-13 23:25:17 +01:00
Serge
d859c56e27 Single color ambient tweaks 2023-11-13 23:05:34 +01:00
DLdota
0f56883c37 Ambient + Custom colors effect for ROG Strix (#1582)
* Added ambient effect.
Refact AsusUSB.cs

* merge

* Improved perfomance for Ambient effect.
Added AuraMsg.cs

* Fix leaked.
Decrease saturation.

* returned the old form formatting

* Fixed color size

* Removed visible colors for ambient effect

* Add comments

* Improved performance by 60%

* merge

* added "init = true" for effect
2023-11-13 22:05:33 +01:00
Serge
229255fbff Cleanup 2023-11-13 13:51:54 +01:00
Serge
786bb4eadf Listener tweaks 2023-11-13 10:32:36 +01:00
Serge
42847de055 Merge branch 'main' of https://github.com/seerge/g-helper 2023-11-13 10:28:49 +01:00
Serge
6787d38678 Main window icon 2023-11-13 10:28:45 +01:00
Serge
8c0a0a2c92 Update README.md 2023-11-13 10:08:31 +01:00
Oleg Yermolenko
8eaafcacb7 fix toggle touchpad (#1595) 2023-11-13 10:04:54 +01:00
Serge
940993e1d5 Adjust icon with GPU mode 2023-11-12 22:37:23 +01:00
Serge
5c4500315c Migrated Aura & XGM communication to HidSharp library to speed things up (#1594)
* Cleanup

* Touchpad toggle fix for FA507 https://github.com/seerge/g-helper/issues/1589

* Cleanup
2023-11-12 22:28:37 +01:00
Serge
dd52f8039c Version bump 2023-11-12 11:48:29 +01:00
Serge
9f56aa9d3d Detect Z13 keyboard reconnection https://github.com/seerge/g-helper/issues/1581 2023-11-12 11:48:06 +01:00
45 changed files with 1443 additions and 263 deletions

View File

@@ -355,7 +355,12 @@ public static class AppConfig
public static bool IsStrixLimitedRGB()
{
return ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513RS");
return ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513RS") || ContainsModel("G513RM") || ContainsModel("G713PV") || ContainsModel("G513IE") || ContainsModel("G513QM") || ContainsModel("G713RC");
}
public static bool IsStrixNumpad()
{
return ContainsModel("G713R");
}
public static bool IsZ13()
@@ -423,7 +428,7 @@ public static class AppConfig
public static bool IsGPUFixNeeded()
{
return ContainsModel("GA402X") || ContainsModel("GV302") || ContainsModel("GZ301") || ContainsModel("FX506") || ContainsModel("GU603V") || ContainsModel("GU603Z");
return ContainsModel("GA402X") || ContainsModel("GV302") || ContainsModel("GV301") || ContainsModel("GZ301") || ContainsModel("FX506") || ContainsModel("GU603V") || ContainsModel("GU603Z");
}
public static bool IsGPUFix()
@@ -446,4 +451,8 @@ public static class AppConfig
return ContainsModel("FA507");
}
public static bool IsASUS()
{
return ContainsModel("ROG") || ContainsModel("TUF") || ContainsModel("Vivobook") || ContainsModel("Zenbook");
}
}

View File

@@ -36,7 +36,7 @@ public class AsusACPI
const uint INIT = 0x54494E49;
public const uint UniversalControl = 0x00100021;
public const int KB_Light_Up = 0xc4;
public const int KB_Light_Down = 0xc5;
public const int Brightness_Down = 0x10;
@@ -94,6 +94,8 @@ public class AsusACPI
public const int PPT_APUC1 = 0x001200C1; // fPPT (fast boost limit)
public const int PPT_GPUC2 = 0x001200C2; // NVIDIA GPU Temp Target (75.. 87 C)
public const int APU_MEM = 0x000600C1;
public const int TUF_KB_BRIGHTNESS = 0x00050021;
public const int TUF_KB = 0x00100056;
public const int TUF_KB2 = 0x0010005a;
@@ -183,6 +185,7 @@ public class AsusACPI
private static extern bool WaitForSingleObject(IntPtr hHandle, int dwMilliseconds);
private IntPtr eventHandle;
private bool _connected = false;
// still works only with asus optimization service on , if someone knows how to get ACPI events from asus without that - let me know
public void RunListener()
@@ -209,22 +212,33 @@ public class AsusACPI
}
}
public bool IsConnected()
{
return _connected;
}
public AsusACPI()
{
handle = CreateFile(
FILE_NAME,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
IntPtr.Zero,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
IntPtr.Zero
);
if (handle == new IntPtr(-1))
try
{
throw new Exception("Can't connect to ACPI");
handle = CreateFile(
FILE_NAME,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
IntPtr.Zero,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
IntPtr.Zero
);
//handle = new IntPtr(-1);
//throw new Exception("ERROR");
_connected = true;
}
catch (Exception ex)
{
Logger.WriteLine($"Can't connect to ACPI: {ex.Message}");
}
if (AppConfig.IsAdvantageEdition()) MaxTotal = 250;
@@ -387,7 +401,7 @@ public class AsusACPI
byte min = (byte)(curve[8] * 255 / 100);
byte max = (byte)(curve[15] * 255 / 100);
byte[] range = { min, max};
byte[] range = { min, max };
int result;
switch (device)
@@ -419,7 +433,7 @@ public class AsusACPI
// it seems to be a bug, when some old model's bios can go nuts if fan is set to 100%
for (int i = 8; i < curve.Length; i++) curve[i] = (byte)(Math.Max((byte)0, Math.Min((byte)100, curve[i])) * fanScale / 100);
for (int i = 8; i < curve.Length; i++) curve[i] = (byte)(Math.Max((byte)0, Math.Min((byte)100, curve[i])) * fanScale / 100);
switch (device)
{
@@ -525,6 +539,75 @@ public class AsusACPI
return DeviceGet(PPT_CPUB0) >= 0 && DeviceGet(PPT_GPUC0) < 0;
}
public void SetAPUMem(int memory = 4)
{
if (memory < 0 || memory > 8) return;
int mem = 0;
switch (memory)
{
case 0:
mem = 0;
break;
case 1:
mem = 258;
break;
case 2:
mem = 259;
break;
case 3:
mem = 260;
break;
case 4:
mem = 261;
break;
case 5:
mem = 263;
break;
case 6:
mem = 264;
break;
case 7:
mem = 265;
break;
case 8:
mem = 262;
break;
}
Program.acpi.DeviceSet(APU_MEM, mem, "APU Mem");
}
public int GetAPUMem()
{
int memory = Program.acpi.DeviceGet(APU_MEM);
if (memory < 0) return -1;
switch (memory)
{
case 256:
return 0;
case 258:
return 1;
case 259:
return 2;
case 260:
return 3;
case 261:
return 4;
case 262:
return 8;
case 263:
return 5;
case 264:
return 6;
case 265:
return 7;
default:
return 4;
}
}
public void ScanRange()
{
@@ -554,7 +637,7 @@ public class AsusACPI
{
byte[] setting = new byte[6];
setting[0] = (byte)0xb4;
setting[1] = (byte)mode;
setting[2] = color.R;

99
app/Extra.Designer.cs generated
View File

@@ -106,6 +106,7 @@ namespace GHelper
checkAutoToggleClamshellMode = new CheckBox();
checkTopmost = new CheckBox();
checkNoOverdrive = new CheckBox();
checkBootSound = new CheckBox();
checkUSBC = new CheckBox();
checkVariBright = new CheckBox();
checkGpuApps = new CheckBox();
@@ -115,7 +116,10 @@ namespace GHelper
labelHibernateAfter = new Label();
pictureHibernate = new PictureBox();
toolTip = new ToolTip(components);
checkBootSound = new CheckBox();
panelAPU = new Panel();
comboAPU = new RComboBox();
pictureAPUMem = new PictureBox();
labelAPUMem = new Label();
panelServices.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureService).BeginInit();
panelBindingsHeader.SuspendLayout();
@@ -138,6 +142,8 @@ namespace GHelper
panelPower.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericHibernateAfter).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureHibernate).BeginInit();
panelAPU.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureAPUMem).BeginInit();
SuspendLayout();
//
// panelServices
@@ -148,7 +154,7 @@ namespace GHelper
panelServices.Controls.Add(labelServices);
panelServices.Controls.Add(buttonServices);
panelServices.Dock = DockStyle.Top;
panelServices.Location = new Point(15, 1321);
panelServices.Location = new Point(15, 1378);
panelServices.Name = "panelServices";
panelServices.Size = new Size(983, 75);
panelServices.TabIndex = 5;
@@ -1072,7 +1078,7 @@ namespace GHelper
panelSettings.Controls.Add(checkGpuApps);
panelSettings.Controls.Add(checkGPUFix);
panelSettings.Dock = DockStyle.Top;
panelSettings.Location = new Point(15, 921);
panelSettings.Location = new Point(15, 978);
panelSettings.Name = "panelSettings";
panelSettings.Padding = new Padding(20, 5, 11, 5);
panelSettings.Size = new Size(983, 346);
@@ -1116,6 +1122,19 @@ namespace GHelper
checkNoOverdrive.Text = Strings.DisableOverdrive;
checkNoOverdrive.UseVisualStyleBackColor = true;
//
// 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;
//
// checkUSBC
//
checkUSBC.AutoSize = true;
@@ -1174,7 +1193,7 @@ namespace GHelper
panelPower.Controls.Add(labelHibernateAfter);
panelPower.Controls.Add(pictureHibernate);
panelPower.Dock = DockStyle.Top;
panelPower.Location = new Point(15, 1267);
panelPower.Location = new Point(15, 1324);
panelPower.Name = "panelPower";
panelPower.Size = new Size(983, 54);
panelPower.TabIndex = 4;
@@ -1211,18 +1230,58 @@ namespace GHelper
pictureHibernate.TabIndex = 22;
pictureHibernate.TabStop = false;
//
// checkBootSound
// panelAPU
//
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;
panelAPU.AutoSize = true;
panelAPU.Controls.Add(comboAPU);
panelAPU.Controls.Add(pictureAPUMem);
panelAPU.Controls.Add(labelAPUMem);
panelAPU.Dock = DockStyle.Top;
panelAPU.Location = new Point(15, 921);
panelAPU.Name = "panelAPU";
panelAPU.Padding = new Padding(11, 5, 11, 0);
panelAPU.Size = new Size(983, 57);
panelAPU.TabIndex = 46;
panelAPU.Visible = false;
panelAPU.Paint += panelAPU_Paint;
//
// comboAPU
//
comboAPU.AccessibleName = "Keyboard Animation Speed";
comboAPU.Anchor = AnchorStyles.Top | AnchorStyles.Right;
comboAPU.BorderColor = Color.White;
comboAPU.ButtonColor = SystemColors.ControlLight;
comboAPU.FlatStyle = FlatStyle.Flat;
comboAPU.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
comboAPU.FormattingEnabled = true;
comboAPU.ItemHeight = 32;
comboAPU.Items.AddRange(new object[] { "Auto", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G" });
comboAPU.Location = new Point(663, 8);
comboAPU.Margin = new Padding(4, 12, 4, 9);
comboAPU.Name = "comboAPU";
comboAPU.Size = new Size(293, 40);
comboAPU.TabIndex = 12;
comboAPU.TabStop = false;
//
// pictureAPUMem
//
pictureAPUMem.BackgroundImage = Resources.icons8_video_48;
pictureAPUMem.BackgroundImageLayout = ImageLayout.Zoom;
pictureAPUMem.Location = new Point(20, 11);
pictureAPUMem.Name = "pictureAPUMem";
pictureAPUMem.Size = new Size(32, 32);
pictureAPUMem.TabIndex = 1;
pictureAPUMem.TabStop = false;
//
// labelAPUMem
//
labelAPUMem.AutoSize = true;
labelAPUMem.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelAPUMem.Location = new Point(56, 11);
labelAPUMem.Name = "labelAPUMem";
labelAPUMem.Size = new Size(309, 32);
labelAPUMem.TabIndex = 0;
labelAPUMem.Text = "Memory Assigned to GPU";
//
// Extra
//
@@ -1230,10 +1289,11 @@ namespace GHelper
AutoScaleMode = AutoScaleMode.Dpi;
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new Size(1013, 1467);
ClientSize = new Size(1013, 1515);
Controls.Add(panelServices);
Controls.Add(panelPower);
Controls.Add(panelSettings);
Controls.Add(panelAPU);
Controls.Add(panelSettingsHeader);
Controls.Add(panelBacklight);
Controls.Add(panelBacklightHeader);
@@ -1282,6 +1342,9 @@ namespace GHelper
panelPower.PerformLayout();
((System.ComponentModel.ISupportInitialize)numericHibernateAfter).EndInit();
((System.ComponentModel.ISupportInitialize)pictureHibernate).EndInit();
panelAPU.ResumeLayout(false);
panelAPU.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureAPUMem).EndInit();
ResumeLayout(false);
PerformLayout();
}
@@ -1372,5 +1435,9 @@ namespace GHelper
private CheckBox checkGPUFix;
private ToolTip toolTip;
private CheckBox checkBootSound;
private Panel panelAPU;
private PictureBox pictureAPUMem;
private Label labelAPUMem;
private RComboBox comboAPU;
}
}

View File

@@ -13,6 +13,7 @@ namespace GHelper
{
ScreenControl screenControl = new ScreenControl();
ModeControl modeControl = new ModeControl();
ClamshellModeControl clamshellControl = new ClamshellModeControl();
const string EMPTY = "--------------";
@@ -138,6 +139,8 @@ namespace GHelper
checkGpuApps.Text = Properties.Strings.KillGpuApps;
labelHibernateAfter.Text = Properties.Strings.HibernateAfter;
labelAPUMem.Text = Properties.Strings.APUMemory;
Text = Properties.Strings.ExtraSettings;
if (AppConfig.IsARCNM())
@@ -147,14 +150,14 @@ namespace GHelper
labelM2.Visible = comboM2.Visible = textM2.Visible = false;
labelM4.Visible = comboM4.Visible = textM4.Visible = false;
labelFNF4.Visible = comboFNF4.Visible = textFNF4.Visible = false;
}
}
if (AppConfig.NoMKeys())
{
labelM1.Text = "FN+F2";
labelM2.Text = "FN+F3";
labelM3.Text = "FN+F4";
labelM4.Visible = comboM4.Visible = textM4.Visible = AppConfig.IsDUO();
labelM4.Visible = comboM4.Visible = textM4.Visible = AppConfig.IsDUO();
labelFNF4.Visible = comboFNF4.Visible = textFNF4.Visible = false;
}
@@ -195,6 +198,17 @@ namespace GHelper
SetKeyCombo(comboM4, textM4, "m4");
SetKeyCombo(comboFNF4, textFNF4, "paddle");
int apuMem = Program.acpi.GetAPUMem();
if (apuMem >= 0)
{
panelAPU.Visible = true;
comboAPU.DropDownStyle = ComboBoxStyle.DropDownList;
comboAPU.SelectedIndex = apuMem;
}
comboAPU.SelectedIndexChanged += ComboAPU_SelectedIndexChanged;
}
else
{
@@ -348,6 +362,19 @@ namespace GHelper
InitHibernate();
}
private void ComboAPU_SelectedIndexChanged(object? sender, EventArgs e)
{
int mem = comboAPU.SelectedIndex;
Program.acpi.SetAPUMem(mem);
DialogResult dialogResult = MessageBox.Show(Properties.Strings.AlertAPUMemoryRestart, Properties.Strings.AlertAPUMemoryRestartTitle, MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
Process.Start("shutdown", "/r /t 1");
}
}
private void CheckBootSound_CheckedChanged(object? sender, EventArgs e)
{
Program.acpi.DeviceSet(AsusACPI.BootSound, (checkBootSound.Checked ? 1 : 0), "BootSound");
@@ -604,5 +631,10 @@ namespace GHelper
}
}
private void panelAPU_Paint(object sender, PaintEventArgs e)
{
}
}
}

View File

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

View File

@@ -54,7 +54,7 @@ namespace GHelper.Gpu
AppConfig.Set("gpu_mode", gpuMode);
settings.VisualiseGPUMode(gpuMode);
Aura.ApplyGPUColor();
Aura.CustomRGB.ApplyGPUColor();
}
@@ -181,6 +181,12 @@ namespace GHelper.Gpu
Program.modeControl.SetGPUClocks(false);
}
if (AppConfig.Is("mode_reapply"))
{
await Task.Delay(TimeSpan.FromMilliseconds(3000));
Program.modeControl.AutoPerformance();
}
});

View File

@@ -1,6 +1,8 @@
namespace GHelper.Helpers
using System.Runtime.CompilerServices;
namespace GHelper.Helpers
{
public class ColorUtilities
public class ColorUtils
{
// Method to get the weighted average between two colors
public static Color GetWeightedAverage(Color color1, Color color2, float weight)
@@ -16,6 +18,144 @@
return Color.FromArgb(red, green, blue);
}
public static Color GetMidColor(Color color1, Color color2)
{
return Color.FromArgb((color1.R + color2.R) / 2,
(color1.G + color2.G) / 2,
(color1.B + color2.B) / 2);
}
public class HSV
{
public double Hue { get; set; }
public double Saturation { get; set; }
public double Value { get; set; }
public Color ToRGB()
{
var hue = Hue * 6;
var saturation = Saturation;
var value = Value;
double red;
double green;
double blue;
if (saturation == 0)
{
red = green = blue = value;
}
else
{
var i = Convert.ToInt32(Math.Floor(hue));
var f = hue - i;
var p = value * (1 - saturation);
var q = value * (1 - saturation * f);
var t = value * (1 - saturation * (1 - f));
int mod = i % 6;
red = new[] { value, q, p, p, t, value }[mod];
green = new[] { t, value, value, q, p, p }[mod];
blue = new[] { p, p, t, value, value, q }[mod];
}
return Color.FromArgb(Convert.ToInt32(red * 255), Convert.ToInt32(green * 255), Convert.ToInt32(blue * 255));
}
public static HSV ToHSV(Color rgb)
{
double red = rgb.R / 255.0;
double green = rgb.G / 255.0;
double blue = rgb.B / 255.0;
var min = Math.Min(red, Math.Min(green, blue));
var max = Math.Max(red, Math.Max(green, blue));
var delta = max - min;
double hue;
double saturation = 0;
var value = max;
if (max != 0)
saturation = delta / max;
if (delta == 0)
hue = 0;
else
{
if (red == max)
hue = (green - blue) / delta + (green < blue ? 6 : 0);
else if (green == max)
hue = 2 + (blue - red) / delta;
else
hue = 4 + (red - green) / delta;
hue /= 6;
}
return new HSV { Hue = hue, Saturation = saturation, Value = value };
}
public static Color UpSaturation(Color rgb, float increse = 0.2f) //make color more colored
{
if (rgb.R == rgb.G && rgb.G == rgb.B)
return rgb;
var hsv_color = ToHSV(rgb);
hsv_color.Saturation = Math.Min(hsv_color.Saturation + increse, 1.00f);
return hsv_color.ToRGB();
}
}
public class SmoothColor
{
public Color RGB
{
get { return Interpolate(); }
set { clr = value; }
}
Color Interpolate()
{
clr_ = ColorInterpolator.InterpolateBetween(clr, clr_, smooth);
return clr_;
}
private float smooth = 0.65f; //smooth
private Color clr = new Color();
private Color clr_ = new Color();
static class ColorInterpolator
{
delegate byte ComponentSelector(Color color);
static ComponentSelector _redSelector = color => color.R;
static ComponentSelector _greenSelector = color => color.G;
static ComponentSelector _blueSelector = color => color.B;
public static Color InterpolateBetween(Color endPoint1, Color endPoint2, double lambda)
{
if (lambda < 0 || lambda > 1)
throw new ArgumentOutOfRangeException("lambda");
if (endPoint1 != endPoint2)
{
return Color.FromArgb(
InterpolateComponent(endPoint1, endPoint2, lambda, _redSelector),
InterpolateComponent(endPoint1, endPoint2, lambda, _greenSelector),
InterpolateComponent(endPoint1, endPoint2, lambda, _blueSelector)
);
}
return endPoint1;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static byte InterpolateComponent(Color end1, Color end2, double lambda, ComponentSelector selector)
{
return (byte)(selector(end1) + (selector(end2) - selector(end1)) * lambda);
}
}
}
}
}

View File

@@ -84,6 +84,9 @@ namespace GHelper.Input
Logger.WriteLine("Optimization service is running");
InitBacklightTimer();
if (AppConfig.ContainsModel("VivoBook")) Program.acpi.DeviceSet(AsusACPI.FnLock, AppConfig.Is("fn_lock") ? 1 : 0, "FnLock");
}
public void InitBacklightTimer()
@@ -113,6 +116,9 @@ namespace GHelper.Input
if (keyApp != Keys.None) hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control, keyApp);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15);
if (!AppConfig.Is("skip_hotkeys"))
{
hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeDown);
@@ -191,7 +197,7 @@ namespace GHelper.Input
KeyboardHook.KeyKeyPress((Keys)hexKeys[0], (Keys)hexKeys[1]);
break;
case 3:
KeyboardHook.KeyKeyKeyPress((Keys)hexKeys[0], (Keys)hexKeys[1], (Keys)hexKeys[3]);
KeyboardHook.KeyKeyKeyPress((Keys)hexKeys[0], (Keys)hexKeys[1], (Keys)hexKeys[2]);
break;
default:
LaunchProcess(command);
@@ -308,9 +314,6 @@ namespace GHelper.Input
case Keys.F11:
SleepEvent();
break;
case Keys.F12:
KeyboardHook.KeyKeyPress(Keys.LWin, Keys.A);
break;
case Keys.VolumeDown:
KeyProcess("m1");
break;
@@ -345,6 +348,16 @@ namespace GHelper.Input
if (e.Modifier == (ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt))
{
if (e.Key == keyProfile) modeControl.CyclePerformanceMode(true);
switch (e.Key)
{
case Keys.F14:
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
break;
case Keys.F15:
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeStandard);
break;
}
}
@@ -509,7 +522,7 @@ namespace GHelper.Input
AppConfig.Set("fn_lock", fnLock);
if (AppConfig.ContainsModel("VivoBook"))
Program.acpi.DeviceSet(AsusACPI.FnLock, fnLock == 1 ? 0 : 1, "FnLock");
Program.acpi.DeviceSet(AsusACPI.FnLock, fnLock == 1 ? 1 : 0, "FnLock");
else
Program.settingsForm.BeginInvoke(Program.inputDispatcher.RegisterKeys);
@@ -640,7 +653,7 @@ namespace GHelper.Input
case 106: // Screenpad button on DUO
if (Control.ModifierKeys == Keys.Shift)
ToggleScreenpad();
else
else
SetScreenpad(100);
break;

View File

@@ -40,10 +40,13 @@ public sealed class KeyboardHook : IDisposable
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
if (sleep > 0)
{
Thread.Sleep(sleep);
}
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
if (sleep > 0) Thread.Sleep(sleep);
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
if (sleep > 0) Thread.Sleep(sleep);
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
}

View File

@@ -26,8 +26,6 @@ namespace GHelper.Input
return;
}
input.ReadTimeout = int.MaxValue;
Logger.WriteLine($"Input: {input.Device.DevicePath}");
var task = Task.Run(() =>
@@ -44,6 +42,7 @@ namespace GHelper.Input
break;
}
input.ReadTimeout = int.MaxValue;
var data = input.Read();
if (data.Length > 1 && data[0] == AsusHid.INPUT_ID && data[1] > 0 && data[1] != 236)

View File

@@ -0,0 +1,211 @@
namespace GHelper.Peripherals.Mouse.Models
{
//P511
public class ChakramCore : AsusMouse
{
public ChakramCore() : base(0x0B05, 0x1958, "mi_00", false) {
}
public override int DPIProfileCount()
{
return 4;
}
public override string GetDisplayName()
{
return "ROG Chakram Core";
}
public override PollingRate[] SupportedPollingrates()
{
return new PollingRate[] {
PollingRate.PR125Hz,
PollingRate.PR250Hz,
PollingRate.PR500Hz,
PollingRate.PR1000Hz
};
}
public override int ProfileCount()
{
return 3;
}
public override int MaxDPI()
{
return 16_000;
}
public override bool HasDebounceSetting()
{
return false;
}
public override bool HasLiftOffSetting()
{
return true;
}
public override int DPIIncrements()
{
return 100;
}
public override bool HasRGB()
{
return true;
}
public override int MaxBrightness()
{
return 4;
}
public override LightingZone[] SupportedLightingZones()
{
return new LightingZone[] { LightingZone.Logo, LightingZone.Scrollwheel };
}
public override bool IsLightingModeSupported(LightingMode lightingMode)
{
return lightingMode == LightingMode.Static
|| lightingMode == LightingMode.Breathing
|| lightingMode == LightingMode.ColorCycle
|| lightingMode == LightingMode.React;
}
//Mouse has React mapped to 0x03 instead of 0x04 like other mice
protected override byte IndexForLightingMode(LightingMode lightingMode)
{
if (lightingMode == LightingMode.React)
{
return 0x03;
}
return ((byte)lightingMode);
}
//Mouse has React mapped to 0x03 instead of 0x04 like other mice
protected override LightingMode LightingModeForIndex(byte lightingMode)
{
if (lightingMode == 0x03)
{
return LightingMode.React;
}
return base.LightingModeForIndex(lightingMode);
}
public override bool HasBattery()
{
return false;
}
public override bool HasAngleSnapping()
{
return true;
}
public override bool HasAngleTuning()
{
return false;
}
protected override byte[] GetReadLightingModePacket(LightingZone zone)
{
return new byte[] { 0x00, 0x12, 0x03, 0x00 };
}
protected LightingSetting? ParseLightingSetting(byte[] packet, LightingZone zone)
{
if (packet[1] != 0x12 || packet[2] != 0x03)
{
return null;
}
int offset = 5 + (((int)zone) * 5);
LightingSetting setting = new LightingSetting();
setting.LightingMode = LightingModeForIndex(packet[offset + 0]);
setting.Brightness = packet[offset + 1];
setting.RGBColor = Color.FromArgb(packet[offset + 2], packet[offset + 3], packet[offset + 4]);
setting.AnimationDirection = SupportsAnimationDirection(setting.LightingMode)
? (AnimationDirection)packet[21]
: AnimationDirection.Clockwise;
if (setting.AnimationDirection != AnimationDirection.Clockwise
&& setting.AnimationDirection != AnimationDirection.CounterClockwise)
{
setting.AnimationDirection = AnimationDirection.Clockwise;
}
setting.RandomColor = SupportsRandomColor(setting.LightingMode) && packet[22] == 0x01;
setting.AnimationSpeed = SupportsAnimationSpeed(setting.LightingMode)
? (AnimationSpeed)packet[23]
: AnimationSpeed.Medium;
//If the mouse reports an out of range value, which it does when the current setting has no speed option, chose medium as default
if (setting.AnimationSpeed != AnimationSpeed.Fast
&& setting.AnimationSpeed != AnimationSpeed.Medium
&& setting.AnimationSpeed != AnimationSpeed.Slow)
{
setting.AnimationSpeed = AnimationSpeed.Medium;
}
return setting;
}
public override void ReadLightingSetting()
{
if (!HasRGB())
{
return;
}
//Mouse sends all lighting zones in one response
//21: Direction
//22: Random
//23: Speed
// 20 21 22 23
//00 12 03 00 00 [03 04 00 00 ff] [03 04 00 00 ff] [03 04 00 00 ff] 00 04 00 00
//00 12 03 00 00 [05 02 ff 00 ff] [05 02 ff 00 ff] [05 02 ff 00 ff] 00 01 01 00
//00 12 03 00 00 [03 01 00 00 ff] [03 01 00 00 ff] [03 01 00 00 ff] 00 01 00 01
byte[]? response = WriteForResponse(GetReadLightingModePacket(LightingZone.All));
if (response is null) return;
LightingZone[] lz = SupportedLightingZones();
for (int i = 0; i < lz.Length; ++i)
{
LightingSetting? ls = ParseLightingSetting(response, lz[i]);
if (ls is null)
{
Logger.WriteLine(GetDisplayName() + ": Failed to read RGB Setting for Zone " + lz[i].ToString());
continue;
}
Logger.WriteLine(GetDisplayName() + ": Read RGB Setting for Zone " + lz[i].ToString() + ": " + ls.ToString());
LightingSetting[i] = ls;
}
}
public override bool CanChangeDPIProfile()
{
return false;
}
protected override LiftOffDistance ParseLiftOffDistance(byte[] packet)
{
if (packet[1] != 0x12 || packet[2] != 0x06)
{
return LiftOffDistance.Low;
}
return (LiftOffDistance)packet[5];
}
protected override byte[] GetUpdateLiftOffDistancePacket(LiftOffDistance liftOffDistance)
{
return new byte[] { 0x00, 0x51, 0x35, 0x00, 0x00, ((byte)liftOffDistance) };
}
}
}

View File

@@ -208,6 +208,7 @@ namespace GHelper.Peripherals
DetectMouse(new StrixImpactII());
DetectMouse(new Chakram());
DetectMouse(new ChakramWired());
DetectMouse(new ChakramCore());
}
public static void DetectMouse(AsusMouse am)
@@ -239,6 +240,7 @@ namespace GHelper.Peripherals
timer.Stop();
Logger.WriteLine("HID Device Event: Checking for new ASUS Mice");
DetectAllAsusMice();
if (AppConfig.IsZ13()) Program.inputDispatcher.Init();
}
}
}

View File

@@ -64,11 +64,12 @@ namespace GHelper
ProcessHelper.CheckAlreadyRunning();
try
{
acpi = new AsusACPI();
}
catch
Logger.WriteLine("------------");
Logger.WriteLine("App launched: " + AppConfig.GetModel() + " :" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + CultureInfo.CurrentUICulture + (ProcessHelper.IsUserAdministrator() ? "." : ""));
acpi = new AsusACPI();
if (!acpi.IsConnected() && AppConfig.IsASUS())
{
DialogResult dialogResult = MessageBox.Show(Properties.Strings.ACPIError, Properties.Strings.StartupError, MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
@@ -80,9 +81,6 @@ namespace GHelper
return;
}
Logger.WriteLine("------------");
Logger.WriteLine("App launched: " + AppConfig.GetModel() + " :" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + CultureInfo.CurrentUICulture + (ProcessHelper.IsUserAdministrator() ? "." : ""));
Application.EnableVisualStyles();
HardwareControl.RecreateGpuControl();
@@ -97,7 +95,7 @@ namespace GHelper
gpuControl.InitXGM();
SetAutoModes(init : true);
SetAutoModes(init: true);
// Subscribing for system power change events
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
@@ -119,13 +117,42 @@ namespace GHelper
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0)
{
SettingsToggle(action, false);
SettingsToggle(false);
}
switch (action)
{
case "cpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle();
break;
case "gpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(1);
break;
case "gpurestart":
gpuControl.RestartGPU(false);
break;
case "services":
settingsForm.extraForm = new Extra();
settingsForm.extraForm.Show();
settingsForm.extraForm.ServiesToggle();
break;
case "uv":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(2);
modeControl.SetRyzen();
break;
default:
Startup.StartupCheck();
break;
}
Application.Run();
}
private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
{
gpuControl.StandardModeFix();
@@ -213,7 +240,7 @@ namespace GHelper
SetAutoModes(true);
}
public static void SettingsToggle(string action = "", bool checkForFocus = true, bool trayClick = false)
public static void SettingsToggle(bool checkForFocus = true, bool trayClick = false)
{
if (settingsForm.Visible)
{
@@ -241,34 +268,6 @@ namespace GHelper
settingsForm.Top = Screen.FromControl(settingsForm).WorkingArea.Height - 10 - settingsForm.Height;
settingsForm.VisualiseGPUMode();
switch (action)
{
case "cpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle();
break;
case "gpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(1);
break;
case "gpurestart":
gpuControl.RestartGPU(false);
break;
case "services":
settingsForm.extraForm = new Extra();
settingsForm.extraForm.Show();
settingsForm.extraForm.ServiesToggle();
break;
case "uv":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(2);
modeControl.SetRyzen();
break;
default:
Startup.StartupCheck();
break;
}
}
}

View File

@@ -110,6 +110,36 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap dot_eco {
get {
object obj = ResourceManager.GetObject("dot_eco", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap dot_standard {
get {
object obj = ResourceManager.GetObject("dot_standard", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap dot_ultimate {
get {
object obj = ResourceManager.GetObject("dot_ultimate", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>

View File

@@ -292,4 +292,13 @@
<data name="MFont" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Font.otf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="dot_eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\dot-eco.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="dot_standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\dot-standard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="dot_ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\dot-ultimate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -78,6 +78,24 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Restart your device to apply changes.
/// </summary>
internal static string AlertAPUMemoryRestart {
get {
return ResourceManager.GetString("AlertAPUMemoryRestart", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Restart now?.
/// </summary>
internal static string AlertAPUMemoryRestartTitle {
get {
return ResourceManager.GetString("AlertAPUMemoryRestartTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Looks like GPU is in heavy use, disable it?.
/// </summary>
@@ -195,6 +213,15 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Memory Assigned to GPU.
/// </summary>
internal static string APUMemory {
get {
return ResourceManager.GetString("APUMemory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Asus Services Running.
/// </summary>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Verbindung zu ASUS ACPI fehlgeschlagen. G-Helper kann nicht ausgeführt werden. Bitte installiere ASUS System Control Interface.</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Die GPU wird gerade verwendet. Trotzdem deaktivieren?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Windows Leistungsmodus automatisch anpassen</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>ASUS Dienste laufen</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>No se pudo conectar con ASUS ACPI. La aplicación no puede funcionar sin el recurso. Instale Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Reinicia el dispositivo para aplicar los cambios</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>¿Reiniciar ahora?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Detectado uso intensivo de la GPU, ¿deshabilitarla?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Autoajustar plan de energía Windows</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memoria asignada a GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Servicios de Asus en ejecución</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Connexion impossible avec ASUS ACPI. L'application ne peut fonctionner sans. Veuillez installer Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Le GPU semble être surchargé, voulez vous le désactiver ?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Ajustement auto des modes de gestion alim. Windows</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Services Asus actifs</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Nem sikerült csatlakozni az ASUS ACPI-hez, az alkalmazás nem működik enélkül. Próbáld meg telepíteni az ASUS rendszervezérlő interfész-t</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Úgy tűnik használatban van a GPU. Biztosan letiltod?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>A Windows energiagazdálkodási módok automatikus beállítása</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Asus szolgáltatások futnak</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Tidak dapat terhubung ke ASUS ACPI. tanpanya aplikasi tidak dapat berfungsi. Cobalah untuk menginstal Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Tampaknya GPU sedang digunakan intensif, nonaktifkan?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Otomatis sesuaikan Mode Daya Windows</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Layanan Asus Berjalan</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Impossibile connettersi ad ASUS ACPI. Senza di essa l'applicazione non può funzionare. Prova ad installare Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Uso intensivo della GPU, disabilitare?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Regola Piano Energetico di Windows in automatico</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Servizi Asus in Esecuzione</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>ASUS ACPI에 연결할 수 없어 응용 프로그램이 작동하지 않습니다. Asus System Control Interface를 먼저 설치하십시오.</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>GPU 사용량이 높습니다. 비활성화 하시겠습니까?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>윈도우 전원 모드 자동조절</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>실행중인 Asus 서비스</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Nepavyko prisijungti prie ASUS ACPI. Programėlė be jo negali veikti. Pabandykite įdiegti Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Panašu, kad jūsų GPU yra intensyviai naudojamas. Išjungti jį?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Automatiškai derinti Windows energijos režimus</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Veikiančios Asus tarnybos</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Nie można odnaleźć sterownika ASUS ACPI. Aplikacja nie może bez niego funkcjonować. Spróbuj zainstalować Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Uruchom ponownie, aby zastosować ustawienia</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Uruchomić ponownie teraz?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Wygląda na to, że GPU jest mocno obciążone. Wyłączyć?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Dostosuj systemowy Tryb Zasilania</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Pamięć przypisana do GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Uruchomione usługi Asus</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Não foi possível conectar ao ASUS ACPI. O aplicativo não pode funcionar sem isso. Tente instalar Asus System Controle Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Parece que o GPU está em uso pesado.</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Ajuste automático dos modos de energia do Windows</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Serviços da Asus em execução</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Não foi possível conectar ao ASUS ACPI. O programa não funciona sem esse serviço. Tente instalar Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Parece que o GPU está em uso pesado, desativá-lo?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Ajuste automático dos modos de energia do Windows</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Serviços da Asus em execução</value>
</data>
@@ -253,7 +262,7 @@
<value>Estado da bateria</value>
</data>
<data name="BatteryLimitFull" xml:space="preserve">
<value>One time charge to 100%</value>
<value>Carregamento único até 100%</value>
</data>
<data name="BiosAndDriverUpdates" xml:space="preserve">
<value>Atualizações de Drivers e da BIOS</value>
@@ -262,7 +271,7 @@
<value>Ao ligar</value>
</data>
<data name="BootSound" xml:space="preserve">
<value>Boot Sound</value>
<value>Som de ligar</value>
</data>
<data name="Brightness" xml:space="preserve">
<value>Nível do brilho</value>
@@ -274,7 +283,7 @@
<value>Aumentar o brilho</value>
</data>
<data name="Calibrate" xml:space="preserve">
<value>Calibrate</value>
<value>Calibrar</value>
</data>
<data name="Charging" xml:space="preserve">
<value>Carregando</value>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Can't connect to ASUS ACPI. Application can't function without it. Try to install Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Looks like GPU is in heavy use, disable it?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto adjust Windows Power Modes</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Asus Services Running</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Nu se poate conecta la ASUS ACPI. Aplicația nu poate funcționa fără aceasta. Încercați să instalați Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Se pare că GPU-ul este folosit intens, dezactivați?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Reglare automată a modului de alimentare Windows</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Servicii Asus în derulare</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>ASUS ACPI'ye bağlanılamıyor. Uygulama o olmadan çalışamaz. Asus Sistem Kontrol Arayüzü'nü yüklemeyi deneyin.</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Görünüşe göre GPU yoğun bir şekilde kullanılıyor, devre dışı bırakılsın mı?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Windows Güç Modunu otomatik ayarla</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Çalışan Asus Hizmetleri</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Не вдається під'єднатися до ASUS ACPI. Програма не може працювати без нього. Спробуйте встановити Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Здається, що GPU використовується, вимкнути її?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Автоматично застосовувати Windows Power Modes</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Кількість запущених сервісів Asus</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>Không thể kết nối đến ASUS ACPI. Chương trình cần nó để có thể hoạt động. Hãy thử cài lại Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>Có vẻ như GPU rời đang được sử dụng nhiều, tắt nó?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Tự động điều chỉnh Kế hoạch nguồn của Windows</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>Dịch vụ Asus đang chạy</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>无法连接到ASUS ACPI。 没有它应用程序将无法运行。 请尝试安装Asus System Control Interface驱动。</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>看起来 GPU 正在被重度使用,是否禁用?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>自动调整Windows电源模式</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>正在运行的 Asus 服务</value>
</data>

View File

@@ -123,6 +123,12 @@
<data name="ACPIError" xml:space="preserve">
<value>無法連結到華碩 ACPI。 没有它,應用程式將無法執行。 嘗試安裝Asus System Control Interface</value>
</data>
<data name="AlertAPUMemoryRestart" xml:space="preserve">
<value>Restart your device to apply changes</value>
</data>
<data name="AlertAPUMemoryRestartTitle" xml:space="preserve">
<value>Restart now?</value>
</data>
<data name="AlertDGPU" xml:space="preserve">
<value>看起来 GPU 正在大量使用,是否禁用它?</value>
</data>
@@ -162,6 +168,9 @@
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>自動調整Windows電源模式</value>
</data>
<data name="APUMemory" xml:space="preserve">
<value>Memory Assigned to GPU</value>
</data>
<data name="AsusServicesRunning" xml:space="preserve">
<value>執行中的華碩服務</value>
</data>

BIN
app/Resources/dot-eco.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

View File

@@ -206,10 +206,10 @@ namespace GHelper
comboMatrixRunning.FormattingEnabled = true;
comboMatrixRunning.ItemHeight = 32;
comboMatrixRunning.Items.AddRange(new object[] { Properties.Strings.MatrixBanner, Properties.Strings.MatrixLogo, Properties.Strings.MatrixPicture, Properties.Strings.MatrixClock, Properties.Strings.MatrixAudio });
comboMatrixRunning.Location = new Point(266, 11);
comboMatrixRunning.Margin = new Padding(4, 11, 4, 8);
comboMatrixRunning.Location = new Point(269, 11);
comboMatrixRunning.Margin = new Padding(7, 11, 7, 8);
comboMatrixRunning.Name = "comboMatrixRunning";
comboMatrixRunning.Size = new Size(254, 40);
comboMatrixRunning.Size = new Size(248, 40);
comboMatrixRunning.TabIndex = 17;
//
// buttonMatrix
@@ -1439,7 +1439,6 @@ namespace GHelper
MinimumSize = new Size(822, 71);
Name = "SettingsForm";
Padding = new Padding(11);
ShowIcon = false;
StartPosition = FormStartPosition.CenterScreen;
Text = "G-Helper";
panelMatrix.ResumeLayout(false);
@@ -1574,4 +1573,4 @@ namespace GHelper
private RButton buttonFnLock;
private RButton buttonBatteryFull;
}
}
}

View File

@@ -16,14 +16,12 @@ using System.Timers;
namespace GHelper
{
public partial class SettingsForm : RForm
{
ContextMenuStrip contextMenuStrip = new CustomContextMenu();
ToolStripMenuItem menuSilent, menuBalanced, menuTurbo, menuEco, menuStandard, menuUltimate, menuOptimized;
GPUModeControl gpuControl;
public GPUModeControl gpuControl;
ScreenControl screenControl = new ScreenControl();
AutoUpdateControl updateControl;
@@ -1151,7 +1149,6 @@ namespace GHelper
});
}
public void VisualiseGPUMode(int GPUMode = -1)
{
ButtonEnabled(buttonOptimized, true);
@@ -1177,11 +1174,13 @@ namespace GHelper
buttonOptimized.Activated = GPUAuto;
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeEco;
Program.trayIcon.Icon = Properties.Resources.eco;
IconHelper.SetIcon(this, Properties.Resources.dot_eco);
break;
case AsusACPI.GPUModeUltimate:
buttonUltimate.Activated = true;
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeUltimate;
Program.trayIcon.Icon = Properties.Resources.ultimate;
IconHelper.SetIcon(this, Properties.Resources.dot_ultimate);
break;
default:
buttonOptimized.BorderColor = colorStandard;
@@ -1189,6 +1188,7 @@ namespace GHelper
buttonOptimized.Activated = GPUAuto;
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeStandard;
Program.trayIcon.Icon = Properties.Resources.standard;
IconHelper.SetIcon(this, Properties.Resources.dot_standard);
break;
}

31
app/UI/IconHelper.cs Normal file
View File

@@ -0,0 +1,31 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace GHelper.UI
{
public class IconHelper
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
private const uint WM_SETICON = 0x80u;
private const int ICON_SMALL = 0;
private const int ICON_BIG = 1;
public static void SetIcon(Form form, Bitmap icon)
{
try
{
SendMessage(form.Handle, WM_SETICON, ICON_BIG, Icon.ExtractAssociatedIcon(Application.ExecutablePath)!.Handle);
SendMessage(form.Handle, WM_SETICON, ICON_SMALL, icon.GetHicon());
}
catch (Exception ex)
{
Debug.WriteLine($"Error setting icon {ex.Message}");
}
}
}
}

View File

@@ -12,67 +12,96 @@ public static class AsusHid
static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0, 0x18c6, 0x1abe };
static HidStream auraStream;
static HidStream? auraStream;
public static HidStream FindHidStream(byte reportId, int minFeatureLength = 1)
public static IEnumerable<HidDevice>? FindDevices(byte reportId)
{
HidDeviceLoader loader = new HidDeviceLoader();
var deviceList = loader.GetDevices(ASUS_ID).Where(device => deviceIds.Contains(device.ProductID));
IEnumerable<HidDevice> deviceList;
foreach (var device in deviceList) if (device.CanOpen)
try
{
deviceList = loader.GetDevices(ASUS_ID).Where(device => deviceIds.Contains(device.ProductID) && device.CanOpen && device.GetMaxFeatureReportLength() > 0);
}
catch (Exception ex)
{
Logger.WriteLine($"Error enumerating HID devices: {ex.Message}");
yield break;
}
foreach (var device in deviceList)
if (device.GetReportDescriptor().TryGetReport(ReportType.Feature, reportId, out _))
yield return device;
}
public static HidStream? FindHidStream(byte reportId)
{
try
{
var devices = FindDevices(reportId);
if (devices is null) return null;
if (AppConfig.IsZ13())
{
try
{
var config = new OpenConfiguration();
config.SetOption(OpenOption.Interruptible, false);
config.SetOption(OpenOption.Exclusive, false);
config.SetOption(OpenOption.Priority, 10);
HidStream hidStream = device.Open();
if (device.GetMaxFeatureReportLength() >= minFeatureLength)
{
var reportDescriptor = device.GetReportDescriptor();
if (reportDescriptor.TryGetReport(ReportType.Feature, reportId, out _))
{
return hidStream;
}
}
hidStream.Close();
hidStream.Dispose();
}
catch (Exception ex)
{
Debug.WriteLine($"Error accessing HID device: {ex.Message}");
}
var z13 = devices.Where(device => device.ProductID == 0x1a30).FirstOrDefault();
if (z13 is not null) return z13.Open();
}
return devices.FirstOrDefault()?.Open();
}
catch (Exception ex)
{
Logger.WriteLine($"Error accessing HID device: {ex.Message}");
}
return null;
}
static void WriteData(HidStream stream, byte[] data, string log = "USB")
public static void WriteInput(byte[] data, string log = "USB")
{
try
foreach (var device in FindDevices(INPUT_ID))
{
stream.Write(data);
Logger.WriteLine($"{log} " + stream.Device.ProductID + ": " + BitConverter.ToString(data));
}
catch (Exception ex)
{
Debug.WriteLine($"Error writing {log} to HID device: {ex.Message} {BitConverter.ToString(data)}");
try
{
using (var stream = device.Open())
{
var payload = new byte[device.GetMaxFeatureReportLength()];
Array.Copy(data, payload, data.Length);
stream.SetFeature(payload);
Logger.WriteLine($"{log} Feature {device.ProductID.ToString("X")}|{device.GetMaxFeatureReportLength()}: {BitConverter.ToString(data)}");
}
}
catch (Exception ex)
{
Logger.WriteLine($"Error setting feature {device.GetMaxFeatureReportLength()} {device.DevicePath}: {BitConverter.ToString(data)} {ex.Message}");
}
}
}
public static void Write(byte[] data, byte reportId = AURA_ID, string log = "USB")
public static void Write(byte[] data, string log = "USB")
{
using (var stream = FindHidStream(reportId))
WriteData(stream, data, log);
Write(new List<byte[]> { data }, log);
}
public static void Write(List<byte[]> dataList, byte reportId = AURA_ID)
public static void Write(List<byte[]> dataList, string log = "USB")
{
using (var stream = FindHidStream(reportId))
foreach (var data in dataList)
WriteData(stream, data);
var devices = FindDevices(AURA_ID);
if (devices is null) return;
foreach (var device in devices)
using (var stream = device.Open())
foreach (var data in dataList)
try
{
stream.Write(data);
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
}
catch (Exception ex)
{
Logger.WriteLine($"Error writing {log} {device.ProductID.ToString("X")}: {ex.Message} {BitConverter.ToString(data)} ");
}
}
public static void WriteAura(byte[] data)
@@ -88,7 +117,7 @@ public static class AsusHid
catch (Exception ex)
{
auraStream.Dispose();
Debug.WriteLine($"Error writing data to HID device: {ex.Message}");
Debug.WriteLine($"Error writing data to HID device: {ex.Message} {BitConverter.ToString(data)}");
}
}

View File

@@ -1,5 +1,9 @@
using GHelper.Gpu;
using GHelper.Helpers;
using GHelper.Input;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Text;
namespace GHelper.USB
@@ -47,6 +51,7 @@ namespace GHelper.USB
Flash = 12,
HEATMAP = 20,
GPUMODE = 21,
AMBIENT = 22,
}
public enum AuraSpeed : int
@@ -63,6 +68,8 @@ namespace GHelper.USB
static byte[] MESSAGE_APPLY = { AsusHid.AURA_ID, 0xb4 };
static byte[] MESSAGE_SET = { AsusHid.AURA_ID, 0xb5, 0, 0, 0 };
static readonly int AURA_ZONES = 8;
private static AuraMode mode = AuraMode.AuraStatic;
private static AuraSpeed speed = AuraSpeed.Normal;
@@ -72,6 +79,9 @@ namespace GHelper.USB
static bool isACPI = AppConfig.IsTUF() || AppConfig.IsVivobook();
static bool isStrix = AppConfig.IsStrix();
static bool isStrix4Zone = AppConfig.IsStrixLimitedRGB();
static bool isStrixNumpad = AppConfig.IsStrixNumpad();
static public bool isSingleColor = false;
static bool isOldHeatmap = AppConfig.Is("old_heatmap");
@@ -93,7 +103,8 @@ namespace GHelper.USB
{ AuraMode.AuraRainbow, Properties.Strings.AuraRainbow },
{ AuraMode.AuraStrobe, Properties.Strings.AuraStrobe },
{ AuraMode.HEATMAP, "Heatmap"},
{ AuraMode.GPUMODE, "GPU Mode" }
{ AuraMode.GPUMODE, "GPU Mode" },
{ AuraMode.AMBIENT, "Ambient"},
};
private static Dictionary<AuraMode, string> _modesStrix = new Dictionary<AuraMode, string>
@@ -111,6 +122,7 @@ namespace GHelper.USB
{ AuraMode.Comet, "Comet" },
{ AuraMode.Flash, "Flash" },
{ AuraMode.HEATMAP, "Heatmap"},
{ AuraMode.AMBIENT, "Ambient"},
};
static Aura()
@@ -119,33 +131,12 @@ namespace GHelper.USB
isSingleColor = AppConfig.IsSingleColor(); // Mono Color
if (AppConfig.ContainsModel("GA402X") || AppConfig.ContainsModel("GA402N"))
using (var stream = AsusHid.FindHidStream(AsusHid.AURA_ID))
{
if (stream is null) return;
if (stream.Device.ReleaseNumberBcd == 22 || stream.Device.ReleaseNumberBcd == 23) isSingleColor = true;
stream.Close();
}
}
private static void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
SetHeatmap();
}
static void SetHeatmap(bool init = false)
{
float cpuTemp = (float)HardwareControl.GetCPUTemp();
int freeze = 20, cold = 40, warm = 65, hot = 90;
Color color;
//Debug.WriteLine(cpuTemp);
if (cpuTemp < cold) color = ColorUtilities.GetWeightedAverage(Color.Blue, Color.Green, ((float)cpuTemp - freeze) / (cold - freeze));
else if (cpuTemp < warm) color = ColorUtilities.GetWeightedAverage(Color.Green, Color.Yellow, ((float)cpuTemp - cold) / (warm - cold));
else if (cpuTemp < hot) color = ColorUtilities.GetWeightedAverage(Color.Yellow, Color.Red, ((float)cpuTemp - warm) / (hot - warm));
else color = Color.Red;
ApplyColor(color, init);
{
var device = AsusHid.FindDevices(AsusHid.AURA_ID).FirstOrDefault();
if (device is null) return;
Logger.WriteLine($"GA402: {device.ReleaseNumberBcd} {device.ReleaseNumber}");
if (device.ReleaseNumberBcd >= 22 && device.ReleaseNumberBcd <= 25) isSingleColor = true;
}
}
public static Dictionary<AuraSpeed, string> GetSpeeds()
@@ -218,6 +209,22 @@ namespace GHelper.USB
return mode == AuraMode.AuraBreathe && !isACPI;
}
private static void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
if (!InputDispatcher.backlightActivity)
return;
if (Mode == AuraMode.HEATMAP)
{
CustomRGB.ApplyHeatmap();
}
else if (Mode == AuraMode.AMBIENT)
{
CustomRGB.ApplyAmbient();
}
}
public static byte[] AuraMessage(AuraMode mode, Color color, Color color2, int speed, bool mono = false)
{
@@ -246,8 +253,8 @@ namespace GHelper.USB
new byte[] { AsusHid.AURA_ID, 0xb9 },
Encoding.ASCII.GetBytes("]ASUS Tech.Inc."),
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1a },
Encoding.ASCII.GetBytes("^ASUS Tech.Inc."),
new byte[] { 0x5e, 0x05, 0x20, 0x31, 0, 0x1a }
//Encoding.ASCII.GetBytes("^ASUS Tech.Inc."),
//new byte[] { 0x5e, 0x05, 0x20, 0x31, 0, 0x1a }
});
});
}
@@ -260,9 +267,9 @@ namespace GHelper.USB
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
if (isACPI) Program.acpi.TUFKeyboardBrightness(brightness);
AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, AsusHid.AURA_ID, log);
if (AppConfig.ContainsModel("GA503"))
AsusHid.Write(new byte[] { AsusHid.INPUT_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, AsusHid.INPUT_ID, log);
AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log);
if (AppConfig.ContainsModel("GA503"))
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log);
});
@@ -355,6 +362,166 @@ namespace GHelper.USB
}
static byte[] packetMap = new byte[]
{
/* VDN VUP MICM HPFN ARMC */
2, 3, 4, 5, 6,
/* ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 DEL15 DEL17 PAUS PRT HOME */
21, 23, 24, 25, 26, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41,
/* BKTK 1 2 3 4 5 6 7 8 9 0 - = BSPC BSPC BSPC PLY15 NMLK NMDV NMTM NMMI */
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
/* TAB Q W E R T Y U I O P [ ] \ STP15 NM7 NM8 NM9 NMPL */
63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 79, 80, 81, 82, 83,
/* CPLK A S D F G H J K L ; " # ENTR ENTR ENTR PRV15 NM4 NM5 NM6 NMPL */
84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
/* LSFT ISO\ Z X C V B N M , . / RSFT RSFT RSFT ARWU NXT15 NM1 NM2 NM3 NMER */
105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 139, 121, 122, 123, 124, 125,
/* LCTL LFNC LWIN LALT SPC RALT RFNC RCTL ARWL ARWD ARWR PRT15 NM0 NMPD NMER */
126, 127, 128, 129, 131, 135, 136, 137, 159, 160, 161, 142, 144, 145, 146,
/* LB1 LB2 LB3 LB4 LB5 LB6 */
174, 173, 172, 171, 170, 169,
/* KSTN LOGO LIDL LIDR */
0, 167, 176, 177,
};
static byte[] packetZone = new byte[]
{
/* VDN VUP MICM HPFN ARMC */
0, 0, 1, 1, 1,
/* ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 DEL15 DEL17 PAUS PRT HOM */
0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
/* BKTK 1 2 3 4 5 6 7 8 9 0 - = BSPC BSPC BSPC PLY15 NMLK NMDV NMTM NMMI */
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
/* TAB Q W E R T Y U I O P [ ] \ STP15 NM7 NM8 NM9 NMPL */
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
/* CPLK A S D F G H J K L ; " # ENTR ENTR ENTR PRV15 NM4 NM5 NM6 NMPL */
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
/* LSFT ISO\ Z X C V B N M , . / RSFT RSFT RSFT ARWU NXT15 NM1 NM2 NM3 NMER */
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
/* LCTL LFNC LWIN LALT SPC RALT RFNC RCTL ARWL ARWD ARWR PRT15 NM0 NMPD NMER */
0, 0, 0, 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
/* LB1 LB1 LB3 LB4 LB5 LB6 */
5, 5, 4, 6, 7, 7,
/* KSTN LOGO LIDL LIDR */
3, 0, 0, 3,
};
static byte[] packetZoneNumpad = new byte[]
{
/* VDN VUP MICM HPFN ARMC */
0, 0, 0, 1, 1,
/* ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 DEL15 DEL17 PAUS PRT HOM */
0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3,
/* BKTK 1 2 3 4 5 6 7 8 9 0 - = BSPC BSPC BSPC PLY15 NMLK NMDV NMTM NMMI */
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
/* TAB Q W E R T Y U I O P [ ] \ STP15 NM7 NM8 NM9 NMPL */
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3,
/* CPLK A S D F G H J K L ; " # ENTR ENTR ENTR PRV15 NM4 NM5 NM6 NMPL */
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
/* LSFT ISO\ Z X C V B N M , . / RSFT RSFT RSFT ARWU NXT15 NM1 NM2 NM3 NMER */
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
/* LCTL LFNC LWIN LALT SPC RALT RFNC RCTL ARWL ARWD ARWR PRT15 NM0 NMPD NMER */
0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3,
/* LB1 LB1 LB3 LB4 LB5 LB6 */
5, 5, 4, 6, 7, 7,
/* KSTN LOGO LIDL LIDR */
3, 0, 0, 3,
};
static byte[] packet4Zone = new byte[]
{
/*01 Z1 Z2 Z3 Z4 NA NA KeyZone */
0, 1, 2, 3, 0, 0,
/*02 RR R RM LM L LL LighBar */
7, 7, 6, 5, 4, 4,
};
public static void ApplyDirect(Color[] color, bool init = false)
{
const byte keySet = 167;
const byte ledCount = 178;
const ushort mapSize = 3 * ledCount;
const byte ledsPerPacket = 16;
byte[] buffer = new byte[64];
byte[] keyBuf = new byte[mapSize];
buffer[0] = AsusHid.AURA_ID;
buffer[1] = 0xbc;
buffer[2] = 0;
buffer[3] = 1;
buffer[4] = 1;
buffer[5] = 1;
buffer[6] = 0;
buffer[7] = 0x10;
if (init)
{
Init();
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc });
}
Array.Clear(keyBuf, 0, keyBuf.Length);
if (!isStrix4Zone) // per key
{
for (int ledIndex = 0; ledIndex < packetMap.Count(); ledIndex++)
{
ushort offset = (ushort)(3 * packetMap[ledIndex]);
byte zone = isStrixNumpad ? packetZoneNumpad[ledIndex] : packetZone[ledIndex];
keyBuf[offset] = color[zone].R;
keyBuf[offset + 1] = color[zone].G;
keyBuf[offset + 2] = color[zone].B;
}
for (int i = 0; i < keySet; i += ledsPerPacket)
{
byte ledsRemaining = (byte)(keySet - i);
if (ledsRemaining < ledsPerPacket)
{
buffer[7] = ledsRemaining;
}
buffer[6] = (byte)i;
Buffer.BlockCopy(keyBuf, 3 * i, buffer, 9, 3 * buffer[7]);
AsusHid.WriteAura(buffer);
}
}
buffer[4] = 0x04;
buffer[5] = 0x00;
buffer[6] = 0x00;
buffer[7] = 0x00;
if (isStrix4Zone) { // per zone
var leds_4_zone = packet4Zone.Count();
for (int ledIndex = 0; ledIndex < leds_4_zone; ledIndex++)
{
byte zone = packet4Zone[ledIndex];
keyBuf[ledIndex * 3] = color[zone].R;
keyBuf[ledIndex * 3 + 1] = color[zone].G;
keyBuf[ledIndex * 3 + 2] = color[zone].B;
}
Buffer.BlockCopy(keyBuf, 0, buffer, 9, 3 * leds_4_zone);
AsusHid.WriteAura(buffer);
return;
}
Buffer.BlockCopy(keyBuf, 3 * keySet, buffer, 9, 3 * (ledCount - keySet));
AsusHid.WriteAura(buffer);
}
public static void ApplyColor(Color color, bool init = false)
{
@@ -366,47 +533,8 @@ namespace GHelper.USB
if (isStrix && !isOldHeatmap)
{
byte[] msg = new byte[0x40];
byte start = 9;
byte maxLeds = 0x93;
msg[0] = AsusHid.AURA_ID;
msg[1] = 0xbc;
msg[2] = 0;
msg[3] = 1;
msg[4] = 1;
msg[5] = 1;
msg[6] = 0;
msg[7] = 0x10;
for (byte i = 0; i < 0x12; i++)
{
msg[start + i * 3] = color.R; // R
msg[start + 1 + i * 3] = color.G; // G
msg[start + 2 + i * 3] = color.B; // B
}
if (init)
{
Init();
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc });
}
for (byte b = 0; b < maxLeds; b += 0x10)
{
msg[6] = b;
AsusHid.WriteAura(msg);
}
msg[6] = maxLeds;
AsusHid.WriteAura(msg);
msg[4] = 4;
msg[5] = 0;
msg[6] = 0;
msg[7] = 0;
AsusHid.WriteAura(msg);
ApplyDirect(Enumerable.Repeat(color, AURA_ZONES).ToArray(), init);
return;
}
else
@@ -417,26 +545,6 @@ namespace GHelper.USB
}
public static void ApplyGPUColor()
{
if ((AuraMode)AppConfig.Get("aura_mode") != AuraMode.GPUMODE) return;
switch (GPUModeControl.gpuMode)
{
case AsusACPI.GPUModeUltimate:
ApplyColor(Color.Red, true);
break;
case AsusACPI.GPUModeEco:
ApplyColor(Color.Green, true);
break;
default:
ApplyColor(Color.Yellow, true);
break;
}
}
public static void ApplyAura()
{
@@ -449,14 +557,23 @@ namespace GHelper.USB
if (Mode == AuraMode.HEATMAP)
{
SetHeatmap(true);
CustomRGB.ApplyHeatmap(true);
timer.Enabled = true;
timer.Interval = 2000;
return;
}
if (Mode == AuraMode.AMBIENT)
{
CustomRGB.ApplyAmbient(true);
timer.Enabled = true;
timer.Interval = 100;
return;
}
if (Mode == AuraMode.GPUMODE)
{
ApplyGPUColor();
CustomRGB.ApplyGPUColor();
return;
}
@@ -470,6 +587,210 @@ namespace GHelper.USB
}
public static class CustomRGB
{
public static void ApplyGPUColor()
{
if ((AuraMode)AppConfig.Get("aura_mode") != AuraMode.GPUMODE) return;
switch (GPUModeControl.gpuMode)
{
case AsusACPI.GPUModeUltimate:
ApplyColor(Color.Red, true);
break;
case AsusACPI.GPUModeEco:
ApplyColor(Color.Green, true);
break;
default:
ApplyColor(Color.Yellow, true);
break;
}
}
public static void ApplyHeatmap(bool init = false)
{
float cpuTemp = (float)HardwareControl.GetCPUTemp();
int freeze = 20, cold = 40, warm = 65, hot = 90;
Color color;
//Debug.WriteLine(cpuTemp);
if (cpuTemp < cold) color = ColorUtils.GetWeightedAverage(Color.Blue, Color.Green, ((float)cpuTemp - freeze) / (cold - freeze));
else if (cpuTemp < warm) color = ColorUtils.GetWeightedAverage(Color.Green, Color.Yellow, ((float)cpuTemp - cold) / (warm - cold));
else if (cpuTemp < hot) color = ColorUtils.GetWeightedAverage(Color.Yellow, Color.Red, ((float)cpuTemp - warm) / (hot - warm));
else color = Color.Red;
ApplyColor(color, init);
}
public static void ApplyAmbient(bool init = false)
{
var bound = Screen.GetBounds(Point.Empty);
bound.Y += bound.Height / 3;
bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel
Bitmap screen_low = screen_low = AmbientData.CamptureScreen(bound, 512, 288); //quality decreases greatly if it is less 512 ;
Bitmap screeb_pxl;
int zones = AURA_ZONES;
if (isStrix) // laptop with lightbar
{
screeb_pxl = AmbientData.ResizeImage(screen_low, 4, 2); // 4x2 zone. top for keyboard and bot for lightbar
var mid_left = ColorUtils.GetMidColor(screeb_pxl.GetPixel(0, 1), screeb_pxl.GetPixel(1, 1));
var mid_right = ColorUtils.GetMidColor(screeb_pxl.GetPixel(2, 1), screeb_pxl.GetPixel(3, 1));
AmbientData.Colors[4].RGB = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(1, 1)); // left bck
AmbientData.Colors[5].RGB = ColorUtils.HSV.UpSaturation(mid_left); // center left
AmbientData.Colors[6].RGB = ColorUtils.HSV.UpSaturation(mid_right); // center right
AmbientData.Colors[7].RGB = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(3, 1)); // right bck
for (int i = 0; i < 4; i++) // keyboard
AmbientData.Colors[i].RGB = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(i, 0));
}
else
{
zones = 1;
screeb_pxl = AmbientData.ResizeImage(screen_low, 1, 1);
AmbientData.Colors[0].RGB = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(0, 0), (float)0.3);
}
//screeb_pxl.Save("test.jpg", ImageFormat.Jpeg);
screen_low.Dispose();
screeb_pxl.Dispose();
bool is_fresh = false;
for (int i = 0; i < zones; i++)
{
if (AmbientData.result[i].ToArgb() != AmbientData.Colors[i].RGB.ToArgb()) is_fresh = true;
AmbientData.result[i] = AmbientData.Colors[i].RGB;
}
if (is_fresh)
{
if (isStrix) ApplyDirect(AmbientData.result, init);
else ApplyColor(AmbientData.result[0], init);
}
}
static class AmbientData
{
public enum StretchMode
{
STRETCH_ANDSCANS = 1,
STRETCH_ORSCANS = 2,
STRETCH_DELETESCANS = 3,
STRETCH_HALFTONE = 4,
}
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hWnd);
[DllImport("gdi32.dll")]
private static extern IntPtr CreateCompatibleDC(IntPtr hDC);
[DllImport("gdi32.dll")]
private static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int nWidth, int nHeight);
[DllImport("gdi32.dll")]
private static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
[DllImport("user32.dll")]
private static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("gdi32.dll")]
private static extern bool DeleteDC(IntPtr hdc);
[DllImport("gdi32.dll")]
private static extern bool DeleteObject(IntPtr hObject);
[DllImport("gdi32.dll")]
private static extern bool StretchBlt(IntPtr hdcDest, int nXOriginDest, int nYOriginDest,
int nWidthDest, int nHeightDest,
IntPtr hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, Int32 dwRop);
[DllImport("gdi32.dll")]
static extern bool SetStretchBltMode(IntPtr hdc, StretchMode iStretchMode);
/// <summary>
/// Captures a screenshot.
/// </summary>
public static Bitmap CamptureScreen(Rectangle rec, int out_w, int out_h)
{
IntPtr desktop = GetDesktopWindow();
IntPtr hdc = GetWindowDC(desktop);
IntPtr hdcMem = CreateCompatibleDC(hdc);
IntPtr hBitmap = CreateCompatibleBitmap(hdc, out_w, out_h);
IntPtr hOld = SelectObject(hdcMem, hBitmap);
SetStretchBltMode(hdcMem, StretchMode.STRETCH_DELETESCANS);
StretchBlt(hdcMem, 0, 0, out_w, out_h, hdc, rec.X, rec.Y, rec.Width, rec.Height, 0x00CC0020);
SelectObject(hdcMem, hOld);
DeleteDC(hdcMem);
ReleaseDC(desktop, hdc);
var result = Image.FromHbitmap(hBitmap, IntPtr.Zero);
DeleteObject(hBitmap);
return result;
}
public static Bitmap ResizeImage(Image image, int width, int height)
{
var destRect = new Rectangle(0, 0, width, height);
var destImage = new Bitmap(width, height);
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
using (var graphics = Graphics.FromImage(destImage))
{
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.Bicubic;
graphics.SmoothingMode = SmoothingMode.None;
graphics.PixelOffsetMode = PixelOffsetMode.None;
using (var wrapMode = new ImageAttributes())
{
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
}
}
return destImage;
}
static public Color[] result = new Color[AURA_ZONES];
static public ColorUtils.SmoothColor[] Colors = Enumerable.Repeat(0, AURA_ZONES).
Select(h => new ColorUtils.SmoothColor()).ToArray();
public static Color GetMostUsedColor(Bitmap bitMap)
{
var colorIncidence = new Dictionary<int, int>();
for (var x = 0; x < bitMap.Size.Width; x++)
for (var y = 0; y < bitMap.Size.Height; y++)
{
var pixelColor = bitMap.GetPixel(x, y).ToArgb();
if (colorIncidence.Keys.Contains(pixelColor))
colorIncidence[pixelColor]++;
else
colorIncidence.Add(pixelColor, 1);
}
return Color.FromArgb(colorIncidence.OrderByDescending(x => x.Value).ToDictionary(x => x.Key, x => x.Value).First().Key);
}
}
}
}
}

View File

@@ -1,7 +1,6 @@
// Reference : thanks to https://github.com/RomanYazvinsky/ for initial discovery of XGM payloads
using HidSharp;
using System.Diagnostics;
using System.Text;
namespace GHelper.USB
@@ -9,30 +8,37 @@ namespace GHelper.USB
public static class XGM
{
const int XGM_ID = 0x1970;
public const int ASUS_ID = 0x0b05;
const int ASUS_ID = 0x0b05;
public static void Write(byte[] data)
{
HidDeviceLoader loader = new HidDeviceLoader();
HidDevice device = loader.GetDevices(ASUS_ID, XGM_ID).Where(device => device.GetMaxFeatureReportLength() >= 300).FirstOrDefault();
if (device is null) return;
try
{
HidDevice device = loader.GetDevices(ASUS_ID, XGM_ID).Where(device => device.CanOpen && device.GetMaxFeatureReportLength() >= 300).FirstOrDefault();
if (device is null)
{
Logger.WriteLine("XGM SUB device not found");
return;
}
using (HidStream hidStream = device.Open())
{
var payload = new byte[300];
Array.Copy(data, payload, data.Length);
hidStream.Write(payload);
Logger.WriteLine("XGM " + device.ProductID + "|" + device.GetMaxFeatureReportLength() + ":" + BitConverter.ToString(data));
hidStream.SetFeature(payload);
Logger.WriteLine("XGM-" + device.ProductID + "|" + device.GetMaxFeatureReportLength() + ":" + BitConverter.ToString(data));
hidStream.Close();
}
}
catch (Exception ex)
{
Debug.WriteLine($"Error accessing HID device: {ex.Message}");
Logger.WriteLine($"Error accessing XGM device: {ex}");
}
}
public static void Init()

View File

@@ -55,10 +55,10 @@ namespace GHelper
tableBios.AutoSize = true;
tableBios.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableBios.ColumnCount = 4;
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 23F));
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 22F));
tableBios.Dock = DockStyle.Top;
tableBios.Location = new Point(20, 20);
tableBios.Margin = new Padding(4);
@@ -99,14 +99,14 @@ namespace GHelper
panelBiosTitle.Location = new Point(0, 0);
panelBiosTitle.Margin = new Padding(4);
panelBiosTitle.Name = "panelBiosTitle";
panelBiosTitle.Size = new Size(1256, 62);
panelBiosTitle.Size = new Size(1294, 62);
panelBiosTitle.TabIndex = 3;
//
// labelUpdates
//
labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right;
labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelUpdates.Location = new Point(810, 23);
labelUpdates.Location = new Point(848, 23);
labelUpdates.Name = "labelUpdates";
labelUpdates.Size = new Size(245, 32);
labelUpdates.TabIndex = 4;
@@ -122,7 +122,7 @@ namespace GHelper
buttonRefresh.FlatAppearance.BorderSize = 0;
buttonRefresh.FlatStyle = FlatStyle.Flat;
buttonRefresh.Image = Properties.Resources.icons8_refresh_32;
buttonRefresh.Location = new Point(1183, 14);
buttonRefresh.Location = new Point(1221, 14);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Secondary = true;
buttonRefresh.Size = new Size(52, 46);
@@ -138,7 +138,7 @@ namespace GHelper
panelBios.Margin = new Padding(4);
panelBios.Name = "panelBios";
panelBios.Padding = new Padding(20);
panelBios.Size = new Size(1256, 40);
panelBios.Size = new Size(1294, 40);
panelBios.TabIndex = 4;
//
// panelDrivers
@@ -150,7 +150,7 @@ namespace GHelper
panelDrivers.Margin = new Padding(4);
panelDrivers.Name = "panelDrivers";
panelDrivers.Padding = new Padding(20);
panelDrivers.Size = new Size(1256, 40);
panelDrivers.Size = new Size(1294, 40);
panelDrivers.TabIndex = 6;
//
// tableDrivers
@@ -158,10 +158,10 @@ namespace GHelper
tableDrivers.AutoSize = true;
tableDrivers.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableDrivers.ColumnCount = 4;
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 23F));
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 22F));
tableDrivers.Dock = DockStyle.Top;
tableDrivers.Location = new Point(20, 20);
tableDrivers.Margin = new Padding(4);
@@ -178,7 +178,7 @@ namespace GHelper
panelDriversTitle.Location = new Point(0, 102);
panelDriversTitle.Margin = new Padding(4);
panelDriversTitle.Name = "panelDriversTitle";
panelDriversTitle.Size = new Size(1256, 44);
panelDriversTitle.Size = new Size(1294, 44);
panelDriversTitle.TabIndex = 5;
//
// labelDrivers
@@ -208,7 +208,7 @@ namespace GHelper
AutoScaleDimensions = new SizeF(192F, 192F);
AutoScaleMode = AutoScaleMode.Dpi;
AutoScroll = true;
ClientSize = new Size(1256, 690);
ClientSize = new Size(1294, 690);
Controls.Add(panelDrivers);
Controls.Add(panelDriversTitle);
Controls.Add(panelBios);

View File

@@ -108,7 +108,9 @@ Ultimate mode is supported (by hardware) only on 2022+ models
You don't have to, it's purely optional. From my experience built in (in BIOS) performance modes work well. Limit your power or apply custom fan curves only if you have issues. As soon as you click Apply in the ``Fans + Power`` section BIOS will consider your fan curve as "custom"! (no matter if you modified it or not)
#### How does G-helper control my fan speeds?
**It doesn't.** Your BIOS does (same as in case with Armoury). What G-helper can do - is (optionally) set a custom fan profile to current performance mode consisting of 8 pairs of temperature + fan speed % via same endpoint armoury seem to use.
**It doesn't.** Your firmware / BIOS controls them in real-time. Armoury also doesn't control fans in real time anyhow.
What G-helper can do - is (optionally) set a custom fan profile to the current performance mode consisting of 8 pairs of temperature + fan speed % via the same endpoint Armoury seems to use. How it will be interpreted - is still up to the firmware.
#### How do I change fan % to fan RPM?
Click on them
@@ -301,7 +303,7 @@ To disable automatic touchpad toggling when laptop enters / leaves tablet mode
```
### Extra Keybindings
- ``Ctrl + Shift + F5`` - Toggle Performance Modes
- ``Ctrl + Shift + F5`` / ``Ctrl + Shift + Alt + F5`` - Toggle Performance Modes
- ``Ctrl + Shift + F12`` - Open G-Helper window
- ``Ctrl + M1 / M2`` - Screen brightness Down / Up
- ``Shift + M1 / M2`` - Backlight brightness Down / Up