Compare commits

..

7 Commits

Author SHA1 Message Date
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
6 changed files with 85 additions and 85 deletions

View File

@@ -355,7 +355,7 @@ 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");
}
public static bool IsZ13()

View File

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

View File

@@ -194,7 +194,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);
@@ -311,9 +311,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;

View File

@@ -1439,7 +1439,7 @@ namespace GHelper
MinimumSize = new Size(822, 71);
Name = "SettingsForm";
Padding = new Padding(11);
ShowIcon = true;
ShowIcon = false;
StartPosition = FormStartPosition.CenterScreen;
Text = "G-Helper";
panelMatrix.ResumeLayout(false);

View File

@@ -17,35 +17,34 @@ public static class AsusHid
public static HidStream FindHidStream(byte reportId, int minFeatureLength = 1)
{
HidDeviceLoader loader = new HidDeviceLoader();
var deviceList = loader.GetDevices(ASUS_ID).Where(device => deviceIds.Contains(device.ProductID));
foreach (var device in deviceList) if (device.CanOpen)
try
{
var deviceList = loader.GetDevices(ASUS_ID).Where(device => deviceIds.Contains(device.ProductID) && device.CanOpen);
foreach (var device in deviceList)
{
try
{
var config = new OpenConfiguration();
config.SetOption(OpenOption.Interruptible, false);
config.SetOption(OpenOption.Exclusive, false);
config.SetOption(OpenOption.Priority, 10);
HidStream hidStream = device.Open();
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)
if (device.GetMaxFeatureReportLength() >= minFeatureLength)
{
var reportDescriptor = device.GetReportDescriptor();
if (reportDescriptor.TryGetReport(ReportType.Feature, reportId, out _))
{
var reportDescriptor = device.GetReportDescriptor();
if (reportDescriptor.TryGetReport(ReportType.Feature, reportId, out _))
{
return hidStream;
}
return hidStream;
}
}
hidStream.Close();
hidStream.Dispose();
}
catch (Exception ex)
{
Debug.WriteLine($"Error accessing HID device: {ex.Message}");
}
hidStream.Close();
hidStream.Dispose();
}
}
catch (Exception ex)
{
Debug.WriteLine($"Error accessing HID device: {ex.Message}");
}
return null;
}

View File

@@ -359,69 +359,69 @@ namespace GHelper.USB
}
public static void ApplyColor(Color color, bool init = false)
public static void ApplyColorStrix(Color[] color, bool init = false)
{
Color[] color_list = Enumerable.Repeat(color, 0x12).ToArray();
ApplyColor(color_list, init);
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 < AURA_ZONES; i++)
{
msg[start + i * 3] = color[i].R; // R
msg[start + 1 + i * 3] = color[i].G; // G
msg[start + 2 + i * 3] = color[i].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);
}
public static void ApplyColor(Color[] color, bool init = false)
public static void ApplyColor(Color color, bool init = false)
{
if (isACPI)
{
Program.acpi.TUFKeyboardRGB(0, color[0], 0, null);
Program.acpi.TUFKeyboardRGB(0, color, 0, null);
return;
}
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 < AURA_ZONES; i++)
{
msg[start + i * 3] = color[i].R; // R
msg[start + 1 + i * 3] = color[i].G; // G
msg[start + 2 + i * 3] = color[i].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);
ApplyColorStrix(Enumerable.Repeat(color, AURA_ZONES).ToArray(), init);
return;
}
else
{
AsusHid.WriteAura(AuraMessage(0, color[0], color[0], 0));
AsusHid.WriteAura(AuraMessage(0, color, color, 0));
AsusHid.WriteAura(MESSAGE_SET);
}
@@ -514,9 +514,11 @@ namespace GHelper.USB
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
var screen_low = AmbientData.CamptureScreen(bound, 512, 288);
var screen_low = AmbientData.CamptureScreen(bound, 256, 144);
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
@@ -537,10 +539,9 @@ namespace GHelper.USB
}
else
{
zones = 1;
screeb_pxl = AmbientData.ResizeImage(screen_low, 1, 1);
var average = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(0, 0), (float)0.3);
for (int i = 0; i < 4; i++) //just color transfer from the bottom screen on keyboard
AmbientData.Colors[i].RGB = average;
AmbientData.Colors[0].RGB = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(0, 0), (float)0.3);
}
@@ -550,15 +551,18 @@ namespace GHelper.USB
bool is_fresh = false;
for (int i = 0; i < AURA_ZONES; i++)
for (int i = 0; i < zones; i++)
{
if (AmbientData.result[i].ToArgb() != AmbientData.Colors[i].RGB.ToArgb())
is_fresh = true;
if (AmbientData.result[i].ToArgb() != AmbientData.Colors[i].RGB.ToArgb()) is_fresh = true;
AmbientData.result[i] = AmbientData.Colors[i].RGB;
}
if (is_fresh)
ApplyColor(AmbientData.result, init);
{
if (isStrix) ApplyColorStrix(AmbientData.result, init);
else ApplyColor(AmbientData.result[0], init);
}
}
static class AmbientData