Compare commits

...

34 Commits

Author SHA1 Message Date
Serge
44dddfd4cc Cleanup 2024-08-11 11:07:32 +02:00
Serge
7af211f656 Cleanup 2024-08-11 11:06:24 +02:00
Serge
991eab1280 Softwar FN-Lock for ProArt 2024-08-11 10:44:13 +02:00
Serge
59f36e6db3 ProArt F12 2024-08-10 13:24:01 +02:00
Serge
1bbd40fbd5 Emojis Popup 2024-08-10 12:35:16 +02:00
Serge
3fd1869d3f Emoji popup 2024-08-10 12:23:01 +02:00
Serge
c64bc4599e Visual modes and gamuts 2024-08-10 12:06:40 +02:00
Serge
d94a54f785 Update AsusACPI.cs 2024-08-09 10:59:22 +02:00
Serge
ff5aac78a3 Init 2024-08-09 10:29:03 +02:00
Serge
88eb4916b6 Aura Breath bit https://github.com/seerge/g-helper/issues/2937 2024-08-07 11:08:24 +02:00
Serge
741d9cf1e2 Removed unsupported RGB modes for A16 https://github.com/seerge/g-helper/discussions/2922 2024-08-06 23:08:43 +02:00
Serge
45e3d5e75f Version bump 2024-08-06 18:35:14 +02:00
Serge
443f6726c7 Slash Lighting ID for GA605 #2892 2024-08-06 18:33:57 +02:00
Serge
f22f6eb960 Slash Lighting ID for GA605 #2892 2024-08-06 11:48:54 +02:00
Serge
a83b42c263 Improved ROG Ally X detection https://github.com/seerge/g-helper/discussions/2925 2024-08-05 23:27:27 +02:00
Serge
b97bd9af65 Slash Lighting ID for GA605 https://github.com/seerge/g-helper/issues/2892 2024-08-05 23:24:47 +02:00
Serge
a70956eaf8 Added ROG Ally X Controller ID https://github.com/seerge/g-helper/discussions/2925 2024-08-05 13:04:26 +02:00
Serge
a8fd049090 Matrix Clock position tweak 2024-08-04 11:06:50 +02:00
Serge
9817769d62 Merge branch 'main' of https://github.com/seerge/g-helper 2024-08-04 11:03:02 +02:00
Serge
39f919213f ProArt GPU mode support https://github.com/seerge/g-helper/issues/2912 2024-08-04 11:02:59 +02:00
Serge
709f2b89ca Cleanup 2024-08-03 17:58:32 +02:00
Serge
950d082fc3 Media hotkeys for G712LU https://github.com/seerge/g-helper/issues/2897 2024-08-03 12:18:09 +02:00
Serge
ceaa8c4110 Hotkeys with 4-key combos https://github.com/seerge/g-helper/issues/2916 2024-08-03 12:08:16 +02:00
Serge
fefbe94a8c Custom Matrix clock formats https://github.com/seerge/g-helper/issues/2903 2024-08-03 12:02:46 +02:00
Serge
c96a7749be Exception handling https://github.com/seerge/g-helper/issues/2917 2024-08-03 11:40:59 +02:00
Serge
bc9917b69a Slash Lighting support for GA605 2024-08-03 11:29:32 +02:00
Serge
f5964b60c7 Added GA605 to config https://github.com/seerge/g-helper/issues/2892 2024-07-29 12:12:22 +02:00
Serge
b3133ede7a Slash Lighting support for GA605 https://github.com/seerge/g-helper/issues/2892 2024-07-29 11:32:49 +02:00
Serge
c245a929f3 Version bump 2024-07-26 13:38:56 +02:00
Serge
4c4e6c8291 Dynamic Lighting models list 2024-07-25 16:45:30 +02:00
Serge
887e769bc6 Vivobook Mux code cleanup 2024-07-25 16:43:26 +02:00
Serge
5858a9d45b Vivobook Eco mode #2847 2024-07-25 16:39:56 +02:00
Serge
69f6be8941 Vivobook Eco mode https://github.com/seerge/g-helper/issues/2847 2024-07-25 00:06:19 +02:00
Serge
258bf3048a Max refresh rate config storage for backup https://github.com/seerge/g-helper/issues/2871 2024-07-24 21:12:43 +02:00
15 changed files with 199 additions and 84 deletions

View File

@@ -40,9 +40,16 @@ namespace GHelper.AnimeMatrix
try try
{ {
if (AppConfig.IsSlash()) if (AppConfig.IsSlash())
deviceSlash = new SlashDevice(); {
if (AppConfig.IsSlashAura())
deviceSlash = new SlashDeviceAura();
else
deviceSlash = new SlashDevice();
}
else else
{
deviceMatrix = new AnimeMatrixDevice(); deviceMatrix = new AnimeMatrixDevice();
}
matrixTimer = new System.Timers.Timer(100); matrixTimer = new System.Timers.Timer(100);
matrixTimer.Elapsed += MatrixTimer_Elapsed; matrixTimer.Elapsed += MatrixTimer_Elapsed;
@@ -103,7 +110,7 @@ namespace GHelper.AnimeMatrix
deviceSlash.SetEnabled(true); deviceSlash.SetEnabled(true);
deviceSlash.Init(); deviceSlash.Init();
switch ((SlashMode)running) switch ((SlashMode)running)
{ {
case SlashMode.Static: case SlashMode.Static:
@@ -111,7 +118,8 @@ namespace GHelper.AnimeMatrix
if (custom is not null && custom.Length > 0) if (custom is not null && custom.Length > 0)
{ {
deviceSlash.SetCustom(AppConfig.StringToBytes(custom)); deviceSlash.SetCustom(AppConfig.StringToBytes(custom));
} else }
else
{ {
deviceSlash.SetStatic(brightness); deviceSlash.SetStatic(brightness);
} }
@@ -137,7 +145,7 @@ namespace GHelper.AnimeMatrix
public void SetLidMode(bool force = false) public void SetLidMode(bool force = false)
{ {
bool matrixLid = AppConfig.Is("matrix_lid"); bool matrixLid = AppConfig.Is("matrix_lid");
if (deviceSlash is not null) if (deviceSlash is not null)
{ {
deviceSlash.SetLidMode(true); deviceSlash.SetLidMode(true);
@@ -268,8 +276,8 @@ namespace GHelper.AnimeMatrix
StartMatrixTimer(1000); StartMatrixTimer(1000);
Logger.WriteLine("Matrix Clock"); Logger.WriteLine("Matrix Clock");
} }
private void SlashTimer_start(int interval = 60000) private void SlashTimer_start(int interval = 60000)
{ {
// 100% to 0% in 1hr = 1% every 36 seconds // 100% to 0% in 1hr = 1% every 36 seconds
@@ -279,18 +287,18 @@ namespace GHelper.AnimeMatrix
// create the timer if first call // create the timer if first call
// this way, the timer only spawns if user tries to use battery pattern // this way, the timer only spawns if user tries to use battery pattern
if(slashTimer == default(System.Timers.Timer)) if (slashTimer == default(System.Timers.Timer))
{ {
slashTimer = new System.Timers.Timer(interval); slashTimer = new System.Timers.Timer(interval);
slashTimer.Elapsed += SlashTimer_elapsed; slashTimer.Elapsed += SlashTimer_elapsed;
slashTimer.AutoReset = true; slashTimer.AutoReset = true;
} }
// only write if interval changed // only write if interval changed
if(slashTimer.Interval != interval) if (slashTimer.Interval != interval)
{ {
slashTimer.Interval = interval; slashTimer.Interval = interval;
} }
slashTimer.Start(); slashTimer.Start();
} }
@@ -304,7 +312,7 @@ namespace GHelper.AnimeMatrix
if (deviceSlash is null) return; if (deviceSlash is null) return;
//kill timer if called but not in battery pattern mode //kill timer if called but not in battery pattern mode
if((SlashMode)AppConfig.Get("matrix_running", 0) != SlashMode.BatteryLevel) if ((SlashMode)AppConfig.Get("matrix_running", 0) != SlashMode.BatteryLevel)
{ {
slashTimer.Stop(); slashTimer.Stop();
slashTimer.Dispose(); slashTimer.Dispose();

View File

@@ -404,12 +404,14 @@ namespace GHelper.AnimeMatrix
public void PresentClock() public void PresentClock()
{ {
string second = (DateTime.Now.Second % 2 == 0) ? ":" : " "; string timeFormat = AppConfig.GetString("matrix_time", "HH:mm");
string time = DateTime.Now.ToString("HH" + second + "mm"); string dateFormat = AppConfig.GetString("matrix_date", "yy.MM.dd");
if (DateTime.Now.Second % 2 != 0) timeFormat = timeFormat.Replace(":", " ");
Clear(); Clear();
Text(time, 15, 0, 25); Text(DateTime.Now.ToString(timeFormat), 15, 2, 25);
Text(DateTime.Now.ToString("yy'. 'MM'. 'dd"), 11.5F, 0, 14); Text(DateTime.Now.ToString(dateFormat), 11.5F, 0, 14);
Present(); Present();
} }

View File

@@ -1,7 +1,6 @@
using GHelper.AnimeMatrix.Communication; using GHelper.AnimeMatrix.Communication;
using System.Management; using System.Management;
using System.Text; using System.Text;
using System.Timers;
namespace GHelper.AnimeMatrix namespace GHelper.AnimeMatrix
{ {
@@ -26,16 +25,24 @@ namespace GHelper.AnimeMatrix
BatteryLevel, BatteryLevel,
} }
internal class SlashPacket : Packet public class SlashPacket : Packet
{ {
public SlashPacket(byte[] command) : base(0x5E, 128, command) public SlashPacket(byte[] command, byte reportID = 0x5E) : base(reportID, 128, command)
{ {
} }
} }
public class SlashDevice : Device public class SlashDevice : Device
{ {
protected virtual byte reportID => 0x5E;
protected virtual SlashPacket CreatePacket(byte[] command)
{
return new SlashPacket(command, reportID);
}
public static Dictionary<SlashMode, string> Modes = new Dictionary<SlashMode, string> public static Dictionary<SlashMode, string> Modes = new Dictionary<SlashMode, string>
{ {
{ SlashMode.Bounce, "Bounce"}, { SlashMode.Bounce, "Bounce"},
@@ -85,31 +92,31 @@ namespace GHelper.AnimeMatrix
{ SlashMode.Buzzer, 0x44}, { SlashMode.Buzzer, 0x44},
}; };
public SlashDevice() : base(0x0B05, 0x193B, 128) public SlashDevice(ushort productId = 0x193B) : base(0x0B05, productId, 128)
{ {
} }
public void WakeUp() public void WakeUp()
{ {
Set(Packet<SlashPacket>(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")), "SlashWakeUp"); Set(CreatePacket(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")), "SlashWakeUp");
Set(Packet<SlashPacket>(0xC2), "SlashWakeUp"); Set(CreatePacket([0xC2]), "SlashWakeUp");
Set(Packet<SlashPacket>(0xD1, 0x01, 0x00, 0x01), "SlashWakeUp"); Set(CreatePacket([0xD1, 0x01, 0x00, 0x01 ]), "SlashWakeUp");
} }
public void Init() public void Init()
{ {
Set(Packet<SlashPacket>(0xD7, 0x00, 0x00, 0x01, 0xAC), "SlashInit"); Set(CreatePacket([0xD7, 0x00, 0x00, 0x01, 0xAC]), "SlashInit");
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xAB), "SlashInit"); Set(CreatePacket([0xD2, 0x02, 0x01, 0x08, 0xAB]), "SlashInit");
} }
public void SetEnabled(bool status = true) public void SetEnabled(bool status = true)
{ {
Set(Packet<SlashPacket>(0xD8, 0x02, 0x00, 0x01, status ? (byte)0x00 : (byte)0x80), $"SlashEnable {status}"); Set(CreatePacket([0xD8, 0x02, 0x00, 0x01, status ? (byte)0x00 : (byte)0x80]), $"SlashEnable {status}");
} }
public void Save() public void Save()
{ {
Set(Packet<SlashPacket>(0xD4, 0x00, 0x00, 0x01, 0xAB), "SlashSave"); Set(CreatePacket([0xD4, 0x00, 0x00, 0x01, 0xAB]), "SlashSave");
} }
public void SetMode(SlashMode mode) public void SetMode(SlashMode mode)
@@ -125,8 +132,8 @@ namespace GHelper.AnimeMatrix
modeByte = 0x00; modeByte = 0x00;
} }
Set(Packet<SlashPacket>(0xD2, 0x03, 0x00, 0x0C), "SlashMode"); Set(CreatePacket([0xD2, 0x03, 0x00, 0x0C]), "SlashMode");
Set(Packet<SlashPacket>(0xD3, 0x04, 0x00, 0x0C, 0x01, modeByte, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13), "SlashMode"); Set(CreatePacket([0xD3, 0x04, 0x00, 0x0C, 0x01, modeByte, 0x02, 0x19, 0x03, 0x13, 0x04, 0x11, 0x05, 0x12, 0x06, 0x13]), "SlashMode");
} }
public void SetStatic(int brightness = 0) public void SetStatic(int brightness = 0)
@@ -135,23 +142,23 @@ namespace GHelper.AnimeMatrix
} }
public static double GetBatteryChargePercentage() public static double GetBatteryChargePercentage()
{
double batteryCharge = 0;
try
{ {
double batteryCharge = 0; ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Battery");
try foreach (ManagementObject battery in searcher.Get())
{ {
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Battery"); batteryCharge = Convert.ToDouble(battery["EstimatedChargeRemaining"]);
foreach (ManagementObject battery in searcher.Get()) break; // Assuming only one battery
{
batteryCharge = Convert.ToDouble(battery["EstimatedChargeRemaining"]);
break; // Assuming only one battery
}
} }
catch (ManagementException e)
{
Console.WriteLine("An error occurred while querying for WMI data: " + e.Message);
}
return batteryCharge;
} }
catch (ManagementException e)
{
Console.WriteLine("An error occurred while querying for WMI data: " + e.Message);
}
return batteryCharge;
}
private byte[] GetBatteryPattern(int brightness, double percentage) private byte[] GetBatteryPattern(int brightness, double percentage)
{ {
@@ -159,64 +166,77 @@ namespace GHelper.AnimeMatrix
// set brightness to reflect battery's percentage within that range // set brightness to reflect battery's percentage within that range
int bracket = (int)Math.Floor(percentage / 14.2857); int bracket = (int)Math.Floor(percentage / 14.2857);
if(bracket >= 7) return Enumerable.Repeat((byte)(brightness * 85.333), 7).ToArray(); if (bracket >= 7) return Enumerable.Repeat((byte)(brightness * 85.333), 7).ToArray();
byte[] batteryPattern = Enumerable.Repeat((byte)(0x00), 7).ToArray(); byte[] batteryPattern = Enumerable.Repeat((byte)(0x00), 7).ToArray();
for (int i = 6; i > 6-bracket; i--) for (int i = 6; i > 6 - bracket; i--)
{ {
batteryPattern[i] = (byte)(brightness * 85.333); batteryPattern[i] = (byte)(brightness * 85.333);
} }
//set the "selected" bracket to the percentage of that bracket filled from 0 to 255 as a hex //set the "selected" bracket to the percentage of that bracket filled from 0 to 255 as a hex
batteryPattern[6-bracket] = (byte)(((percentage % 14.2857) * brightness * 85.333) / 14.2857); batteryPattern[6 - bracket] = (byte)(((percentage % 14.2857) * brightness * 85.333) / 14.2857);
return batteryPattern; return batteryPattern;
} }
public void SetBatteryPattern(int brightness) public void SetBatteryPattern(int brightness)
{ {
SetCustom(GetBatteryPattern(brightness, 100*(GetBatteryChargePercentage()/AppConfig.Get("charge_limit",100)))); SetCustom(GetBatteryPattern(brightness, 100 * (GetBatteryChargePercentage() / AppConfig.Get("charge_limit", 100))));
} }
public void SetCustom(byte[] data) public void SetCustom(byte[] data)
{ {
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xAC), "Static"); Set(CreatePacket([0xD2, 0x02, 0x01, 0x08, 0xAC]), "Static");
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAC, 0xFF, 0xFF, 0x01, 0x05, 0xFF, 0xFF), "StaticSettings"); Set(CreatePacket([0xD3, 0x03, 0x01, 0x08, 0xAC, 0xFF, 0xFF, 0x01, 0x05, 0xFF, 0xFF]), "StaticSettings");
Set(Packet<SlashPacket>(0xD4, 0x00, 0x00, 0x01, 0xAC), "StaticSave"); Set(CreatePacket([0xD4, 0x00, 0x00, 0x01, 0xAC]), "StaticSave");
byte[] payload = new byte[] { 0xD3, 0x00, 0x00, 0x07 }; byte[] payload = new byte[] { 0xD3, 0x00, 0x00, 0x07 };
Set(Packet<SlashPacket>(payload.Concat(data.Take(7)).ToArray()), "Static Data"); Set(CreatePacket(payload.Concat(data.Take(7)).ToArray()), "Static Data");
} }
public void SetOptions(bool status, int brightness = 0, int interval = 0) public void SetOptions(bool status, int brightness = 0, int interval = 0)
{ {
byte brightnessByte = (byte)(brightness * 85.333); byte brightnessByte = (byte)(brightness * 85.333);
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAB, 0xFF, 0x01, status ? (byte)0x01 : (byte)0x00, 0x06, brightnessByte, 0xFF, (byte)interval), "SlashOptions"); Set(CreatePacket([0xD3, 0x03, 0x01, 0x08, 0xAB, 0xFF, 0x01, status ? (byte)0x01 : (byte)0x00, 0x06, brightnessByte, 0xFF, (byte)interval]), "SlashOptions");
} }
public void SetBatterySaver(bool status) public void SetBatterySaver(bool status)
{ {
Set(Packet<SlashPacket>(0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00), $"SlashBatterySaver {status}"); Set(CreatePacket([0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00]), $"SlashBatterySaver {status}");
} }
public void SetLidMode(bool status) public void SetLidMode(bool status)
{ {
Set(Packet<SlashPacket>(0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00), $"DisableLidClose {status}"); Set(CreatePacket([0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00]), $"DisableLidClose {status}");
} }
public void SetSleepActive(bool status) public void SetSleepActive(bool status)
{ {
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xA1), "SleepInit"); Set(CreatePacket([0xD2, 0x02, 0x01, 0x08, 0xA1]), "SleepInit");
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xA1, 0x00, 0xFF, status ? (byte)0x01 : (byte)0x00, 0x02, 0xFF, 0xFF), $"Sleep {status}"); Set(CreatePacket([0xD3, 0x03, 0x01, 0x08, 0xA1, 0x00, 0xFF, status ? (byte)0x01 : (byte)0x00, 0x02, 0xFF, 0xFF]), $"Sleep {status}");
} }
public void Set(Packet packet, string? log = null) public void Set(Packet packet, string? log = null)
{ {
_usbProvider?.Set(packet.Data); _usbProvider?.Set(packet.Data);
if (log is not null) Logger.WriteLine($"{log}:" + BitConverter.ToString(packet.Data).Substring(0,48)); if (log is not null) Logger.WriteLine($"{log}:" + BitConverter.ToString(packet.Data).Substring(0, 48));
}
}
public class SlashDeviceAura : SlashDevice
{
protected override byte reportID => 0x5D;
public SlashDeviceAura() : base(0x19B6)
{
} }
protected override SlashPacket CreatePacket(byte[] command)
{
return new SlashPacket(command, reportID);
}
} }
} }

View File

@@ -377,6 +377,11 @@ public static class AppConfig
return ContainsModel("Vivobook") || ContainsModel("Zenbook"); return ContainsModel("Vivobook") || ContainsModel("Zenbook");
} }
public static bool IsVivoZenPro()
{
return ContainsModel("Vivobook") || ContainsModel("Zenbook") || ContainsModel("ProArt");
}
// Devices with bugged bios command to change brightness // Devices with bugged bios command to change brightness
public static bool SwappedBrightness() public static bool SwappedBrightness()
{ {
@@ -395,14 +400,24 @@ public static class AppConfig
return ContainsModel("GA401I") && !ContainsModel("GA401IHR"); return ContainsModel("GA401I") && !ContainsModel("GA401IHR");
} }
public static bool MediaKeys()
{
return NoAura() || ContainsModel("G712L");
}
public static bool IsSingleColor() public static bool IsSingleColor()
{ {
return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("GA502IU"); return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("GA502IU") || ContainsModel("FA617N") || ContainsModel("FA617X");
} }
public static bool IsSlash() public static bool IsSlash()
{ {
return ContainsModel("GA403") || ContainsModel("GU605"); return ContainsModel("GA403") || ContainsModel("GU605") || ContainsModel("GA605");
}
public static bool IsSlashAura()
{
return ContainsModel("GA605");
} }
public static bool IsInputBacklight() public static bool IsInputBacklight()
@@ -517,7 +532,7 @@ public static class AppConfig
public static bool DynamicBoost20() public static bool DynamicBoost20()
{ {
return ContainsModel("GU605"); return ContainsModel("GU605") || ContainsModel("GA605");
} }
public static bool IsAdvantageEdition() public static bool IsAdvantageEdition()
@@ -527,7 +542,7 @@ public static class AppConfig
public static bool NoAutoUltimate() public static bool NoAutoUltimate()
{ {
return ContainsModel("G614") || ContainsModel("GU604") || ContainsModel("FX507") || ContainsModel("G513") || ContainsModel("FA617") || ContainsModel("G834") || ContainsModel("GA403") || ContainsModel("GU605") || ContainsModel("GU603VV"); return ContainsModel("G614") || ContainsModel("GU604") || ContainsModel("FX507") || ContainsModel("G513") || ContainsModel("FA617") || ContainsModel("G834") || ContainsModel("GA403") || ContainsModel("GU605") || ContainsModel("GA605") || ContainsModel("GU603VV");
} }
@@ -647,14 +662,14 @@ public static class AppConfig
public static bool IsChargeLimit6080() public static bool IsChargeLimit6080()
{ {
return ContainsModel("GA403U") || ContainsModel("GU605") || ContainsModel("GA503R") || (IsTUF() && !(ContainsModel("FX507Z") || ContainsModel("FA617"))); return ContainsModel("GA403U") || ContainsModel("GU605") || ContainsModel("GA605") || ContainsModel("GA503R") || (IsTUF() && !(ContainsModel("FX507Z") || ContainsModel("FA617")));
} }
// 2024 Models support Dynamic Lighting // 2024 Models support Dynamic Lighting
public static bool IsDynamicLighting() public static bool IsDynamicLighting()
{ {
return IsSlash() || ContainsModel("JIR") || ContainsModel("JZR") || ContainsModel("JVR") || ContainsModel("JYR") || ContainsModel("FA607P") || ContainsModel("FX607J") || ContainsModel("FA507U"); return IsSlash() || IsIntelHX() || ContainsModel("FA607P") || ContainsModel("FX607J") || ContainsModel("FA507U");
} }
public static bool IsForceMiniled() public static bool IsForceMiniled()

View File

@@ -46,6 +46,7 @@ public class AsusACPI
public const int KB_TouchpadToggle = 0x6b; public const int KB_TouchpadToggle = 0x6b;
public const int KB_MuteToggle = 0x7c; public const int KB_MuteToggle = 0x7c;
public const int KB_NumlockToggle = 0x4e;
public const int KB_DUO_PgUpDn = 0x4B; public const int KB_DUO_PgUpDn = 0x4B;
public const int KB_DUO_SecondDisplay = 0x6A; public const int KB_DUO_SecondDisplay = 0x6A;
@@ -66,12 +67,13 @@ public class AsusACPI
public const uint PerformanceMode = 0x00120075; // Performance modes public const uint PerformanceMode = 0x00120075; // Performance modes
public const uint VivoBookMode = 0x00110019; // Vivobook performance modes public const uint VivoBookMode = 0x00110019; // Vivobook performance modes
public const uint GPUEco = 0x00090020; public const uint GPUEcoROG = 0x00090020;
public const uint GPUEcoVivo = 0x00090120;
public const uint GPUXGConnected = 0x00090018; public const uint GPUXGConnected = 0x00090018;
public const uint GPUXG = 0x00090019; public const uint GPUXG = 0x00090019;
public const uint GPUMux = 0x00090016; public const uint GPUMuxROG = 0x00090016;
public const uint GPUMuxVivo = 0x00090026; public const uint GPUMuxVivo = 0x00090026;
public const uint BatteryLimit = 0x00120057; public const uint BatteryLimit = 0x00120057;
@@ -170,6 +172,8 @@ public class AsusACPI
private bool? _allAMD = null; private bool? _allAMD = null;
private bool? _overdrive = null; private bool? _overdrive = null;
public static uint GPUEco => AppConfig.IsVivoZenPro() ? GPUEcoVivo : GPUEcoROG;
public static uint GPUMux => AppConfig.IsVivoZenPro() ? GPUMuxVivo : GPUMuxROG;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern IntPtr CreateFile( private static extern IntPtr CreateFile(
@@ -445,14 +449,16 @@ public class AsusACPI
public int SetGPUEco(int eco) public int SetGPUEco(int eco)
{ {
int ecoFlag = DeviceGet(GPUEco); uint ecoEndpoint = GPUEco;
int ecoFlag = DeviceGet(ecoEndpoint);
if (ecoFlag < 0) return -1; if (ecoFlag < 0) return -1;
if (ecoFlag == 1 && eco == 0) if (ecoFlag == 1 && eco == 0)
return DeviceSet(GPUEco, eco, "GPUEco"); return DeviceSet(ecoEndpoint, eco, "GPUEco");
if (ecoFlag == 0 && eco == 1) if (ecoFlag == 0 && eco == 1)
return DeviceSet(GPUEco, eco, "GPUEco"); return DeviceSet(ecoEndpoint, eco, "GPUEco");
return -1; return -1;
} }
@@ -639,7 +645,7 @@ public class AsusACPI
public bool IsAllAmdPPT() public bool IsAllAmdPPT()
{ {
if (_allAMD is null) _allAMD = DeviceGet(PPT_CPUB0) >= 0 && DeviceGet(PPT_GPUC0) < 0; if (_allAMD is null) _allAMD = DeviceGet(PPT_CPUB0) >= 0 && DeviceGet(PPT_GPUC0) < 0 && !AppConfig.IsAlly();
return (bool)_allAMD; return (bool)_allAMD;
} }

View File

@@ -36,7 +36,13 @@ namespace GHelper.AutoUpdate
public void LoadReleases() public void LoadReleases()
{ {
Process.Start(new ProcessStartInfo(versionUrl) { UseShellExecute = true }); try
{
Process.Start(new ProcessStartInfo(versionUrl) { UseShellExecute = true });
} catch (Exception ex)
{
Logger.WriteLine("Failed to open releases page:" + ex.Message);
}
} }
async void CheckForUpdatesAsync() async void CheckForUpdatesAsync()

View File

@@ -153,6 +153,9 @@ namespace GHelper.Display
int frequency = ScreenNative.GetRefreshRate(laptopScreen); int frequency = ScreenNative.GetRefreshRate(laptopScreen);
int maxFrequency = ScreenNative.GetMaxRefreshRate(laptopScreen); int maxFrequency = ScreenNative.GetMaxRefreshRate(laptopScreen);
if (maxFrequency > 0) AppConfig.Set("max_frequency", maxFrequency);
else maxFrequency = AppConfig.Get("max_frequency");
bool screenAuto = AppConfig.Is("screen_auto"); bool screenAuto = AppConfig.Is("screen_auto");
bool overdriveSetting = Program.acpi.IsOverdriveSupported() && !AppConfig.IsNoOverdrive(); bool overdriveSetting = Program.acpi.IsOverdriveSupported() && !AppConfig.IsNoOverdrive();

View File

@@ -70,13 +70,13 @@ namespace GHelper.Display
public static SplendidGamut GetDefaultGamut() public static SplendidGamut GetDefaultGamut()
{ {
return AppConfig.IsVivoZenbook() ? SplendidGamut.VivoNative : SplendidGamut.Native; return AppConfig.IsVivoZenPro() ? SplendidGamut.VivoNative : SplendidGamut.Native;
} }
public static Dictionary<SplendidGamut, string> GetGamutModes() public static Dictionary<SplendidGamut, string> GetGamutModes()
{ {
bool isVivo = AppConfig.IsVivoZenbook(); bool isVivo = AppConfig.IsVivoZenPro();
Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>(); Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>();
@@ -148,13 +148,13 @@ namespace GHelper.Display
public static SplendidCommand GetDefaultVisualMode() public static SplendidCommand GetDefaultVisualMode()
{ {
return AppConfig.IsVivoZenbook() ? SplendidCommand.VivoNormal : SplendidCommand.Default; return AppConfig.IsVivoZenPro() ? SplendidCommand.VivoNormal : SplendidCommand.Default;
} }
public static Dictionary<SplendidCommand, string> GetVisualModes() public static Dictionary<SplendidCommand, string> GetVisualModes()
{ {
if (AppConfig.IsVivoZenbook()) if (AppConfig.IsVivoZenPro())
{ {
return new Dictionary<SplendidCommand, string> return new Dictionary<SplendidCommand, string>
{ {
@@ -291,7 +291,7 @@ namespace GHelper.Display
private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null) private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null)
{ {
var splendid = GetSplendidPath(); var splendid = GetSplendidPath();
bool isVivo = AppConfig.IsVivoZenbook(); bool isVivo = AppConfig.IsVivoZenPro();
bool isSplenddid = File.Exists(splendid); bool isSplenddid = File.Exists(splendid);
if (isSplenddid) if (isSplenddid)

View File

@@ -203,7 +203,7 @@ namespace GHelper
labelFNF4.Visible = comboFNF4.Visible = textFNF4.Visible = false; labelFNF4.Visible = comboFNF4.Visible = textFNF4.Visible = false;
} }
if (AppConfig.NoAura()) if (AppConfig.MediaKeys())
{ {
labelFNF4.Visible = comboFNF4.Visible = textFNF4.Visible = false; labelFNF4.Visible = comboFNF4.Visible = textFNF4.Visible = false;
} }

View File

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

View File

@@ -25,8 +25,6 @@ namespace GHelper.Gpu
int eco = Program.acpi.DeviceGet(AsusACPI.GPUEco); int eco = Program.acpi.DeviceGet(AsusACPI.GPUEco);
int mux = Program.acpi.DeviceGet(AsusACPI.GPUMux); int mux = Program.acpi.DeviceGet(AsusACPI.GPUMux);
if (mux < 0) mux = Program.acpi.DeviceGet(AsusACPI.GPUMuxVivo);
Logger.WriteLine("Eco flag : " + eco); Logger.WriteLine("Eco flag : " + eco);
Logger.WriteLine("Mux flag : " + mux); Logger.WriteLine("Mux flag : " + mux);
@@ -83,7 +81,6 @@ namespace GHelper.Gpu
if (dialogResult == DialogResult.Yes) if (dialogResult == DialogResult.Yes)
{ {
status = Program.acpi.DeviceSet(AsusACPI.GPUMux, 1, "GPUMux"); status = Program.acpi.DeviceSet(AsusACPI.GPUMux, 1, "GPUMux");
if (status != 1) Program.acpi.DeviceSet(AsusACPI.GPUMuxVivo, 1, "GPUMuxVivo");
restart = true; restart = true;
changed = true; changed = true;
} }
@@ -99,7 +96,6 @@ namespace GHelper.Gpu
Thread.Sleep(100); Thread.Sleep(100);
} }
status = Program.acpi.DeviceSet(AsusACPI.GPUMux, 0, "GPUMux"); status = Program.acpi.DeviceSet(AsusACPI.GPUMux, 0, "GPUMux");
if (status != 1) Program.acpi.DeviceSet(AsusACPI.GPUMuxVivo, 0, "GPUMuxVivo");
restart = true; restart = true;
changed = true; changed = true;
} }

View File

@@ -218,6 +218,9 @@ namespace GHelper.Input
case 3: case 3:
KeyboardHook.KeyKeyKeyPress((Keys)hexKeys[0], (Keys)hexKeys[1], (Keys)hexKeys[2]); KeyboardHook.KeyKeyKeyPress((Keys)hexKeys[0], (Keys)hexKeys[1], (Keys)hexKeys[2]);
break; break;
case 4:
KeyboardHook.KeyKeyKeyKeyPress((Keys)hexKeys[0], (Keys)hexKeys[1], (Keys)hexKeys[2], (Keys)hexKeys[3]);
break;
default: default:
LaunchProcess(command); LaunchProcess(command);
break; break;
@@ -278,6 +281,43 @@ namespace GHelper.Input
} }
} }
if (AppConfig.IsProArt())
{
switch (e.Key)
{
case Keys.F2:
KeyboardHook.KeyPress(Keys.VolumeDown);
return;
case Keys.F3:
KeyboardHook.KeyPress(Keys.VolumeUp);
return;
case Keys.F4:
HandleEvent(199); // Backlight cycle
return;
case Keys.F5:
SetBrightness(-10);
return;
case Keys.F6:
SetBrightness(+10);
return;
case Keys.F7:
KeyboardHook.KeyKeyPress(Keys.LWin, Keys.P);
return;
case Keys.F8:
HandleEvent(126); // Emojis
return;
case Keys.F9:
KeyProcess("m3"); // MicMute
return;
case Keys.F10:
HandleEvent(133); // Camera Toggle
return;
case Keys.F11:
KeyboardHook.KeyPress(Keys.Snapshot); // PrintScreen
return;
}
}
if (AppConfig.IsZ13() || AppConfig.IsDUO()) if (AppConfig.IsZ13() || AppConfig.IsDUO())
{ {
switch (e.Key) switch (e.Key)
@@ -288,7 +328,7 @@ namespace GHelper.Input
} }
} }
if (AppConfig.NoAura()) if (AppConfig.MediaKeys())
{ {
switch (e.Key) switch (e.Key)
{ {
@@ -655,6 +695,7 @@ namespace GHelper.Input
switch (EventID) switch (EventID)
{ {
case 134: // FN + F12 ON OLD DEVICES case 134: // FN + F12 ON OLD DEVICES
case 139: // ProArt F12
KeyProcess("m4"); KeyProcess("m4");
return; return;
case 124: // M3 case 124: // M3
@@ -688,7 +729,7 @@ namespace GHelper.Input
case 78: // Fn + ESC case 78: // Fn + ESC
ToggleFnLock(); ToggleFnLock();
return; return;
case 75: // Fn + ESC case 75: // Fn + Arrow Lock
ToggleArrowLock(); ToggleArrowLock();
return; return;
case 189: // Tablet mode case 189: // Tablet mode
@@ -777,6 +818,9 @@ namespace GHelper.Input
case 53: // Fn+F6 on GA-502DU model case 53: // Fn+F6 on GA-502DU model
NativeMethods.TurnOffScreen(); NativeMethods.TurnOffScreen();
return; return;
case 126: // Fn+F8 emojis popup
KeyboardHook.KeyKeyPress(Keys.LWin, Keys.OemSemicolon);
return;
} }

View File

@@ -77,6 +77,21 @@ public sealed class KeyboardHook : IDisposable
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero); keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
} }
public static void KeyKeyKeyKeyPress(Keys key, Keys key2, Keys key3, Keys key4, int sleep = 1)
{
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
keybd_event((byte)key4, 0, KEYEVENTF_EXTENDEDKEY, IntPtr.Zero);
Thread.Sleep(sleep);
keybd_event((byte)key4, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
keybd_event((byte)key3, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
keybd_event((byte)key2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
keybd_event((byte)key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, IntPtr.Zero);
}
/// <summary> /// <summary>
/// Represents the window that is used internally to get the messages. /// Represents the window that is used internally to get the messages.
/// </summary> /// </summary>

View File

@@ -10,7 +10,7 @@ public static class AsusHid
public const byte INPUT_ID = 0x5a; public const byte INPUT_ID = 0x5a;
public const byte AURA_ID = 0x5d; public const byte AURA_ID = 0x5d;
static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0, 0x18c6, 0x1abe }; static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0, 0x18c6, 0x1abe, 0x1b4c };
static HidStream? auraStream; static HidStream? auraStream;

View File

@@ -79,7 +79,7 @@ namespace GHelper.USB
public static Color Color1 = Color.White; public static Color Color1 = Color.White;
public static Color Color2 = Color.Black; public static Color Color2 = Color.Black;
static bool isACPI = AppConfig.IsTUF() || AppConfig.IsVivoZenbook() || AppConfig.IsProArt(); static bool isACPI = AppConfig.IsTUF() || AppConfig.IsVivoZenPro();
static bool isStrix = AppConfig.IsAdvancedRGB() && !AppConfig.IsNoDirectRGB(); static bool isStrix = AppConfig.IsAdvancedRGB() && !AppConfig.IsNoDirectRGB();
static bool isStrix4Zone = AppConfig.Is4ZoneRGB(); static bool isStrix4Zone = AppConfig.Is4ZoneRGB();
@@ -254,7 +254,7 @@ namespace GHelper.USB
msg[6] = mono ? (byte)0 : color.B; // B msg[6] = mono ? (byte)0 : color.B; // B
msg[7] = (byte)speed; // aura.speed as u8; msg[7] = (byte)speed; // aura.speed as u8;
msg[8] = 0x00; // aura.direction as u8; msg[8] = 0x00; // aura.direction as u8;
msg[9] = (color.R == 0 && color.G == 0 && color.B == 0) ? (byte)0xFF : (byte)0x00; // random color flag msg[9] = (color.R == 0 && color.G == 0 && color.B == 0) ? (byte)0xFF : (mode == AuraMode.AuraBreathe ? (byte)0x01 : (byte)0x00); // random color flag
msg[10] = color2.R; // R msg[10] = color2.R; // R
msg[11] = mono ? (byte)0 : color2.G; // G msg[11] = mono ? (byte)0 : color2.G; // G
msg[12] = mono ? (byte)0 : color2.B; // B msg[12] = mono ? (byte)0 : color2.B; // B