mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Controller mode binding
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using GHelper.Gpu.AMD;
|
using GHelper.Gpu.AMD;
|
||||||
|
using GHelper.Helpers;
|
||||||
using GHelper.Input;
|
using GHelper.Input;
|
||||||
using GHelper.Mode;
|
using GHelper.Mode;
|
||||||
using GHelper.USB;
|
using GHelper.USB;
|
||||||
@@ -90,6 +91,7 @@ namespace GHelper.Ally
|
|||||||
public const string BindBrightnessDown = "04-04-8C-88-8A-05";
|
public const string BindBrightnessDown = "04-04-8C-88-8A-05";
|
||||||
public const string BindBrightnessUp = "04-04-8C-88-8A-06";
|
public const string BindBrightnessUp = "04-04-8C-88-8A-06";
|
||||||
public const string BindXGM = "04-04-8C-88-8A-04";
|
public const string BindXGM = "04-04-8C-88-8A-04";
|
||||||
|
public const string BindToggleMode = "04-04-8C-88-8A-0C";
|
||||||
|
|
||||||
public const string BindOverlay = "04-03-8C-88-44";
|
public const string BindOverlay = "04-03-8C-88-44";
|
||||||
|
|
||||||
@@ -140,6 +142,8 @@ namespace GHelper.Ally
|
|||||||
|
|
||||||
{ BindXB, "XBox/Steam" },
|
{ BindXB, "XBox/Steam" },
|
||||||
|
|
||||||
|
{ BindToggleMode, "Controller Mode" },
|
||||||
|
|
||||||
{ BindVolUp, "Vol Up" },
|
{ BindVolUp, "Vol Up" },
|
||||||
{ BindVolDown, "Vol Down" },
|
{ BindVolDown, "Vol Down" },
|
||||||
{ BindBrightnessUp, "Bright Up" },
|
{ BindBrightnessUp, "Bright Up" },
|
||||||
@@ -584,6 +588,21 @@ namespace GHelper.Ally
|
|||||||
settings.VisualiseController(mode);
|
settings.VisualiseController(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ToggleModeHotkey()
|
||||||
|
{
|
||||||
|
if (_applyMode == ControllerMode.Gamepad)
|
||||||
|
{
|
||||||
|
SetMode(ControllerMode.Mouse);
|
||||||
|
Program.toast.RunToast("Mouse", ToastIcon.Controller);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetMode(ControllerMode.Gamepad);
|
||||||
|
Program.toast.RunToast("Gamepad", ToastIcon.Controller);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ToggleMode()
|
public void ToggleMode()
|
||||||
{
|
{
|
||||||
switch (_mode)
|
switch (_mode)
|
||||||
|
|||||||
@@ -65,8 +65,14 @@ public class AmdGpuControl : IGpuControl
|
|||||||
if (!Adl2.Load())
|
if (!Adl2.Load())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Adl2.ADL2_Main_Control_Create(1, out _adlContextHandle) != Adl2.ADL_SUCCESS)
|
try
|
||||||
|
{
|
||||||
|
if (Adl2.ADL2_Main_Control_Create(1, out _adlContextHandle) != Adl2.ADL_SUCCESS) return;
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WriteLine(ex.Message);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ADLAdapterInfo? internalDiscreteAdapter = FindByType(ADLAsicFamilyType.Discrete);
|
ADLAdapterInfo? internalDiscreteAdapter = FindByType(ADLAsicFamilyType.Discrete);
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ namespace GHelper.Helpers
|
|||||||
MicrophoneMute,
|
MicrophoneMute,
|
||||||
FnLock,
|
FnLock,
|
||||||
Battery,
|
Battery,
|
||||||
Charger
|
Charger,
|
||||||
|
Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ToastForm : OSDNativeForm
|
public class ToastForm : OSDNativeForm
|
||||||
@@ -111,6 +112,9 @@ namespace GHelper.Helpers
|
|||||||
case ToastIcon.Charger:
|
case ToastIcon.Charger:
|
||||||
icon = Properties.Resources.icons8_charging_battery_96;
|
icon = Properties.Resources.icons8_charging_battery_96;
|
||||||
break;
|
break;
|
||||||
|
case ToastIcon.Controller:
|
||||||
|
icon = Properties.Resources.icons8_controller_96;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ namespace GHelper.Input
|
|||||||
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F1);
|
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F1);
|
||||||
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2);
|
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F2);
|
||||||
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F3);
|
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F3);
|
||||||
|
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FN-Lock group
|
// FN-Lock group
|
||||||
@@ -374,6 +375,9 @@ namespace GHelper.Input
|
|||||||
case Keys.F3:
|
case Keys.F3:
|
||||||
Program.settingsForm.gpuControl.ToggleXGM(true);
|
Program.settingsForm.gpuControl.ToggleXGM(true);
|
||||||
break;
|
break;
|
||||||
|
case Keys.F4:
|
||||||
|
Program.settingsForm.allyControl.ToggleModeHotkey();
|
||||||
|
break;
|
||||||
case Keys.F14:
|
case Keys.F14:
|
||||||
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
|
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
|
||||||
break;
|
break;
|
||||||
|
|||||||
10
app/Properties/Resources.Designer.cs
generated
10
app/Properties/Resources.Designer.cs
generated
@@ -250,6 +250,16 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap icons8_controller_96 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("icons8_controller_96", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -328,4 +328,7 @@
|
|||||||
<data name="icons8-xbox-rt-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8-xbox-rt-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="icons8_controller_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
BIN
app/Resources/icons8-controller-96.png
Normal file
BIN
app/Resources/icons8-controller-96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -24,8 +24,8 @@ namespace GHelper
|
|||||||
ToolStripMenuItem menuSilent, menuBalanced, menuTurbo, menuEco, menuStandard, menuUltimate, menuOptimized;
|
ToolStripMenuItem menuSilent, menuBalanced, menuTurbo, menuEco, menuStandard, menuUltimate, menuOptimized;
|
||||||
|
|
||||||
public GPUModeControl gpuControl;
|
public GPUModeControl gpuControl;
|
||||||
|
public AllyControl allyControl;
|
||||||
ScreenControl screenControl = new ScreenControl();
|
ScreenControl screenControl = new ScreenControl();
|
||||||
AllyControl allyControl;
|
|
||||||
AutoUpdateControl updateControl;
|
AutoUpdateControl updateControl;
|
||||||
|
|
||||||
AsusMouseSettings? mouseSettings;
|
AsusMouseSettings? mouseSettings;
|
||||||
|
|||||||
@@ -238,19 +238,19 @@ namespace GHelper.USB
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static byte[] AuraMessage(AuraMode mode, Color color, Color color2, int speed, bool mono = false)
|
public static byte[] AuraMessage(AuraMode mode, Color color, Color color2, int speed, bool mono = false, byte zoneByte = 0x00)
|
||||||
{
|
{
|
||||||
|
|
||||||
byte[] msg = new byte[17];
|
byte[] msg = new byte[17];
|
||||||
msg[0] = AsusHid.AURA_ID;
|
msg[0] = AsusHid.AURA_ID;
|
||||||
msg[1] = 0xb3;
|
msg[1] = 0xB3;
|
||||||
msg[2] = 0x00; // Zone
|
msg[2] = zoneByte; // Zone
|
||||||
msg[3] = (byte)mode; // Aura Mode
|
msg[3] = (byte)mode; // Aura Mode
|
||||||
msg[4] = color.R; // R
|
msg[4] = color.R; // R
|
||||||
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] = 0; // aura.direction as u8;
|
msg[8] = 0xFF; // 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
|
||||||
@@ -665,6 +665,7 @@ namespace GHelper.USB
|
|||||||
int _speed = (Speed == AuraSpeed.Normal) ? 0xeb : (Speed == AuraSpeed.Fast) ? 0xf5 : 0xe1;
|
int _speed = (Speed == AuraSpeed.Normal) ? 0xeb : (Speed == AuraSpeed.Fast) ? 0xf5 : 0xe1;
|
||||||
|
|
||||||
AsusHid.Write(new List<byte[]> { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_SET, MESSAGE_APPLY });
|
AsusHid.Write(new List<byte[]> { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_SET, MESSAGE_APPLY });
|
||||||
|
//AsusHid.Write(new List<byte[]> { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor, 0x0A), MESSAGE_SET, MESSAGE_APPLY });
|
||||||
|
|
||||||
if (isACPI)
|
if (isACPI)
|
||||||
Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed);
|
Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed);
|
||||||
|
|||||||
Reference in New Issue
Block a user