diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index f8aec50e..1a7bf5f0 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -1,4 +1,5 @@ using GHelper.Gpu.AMD; +using GHelper.Helpers; using GHelper.Input; using GHelper.Mode; using GHelper.USB; @@ -90,6 +91,7 @@ namespace GHelper.Ally public const string BindBrightnessDown = "04-04-8C-88-8A-05"; public const string BindBrightnessUp = "04-04-8C-88-8A-06"; 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"; @@ -140,6 +142,8 @@ namespace GHelper.Ally { BindXB, "XBox/Steam" }, + { BindToggleMode, "Controller Mode" }, + { BindVolUp, "Vol Up" }, { BindVolDown, "Vol Down" }, { BindBrightnessUp, "Bright Up" }, @@ -584,6 +588,21 @@ namespace GHelper.Ally 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() { switch (_mode) diff --git a/app/Gpu/AMD/AmdGpuControl.cs b/app/Gpu/AMD/AmdGpuControl.cs index bae8716c..6583f12a 100644 --- a/app/Gpu/AMD/AmdGpuControl.cs +++ b/app/Gpu/AMD/AmdGpuControl.cs @@ -65,8 +65,14 @@ public class AmdGpuControl : IGpuControl if (!Adl2.Load()) 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; + } ADLAdapterInfo? internalDiscreteAdapter = FindByType(ADLAsicFamilyType.Discrete); diff --git a/app/Helpers/ToastForm.cs b/app/Helpers/ToastForm.cs index 31be15ca..a96cc509 100644 --- a/app/Helpers/ToastForm.cs +++ b/app/Helpers/ToastForm.cs @@ -50,7 +50,8 @@ namespace GHelper.Helpers MicrophoneMute, FnLock, Battery, - Charger + Charger, + Controller } public class ToastForm : OSDNativeForm @@ -111,6 +112,9 @@ namespace GHelper.Helpers case ToastIcon.Charger: icon = Properties.Resources.icons8_charging_battery_96; break; + case ToastIcon.Controller: + icon = Properties.Resources.icons8_controller_96; + break; } diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 01346d27..580d97f7 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -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.F2); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F3); + hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F4); } // FN-Lock group @@ -374,6 +375,9 @@ namespace GHelper.Input case Keys.F3: Program.settingsForm.gpuControl.ToggleXGM(true); break; + case Keys.F4: + Program.settingsForm.allyControl.ToggleModeHotkey(); + break; case Keys.F14: Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); break; diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 7e09db07..7afc4654 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -250,6 +250,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_controller_96 { + get { + object obj = ResourceManager.GetObject("icons8_controller_96", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 1dc0a113..61b20e70 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -328,4 +328,7 @@ ..\Resources\icons8-xbox-rt-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/app/Resources/icons8-controller-96.png b/app/Resources/icons8-controller-96.png new file mode 100644 index 00000000..56f92739 Binary files /dev/null and b/app/Resources/icons8-controller-96.png differ diff --git a/app/Settings.cs b/app/Settings.cs index 63a8aa16..0ad3e14f 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -24,8 +24,8 @@ namespace GHelper ToolStripMenuItem menuSilent, menuBalanced, menuTurbo, menuEco, menuStandard, menuUltimate, menuOptimized; public GPUModeControl gpuControl; + public AllyControl allyControl; ScreenControl screenControl = new ScreenControl(); - AllyControl allyControl; AutoUpdateControl updateControl; AsusMouseSettings? mouseSettings; diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 8a8e2078..c2addfdb 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -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]; msg[0] = AsusHid.AURA_ID; - msg[1] = 0xb3; - msg[2] = 0x00; // Zone + msg[1] = 0xB3; + msg[2] = zoneByte; // Zone msg[3] = (byte)mode; // Aura Mode msg[4] = color.R; // R msg[5] = mono ? (byte)0 : color.G; // G msg[6] = mono ? (byte)0 : color.B; // B 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[10] = color2.R; // R 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; AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor), MESSAGE_SET, MESSAGE_APPLY }); + //AsusHid.Write(new List { AuraMessage(Mode, _Color1, _Color2, _speed, isSingleColor, 0x0A), MESSAGE_SET, MESSAGE_APPLY }); if (isACPI) Program.acpi.TUFKeyboardRGB(Mode, Color1, _speed);