diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7933b35bd..0a22a429f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -14,7 +14,6 @@ labels: bug - [ ] GPD - [ ] ONEXPLAYER - [ ] VALVE -- [ ] LENOVO **Device model** Your device model diff --git a/HandheldCompanion/Actions/AxisActions.cs b/HandheldCompanion/Actions/AxisActions.cs index bd5e31c1a..b89f7ffbe 100644 --- a/HandheldCompanion/Actions/AxisActions.cs +++ b/HandheldCompanion/Actions/AxisActions.cs @@ -1,58 +1,58 @@ -using HandheldCompanion.Inputs; -using HandheldCompanion.Utils; -using System; -using System.Numerics; -using System.Windows.Forms; - -namespace HandheldCompanion.Actions -{ - [Serializable] - public class AxisActions : GyroActions - { - public AxisLayoutFlags Axis; - - // Axis to axis - public bool ImproveCircularity = false; - public int AxisAntiDeadZone = 0; - public int AxisDeadZoneInner = 0; - public int AxisDeadZoneOuter = 0; - public bool AxisRotated = false; - public bool AxisInverted = false; - - public AxisActions() - { - this.actionType = ActionType.Joystick; - this.Value = new Vector2(); - } - - public AxisActions(AxisLayoutFlags axis) : this() - { - this.Axis = axis; - } - - public void Execute(AxisLayout layout) - { - layout.vector = InputUtils.ThumbScaledRadialInnerOuterDeadzone(layout.vector, AxisDeadZoneInner, AxisDeadZoneOuter); - layout.vector = InputUtils.ApplyAntiDeadzone(layout.vector, AxisAntiDeadZone); - - if (ImproveCircularity) - layout.vector = InputUtils.ImproveCircularity(layout.vector); - - if (AutoRotate) - layout.vector = ((Orientation & ScreenOrientation.Angle90) == ScreenOrientation.Angle90 - ? new Vector2(layout.vector.Y, -layout.vector.X) - : layout.vector) - * ((Orientation & ScreenOrientation.Angle180) == ScreenOrientation.Angle180 ? -1.0f : 1.0f); - else - layout.vector = (AxisRotated ? new Vector2(layout.vector.Y, -layout.vector.X) : layout.vector) - * (AxisInverted ? -1.0f : 1.0f); - - this.Value = (AxisRotated ? new(layout.vector.Y, -layout.vector.X) : layout.vector) * (AxisInverted ? -1.0f : 1.0f); - } - - public Vector2 GetValue() - { - return (Vector2)this.Value; - } - } -} +using HandheldCompanion.Inputs; +using HandheldCompanion.Utils; +using System; +using System.Numerics; +using System.Windows.Forms; + +namespace HandheldCompanion.Actions +{ + [Serializable] + public class AxisActions : GyroActions + { + public AxisLayoutFlags Axis; + + // Axis to axis + public bool ImproveCircularity = false; + public int AxisAntiDeadZone = 0; + public int AxisDeadZoneInner = 0; + public int AxisDeadZoneOuter = 0; + public bool AxisRotated = false; + public bool AxisInverted = false; + + public AxisActions() + { + this.actionType = ActionType.Joystick; + this.Value = new Vector2(); + } + + public AxisActions(AxisLayoutFlags axis) : this() + { + this.Axis = axis; + } + + public void Execute(AxisLayout layout) + { + layout.vector = InputUtils.ThumbScaledRadialInnerOuterDeadzone(layout.vector, AxisDeadZoneInner, AxisDeadZoneOuter); + layout.vector = InputUtils.ApplyAntiDeadzone(layout.vector, AxisAntiDeadZone); + + if (ImproveCircularity) + layout.vector = InputUtils.ImproveCircularity(layout.vector); + + if (AutoRotate) + layout.vector = ((Orientation & ScreenOrientation.Angle90) == ScreenOrientation.Angle90 + ? new Vector2(layout.vector.Y, -layout.vector.X) + : layout.vector) + * ((Orientation & ScreenOrientation.Angle180) == ScreenOrientation.Angle180 ? -1.0f : 1.0f); + else + layout.vector = (AxisRotated ? new Vector2(layout.vector.Y, -layout.vector.X) : layout.vector) + * (AxisInverted ? -1.0f : 1.0f); + + this.Value = (AxisRotated ? new(layout.vector.Y, -layout.vector.X) : layout.vector) * (AxisInverted ? -1.0f : 1.0f); + } + + public Vector2 GetValue() + { + return (Vector2)this.Value; + } + } +} diff --git a/HandheldCompanion/Actions/ButtonActions.cs b/HandheldCompanion/Actions/ButtonActions.cs index 2b95662ac..34909b0d2 100644 --- a/HandheldCompanion/Actions/ButtonActions.cs +++ b/HandheldCompanion/Actions/ButtonActions.cs @@ -1,59 +1,59 @@ -using HandheldCompanion.Inputs; -using System; - -namespace HandheldCompanion.Actions -{ - [Serializable] - public class ButtonActions : IActions - { - public ButtonFlags Button; - - // runtime variables - private bool IsKeyDown = false; - - public ButtonActions() - { - this.actionType = ActionType.Button; - - this.Value = false; - this.prevValue = false; - } - - public ButtonActions(ButtonFlags button) : this() - { - this.Button = button; - } - - public override void Execute(ButtonFlags button, bool value) - { - base.Execute(button, value); - - switch (this.Value) - { - case true: - { - if (IsKeyDown) - return; - - IsKeyDown = true; - SetHaptic(button, false); - } - break; - case false: - { - if (!IsKeyDown) - return; - - IsKeyDown = false; - SetHaptic(button, true); - } - break; - } - } - - public bool GetValue() - { - return (bool)this.Value; - } - } -} +using HandheldCompanion.Inputs; +using System; + +namespace HandheldCompanion.Actions +{ + [Serializable] + public class ButtonActions : IActions + { + public ButtonFlags Button; + + // runtime variables + private bool IsKeyDown = false; + + public ButtonActions() + { + this.actionType = ActionType.Button; + + this.Value = false; + this.prevValue = false; + } + + public ButtonActions(ButtonFlags button) : this() + { + this.Button = button; + } + + public override void Execute(ButtonFlags button, bool value) + { + base.Execute(button, value); + + switch (this.Value) + { + case true: + { + if (IsKeyDown) + return; + + IsKeyDown = true; + SetHaptic(button, false); + } + break; + case false: + { + if (!IsKeyDown) + return; + + IsKeyDown = false; + SetHaptic(button, true); + } + break; + } + } + + public bool GetValue() + { + return (bool)this.Value; + } + } +} diff --git a/HandheldCompanion/Actions/IActions.cs b/HandheldCompanion/Actions/IActions.cs index ab25b1683..42b8e6d0e 100644 --- a/HandheldCompanion/Actions/IActions.cs +++ b/HandheldCompanion/Actions/IActions.cs @@ -1,380 +1,380 @@ -using HandheldCompanion.Inputs; -using HandheldCompanion.Managers; -using System; -using System.Collections.Generic; -using System.Windows.Forms; -using WindowsInput.Events; - -namespace HandheldCompanion.Actions -{ - [Serializable] - public enum ActionType - { - Disabled = 0, - Button = 1, - Joystick = 2, - Keyboard = 3, - Mouse = 4, - Trigger = 5, - Special = 6, - } - - [Serializable] - public enum ActionState - { - Stopped = 0, - Running = 1, - Aborted = 2, - Succeed = 3, - Suspended = 4, - Forced = 5, - } - - [Serializable] - public enum ModifierSet - { - None = 0, - Shift = 1, - Control = 2, - Alt = 3, - ShiftControl = 4, - ShiftAlt = 5, - ControlAlt = 6, - ShiftControlAlt = 7, - } - - [Serializable] - public enum PressType - { - Short = 0, - Long = 1, // hold for x ms and get an action - Hold = 2, // press and hold the command for x ms - Double = 3, - } - - [Serializable] - public enum HapticMode - { - Off = 0, - Down = 1, - Up = 2, - Both = 3, - } - - [Serializable] - public enum HapticStrength - { - Low = 0, - Medium = 1, - High = 2, - } - - [Serializable] - public abstract class IActions : ICloneable - { - public static Dictionary ModifierMap = new() - { - { ModifierSet.None, new KeyCode[] { } }, - { ModifierSet.Shift, new KeyCode[] { KeyCode.LShift } }, - { ModifierSet.Control, new KeyCode[] { KeyCode.LControl } }, - { ModifierSet.Alt, new KeyCode[] { KeyCode.LMenu } }, - { ModifierSet.ShiftControl, new KeyCode[] { KeyCode.LShift, KeyCode.LControl } }, - { ModifierSet.ShiftAlt, new KeyCode[] { KeyCode.LShift, KeyCode.LMenu } }, - { ModifierSet.ControlAlt, new KeyCode[] { KeyCode.LControl, KeyCode.LMenu } }, - { ModifierSet.ShiftControlAlt, new KeyCode[] { KeyCode.LShift, KeyCode.LControl, KeyCode.LMenu } }, - }; - - public ActionType actionType = ActionType.Disabled; - public PressType pressType = PressType.Short; - public ActionState actionState = ActionState.Stopped; - - protected object Value; - protected object prevValue; - - public int ActionTimer = 200; // default value for steam - public int pressTimer = -1; // -1 inactive, >= 0 active - - private int pressCount = 0; // used to store previous press value for double tap - - public bool Turbo; - public int TurboDelay = 30; - protected int TurboIdx; - protected bool IsTurboed; - - public bool Toggle; - protected bool IsToggled; - - public bool Interruptable = true; - - public HapticMode HapticMode = HapticMode.Off; - public HapticStrength HapticStrength = HapticStrength.Low; - - protected ScreenOrientation Orientation = ScreenOrientation.Angle0; - public bool AutoRotate { get; set; } = false; - - public IActions() - { - } - - public virtual void SetHaptic(ButtonFlags button, bool up) - { - if (this.HapticMode == HapticMode.Off) return; - if (this.HapticMode == HapticMode.Down && up) return; - if (this.HapticMode == HapticMode.Up && !up) return; - - ControllerManager.GetTargetController()?.SetHaptic(this.HapticStrength, button); - } - - public virtual void Execute(ButtonFlags button, bool value) - { - if (actionState == ActionState.Suspended) - { - // bypass output - this.Value = false; - this.prevValue = value; - return; - } - else if (actionState == ActionState.Forced) - { - // bypass output - value = true; - } - - switch (pressType) - { - case PressType.Long: - { - if (value) - { - // update state - actionState = ActionState.Running; - - // update timer - pressTimer += TimerManager.GetPeriod(); - - if (pressTimer >= ActionTimer) - { - // update state - actionState = ActionState.Succeed; - } - else - { - // bypass output - this.Value = false; - this.prevValue = value; - return; - } - } - else - { - // key was released too early - if (actionState == ActionState.Running) - { - // update state - actionState = ActionState.Aborted; - - // update timer - pressTimer = Math.Max(50, pressTimer); - } - else if (actionState == ActionState.Succeed) - { - // update state - actionState = ActionState.Stopped; - - // update timer - pressTimer = -1; - } - else if (actionState == ActionState.Stopped) - { - // update timer - pressTimer = -1; - } - - if (actionState == ActionState.Aborted) - { - // set to aborted for a time equal to the actions was "running" - if (pressTimer >= 0) - { - // update state - actionState = ActionState.Aborted; - - // update timer - pressTimer -= TimerManager.GetPeriod(); - } - else - { - // update state - actionState = ActionState.Stopped; - - // update timer - pressTimer = -1; - } - } - } - } - break; - - case PressType.Hold: - { - if (value || (pressTimer <= ActionTimer && pressTimer >= 0)) - { - // update state - actionState = ActionState.Running; - - // update timer - pressTimer += TimerManager.GetPeriod(); - - // bypass output (simple) - value = true; - } - else if (pressTimer >= ActionTimer) - { - // update state - actionState = ActionState.Stopped; - - // reset var(s) - pressTimer = -1; - } - } - break; - - case PressType.Double: - { - if (value) - { - // increase press count - if ((bool)prevValue != value) - pressCount++; - } - - switch (pressCount) - { - default: - { - if (actionState != ActionState.Stopped) - { - // update timer - pressTimer += TimerManager.GetPeriod(); - - if (pressTimer >= 50) - { - // update state - actionState = ActionState.Stopped; - - // reset var(s) - pressCount = 0; - pressTimer = 0; - } - } - - // bypass output - this.Value = false; - this.prevValue = value; - return; - } - - case 1: - { - // update state - actionState = ActionState.Running; - - // update timer - pressTimer += TimerManager.GetPeriod(); - - // too slow to press again ? - if (pressTimer > ActionTimer) - { - // update state - actionState = ActionState.Aborted; - - // reset var(s) - pressCount = 0; - pressTimer = 0; - } - - // bypass output - this.Value = false; - this.prevValue = value; - return; - } - - case 2: - { - // on time - if (pressTimer <= ActionTimer && value) - { - // update state - actionState = ActionState.Succeed; - - // reset var(s) - pressCount = 2; - pressTimer = ActionTimer; - } - else - { - // update state - actionState = ActionState.Stopped; - - // reset var(s) - pressCount = 0; - pressTimer = 0; - } - } - break; - } - } - break; - } - - if (Toggle) - { - if ((bool)prevValue != value && value) - IsToggled = !IsToggled; - } - else - IsToggled = false; - - if (Turbo) - { - if (value || IsToggled) - { - if (TurboIdx % TurboDelay == 0) - IsTurboed = !IsTurboed; - - TurboIdx += TimerManager.GetPeriod(); - } - else - { - IsTurboed = false; - TurboIdx = 0; - } - } - else - IsTurboed = false; - - // update previous value - prevValue = value; - - // update value - if (Toggle && Turbo) - this.Value = IsToggled && IsTurboed; - else if (Toggle) - this.Value = IsToggled; - else if (Turbo) - this.Value = IsTurboed; - else - this.Value = value; - } - - public virtual void SetOrientation(ScreenOrientation orientation) - { - Orientation = orientation; - } - - // Improve me ! - public object Clone() - { - return MemberwiseClone(); - } - } -} +using HandheldCompanion.Inputs; +using HandheldCompanion.Managers; +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using WindowsInput.Events; + +namespace HandheldCompanion.Actions +{ + [Serializable] + public enum ActionType + { + Disabled = 0, + Button = 1, + Joystick = 2, + Keyboard = 3, + Mouse = 4, + Trigger = 5, + Special = 6, + } + + [Serializable] + public enum ActionState + { + Stopped = 0, + Running = 1, + Aborted = 2, + Succeed = 3, + Suspended = 4, + Forced = 5, + } + + [Serializable] + public enum ModifierSet + { + None = 0, + Shift = 1, + Control = 2, + Alt = 3, + ShiftControl = 4, + ShiftAlt = 5, + ControlAlt = 6, + ShiftControlAlt = 7, + } + + [Serializable] + public enum PressType + { + Short = 0, + Long = 1, // hold for x ms and get an action + Hold = 2, // press and hold the command for x ms + Double = 3, + } + + [Serializable] + public enum HapticMode + { + Off = 0, + Down = 1, + Up = 2, + Both = 3, + } + + [Serializable] + public enum HapticStrength + { + Low = 0, + Medium = 1, + High = 2, + } + + [Serializable] + public abstract class IActions : ICloneable + { + public static Dictionary ModifierMap = new() + { + { ModifierSet.None, new KeyCode[] { } }, + { ModifierSet.Shift, new KeyCode[] { KeyCode.LShift } }, + { ModifierSet.Control, new KeyCode[] { KeyCode.LControl } }, + { ModifierSet.Alt, new KeyCode[] { KeyCode.LMenu } }, + { ModifierSet.ShiftControl, new KeyCode[] { KeyCode.LShift, KeyCode.LControl } }, + { ModifierSet.ShiftAlt, new KeyCode[] { KeyCode.LShift, KeyCode.LMenu } }, + { ModifierSet.ControlAlt, new KeyCode[] { KeyCode.LControl, KeyCode.LMenu } }, + { ModifierSet.ShiftControlAlt, new KeyCode[] { KeyCode.LShift, KeyCode.LControl, KeyCode.LMenu } }, + }; + + public ActionType actionType = ActionType.Disabled; + public PressType pressType = PressType.Short; + public ActionState actionState = ActionState.Stopped; + + protected object Value; + protected object prevValue; + + public int ActionTimer = 200; // default value for steam + public int pressTimer = -1; // -1 inactive, >= 0 active + + private int pressCount = 0; // used to store previous press value for double tap + + public bool Turbo; + public int TurboDelay = 30; + protected int TurboIdx; + protected bool IsTurboed; + + public bool Toggle; + protected bool IsToggled; + + public bool Interruptable = true; + + public HapticMode HapticMode = HapticMode.Off; + public HapticStrength HapticStrength = HapticStrength.Low; + + protected ScreenOrientation Orientation = ScreenOrientation.Angle0; + public bool AutoRotate { get; set; } = false; + + public IActions() + { + } + + public virtual void SetHaptic(ButtonFlags button, bool up) + { + if (this.HapticMode == HapticMode.Off) return; + if (this.HapticMode == HapticMode.Down && up) return; + if (this.HapticMode == HapticMode.Up && !up) return; + + ControllerManager.GetTargetController()?.SetHaptic(this.HapticStrength, button); + } + + public virtual void Execute(ButtonFlags button, bool value) + { + if (actionState == ActionState.Suspended) + { + // bypass output + this.Value = false; + this.prevValue = value; + return; + } + else if (actionState == ActionState.Forced) + { + // bypass output + value = true; + } + + switch (pressType) + { + case PressType.Long: + { + if (value) + { + // update state + actionState = ActionState.Running; + + // update timer + pressTimer += TimerManager.GetPeriod(); + + if (pressTimer >= ActionTimer) + { + // update state + actionState = ActionState.Succeed; + } + else + { + // bypass output + this.Value = false; + this.prevValue = value; + return; + } + } + else + { + // key was released too early + if (actionState == ActionState.Running) + { + // update state + actionState = ActionState.Aborted; + + // update timer + pressTimer = Math.Max(50, pressTimer); + } + else if (actionState == ActionState.Succeed) + { + // update state + actionState = ActionState.Stopped; + + // update timer + pressTimer = -1; + } + else if (actionState == ActionState.Stopped) + { + // update timer + pressTimer = -1; + } + + if (actionState == ActionState.Aborted) + { + // set to aborted for a time equal to the actions was "running" + if (pressTimer >= 0) + { + // update state + actionState = ActionState.Aborted; + + // update timer + pressTimer -= TimerManager.GetPeriod(); + } + else + { + // update state + actionState = ActionState.Stopped; + + // update timer + pressTimer = -1; + } + } + } + } + break; + + case PressType.Hold: + { + if (value || (pressTimer <= ActionTimer && pressTimer >= 0)) + { + // update state + actionState = ActionState.Running; + + // update timer + pressTimer += TimerManager.GetPeriod(); + + // bypass output (simple) + value = true; + } + else if (pressTimer >= ActionTimer) + { + // update state + actionState = ActionState.Stopped; + + // reset var(s) + pressTimer = -1; + } + } + break; + + case PressType.Double: + { + if (value) + { + // increase press count + if ((bool)prevValue != value) + pressCount++; + } + + switch (pressCount) + { + default: + { + if (actionState != ActionState.Stopped) + { + // update timer + pressTimer += TimerManager.GetPeriod(); + + if (pressTimer >= 50) + { + // update state + actionState = ActionState.Stopped; + + // reset var(s) + pressCount = 0; + pressTimer = 0; + } + } + + // bypass output + this.Value = false; + this.prevValue = value; + return; + } + + case 1: + { + // update state + actionState = ActionState.Running; + + // update timer + pressTimer += TimerManager.GetPeriod(); + + // too slow to press again ? + if (pressTimer > ActionTimer) + { + // update state + actionState = ActionState.Aborted; + + // reset var(s) + pressCount = 0; + pressTimer = 0; + } + + // bypass output + this.Value = false; + this.prevValue = value; + return; + } + + case 2: + { + // on time + if (pressTimer <= ActionTimer && value) + { + // update state + actionState = ActionState.Succeed; + + // reset var(s) + pressCount = 2; + pressTimer = ActionTimer; + } + else + { + // update state + actionState = ActionState.Stopped; + + // reset var(s) + pressCount = 0; + pressTimer = 0; + } + } + break; + } + } + break; + } + + if (Toggle) + { + if ((bool)prevValue != value && value) + IsToggled = !IsToggled; + } + else + IsToggled = false; + + if (Turbo) + { + if (value || IsToggled) + { + if (TurboIdx % TurboDelay == 0) + IsTurboed = !IsTurboed; + + TurboIdx += TimerManager.GetPeriod(); + } + else + { + IsTurboed = false; + TurboIdx = 0; + } + } + else + IsTurboed = false; + + // update previous value + prevValue = value; + + // update value + if (Toggle && Turbo) + this.Value = IsToggled && IsTurboed; + else if (Toggle) + this.Value = IsToggled; + else if (Turbo) + this.Value = IsTurboed; + else + this.Value = value; + } + + public virtual void SetOrientation(ScreenOrientation orientation) + { + Orientation = orientation; + } + + // Improve me ! + public object Clone() + { + return MemberwiseClone(); + } + } +} diff --git a/HandheldCompanion/Actions/KeyboardActions.cs b/HandheldCompanion/Actions/KeyboardActions.cs index 6f1c488af..fd4b8de07 100644 --- a/HandheldCompanion/Actions/KeyboardActions.cs +++ b/HandheldCompanion/Actions/KeyboardActions.cs @@ -1,66 +1,66 @@ -using GregsStack.InputSimulatorStandard.Native; -using HandheldCompanion.Inputs; -using HandheldCompanion.Simulators; -using System; -using WindowsInput.Events; - -namespace HandheldCompanion.Actions -{ - [Serializable] - public class KeyboardActions : IActions - { - public VirtualKeyCode Key; - - // runtime variables - private bool IsKeyDown = false; - private KeyCode[] pressed; - - // settings - public ModifierSet Modifiers = ModifierSet.None; - - public KeyboardActions() - { - this.actionType = ActionType.Keyboard; - - this.Value = false; - this.prevValue = false; - } - - public KeyboardActions(VirtualKeyCode key) : this() - { - this.Key = key; - } - - public override void Execute(ButtonFlags button, bool value) - { - base.Execute(button, value); - - switch (this.Value) - { - case true: - { - if (IsKeyDown) - return; - - IsKeyDown = true; - pressed = ModifierMap[Modifiers]; - KeyboardSimulator.KeyDown(pressed); - KeyboardSimulator.KeyDown(Key); - SetHaptic(button, false); - } - break; - case false: - { - if (!IsKeyDown) - return; - - IsKeyDown = false; - KeyboardSimulator.KeyUp(Key); - KeyboardSimulator.KeyUp(pressed); - SetHaptic(button, true); - } - break; - } - } - } -} +using GregsStack.InputSimulatorStandard.Native; +using HandheldCompanion.Inputs; +using HandheldCompanion.Simulators; +using System; +using WindowsInput.Events; + +namespace HandheldCompanion.Actions +{ + [Serializable] + public class KeyboardActions : IActions + { + public VirtualKeyCode Key; + + // runtime variables + private bool IsKeyDown = false; + private KeyCode[] pressed; + + // settings + public ModifierSet Modifiers = ModifierSet.None; + + public KeyboardActions() + { + this.actionType = ActionType.Keyboard; + + this.Value = false; + this.prevValue = false; + } + + public KeyboardActions(VirtualKeyCode key) : this() + { + this.Key = key; + } + + public override void Execute(ButtonFlags button, bool value) + { + base.Execute(button, value); + + switch (this.Value) + { + case true: + { + if (IsKeyDown) + return; + + IsKeyDown = true; + pressed = ModifierMap[Modifiers]; + KeyboardSimulator.KeyDown(pressed); + KeyboardSimulator.KeyDown(Key); + SetHaptic(button, false); + } + break; + case false: + { + if (!IsKeyDown) + return; + + IsKeyDown = false; + KeyboardSimulator.KeyUp(Key); + KeyboardSimulator.KeyUp(pressed); + SetHaptic(button, true); + } + break; + } + } + } +} diff --git a/HandheldCompanion/Actions/MouseActions.cs b/HandheldCompanion/Actions/MouseActions.cs index 97fdc8c00..ae20b4839 100644 --- a/HandheldCompanion/Actions/MouseActions.cs +++ b/HandheldCompanion/Actions/MouseActions.cs @@ -1,206 +1,206 @@ -using HandheldCompanion.Inputs; -using HandheldCompanion.Simulators; -using System; -using System.ComponentModel; -using System.Numerics; -using WindowsInput.Events; - -namespace HandheldCompanion.Actions -{ - [Serializable] - public enum MouseActionsType - { - [Description("Left Button")] - LeftButton = 1, - [Description("Right Button")] - RightButton = 2, - [Description("Middle Button")] - MiddleButton = 3, - - [Description("Move Cursor")] - Move = 4, - [Description("Scroll Wheel")] - Scroll = 5, - - [Description("Scroll Up")] - ScrollUp = 6, - [Description("Scroll Down")] - ScrollDown = 7, - } - - [Serializable] - public class MouseActions : GyroActions - { - public MouseActionsType MouseType; - - // const settings - private const int scrollAmountInClicks = 20; - private const float FilterBeta = 0.5f; - - // runtime variables - private bool IsCursorDown = false; - private bool IsTouched = false; - private Vector2 remainder = new(); - private KeyCode[] pressed; - private OneEuroFilterPair mouseFilter; - private Vector2 prevVector = new(); - - // settings click - public ModifierSet Modifiers = ModifierSet.None; - - // settings axis - public int Sensivity = 33; - public float Acceleration = 1.0f; - public int Deadzone = 10; // stick only - public bool Filtering = false; // pad only - public float FilterCutoff = 0.05f; // pad only - public bool AxisRotated = false; - public bool AxisInverted = false; - - public MouseActions() - { - this.actionType = ActionType.Mouse; - - this.Value = false; - this.prevValue = false; - - mouseFilter = new(FilterCutoff, FilterBeta); - } - - public MouseActions(MouseActionsType type) : this() - { - this.MouseType = type; - } - - public override void Execute(ButtonFlags button, bool value) - { - base.Execute(button, value); - - switch (this.Value) - { - case true: - { - if (IsCursorDown) - return; - - IsCursorDown = true; - pressed = ModifierMap[Modifiers]; - KeyboardSimulator.KeyDown(pressed); - MouseSimulator.MouseDown(MouseType, scrollAmountInClicks); - SetHaptic(button, false); - } - break; - case false: - { - if (!IsCursorDown) - return; - - IsCursorDown = false; - MouseSimulator.MouseUp(MouseType); - KeyboardSimulator.KeyUp(pressed); - SetHaptic(button, true); - } - break; - } - } - - private bool IsNewTouch(bool value) - { - if (value == IsTouched) - return false; - if (IsTouched = value) - return true; - return false; - } - - public void Execute(AxisLayout layout, bool touched) - { - // this line needs to be before the next vector zero check - bool newTouch = IsNewTouch(touched); - - if (layout.vector == Vector2.Zero) - return; - - layout.vector.Y *= -1; - - Vector2 deltaVector; - float sensitivityFinetune; - - switch (layout.flags) - { - case AxisLayoutFlags.LeftStick: - case AxisLayoutFlags.RightStick: - case AxisLayoutFlags.Gyroscope: - default: - { - // convert to <0.0-1.0> values - deltaVector = layout.vector / short.MaxValue; - float deadzone = Deadzone / 100.0f; - - // apply deadzone - if (deltaVector.Length() < deadzone) - return; - - deltaVector *= (deltaVector.Length() - deadzone) / deltaVector.Length(); // shorten by deadzone - deltaVector *= 1.0f / (1.0f - deadzone); // rescale to 0.0 - 1.0 - - sensitivityFinetune = (MouseType == MouseActionsType.Move ? 0.3f : 0.1f); - } - break; - - case AxisLayoutFlags.LeftPad: - case AxisLayoutFlags.RightPad: - { - // touchpad was touched, update entry point for delta calculations - if (newTouch) - { - prevVector = layout.vector; - return; - } - - // calculate delta and convert to <0.0-1.0> values - deltaVector = (layout.vector - prevVector) / short.MaxValue; - prevVector = layout.vector; - - sensitivityFinetune = (MouseType == MouseActionsType.Move ? 9.0f : 3.0f); - } - break; - } - - if (Filtering) - { - mouseFilter.SetFilterCutoff(FilterCutoff); - deltaVector.X = (float)mouseFilter.axis1Filter.Filter(deltaVector.X, 1); - deltaVector.Y = (float)mouseFilter.axis2Filter.Filter(deltaVector.Y, 1); - } - - if (Acceleration != 1.0f) - { - deltaVector.X = (float)(Math.Sign(deltaVector.X) * Math.Pow(Math.Abs(deltaVector.X), Acceleration)); - deltaVector.Y = (float)(Math.Sign(deltaVector.Y) * Math.Pow(Math.Abs(deltaVector.Y), Acceleration)); - sensitivityFinetune = (float)Math.Pow(sensitivityFinetune, Acceleration); - } - - // apply sensitivity, rotation and slider finetune - deltaVector *= Sensivity * sensitivityFinetune; - if (AxisRotated) - deltaVector = new(-deltaVector.Y, deltaVector.X); - deltaVector *= (AxisInverted ? -1.0f : 1.0f); - - // handle the fact that MoveBy()/*Scroll() are int only and we can have movement (0 < abs(delta) < 1) - deltaVector += remainder; // add partial previous step - Vector2 intVector = new((int)Math.Truncate(deltaVector.X), (int)Math.Truncate(deltaVector.Y)); - remainder = deltaVector - intVector; // and save the unused rest - - if (MouseType == MouseActionsType.Move) - { - MouseSimulator.MoveBy((int)intVector.X, (int)intVector.Y); - } - else /* if (MouseType == MouseActionsType.Scroll) */ - { - // MouseSimulator.HorizontalScroll((int)-intVector.X); - MouseSimulator.VerticalScroll((int)-intVector.Y); - } - } - } -} +using HandheldCompanion.Inputs; +using HandheldCompanion.Simulators; +using System; +using System.ComponentModel; +using System.Numerics; +using WindowsInput.Events; + +namespace HandheldCompanion.Actions +{ + [Serializable] + public enum MouseActionsType + { + [Description("Left Button")] + LeftButton = 1, + [Description("Right Button")] + RightButton = 2, + [Description("Middle Button")] + MiddleButton = 3, + + [Description("Move Cursor")] + Move = 4, + [Description("Scroll Wheel")] + Scroll = 5, + + [Description("Scroll Up")] + ScrollUp = 6, + [Description("Scroll Down")] + ScrollDown = 7, + } + + [Serializable] + public class MouseActions : GyroActions + { + public MouseActionsType MouseType; + + // const settings + private const int scrollAmountInClicks = 20; + private const float FilterBeta = 0.5f; + + // runtime variables + private bool IsCursorDown = false; + private bool IsTouched = false; + private Vector2 remainder = new(); + private KeyCode[] pressed; + private OneEuroFilterPair mouseFilter; + private Vector2 prevVector = new(); + + // settings click + public ModifierSet Modifiers = ModifierSet.None; + + // settings axis + public int Sensivity = 33; + public float Acceleration = 1.0f; + public int Deadzone = 10; // stick only + public bool Filtering = false; // pad only + public float FilterCutoff = 0.05f; // pad only + public bool AxisRotated = false; + public bool AxisInverted = false; + + public MouseActions() + { + this.actionType = ActionType.Mouse; + + this.Value = false; + this.prevValue = false; + + mouseFilter = new(FilterCutoff, FilterBeta); + } + + public MouseActions(MouseActionsType type) : this() + { + this.MouseType = type; + } + + public override void Execute(ButtonFlags button, bool value) + { + base.Execute(button, value); + + switch (this.Value) + { + case true: + { + if (IsCursorDown) + return; + + IsCursorDown = true; + pressed = ModifierMap[Modifiers]; + KeyboardSimulator.KeyDown(pressed); + MouseSimulator.MouseDown(MouseType, scrollAmountInClicks); + SetHaptic(button, false); + } + break; + case false: + { + if (!IsCursorDown) + return; + + IsCursorDown = false; + MouseSimulator.MouseUp(MouseType); + KeyboardSimulator.KeyUp(pressed); + SetHaptic(button, true); + } + break; + } + } + + private bool IsNewTouch(bool value) + { + if (value == IsTouched) + return false; + if (IsTouched = value) + return true; + return false; + } + + public void Execute(AxisLayout layout, bool touched) + { + // this line needs to be before the next vector zero check + bool newTouch = IsNewTouch(touched); + + if (layout.vector == Vector2.Zero) + return; + + layout.vector.Y *= -1; + + Vector2 deltaVector; + float sensitivityFinetune; + + switch (layout.flags) + { + case AxisLayoutFlags.LeftStick: + case AxisLayoutFlags.RightStick: + case AxisLayoutFlags.Gyroscope: + default: + { + // convert to <0.0-1.0> values + deltaVector = layout.vector / short.MaxValue; + float deadzone = Deadzone / 100.0f; + + // apply deadzone + if (deltaVector.Length() < deadzone) + return; + + deltaVector *= (deltaVector.Length() - deadzone) / deltaVector.Length(); // shorten by deadzone + deltaVector *= 1.0f / (1.0f - deadzone); // rescale to 0.0 - 1.0 + + sensitivityFinetune = (MouseType == MouseActionsType.Move ? 0.3f : 0.1f); + } + break; + + case AxisLayoutFlags.LeftPad: + case AxisLayoutFlags.RightPad: + { + // touchpad was touched, update entry point for delta calculations + if (newTouch) + { + prevVector = layout.vector; + return; + } + + // calculate delta and convert to <0.0-1.0> values + deltaVector = (layout.vector - prevVector) / short.MaxValue; + prevVector = layout.vector; + + sensitivityFinetune = (MouseType == MouseActionsType.Move ? 9.0f : 3.0f); + } + break; + } + + if (Filtering) + { + mouseFilter.SetFilterCutoff(FilterCutoff); + deltaVector.X = (float)mouseFilter.axis1Filter.Filter(deltaVector.X, 1); + deltaVector.Y = (float)mouseFilter.axis2Filter.Filter(deltaVector.Y, 1); + } + + if (Acceleration != 1.0f) + { + deltaVector.X = (float)(Math.Sign(deltaVector.X) * Math.Pow(Math.Abs(deltaVector.X), Acceleration)); + deltaVector.Y = (float)(Math.Sign(deltaVector.Y) * Math.Pow(Math.Abs(deltaVector.Y), Acceleration)); + sensitivityFinetune = (float)Math.Pow(sensitivityFinetune, Acceleration); + } + + // apply sensitivity, rotation and slider finetune + deltaVector *= Sensivity * sensitivityFinetune; + if (AxisRotated) + deltaVector = new(-deltaVector.Y, deltaVector.X); + deltaVector *= (AxisInverted ? -1.0f : 1.0f); + + // handle the fact that MoveBy()/*Scroll() are int only and we can have movement (0 < abs(delta) < 1) + deltaVector += remainder; // add partial previous step + Vector2 intVector = new((int)Math.Truncate(deltaVector.X), (int)Math.Truncate(deltaVector.Y)); + remainder = deltaVector - intVector; // and save the unused rest + + if (MouseType == MouseActionsType.Move) + { + MouseSimulator.MoveBy((int)intVector.X, (int)intVector.Y); + } + else /* if (MouseType == MouseActionsType.Scroll) */ + { + // MouseSimulator.HorizontalScroll((int)-intVector.X); + MouseSimulator.VerticalScroll((int)-intVector.Y); + } + } + } +} diff --git a/HandheldCompanion/Actions/SpecialActions.cs b/HandheldCompanion/Actions/SpecialActions.cs index 5845e0194..3e1bd7f61 100644 --- a/HandheldCompanion/Actions/SpecialActions.cs +++ b/HandheldCompanion/Actions/SpecialActions.cs @@ -1,58 +1,58 @@ -using HandheldCompanion.Inputs; -using HandheldCompanion.Misc; -using HandheldCompanion.Simulators; -using System; -using System.ComponentModel; -using System.Numerics; - -namespace HandheldCompanion.Actions -{ - [Serializable] - public enum SpecialActionsType - { - [Description("Flick Stick")] - FlickStick = 0, - } - - [Serializable] - public class SpecialActions : IActions - { - public SpecialActionsType SpecialType; - - // runtime variables - private FlickStick flickStick = new(); - private float remainder = 0; - - // settings - public float FlickSensitivity = 5.0f; - public float SweepSensitivity = 5.0f; - public float FlickThreshold = 0.75f; - public int FlickSpeed = 100; - public int FlickFrontAngleDeadzone = 15; - - public SpecialActions() - { - this.actionType = ActionType.Special; - } - - public SpecialActions(SpecialActionsType type) : this() - { - this.SpecialType = type; - } - - public void Execute(AxisLayout layout) - { - if (layout.vector == Vector2.Zero) - return; - - float delta = flickStick.Handle(layout.vector, FlickSensitivity, SweepSensitivity, - FlickThreshold, FlickSpeed, FlickFrontAngleDeadzone); - - delta += remainder; - int intDelta = (int)Math.Truncate(delta); - remainder = delta - intDelta; - - MouseSimulator.MoveBy(intDelta, 0); - } - } -} +using HandheldCompanion.Inputs; +using HandheldCompanion.Misc; +using HandheldCompanion.Simulators; +using System; +using System.ComponentModel; +using System.Numerics; + +namespace HandheldCompanion.Actions +{ + [Serializable] + public enum SpecialActionsType + { + [Description("Flick Stick")] + FlickStick = 0, + } + + [Serializable] + public class SpecialActions : IActions + { + public SpecialActionsType SpecialType; + + // runtime variables + private FlickStick flickStick = new(); + private float remainder = 0; + + // settings + public float FlickSensitivity = 5.0f; + public float SweepSensitivity = 5.0f; + public float FlickThreshold = 0.75f; + public int FlickSpeed = 100; + public int FlickFrontAngleDeadzone = 15; + + public SpecialActions() + { + this.actionType = ActionType.Special; + } + + public SpecialActions(SpecialActionsType type) : this() + { + this.SpecialType = type; + } + + public void Execute(AxisLayout layout) + { + if (layout.vector == Vector2.Zero) + return; + + float delta = flickStick.Handle(layout.vector, FlickSensitivity, SweepSensitivity, + FlickThreshold, FlickSpeed, FlickFrontAngleDeadzone); + + delta += remainder; + int intDelta = (int)Math.Truncate(delta); + remainder = delta - intDelta; + + MouseSimulator.MoveBy(intDelta, 0); + } + } +} diff --git a/HandheldCompanion/Actions/TriggerActions.cs b/HandheldCompanion/Actions/TriggerActions.cs index e18661611..eae8eaecf 100644 --- a/HandheldCompanion/Actions/TriggerActions.cs +++ b/HandheldCompanion/Actions/TriggerActions.cs @@ -1,42 +1,42 @@ -using HandheldCompanion.Inputs; -using HandheldCompanion.Utils; -using System; - -namespace HandheldCompanion.Actions -{ - [Serializable] - public class TriggerActions : IActions - { - public AxisLayoutFlags Axis; - - // settings - public int AxisAntiDeadZone = 0; - public int AxisDeadZoneInner = 0; - public int AxisDeadZoneOuter = 0; - - public TriggerActions() - { - this.actionType = ActionType.Trigger; - this.Value = (short)0; - } - - public TriggerActions(AxisLayoutFlags axis) : this() - { - this.Axis = axis; - } - - public void Execute(AxisFlags axis, short value) - { - // Apply inner and outer deadzone adjustments - value = (short)InputUtils.InnerOuterDeadzone(value, AxisDeadZoneInner, AxisDeadZoneOuter, byte.MaxValue); - value = (short)InputUtils.ApplyAntiDeadzone(value, AxisAntiDeadZone, byte.MaxValue); - - this.Value = value; - } - - public short GetValue() - { - return (short)this.Value; - } - } -} +using HandheldCompanion.Inputs; +using HandheldCompanion.Utils; +using System; + +namespace HandheldCompanion.Actions +{ + [Serializable] + public class TriggerActions : IActions + { + public AxisLayoutFlags Axis; + + // settings + public int AxisAntiDeadZone = 0; + public int AxisDeadZoneInner = 0; + public int AxisDeadZoneOuter = 0; + + public TriggerActions() + { + this.actionType = ActionType.Trigger; + this.Value = (short)0; + } + + public TriggerActions(AxisLayoutFlags axis) : this() + { + this.Axis = axis; + } + + public void Execute(AxisFlags axis, short value) + { + // Apply inner and outer deadzone adjustments + value = (short)InputUtils.InnerOuterDeadzone(value, AxisDeadZoneInner, AxisDeadZoneOuter, byte.MaxValue); + value = (short)InputUtils.ApplyAntiDeadzone(value, AxisAntiDeadZone, byte.MaxValue); + + this.Value = value; + } + + public short GetValue() + { + return (short)this.Value; + } + } +} diff --git a/HandheldCompanion/Controllers/NeptuneController.cs b/HandheldCompanion/Controllers/NeptuneController.cs index 6101451c6..9587c7685 100644 --- a/HandheldCompanion/Controllers/NeptuneController.cs +++ b/HandheldCompanion/Controllers/NeptuneController.cs @@ -346,11 +346,6 @@ public override void Unplug() base.Unplug(); } - public override void Cleanup() - { - TimerManager.Tick -= UpdateInputs; - } - public bool GetHapticIntensity(byte? input, sbyte minIntensity, sbyte maxIntensity, out sbyte output) { output = default; diff --git a/HandheldCompanion/Controls/Hints/Hint_HWiNFO12hLimitPassed.cs b/HandheldCompanion/Controls/Hints/Hint_HWiNFO12hLimitPassed.cs deleted file mode 100644 index f91a4c092..000000000 --- a/HandheldCompanion/Controls/Hints/Hint_HWiNFO12hLimitPassed.cs +++ /dev/null @@ -1,60 +0,0 @@ -using HandheldCompanion.Managers; -using HandheldCompanion.Platforms; -using System; -using System.Windows; - -namespace HandheldCompanion.Controls.Hints -{ - public class Hint_HWiNFO12hLimitPassed : IHint - { - public Hint_HWiNFO12hLimitPassed() : base() - { - PlatformManager.HWiNFO.Updated += HWiNFO_Updated; - PlatformManager.HWiNFO.SettingValueChanged += HWiNFO_SettingValueChanged; - - PlatformManager.Initialized += PlatformManager_Initialized; - - // default state - this.HintActionButton.Visibility = Visibility.Collapsed; - - this.HintTitle.Text = Properties.Resources.Hint_HWiNFO12hLimitPassed; - this.HintDescription.Text = Properties.Resources.Hint_HWiNFO12hLimitPassedDesc; - this.HintReadMe.Text = Properties.Resources.Hint_HWiNFO12hLimitPassedReadme; - } - - private void HWiNFO_Updated(PlatformStatus status) - { - CheckSettings(); - } - - private void HWiNFO_SettingValueChanged(string name, object value) - { - // UI thread (async) - Application.Current.Dispatcher.BeginInvoke(() => - { - switch(name) - { - case "SensorsSM": - this.Visibility = Convert.ToBoolean(value) ? Visibility.Collapsed : Visibility.Visible; - break; - } - }); - } - - private void PlatformManager_Initialized() - { - CheckSettings(); - } - - private void CheckSettings() - { - bool SensorsSM = PlatformManager.HWiNFO.GetProperty("SensorsSM"); - HWiNFO_SettingValueChanged("SensorsSM", SensorsSM); - } - - public override void Stop() - { - base.Stop(); - } - } -} diff --git a/HandheldCompanion/Controls/Hints/Hint_LegionGoDaemon.cs b/HandheldCompanion/Controls/Hints/Hint_LegionGoDaemon.cs deleted file mode 100644 index 72342fb53..000000000 --- a/HandheldCompanion/Controls/Hints/Hint_LegionGoDaemon.cs +++ /dev/null @@ -1,81 +0,0 @@ -using HandheldCompanion.Devices; -using HandheldCompanion.Views; -using Microsoft.Win32.TaskScheduler; -using System.Diagnostics; -using System.Linq; -using System.Timers; -using System.Windows; -using Task = System.Threading.Tasks.Task; - -namespace HandheldCompanion.Controls.Hints -{ - public class Hint_LegionGoDaemon : IHint - { - private Process process; - private const string taskName = "LSDaemon"; - private Timer taskTimer; - - public Hint_LegionGoDaemon() : base() - { - if (MainWindow.CurrentDevice is not LegionGo) - return; - - taskTimer = new Timer(4000); - taskTimer.Elapsed += TaskTimer_Elapsed; - taskTimer.Start(); - - // default state - this.HintActionButton.Visibility = Visibility.Visible; - - this.HintTitle.Text = Properties.Resources.Hint_LegionGoDaemon; - this.HintDescription.Text = Properties.Resources.Hint_LegionGoDaemonDesc; - this.HintReadMe.Text = Properties.Resources.Hint_LegionGoDaemonReadme; - - this.HintActionButton.Content = Properties.Resources.Hint_LegionGoDaemonAction; - } - - private void TaskTimer_Elapsed(object? sender, ElapsedEventArgs e) - { - // Get all the processes with the given name - process = Process.GetProcessesByName(taskName).FirstOrDefault(); - - // If there is at least one process, return true - // UI thread (async) - Application.Current.Dispatcher.BeginInvoke(() => - { - if (process is not null && !process.HasExited) - this.Visibility = Visibility.Visible; - else - this.Visibility = Visibility.Collapsed; - }); - } - - protected override void HintActionButton_Click(object sender, RoutedEventArgs e) - { - Task.Run(async () => - { - // Get the task service instance - using (TaskService ts = new TaskService()) - { - // Get the task by name - Microsoft.Win32.TaskScheduler.Task task = ts.GetTask(taskName); - if (task != null && task.State == TaskState.Running) - { - task.Stop(); - task.Enabled = false; - } - } - }); - - // If the process exists and is running, kill it - if (process != null && !process.HasExited) - process.Kill(); - } - - public override void Stop() - { - taskTimer.Stop(); - base.Stop(); - } - } -} diff --git a/HandheldCompanion/Controls/Hints/Hint_LegionGoServices.cs b/HandheldCompanion/Controls/Hints/Hint_LegionGoServices.cs deleted file mode 100644 index 4e23b83c6..000000000 --- a/HandheldCompanion/Controls/Hints/Hint_LegionGoServices.cs +++ /dev/null @@ -1,107 +0,0 @@ -using HandheldCompanion.Devices; -using HandheldCompanion.Utils; -using HandheldCompanion.Views; -using System; -using System.Collections.Generic; -using System.Linq; -using System.ServiceProcess; -using System.Threading.Tasks; -using System.Timers; -using System.Windows; - -namespace HandheldCompanion.Controls.Hints -{ - public class Hint_LegionGoServices : IHint - { - private List serviceNames = new() - { - "DAService", - }; - - private List serviceControllers = new(); - private Timer serviceTimer; - - public Hint_LegionGoServices() : base() - { - if (MainWindow.CurrentDevice is not LegionGo) - return; - - // Get all the services installed on the local computer - ServiceController[] services = ServiceController.GetServices(); - foreach (string serviceName in serviceNames) - { - if (services.Any(s => serviceNames.Contains(s.ServiceName))) - { - // Create a service controller object for the specified service - ServiceController serviceController = new ServiceController(serviceName); - serviceControllers.Add(serviceController); - } - } - - // Check if any of the services in the list exist - if (!serviceControllers.Any()) - return; - - serviceTimer = new Timer(4000); - serviceTimer.Elapsed += ServiceTimer_Elapsed; - serviceTimer.Start(); - - // default state - this.HintActionButton.Visibility = Visibility.Visible; - - this.HintTitle.Text = Properties.Resources.Hint_LegionGoServices; - this.HintDescription.Text = Properties.Resources.Hint_LegionGoServicesDesc; - this.HintReadMe.Text = Properties.Resources.Hint_LegionGoServicesReadme; - - this.HintActionButton.Content = Properties.Resources.Hint_LegionGoServicesAction; - } - - private void ServiceTimer_Elapsed(object? sender, ElapsedEventArgs e) - { - if(!serviceControllers.Any()) - return; - - // Check if any of the services in the list exist and are running - bool anyRunning = false; - - foreach (ServiceController serviceController in serviceControllers) - { - serviceController.Refresh(); - if (serviceController.Status == ServiceControllerStatus.Running) - { - anyRunning = true; - break; - } - } - - // UI thread (async) - Application.Current.Dispatcher.BeginInvoke(() => - { - this.Visibility = anyRunning ? Visibility.Visible : Visibility.Collapsed; - }); - } - - protected override void HintActionButton_Click(object sender, RoutedEventArgs e) - { - if (!serviceControllers.Any()) - return; - - Task.Run(async () => - { - foreach (ServiceController serviceController in serviceControllers) - { - if (serviceController.Status == ServiceControllerStatus.Running) - serviceController.Stop(); - serviceController.WaitForStatus(ServiceControllerStatus.Stopped); - ServiceUtils.ChangeStartMode(serviceController, ServiceStartMode.Disabled, out _); - } - }); - } - - public override void Stop() - { - serviceTimer.Stop(); - base.Stop(); - } - } -} diff --git a/HandheldCompanion/Controls/Mapping/AxisMapping.xaml b/HandheldCompanion/Controls/Mapping/AxisMapping.xaml index 913421d36..b959c4cb9 100644 --- a/HandheldCompanion/Controls/Mapping/AxisMapping.xaml +++ b/HandheldCompanion/Controls/Mapping/AxisMapping.xaml @@ -1,624 +1,624 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HandheldCompanion/Controls/Mapping/AxisMapping.xaml.cs b/HandheldCompanion/Controls/Mapping/AxisMapping.xaml.cs index 90492dfa3..17ca8a0ae 100644 --- a/HandheldCompanion/Controls/Mapping/AxisMapping.xaml.cs +++ b/HandheldCompanion/Controls/Mapping/AxisMapping.xaml.cs @@ -1,389 +1,389 @@ -using HandheldCompanion.Actions; -using HandheldCompanion.Controllers; -using HandheldCompanion.Inputs; -using HandheldCompanion.Managers; -using HandheldCompanion.Utils; -using iNKORE.UI.WPF.Modern.Controls; -using System; -using System.Windows; -using System.Windows.Controls; - -namespace HandheldCompanion.Controls; - -/// -/// Interaction logic for AxisMapping.xaml -/// -public partial class AxisMapping : IMapping -{ - public AxisMapping() - { - InitializeComponent(); - } - - public AxisMapping(AxisLayoutFlags axis) : this() - { - Value = axis; - - Icon.Glyph = axis.ToString(); - } - - public void UpdateIcon(FontIcon newIcon, string newLabel) - { - Name.Text = newLabel; - - Icon.Glyph = newIcon.Glyph; - Icon.FontFamily = newIcon.FontFamily; - Icon.FontSize = newIcon.FontSize; - - if (newIcon.Foreground is not null) - Icon.Foreground = newIcon.Foreground; - else - Icon.SetResourceReference(ForegroundProperty, "SystemControlForegroundBaseMediumBrush"); - } - - public void UpdateSelections() - { - Action_SelectionChanged(null, null); - } - - internal void SetIActions(IActions actions) - { - // reset and update mapping IActions - Reset(); - base.SetIActions(actions); - - // update UI - ActionComboBox.SelectedIndex = (int)actions.actionType; - } - - private void Action_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (ActionComboBox.SelectedItem is null) - return; - - // we're not ready yet - if (TargetComboBox is null) - return; - - // clear current dropdown values - TargetComboBox.Items.Clear(); - TargetComboBox.IsEnabled = ActionComboBox.SelectedIndex != 0; - - // get current controller - IController? controller = ControllerManager.GetEmulatedController(); - - // populate target dropdown based on action type - ActionType type = (ActionType)ActionComboBox.SelectedIndex; - - if (type == ActionType.Disabled) - { - if (Actions is not null) - Delete(); - return; - } - - if (type == ActionType.Joystick) - { - if (Actions is null || Actions is not AxisActions) - Actions = new AxisActions(); - - // we need a controller to get compatible buttons - if (controller is null) - return; - - foreach (AxisLayoutFlags axis in IController.GetTargetAxis()) - { - // create a label, store ButtonFlags as Tag and Label as controller specific string - Label buttonLabel = new Label { Tag = axis, Content = controller.GetAxisName(axis) }; - TargetComboBox.Items.Add(buttonLabel); - - if (axis.Equals(((AxisActions)Actions).Axis)) - TargetComboBox.SelectedItem = buttonLabel; - } - - // settings - Axis2AxisImproveCircularity.IsOn = ((AxisActions)Actions).ImproveCircularity; - Axis2AxisAutoRotate.IsOn = ((AxisActions)Actions).AutoRotate; - Axis2AxisRotation.Value = (((AxisActions)Actions).AxisInverted ? 180 : 0) + - (((AxisActions)Actions).AxisRotated ? 90 : 0); - Axis2AxisInnerDeadzone.Value = ((AxisActions)Actions).AxisDeadZoneInner; - Axis2AxisOuterDeadzone.Value = ((AxisActions)Actions).AxisDeadZoneOuter; - Axis2AxisAntiDeadzone.Value = ((AxisActions)Actions).AxisAntiDeadZone; - } - else if (type == ActionType.Mouse) - { - if (Actions is null || Actions is not MouseActions) - Actions = new MouseActions(); - - foreach (MouseActionsType mouseType in Enum.GetValues(typeof(MouseActionsType))) - { - // skip specific scenarios - switch (mouseType) - { - case MouseActionsType.LeftButton: - case MouseActionsType.RightButton: - case MouseActionsType.MiddleButton: - case MouseActionsType.ScrollUp: - case MouseActionsType.ScrollDown: - continue; - } - - // create a label, store MouseActionsType as Tag and Label as controller specific string - Label buttonLabel = new Label { Tag = mouseType, Content = EnumUtils.GetDescriptionFromEnumValue(mouseType) }; - TargetComboBox.Items.Add(buttonLabel); - - if (mouseType.Equals(((MouseActions)Actions).MouseType)) - TargetComboBox.SelectedItem = buttonLabel; - } - - // settings - Axis2MousePointerSpeed.Value = ((MouseActions)Actions).Sensivity; - Axis2MouseAutoRotate.IsOn = ((MouseActions)Actions).AutoRotate; - Axis2MouseRotation.Value = (((MouseActions)Actions).AxisInverted ? 180 : 0) + - (((MouseActions)Actions).AxisRotated ? 90 : 0); - Axis2MouseDeadzone.Value = ((MouseActions)Actions).Deadzone; - Axis2MouseAcceleration.Value = ((MouseActions)this.Actions).Acceleration; - Axis2MouseFiltering.IsOn = ((MouseActions)this.Actions).Filtering; - Axis2MouseFilterCutoff.Value = ((MouseActions)this.Actions).FilterCutoff; - } - - // if no target element was selected, pick the first one - if (TargetComboBox.SelectedItem is null) - TargetComboBox.SelectedIndex = 0; - - base.Update(); - } - - private void Target_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (Actions is null) - return; - - if (TargetComboBox.SelectedItem is null) - return; - - // generate IActions based on settings - switch (Actions.actionType) - { - case ActionType.Joystick: - { - var buttonLabel = TargetComboBox.SelectedItem as Label; - ((AxisActions)Actions).Axis = (AxisLayoutFlags)buttonLabel.Tag; - } - break; - - case ActionType.Mouse: - { - var buttonLabel = TargetComboBox.SelectedItem as Label; - ((MouseActions)Actions).MouseType = (MouseActionsType)buttonLabel.Tag; - } - break; - } - - base.Update(); - } - - public void Reset() - { - ActionComboBox.SelectedIndex = 0; - TargetComboBox.SelectedItem = null; - } - - private void Axis2AxisAutoRotate_Toggled(object sender, RoutedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Joystick: - ((AxisActions)Actions).AutoRotate = Axis2AxisAutoRotate.IsOn; - break; - } - - base.Update(); - } - - private void Axis_Rotation_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Joystick: - ((AxisActions)Actions).AxisInverted = (((int)Axis2AxisRotation.Value / 90) & 2) == 2; - ((AxisActions)Actions).AxisRotated = (((int)Axis2AxisRotation.Value / 90) & 1) == 1; - break; - } - - base.Update(); - } - - private void Axis_InnerDeadzone_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Joystick: - ((AxisActions)Actions).AxisDeadZoneInner = (int)Axis2AxisInnerDeadzone.Value; - break; - } - - base.Update(); - } - - private void Axis_OuterDeadzone_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Joystick: - ((AxisActions)Actions).AxisDeadZoneOuter = (int)Axis2AxisOuterDeadzone.Value; - break; - } - - base.Update(); - } - - private void Axis_AntiDeadZone_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Joystick: - ((AxisActions)Actions).AxisAntiDeadZone = (int)Axis2AxisAntiDeadzone.Value; - break; - } - - base.Update(); - } - - private void Axis2AxisImproveCircularity_Toggled(object sender, RoutedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Joystick: - ((AxisActions)Actions).ImproveCircularity = Axis2AxisImproveCircularity.IsOn; - break; - } - - base.Update(); - } - - private void Axis2MousePointerSpeed_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Mouse: - ((MouseActions)Actions).Sensivity = (int)Axis2MousePointerSpeed.Value; - break; - } - - base.Update(); - } - - private void Axis2MouseAutoRotate_Toggled(object sender, RoutedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Mouse: - ((MouseActions)Actions).AutoRotate = Axis2MouseAutoRotate.IsOn; - break; - } - - base.Update(); - } - - private void Axis2MouseRotation_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Mouse: - ((MouseActions)Actions).AxisInverted = (((int)Axis2MouseRotation.Value / 90) & 2) == 2; - ((MouseActions)Actions).AxisRotated = (((int)Axis2MouseRotation.Value / 90) & 1) == 1; - break; - } - - base.Update(); - } - - private void Axis2MouseDeadzone_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (Actions is null) - return; - - switch (Actions.actionType) - { - case ActionType.Mouse: - ((MouseActions)Actions).Deadzone = (int)Axis2MouseDeadzone.Value; - break; - } - - base.Update(); - } - - private void Axis2MouseAcceleration_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (this.Actions is null) - return; - - switch (this.Actions.actionType) - { - case ActionType.Mouse: - ((MouseActions)this.Actions).Acceleration = (float)Axis2MouseAcceleration.Value; - break; - } - - base.Update(); - } - - // TODO: artificially convert to something more human readable? - private void Axis2MouseFiltering_Toggled(object sender, RoutedEventArgs e) - { - if (this.Actions is null) - return; - - switch (this.Actions.actionType) - { - case ActionType.Mouse: - ((MouseActions)this.Actions).Filtering = Axis2MouseFiltering.IsOn; - break; - } - - base.Update(); - } - - private void Axis2MouseFilterCutoff_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (this.Actions is null) - return; - - switch (this.Actions.actionType) - { - case ActionType.Mouse: - ((MouseActions)this.Actions).FilterCutoff = (float)Axis2MouseFilterCutoff.Value; - break; - } - - base.Update(); - } +using HandheldCompanion.Actions; +using HandheldCompanion.Controllers; +using HandheldCompanion.Inputs; +using HandheldCompanion.Managers; +using HandheldCompanion.Utils; +using iNKORE.UI.WPF.Modern.Controls; +using System; +using System.Windows; +using System.Windows.Controls; + +namespace HandheldCompanion.Controls; + +/// +/// Interaction logic for AxisMapping.xaml +/// +public partial class AxisMapping : IMapping +{ + public AxisMapping() + { + InitializeComponent(); + } + + public AxisMapping(AxisLayoutFlags axis) : this() + { + Value = axis; + + Icon.Glyph = axis.ToString(); + } + + public void UpdateIcon(FontIcon newIcon, string newLabel) + { + Name.Text = newLabel; + + Icon.Glyph = newIcon.Glyph; + Icon.FontFamily = newIcon.FontFamily; + Icon.FontSize = newIcon.FontSize; + + if (newIcon.Foreground is not null) + Icon.Foreground = newIcon.Foreground; + else + Icon.SetResourceReference(ForegroundProperty, "SystemControlForegroundBaseMediumBrush"); + } + + public void UpdateSelections() + { + Action_SelectionChanged(null, null); + } + + internal void SetIActions(IActions actions) + { + // reset and update mapping IActions + Reset(); + base.SetIActions(actions); + + // update UI + ActionComboBox.SelectedIndex = (int)actions.actionType; + } + + private void Action_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (ActionComboBox.SelectedItem is null) + return; + + // we're not ready yet + if (TargetComboBox is null) + return; + + // clear current dropdown values + TargetComboBox.Items.Clear(); + TargetComboBox.IsEnabled = ActionComboBox.SelectedIndex != 0; + + // get current controller + IController? controller = ControllerManager.GetEmulatedController(); + + // populate target dropdown based on action type + ActionType type = (ActionType)ActionComboBox.SelectedIndex; + + if (type == ActionType.Disabled) + { + if (Actions is not null) + Delete(); + return; + } + + if (type == ActionType.Joystick) + { + if (Actions is null || Actions is not AxisActions) + Actions = new AxisActions(); + + // we need a controller to get compatible buttons + if (controller is null) + return; + + foreach (AxisLayoutFlags axis in IController.GetTargetAxis()) + { + // create a label, store ButtonFlags as Tag and Label as controller specific string + Label buttonLabel = new Label { Tag = axis, Content = controller.GetAxisName(axis) }; + TargetComboBox.Items.Add(buttonLabel); + + if (axis.Equals(((AxisActions)Actions).Axis)) + TargetComboBox.SelectedItem = buttonLabel; + } + + // settings + Axis2AxisImproveCircularity.IsOn = ((AxisActions)Actions).ImproveCircularity; + Axis2AxisAutoRotate.IsOn = ((AxisActions)Actions).AutoRotate; + Axis2AxisRotation.Value = (((AxisActions)Actions).AxisInverted ? 180 : 0) + + (((AxisActions)Actions).AxisRotated ? 90 : 0); + Axis2AxisInnerDeadzone.Value = ((AxisActions)Actions).AxisDeadZoneInner; + Axis2AxisOuterDeadzone.Value = ((AxisActions)Actions).AxisDeadZoneOuter; + Axis2AxisAntiDeadzone.Value = ((AxisActions)Actions).AxisAntiDeadZone; + } + else if (type == ActionType.Mouse) + { + if (Actions is null || Actions is not MouseActions) + Actions = new MouseActions(); + + foreach (MouseActionsType mouseType in Enum.GetValues(typeof(MouseActionsType))) + { + // skip specific scenarios + switch (mouseType) + { + case MouseActionsType.LeftButton: + case MouseActionsType.RightButton: + case MouseActionsType.MiddleButton: + case MouseActionsType.ScrollUp: + case MouseActionsType.ScrollDown: + continue; + } + + // create a label, store MouseActionsType as Tag and Label as controller specific string + Label buttonLabel = new Label { Tag = mouseType, Content = EnumUtils.GetDescriptionFromEnumValue(mouseType) }; + TargetComboBox.Items.Add(buttonLabel); + + if (mouseType.Equals(((MouseActions)Actions).MouseType)) + TargetComboBox.SelectedItem = buttonLabel; + } + + // settings + Axis2MousePointerSpeed.Value = ((MouseActions)Actions).Sensivity; + Axis2MouseAutoRotate.IsOn = ((MouseActions)Actions).AutoRotate; + Axis2MouseRotation.Value = (((MouseActions)Actions).AxisInverted ? 180 : 0) + + (((MouseActions)Actions).AxisRotated ? 90 : 0); + Axis2MouseDeadzone.Value = ((MouseActions)Actions).Deadzone; + Axis2MouseAcceleration.Value = ((MouseActions)this.Actions).Acceleration; + Axis2MouseFiltering.IsOn = ((MouseActions)this.Actions).Filtering; + Axis2MouseFilterCutoff.Value = ((MouseActions)this.Actions).FilterCutoff; + } + + // if no target element was selected, pick the first one + if (TargetComboBox.SelectedItem is null) + TargetComboBox.SelectedIndex = 0; + + base.Update(); + } + + private void Target_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (Actions is null) + return; + + if (TargetComboBox.SelectedItem is null) + return; + + // generate IActions based on settings + switch (Actions.actionType) + { + case ActionType.Joystick: + { + var buttonLabel = TargetComboBox.SelectedItem as Label; + ((AxisActions)Actions).Axis = (AxisLayoutFlags)buttonLabel.Tag; + } + break; + + case ActionType.Mouse: + { + var buttonLabel = TargetComboBox.SelectedItem as Label; + ((MouseActions)Actions).MouseType = (MouseActionsType)buttonLabel.Tag; + } + break; + } + + base.Update(); + } + + public void Reset() + { + ActionComboBox.SelectedIndex = 0; + TargetComboBox.SelectedItem = null; + } + + private void Axis2AxisAutoRotate_Toggled(object sender, RoutedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Joystick: + ((AxisActions)Actions).AutoRotate = Axis2AxisAutoRotate.IsOn; + break; + } + + base.Update(); + } + + private void Axis_Rotation_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Joystick: + ((AxisActions)Actions).AxisInverted = (((int)Axis2AxisRotation.Value / 90) & 2) == 2; + ((AxisActions)Actions).AxisRotated = (((int)Axis2AxisRotation.Value / 90) & 1) == 1; + break; + } + + base.Update(); + } + + private void Axis_InnerDeadzone_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Joystick: + ((AxisActions)Actions).AxisDeadZoneInner = (int)Axis2AxisInnerDeadzone.Value; + break; + } + + base.Update(); + } + + private void Axis_OuterDeadzone_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Joystick: + ((AxisActions)Actions).AxisDeadZoneOuter = (int)Axis2AxisOuterDeadzone.Value; + break; + } + + base.Update(); + } + + private void Axis_AntiDeadZone_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Joystick: + ((AxisActions)Actions).AxisAntiDeadZone = (int)Axis2AxisAntiDeadzone.Value; + break; + } + + base.Update(); + } + + private void Axis2AxisImproveCircularity_Toggled(object sender, RoutedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Joystick: + ((AxisActions)Actions).ImproveCircularity = Axis2AxisImproveCircularity.IsOn; + break; + } + + base.Update(); + } + + private void Axis2MousePointerSpeed_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Mouse: + ((MouseActions)Actions).Sensivity = (int)Axis2MousePointerSpeed.Value; + break; + } + + base.Update(); + } + + private void Axis2MouseAutoRotate_Toggled(object sender, RoutedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Mouse: + ((MouseActions)Actions).AutoRotate = Axis2MouseAutoRotate.IsOn; + break; + } + + base.Update(); + } + + private void Axis2MouseRotation_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Mouse: + ((MouseActions)Actions).AxisInverted = (((int)Axis2MouseRotation.Value / 90) & 2) == 2; + ((MouseActions)Actions).AxisRotated = (((int)Axis2MouseRotation.Value / 90) & 1) == 1; + break; + } + + base.Update(); + } + + private void Axis2MouseDeadzone_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (Actions is null) + return; + + switch (Actions.actionType) + { + case ActionType.Mouse: + ((MouseActions)Actions).Deadzone = (int)Axis2MouseDeadzone.Value; + break; + } + + base.Update(); + } + + private void Axis2MouseAcceleration_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (this.Actions is null) + return; + + switch (this.Actions.actionType) + { + case ActionType.Mouse: + ((MouseActions)this.Actions).Acceleration = (float)Axis2MouseAcceleration.Value; + break; + } + + base.Update(); + } + + // TODO: artificially convert to something more human readable? + private void Axis2MouseFiltering_Toggled(object sender, RoutedEventArgs e) + { + if (this.Actions is null) + return; + + switch (this.Actions.actionType) + { + case ActionType.Mouse: + ((MouseActions)this.Actions).Filtering = Axis2MouseFiltering.IsOn; + break; + } + + base.Update(); + } + + private void Axis2MouseFilterCutoff_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (this.Actions is null) + return; + + switch (this.Actions.actionType) + { + case ActionType.Mouse: + ((MouseActions)this.Actions).FilterCutoff = (float)Axis2MouseFilterCutoff.Value; + break; + } + + base.Update(); + } } \ No newline at end of file diff --git a/HandheldCompanion/Controls/Mapping/ButtonMapping.xaml b/HandheldCompanion/Controls/Mapping/ButtonMapping.xaml index 82ad10483..075697336 100644 --- a/HandheldCompanion/Controls/Mapping/ButtonMapping.xaml +++ b/HandheldCompanion/Controls/Mapping/ButtonMapping.xaml @@ -1,370 +1,370 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HandheldCompanion/Controls/Mapping/ButtonMapping.xaml.cs b/HandheldCompanion/Controls/Mapping/ButtonMapping.xaml.cs index ad3238b9a..0f910bb6d 100644 --- a/HandheldCompanion/Controls/Mapping/ButtonMapping.xaml.cs +++ b/HandheldCompanion/Controls/Mapping/ButtonMapping.xaml.cs @@ -1,332 +1,332 @@ -using GregsStack.InputSimulatorStandard.Native; -using HandheldCompanion.Actions; -using HandheldCompanion.Controllers; -using HandheldCompanion.Inputs; -using HandheldCompanion.Managers; -using HandheldCompanion.Utils; -using iNKORE.UI.WPF.Modern.Controls; -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; -using System.Linq; - -namespace HandheldCompanion.Controls; - -/// -/// Interaction logic for ButtonMapping.xaml -/// -public partial class ButtonMapping : IMapping -{ - private static List