Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pro Art Hotkeys and visual modes support #2962

Merged
merged 9 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
string text = File.ReadAllText(configFile);
try
{
config = JsonSerializer.Deserialize<Dictionary<string, object>>(text);

Check warning on line 42 in app/AppConfig.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.
}
catch
{
Expand Down Expand Up @@ -118,7 +118,7 @@

//if (_model.Contains("GA402RK")) _model = "ROG Zephyrus G14 GA403UI"; // Debug Purposes

return _model;

Check warning on line 121 in app/AppConfig.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.
}

public static (string, string) GetBiosAndModel()
Expand Down Expand Up @@ -201,7 +201,7 @@
return Get(zone + "_bat", Get(zone)) != 0;
}

public static string GetString(string name, string empty = null)

Check warning on line 204 in app/AppConfig.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.
{
if (config.ContainsKey(name))
return config[name].ToString();
Expand Down Expand Up @@ -377,6 +377,11 @@
return ContainsModel("Vivobook") || ContainsModel("Zenbook");
}

public static bool IsVivoZenPro()
{
return ContainsModel("Vivobook") || ContainsModel("Zenbook") || ContainsModel("ProArt");
}

// Devices with bugged bios command to change brightness
public static bool SwappedBrightness()
{
Expand Down
5 changes: 3 additions & 2 deletions app/AsusACPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class AsusACPI

public const int KB_TouchpadToggle = 0x6b;
public const int KB_MuteToggle = 0x7c;
public const int KB_NumlockToggle = 0x4e;

public const int KB_DUO_PgUpDn = 0x4B;
public const int KB_DUO_SecondDisplay = 0x6A;
Expand Down Expand Up @@ -171,8 +172,8 @@ public class AsusACPI
private bool? _allAMD = null;
private bool? _overdrive = null;

public static uint GPUEco => (AppConfig.IsVivoZenbook() || AppConfig.IsProArt()) ? GPUEcoVivo : GPUEcoROG;
public static uint GPUMux => AppConfig.IsVivoZenbook() ? GPUMuxVivo : GPUMuxROG;
public static uint GPUEco => AppConfig.IsVivoZenPro() ? GPUEcoVivo : GPUEcoROG;
public static uint GPUMux => AppConfig.IsVivoZenPro() ? GPUMuxVivo : GPUMuxROG;

[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern IntPtr CreateFile(
Expand Down
10 changes: 5 additions & 5 deletions app/Display/VisualControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ public static string GetVivobookPath()

public static SplendidGamut GetDefaultGamut()
{
return AppConfig.IsVivoZenbook() ? SplendidGamut.VivoNative : SplendidGamut.Native;
return AppConfig.IsVivoZenPro() ? SplendidGamut.VivoNative : SplendidGamut.Native;
}

public static Dictionary<SplendidGamut, string> GetGamutModes()
{

bool isVivo = AppConfig.IsVivoZenbook();
bool isVivo = AppConfig.IsVivoZenPro();

Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>();

Expand Down Expand Up @@ -148,13 +148,13 @@ public static Dictionary<SplendidGamut, string> GetGamutModes()

public static SplendidCommand GetDefaultVisualMode()
{
return AppConfig.IsVivoZenbook() ? SplendidCommand.VivoNormal : SplendidCommand.Default;
return AppConfig.IsVivoZenPro() ? SplendidCommand.VivoNormal : SplendidCommand.Default;
}

public static Dictionary<SplendidCommand, string> GetVisualModes()
{

if (AppConfig.IsVivoZenbook())
if (AppConfig.IsVivoZenPro())
{
return new Dictionary<SplendidCommand, string>
{
Expand Down Expand Up @@ -291,7 +291,7 @@ private static string GetSplendidPath()
private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null)
{
var splendid = GetSplendidPath();
bool isVivo = AppConfig.IsVivoZenbook();
bool isVivo = AppConfig.IsVivoZenPro();
bool isSplenddid = File.Exists(splendid);

if (isSplenddid)
Expand Down
43 changes: 42 additions & 1 deletion app/Input/InputDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,43 @@ public void KeyPressed(object sender, KeyPressedEventArgs e)
}
}

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())
{
switch (e.Key)
Expand Down Expand Up @@ -658,6 +695,7 @@ static void HandleEvent(int EventID)
switch (EventID)
{
case 134: // FN + F12 ON OLD DEVICES
case 139: // ProArt F12
KeyProcess("m4");
return;
case 124: // M3
Expand Down Expand Up @@ -691,7 +729,7 @@ static void HandleEvent(int EventID)
case 78: // Fn + ESC
ToggleFnLock();
return;
case 75: // Fn + ESC
case 75: // Fn + Arrow Lock
ToggleArrowLock();
return;
case 189: // Tablet mode
Expand Down Expand Up @@ -780,6 +818,9 @@ static void HandleOptimizationEvent(int EventID)
case 53: // Fn+F6 on GA-502DU model
NativeMethods.TurnOffScreen();
return;
case 126: // Fn+F8 emojis popup
KeyboardHook.KeyKeyPress(Keys.LWin, Keys.OemSemicolon);
return;


}
Expand Down
2 changes: 1 addition & 1 deletion app/USB/Aura.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static class Aura
public static Color Color1 = Color.White;
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 isStrix4Zone = AppConfig.Is4ZoneRGB();
Expand Down
Loading