Ally Backlight control

This commit is contained in:
Serge
2024-01-25 16:54:34 +01:00
parent 545e2cc705
commit fbfbe8e730
5 changed files with 33 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
using GHelper.Gpu.AMD;
using GHelper.Input;
using GHelper.Mode;
using GHelper.USB;
using HidSharp;
using System.Text;
@@ -580,7 +581,6 @@ namespace GHelper.Ally
public void ToggleMode()
{
switch (_mode)
{
case ControllerMode.Auto:
@@ -596,7 +596,15 @@ namespace GHelper.Ally
SetMode(ControllerMode.Auto);
break;
}
}
public void ToggleXBox()
{
bool status = !AppConfig.IsNotFalse("controller_xbox");
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0B, 0x01, status ? (byte)0x01 : (byte)0x02 }, "XBox");
AppConfig.Set("controller_xbox", status ? 1 : 0);
settings.VisualiseXBox(status);
}
}

View File

@@ -228,6 +228,8 @@ namespace GHelper
checkGpuApps.Visible = false;
checkUSBC.Visible = false;
checkAutoToggleClamshellMode.Visible = false;
checkNoOverdrive.Visible = false;
int apuMem = Program.acpi.GetAPUMem();
if (apuMem >= 0)

View File

@@ -314,6 +314,11 @@ namespace GHelper
}
}
public void VisualiseXBox(bool status)
{
}
public void VisualiseBacklight(int backlight)
{
buttonBacklight.Text = Math.Round((double)backlight*33.33).ToString() + "%";

View File

@@ -21,19 +21,6 @@ namespace GHelper.UI
public static Color chartMain;
public static Color chartGrid;
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
static readonly IntPtr HWND_TOP = new IntPtr(0);
static readonly IntPtr HWND_BOTTOM = new IntPtr(1);
const UInt32 SWP_NOSIZE = 0x0001;
const UInt32 SWP_NOMOVE = 0x0002;
const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
protected override bool ShowWithoutActivation => true;
[DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")]
public static extern bool CheckSystemDarkModeStatus();

View File

@@ -343,7 +343,17 @@ namespace GHelper.USB
if (flags.SleepRear) rear |= 1 << 6;
if (flags.ShutdownRear) rear |= 1 << 7;
return new byte[] { 0x5d, 0xbd, 0x01, keyb, bar, lid, rear, 0xFF };
return new byte[] { AsusHid.AURA_ID, 0xBD, 0x01, keyb, bar, lid, rear, 0xFF };
}
private static void ApplyAllyPower(AuraPower flags)
{
byte power = 0x00;
if (flags.BootKeyb) power |= 0x01;
if (flags.AwakeKeyb) power |= 0x02;
if (flags.SleepKeyb) power |= 0x04;
if (flags.ShutdownKeyb) power |= 0x08;
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x09, 0x01, power }, "Aura");
}
public static void ApplyPower()
@@ -381,6 +391,12 @@ namespace GHelper.USB
flags.SleepRear = AppConfig.IsNotFalse("keyboard_sleep_lid");
flags.ShutdownRear = AppConfig.IsNotFalse("keyboard_shutdown_lid");
if (AppConfig.IsAlly())
{
ApplyAllyPower(flags);
return;
}
AsusHid.Write(AuraPowerMessage(flags));
if (isACPI)