mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Controller Toggle tweaks
This commit is contained in:
@@ -314,7 +314,7 @@ namespace GHelper.Ally
|
|||||||
if (AppConfig.IsAlly()) settings.VisualiseAlly(true);
|
if (AppConfig.IsAlly()) settings.VisualiseAlly(true);
|
||||||
else return;
|
else return;
|
||||||
|
|
||||||
SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto));
|
SetMode((ControllerMode)AppConfig.Get("controller_mode", (int)ControllerMode.Auto), true);
|
||||||
|
|
||||||
settings.VisualiseBacklight(InputDispatcher.GetBacklight());
|
settings.VisualiseBacklight(InputDispatcher.GetBacklight());
|
||||||
settings.VisualiseFPSLimit(amdControl.GetFPSLimit());
|
settings.VisualiseFPSLimit(amdControl.GetFPSLimit());
|
||||||
@@ -477,7 +477,7 @@ namespace GHelper.Ally
|
|||||||
DecodeBinding(KeyR1).CopyTo(bindings, 27);
|
DecodeBinding(KeyR1).CopyTo(bindings, 27);
|
||||||
DecodeBinding(KeyR2).CopyTo(bindings, 38);
|
DecodeBinding(KeyR2).CopyTo(bindings, 38);
|
||||||
|
|
||||||
AsusHid.WriteInput(CommandReady, null);
|
//AsusHid.WriteInput(CommandReady, null);
|
||||||
AsusHid.WriteInput(bindings, $"B{zone}");
|
AsusHid.WriteInput(bindings, $"B{zone}");
|
||||||
|
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
static public void SetDeadzones()
|
static public void SetDeadzones()
|
||||||
{
|
{
|
||||||
WakeUp();
|
//WakeUp();
|
||||||
|
|
||||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4,
|
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xd1, 4, 4,
|
||||||
(byte)AppConfig.Get("ls_min", 0),
|
(byte)AppConfig.Get("ls_min", 0),
|
||||||
@@ -519,7 +519,7 @@ namespace GHelper.Ally
|
|||||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0B, 0x01, AppConfig.Is("controller_disabled") ? (byte)0x02 : (byte)0x01 }, "Status");
|
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x0B, 0x01, AppConfig.Is("controller_disabled") ? (byte)0x02 : (byte)0x01 }, "Status");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto)
|
public static void ApplyMode(ControllerMode applyMode = ControllerMode.Auto, bool init = false)
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -543,11 +543,14 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
if (applyMode != ControllerMode.Auto) _applyMode = applyMode;
|
if (applyMode != ControllerMode.Auto) _applyMode = applyMode;
|
||||||
|
|
||||||
InputDispatcher.SetBacklightAuto(true);
|
if (init)
|
||||||
WakeUp();
|
{
|
||||||
|
WakeUp();
|
||||||
|
InputDispatcher.SetBacklightAuto(true);
|
||||||
|
}
|
||||||
|
|
||||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x01, 0x01, (byte)_applyMode }, "Controller");
|
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xD1, 0x01, 0x01, (byte)_applyMode }, "Controller");
|
||||||
AsusHid.WriteInput(CommandSave, null);
|
//AsusHid.WriteInput(CommandSave, null);
|
||||||
|
|
||||||
BindZone(BindingZone.M1M2);
|
BindZone(BindingZone.M1M2);
|
||||||
|
|
||||||
@@ -561,18 +564,19 @@ namespace GHelper.Ally
|
|||||||
BindZone(BindingZone.Trigger);
|
BindZone(BindingZone.Trigger);
|
||||||
|
|
||||||
AsusHid.WriteInput(CommandSave, null);
|
AsusHid.WriteInput(CommandSave, null);
|
||||||
|
|
||||||
SetDeadzones();
|
SetDeadzones();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetMode(ControllerMode mode)
|
private void SetMode(ControllerMode mode, bool init = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
AppConfig.Set("controller_mode", (int)mode);
|
AppConfig.Set("controller_mode", (int)mode);
|
||||||
|
|
||||||
ApplyMode(mode);
|
ApplyMode(mode, init);
|
||||||
|
|
||||||
if (mode == ControllerMode.Auto)
|
if (mode == ControllerMode.Auto)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ namespace GHelper
|
|||||||
customActions.Add("screenpad_up", Properties.Strings.ScreenPadUp);
|
customActions.Add("screenpad_up", Properties.Strings.ScreenPadUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AppConfig.IsAlly())
|
||||||
|
{
|
||||||
|
customActions.Add("controller", "Controller Mode");
|
||||||
|
}
|
||||||
|
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case "m1":
|
case "m1":
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ namespace GHelper.Input
|
|||||||
Program.settingsForm.gpuControl.ToggleXGM(true);
|
Program.settingsForm.gpuControl.ToggleXGM(true);
|
||||||
break;
|
break;
|
||||||
case Keys.F4:
|
case Keys.F4:
|
||||||
Program.settingsForm.allyControl.ToggleModeHotkey();
|
Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey);
|
||||||
break;
|
break;
|
||||||
case Keys.F14:
|
case Keys.F14:
|
||||||
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
|
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
|
||||||
@@ -520,6 +520,9 @@ namespace GHelper.Input
|
|||||||
case "calculator":
|
case "calculator":
|
||||||
LaunchProcess("calc");
|
LaunchProcess("calc");
|
||||||
break;
|
break;
|
||||||
|
case "controller":
|
||||||
|
Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,10 +229,15 @@ namespace GHelper
|
|||||||
|
|
||||||
BatteryControl.AutoBattery(init);
|
BatteryControl.AutoBattery(init);
|
||||||
|
|
||||||
settingsForm.AutoKeyboard();
|
|
||||||
settingsForm.matrixControl.SetMatrix(true);
|
settingsForm.matrixControl.SetMatrix(true);
|
||||||
|
|
||||||
allyControl.Init();
|
if (AppConfig.IsAlly())
|
||||||
|
{
|
||||||
|
allyControl.Init();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
settingsForm.AutoKeyboard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ namespace GHelper.USB
|
|||||||
msg[5] = mono ? (byte)0 : color.G; // G
|
msg[5] = mono ? (byte)0 : color.G; // G
|
||||||
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] = 0xFF; // aura.direction as u8;
|
msg[8] = 0x00; // aura.direction as u8;
|
||||||
msg[9] = mode == AuraMode.AuraBreathe ? (byte)1 : (byte)0;
|
msg[9] = mode == AuraMode.AuraBreathe ? (byte)1 : (byte)0;
|
||||||
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
|
||||||
@@ -294,12 +294,12 @@ namespace GHelper.USB
|
|||||||
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
|
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
|
||||||
if (isACPI) Program.acpi.TUFKeyboardBrightness(brightness);
|
if (isACPI) Program.acpi.TUFKeyboardBrightness(brightness);
|
||||||
|
|
||||||
AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log);
|
AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log);
|
||||||
|
|
||||||
if (AppConfig.IsAlly()) ApplyAura();
|
if (AppConfig.IsAlly()) ApplyAura();
|
||||||
|
|
||||||
if (AppConfig.ContainsModel("GA503"))
|
if (AppConfig.ContainsModel("GA503"))
|
||||||
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, log);
|
AsusHid.WriteInput(new byte[] { AsusHid.INPUT_ID, 0xBA, 0xC5, 0xC4, (byte)brightness }, log);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user