mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4bcc8f66c | ||
|
|
0f11ffe8f0 | ||
|
|
96cbcbaf7f | ||
|
|
0c1ababcf8 | ||
|
|
36eae610e8 | ||
|
|
69757ff460 | ||
|
|
744bce1819 |
@@ -355,7 +355,7 @@ public static class AppConfig
|
|||||||
|
|
||||||
public static bool IsStrixLimitedRGB()
|
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()
|
public static bool IsZ13()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.132</AssemblyVersion>
|
<AssemblyVersion>0.133</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ namespace GHelper.Input
|
|||||||
KeyboardHook.KeyKeyPress((Keys)hexKeys[0], (Keys)hexKeys[1]);
|
KeyboardHook.KeyKeyPress((Keys)hexKeys[0], (Keys)hexKeys[1]);
|
||||||
break;
|
break;
|
||||||
case 3:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
LaunchProcess(command);
|
LaunchProcess(command);
|
||||||
@@ -311,9 +311,6 @@ namespace GHelper.Input
|
|||||||
case Keys.F11:
|
case Keys.F11:
|
||||||
SleepEvent();
|
SleepEvent();
|
||||||
break;
|
break;
|
||||||
case Keys.F12:
|
|
||||||
KeyboardHook.KeyKeyPress(Keys.LWin, Keys.A);
|
|
||||||
break;
|
|
||||||
case Keys.VolumeDown:
|
case Keys.VolumeDown:
|
||||||
KeyProcess("m1");
|
KeyProcess("m1");
|
||||||
break;
|
break;
|
||||||
|
|||||||
2
app/Settings.Designer.cs
generated
2
app/Settings.Designer.cs
generated
@@ -1439,7 +1439,7 @@ namespace GHelper
|
|||||||
MinimumSize = new Size(822, 71);
|
MinimumSize = new Size(822, 71);
|
||||||
Name = "SettingsForm";
|
Name = "SettingsForm";
|
||||||
Padding = new Padding(11);
|
Padding = new Padding(11);
|
||||||
ShowIcon = true;
|
ShowIcon = false;
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "G-Helper";
|
Text = "G-Helper";
|
||||||
panelMatrix.ResumeLayout(false);
|
panelMatrix.ResumeLayout(false);
|
||||||
|
|||||||
@@ -17,11 +17,10 @@ public static class AsusHid
|
|||||||
public static HidStream FindHidStream(byte reportId, int minFeatureLength = 1)
|
public static HidStream FindHidStream(byte reportId, int minFeatureLength = 1)
|
||||||
{
|
{
|
||||||
HidDeviceLoader loader = new HidDeviceLoader();
|
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
|
try
|
||||||
|
{
|
||||||
|
var deviceList = loader.GetDevices(ASUS_ID).Where(device => deviceIds.Contains(device.ProductID) && device.CanOpen);
|
||||||
|
foreach (var device in deviceList)
|
||||||
{
|
{
|
||||||
var config = new OpenConfiguration();
|
var config = new OpenConfiguration();
|
||||||
config.SetOption(OpenOption.Interruptible, false);
|
config.SetOption(OpenOption.Interruptible, false);
|
||||||
@@ -41,11 +40,11 @@ public static class AsusHid
|
|||||||
hidStream.Close();
|
hidStream.Close();
|
||||||
hidStream.Dispose();
|
hidStream.Dispose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.WriteLine($"Error accessing HID device: {ex.Message}");
|
Debug.WriteLine($"Error accessing HID device: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -359,22 +359,7 @@ 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyColor(Color[] color, bool init = false)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (isACPI)
|
|
||||||
{
|
|
||||||
Program.acpi.TUFKeyboardRGB(0, color[0], 0, null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isStrix && !isOldHeatmap)
|
|
||||||
{
|
{
|
||||||
byte[] msg = new byte[0x40];
|
byte[] msg = new byte[0x40];
|
||||||
|
|
||||||
@@ -419,9 +404,24 @@ namespace GHelper.USB
|
|||||||
AsusHid.WriteAura(msg);
|
AsusHid.WriteAura(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ApplyColor(Color color, bool init = false)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (isACPI)
|
||||||
|
{
|
||||||
|
Program.acpi.TUFKeyboardRGB(0, color, 0, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStrix && !isOldHeatmap)
|
||||||
|
{
|
||||||
|
ApplyColorStrix(Enumerable.Repeat(color, AURA_ZONES).ToArray(), init);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AsusHid.WriteAura(AuraMessage(0, color[0], color[0], 0));
|
AsusHid.WriteAura(AuraMessage(0, color, color, 0));
|
||||||
AsusHid.WriteAura(MESSAGE_SET);
|
AsusHid.WriteAura(MESSAGE_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,9 +514,11 @@ 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
|
||||||
|
|
||||||
var screen_low = AmbientData.CamptureScreen(bound, 512, 288);
|
var screen_low = AmbientData.CamptureScreen(bound, 256, 144);
|
||||||
Bitmap screeb_pxl;
|
Bitmap screeb_pxl;
|
||||||
|
|
||||||
|
int zones = AURA_ZONES;
|
||||||
|
|
||||||
if (isStrix) //laptop with lightbar
|
if (isStrix) //laptop with lightbar
|
||||||
{
|
{
|
||||||
screeb_pxl = AmbientData.ResizeImage(screen_low, 4, 2); // 4x2 zone. top for keyboard and bot for 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
|
else
|
||||||
{
|
{
|
||||||
|
zones = 1;
|
||||||
screeb_pxl = AmbientData.ResizeImage(screen_low, 1, 1);
|
screeb_pxl = AmbientData.ResizeImage(screen_low, 1, 1);
|
||||||
var average = ColorUtils.HSV.UpSaturation(screeb_pxl.GetPixel(0, 0), (float)0.3);
|
AmbientData.Colors[0].RGB = 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -550,15 +551,18 @@ namespace GHelper.USB
|
|||||||
|
|
||||||
bool is_fresh = false;
|
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())
|
if (AmbientData.result[i].ToArgb() != AmbientData.Colors[i].RGB.ToArgb()) is_fresh = true;
|
||||||
is_fresh = true;
|
|
||||||
AmbientData.result[i] = AmbientData.Colors[i].RGB;
|
AmbientData.result[i] = AmbientData.Colors[i].RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_fresh)
|
if (is_fresh)
|
||||||
ApplyColor(AmbientData.result, init);
|
{
|
||||||
|
if (isStrix) ApplyColorStrix(AmbientData.result, init);
|
||||||
|
else ApplyColor(AmbientData.result[0], init);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class AmbientData
|
static class AmbientData
|
||||||
|
|||||||
Reference in New Issue
Block a user