This commit is contained in:
Serge
2024-01-21 15:35:56 +01:00
parent a3fd1a2703
commit 3fbd833e21
5 changed files with 29 additions and 18 deletions

View File

@@ -88,6 +88,7 @@ namespace GHelper.Ally
public const string BindBrightnessDown = "04-04-8C-88-8A-05"; public const string BindBrightnessDown = "04-04-8C-88-8A-05";
public const string BindBrightnessUp = "04-04-8C-88-8A-06"; public const string BindBrightnessUp = "04-04-8C-88-8A-06";
public const string BindXGM = "04-04-8C-88-8A-04";
public const string BindOverlay = "04-03-8C-88-44"; public const string BindOverlay = "04-03-8C-88-44";
@@ -152,6 +153,8 @@ namespace GHelper.Ally
{ BindCloseWindow, "Close Window" }, { BindCloseWindow, "Close Window" },
{ BindShiftTab, "Shift-Tab" }, { BindShiftTab, "Shift-Tab" },
{ BindAltTab, "Alt-Tab" }, { BindAltTab, "Alt-Tab" },
{ BindXGM, "XGM Toggle" },
{ BindEsc, "Esc" }, { BindEsc, "Esc" },
{ BindBack, "Backspace" }, { BindBack, "Backspace" },

View File

@@ -145,6 +145,7 @@ namespace GHelper.Input
{ {
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F1); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F1);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F3);
} }
// FN-Lock group // FN-Lock group
@@ -370,6 +371,9 @@ namespace GHelper.Input
case Keys.F2: case Keys.F2:
SetBrightness(10); SetBrightness(10);
break; break;
case Keys.F3:
Program.settingsForm.gpuControl.ToggleXGM();
break;
case Keys.F14: case Keys.F14:
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
break; break;

View File

@@ -1,6 +1,6 @@
using HidSharp; using GHelper.USB;
using GHelper.USB; using HidSharp;
using GHelper.Ally; using System.Text;
namespace GHelper.Input namespace GHelper.Input
{ {
@@ -16,17 +16,17 @@ namespace GHelper.Input
var task = Task.Run(Listen); var task = Task.Run(Listen);
} }
private void Listen () { private void Listen()
{
HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID); HidStream? input = AsusHid.FindHidStream(AsusHid.INPUT_ID);
// Fallback // Fallback
int count = 0; int count = 0;
while (input == null && count++ < 5) while (input == null && count++ < 10)
{ {
Aura.Init(); Thread.Sleep(1000);
Thread.Sleep(2000);
input = AsusHid.FindHidStream(AsusHid.INPUT_ID); input = AsusHid.FindHidStream(AsusHid.INPUT_ID);
} }
@@ -36,6 +36,7 @@ namespace GHelper.Input
return; return;
} }
AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc."));
Logger.WriteLine($"Input: {input.Device.DevicePath}"); Logger.WriteLine($"Input: {input.Device.DevicePath}");
try try

View File

@@ -1324,10 +1324,11 @@ namespace GHelper
public void VisualiseGPUMode(int GPUMode = -1) public void VisualiseGPUMode(int GPUMode = -1)
{ {
if (AppConfig.IsAlly() && !Program.acpi.IsXGConnected()) if (AppConfig.IsAlly())
{ {
tableGPU.Visible = false; tableGPU.Visible = false;
GPUMode = AsusACPI.GPUModeEco; if (Program.acpi.IsXGConnected()) tableAMD.Controls.Add(buttonXGM, 1, 0);
return;
} }
ButtonEnabled(buttonOptimized, true); ButtonEnabled(buttonOptimized, true);
@@ -1370,7 +1371,6 @@ namespace GHelper
VisualizeXGM(GPUMode); VisualizeXGM(GPUMode);
if (isGpuSection) if (isGpuSection)
{ {
menuEco.Checked = buttonEco.Activated; menuEco.Checked = buttonEco.Activated;

View File

@@ -264,12 +264,13 @@ namespace GHelper.USB
new byte[] { AsusHid.AURA_ID, 0xB9 }, new byte[] { AsusHid.AURA_ID, 0xB9 },
Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), Encoding.ASCII.GetBytes("]ASUS Tech.Inc."),
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A },
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 },
// Random data AC sends to keyboard on start // Random data AC sends to keyboard on start
/*
new byte[] { AsusHid.AURA_ID, 0x9F, 0x01 }, new byte[] { AsusHid.AURA_ID, 0x9F, 0x01 },
new byte[] { AsusHid.AURA_ID, 0xBF }, new byte[] { AsusHid.AURA_ID, 0xBF },
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x10 },
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x20 }, new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x20 },
new byte[] { AsusHid.AURA_ID, 0xC0, 0x03, 0x01}, new byte[] { AsusHid.AURA_ID, 0xC0, 0x03, 0x01},
@@ -277,10 +278,11 @@ namespace GHelper.USB
Encoding.ASCII.GetBytes("]ASUS Tech.Inc."), Encoding.ASCII.GetBytes("]ASUS Tech.Inc."),
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A }, new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1A },
new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01}, */
}, "Init");
AsusHid.WriteInput(Encoding.ASCII.GetBytes("ZASUS Tech.Inc.")); new byte[] { AsusHid.AURA_ID, 0xC0, 0x00, 0x01},
}, "Init");
} }
@@ -483,7 +485,7 @@ namespace GHelper.USB
byte[] keyBuf = new byte[mapSize]; byte[] keyBuf = new byte[mapSize];
buffer[0] = AsusHid.AURA_ID; buffer[0] = AsusHid.AURA_ID;
buffer[1] = 0xbc; buffer[1] = 0xBC;
buffer[2] = 0; buffer[2] = 0;
buffer[3] = 1; buffer[3] = 1;
buffer[4] = 1; buffer[4] = 1;
@@ -494,7 +496,7 @@ namespace GHelper.USB
if (init) if (init)
{ {
Init(); Init();
AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xbc }); AsusHid.WriteAura(new byte[] { AsusHid.AURA_ID, 0xBC });
} }
Array.Clear(keyBuf, 0, keyBuf.Length); Array.Clear(keyBuf, 0, keyBuf.Length);
@@ -531,7 +533,8 @@ namespace GHelper.USB
buffer[6] = 0x00; buffer[6] = 0x00;
buffer[7] = 0x00; buffer[7] = 0x00;
if (isStrix4Zone) { // per zone if (isStrix4Zone)
{ // per zone
var leds_4_zone = packet4Zone.Count(); var leds_4_zone = packet4Zone.Count();
for (int ledIndex = 0; ledIndex < leds_4_zone; ledIndex++) for (int ledIndex = 0; ledIndex < leds_4_zone; ledIndex++)
{ {
@@ -705,7 +708,7 @@ namespace GHelper.USB
bound.Y += bound.Height / 3; 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 bound.Height -= (int)Math.Round(bound.Height * (0.33f + 0.022f)); // cut 1/3 of the top screen + windows panel
Bitmap screen_low = AmbientData.CamptureScreen(bound, 512, 288); //quality decreases greatly if it is less 512 ; Bitmap screen_low = AmbientData.CamptureScreen(bound, 512, 288); //quality decreases greatly if it is less 512 ;
Bitmap screeb_pxl = AmbientData.ResizeImage(screen_low, 4, 2); // 4x2 zone. top for keyboard and bot for lightbar; Bitmap screeb_pxl = AmbientData.ResizeImage(screen_low, 4, 2); // 4x2 zone. top for keyboard and bot for lightbar;
int zones = AURA_ZONES; int zones = AURA_ZONES;