public InputState GetInputState() { var buttons = new HashSet <Button>(); if (keyboard[Key.J].ReadValue() == 1) { buttons.Add(Button.BUTTON1); } if (keyboard[Key.K].ReadValue() == 1) { buttons.Add(Button.BUTTON2); } if (keyboard[Key.U].ReadValue() == 1) { buttons.Add(Button.BUTTON3); } if (keyboard[Key.I].ReadValue() == 1) { buttons.Add(Button.BUTTON4); } JoystickPosition joystickPosition = getJoystickPosition(); return(new InputState( buttons, joystickPosition)); }
public InputState( IEnumerable <Button> pressedButtons, JoystickPosition joystickPosition) { this.Buttons = new HashSet <Button>(pressedButtons); this.JoystickPosition = joystickPosition; }
public JoystickPosition Flip(JoystickPosition pos) { return(pos switch { JoystickPosition.Left => JoystickPosition.Right, JoystickPosition.Right => JoystickPosition.Left, _ => JoystickPosition.Center });
// helper method to check joystick position public bool IsJoystickInPosition(JoystickPosition position) { if (position == Position) { return(true); } return(false); }
private static JoystickPosition ClampToCircle(JoystickPosition position) { Vector2 point = new Vector2(position.Dx, position.Dy); if (point.Length() > short.MaxValue) { point = point / point.Length() * short.MaxValue; } return(new JoystickPosition { Dx = (int)point.X, Dy = (int)point.Y }); }
private void CheckInput() { JoystickPosition currentDirection = GetCurrentJostickPosition(); JoystickPosition lastDirection = latestDirections.GetLast(); // Waits for direction to change so it doesn't accumulate a bunch of equal directions if (currentDirection != lastDirection && currentDirection != JoystickPosition.None) { latestDirections.Add(currentDirection); // We are only interested in the latest 4 directions. if (latestDirections.Count > 4) { latestDirections.RemoveAt(0); } // Generates resources whenever player completed a full spin if (CounterClockwiseCheck() || ClockwiseCheck()) { ResourcesMaster.AddResource(generatedResource, resourcePerSpin); } } }
private bool UpdateFrame() { if (!IsActive) { return(true); } if (IsStopped) { return(false); } HotkeyButtons currentHotkeyButtons = 0; ControllerKeys currentButton = 0; JoystickPosition leftJoystick; JoystickPosition rightJoystick; KeyboardInput? hidKeyboard = null; int leftJoystickDx = 0; int leftJoystickDy = 0; int rightJoystickDx = 0; int rightJoystickDy = 0; // OpenTK always captures keyboard events, even if out of focus, so check if window is focused. if (IsFocused) { KeyboardState keyboard = OpenTK.Input.Keyboard.GetState(); Gtk.Application.Invoke(delegate { HandleScreenState(keyboard); }); // Normal Input currentHotkeyButtons = KeyboardControls.GetHotkeyButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard); currentButton = KeyboardControls.GetButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard); if (ConfigurationState.Instance.Hid.EnableKeyboard) { hidKeyboard = KeyboardControls.GetKeysDown(ConfigurationState.Instance.Hid.KeyboardControls, keyboard); } (leftJoystickDx, leftJoystickDy) = KeyboardControls.GetLeftStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard); (rightJoystickDx, rightJoystickDy) = KeyboardControls.GetRightStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard); } if (!hidKeyboard.HasValue) { hidKeyboard = new KeyboardInput { Modifier = 0, Keys = new int[0x8] }; } currentButton |= _primaryController.GetButtons(); // Keyboard has priority stick-wise if (leftJoystickDx == 0 && leftJoystickDy == 0) { (leftJoystickDx, leftJoystickDy) = _primaryController.GetLeftStick(); } if (rightJoystickDx == 0 && rightJoystickDy == 0) { (rightJoystickDx, rightJoystickDy) = _primaryController.GetRightStick(); } leftJoystick = new JoystickPosition { Dx = leftJoystickDx, Dy = leftJoystickDy }; rightJoystick = new JoystickPosition { Dx = rightJoystickDx, Dy = rightJoystickDy }; currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick); bool hasTouch = false; // Get screen touch position from left mouse click // OpenTK always captures mouse events, even if out of focus, so check if window is focused. if (IsFocused && _mousePressed) { int screenWidth = AllocatedWidth; int screenHeight = AllocatedHeight; if (AllocatedWidth > (AllocatedHeight * SwitchPanelWidth) / SwitchPanelHeight) { screenWidth = (AllocatedHeight * SwitchPanelWidth) / SwitchPanelHeight; } else { screenHeight = (AllocatedWidth * SwitchPanelHeight) / SwitchPanelWidth; } int startX = (AllocatedWidth - screenWidth) >> 1; int startY = (AllocatedHeight - screenHeight) >> 1; int endX = startX + screenWidth; int endY = startY + screenHeight; if (_mouseX >= startX && _mouseY >= startY && _mouseX < endX && _mouseY < endY) { int screenMouseX = (int)_mouseX - startX; int screenMouseY = (int)_mouseY - startY; int mX = (screenMouseX * SwitchPanelWidth) / screenWidth; int mY = (screenMouseY * SwitchPanelHeight) / screenHeight; TouchPoint currentPoint = new TouchPoint { X = (uint)mX, // can be -ve? Y = (uint)mY, // Placeholder values till more data is acquired DiameterX = 10, DiameterY = 10, Angle = 90 }; hasTouch = true; _device.Hid.Touchscreen.Update(currentPoint); } } if (!hasTouch) { _device.Hid.Touchscreen.Update(); } if (ConfigurationState.Instance.Hid.EnableKeyboard && hidKeyboard.HasValue) { _device.Hid.Keyboard.Update(hidKeyboard.Value); } _device.Hid.DebugPad.Update(); _device.Hid.Npads.SetGamepadsInput(new GamepadInput { PlayerId = HidControllerID.Auto, Buttons = currentButton, LStick = leftJoystick, RStick = rightJoystick }); // Toggle vsync if (currentHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync) && !_prevHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync)) { _device.EnableDeviceVsync = !_device.EnableDeviceVsync; } _prevHotkeyButtons = currentHotkeyButtons; return(true); }
private bool UpdateFrame() { if (!IsActive) { return(true); } if (IsStopped) { return(false); } if (IsFocused) { Gtk.Application.Invoke(delegate { KeyboardState keyboard = OpenTK.Input.Keyboard.GetState(); HandleScreenState(keyboard); if (keyboard.IsKeyDown(OpenTK.Input.Key.Delete)) { if (!ParentWindow.State.HasFlag(Gdk.WindowState.Fullscreen)) { Ptc.Continue(); } } }); } List <GamepadInput> gamepadInputs = new List <GamepadInput>(); foreach (InputConfig inputConfig in ConfigurationState.Instance.Hid.InputConfig.Value.ToArray()) { ControllerKeys currentButton = 0; JoystickPosition leftJoystick = new JoystickPosition(); JoystickPosition rightJoystick = new JoystickPosition(); KeyboardInput? hidKeyboard = null; int leftJoystickDx = 0; int leftJoystickDy = 0; int rightJoystickDx = 0; int rightJoystickDy = 0; if (inputConfig is KeyboardConfig keyboardConfig) { if (IsFocused) { // Keyboard Input KeyboardController keyboardController = new KeyboardController(keyboardConfig); currentButton = keyboardController.GetButtons(); (leftJoystickDx, leftJoystickDy) = keyboardController.GetLeftStick(); (rightJoystickDx, rightJoystickDy) = keyboardController.GetRightStick(); leftJoystick = new JoystickPosition { Dx = leftJoystickDx, Dy = leftJoystickDy }; rightJoystick = new JoystickPosition { Dx = rightJoystickDx, Dy = rightJoystickDy }; if (ConfigurationState.Instance.Hid.EnableKeyboard) { hidKeyboard = keyboardController.GetKeysDown(); } if (!hidKeyboard.HasValue) { hidKeyboard = new KeyboardInput { Modifier = 0, Keys = new int[0x8] }; } if (ConfigurationState.Instance.Hid.EnableKeyboard) { _device.Hid.Keyboard.Update(hidKeyboard.Value); } } } else if (inputConfig is Common.Configuration.Hid.ControllerConfig controllerConfig) { // Controller Input JoystickController joystickController = new JoystickController(controllerConfig); currentButton |= joystickController.GetButtons(); (leftJoystickDx, leftJoystickDy) = joystickController.GetLeftStick(); (rightJoystickDx, rightJoystickDy) = joystickController.GetRightStick(); leftJoystick = new JoystickPosition { Dx = controllerConfig.LeftJoycon.InvertStickX ? -leftJoystickDx : leftJoystickDx, Dy = controllerConfig.LeftJoycon.InvertStickY ? -leftJoystickDy : leftJoystickDy }; rightJoystick = new JoystickPosition { Dx = controllerConfig.RightJoycon.InvertStickX ? -rightJoystickDx : rightJoystickDx, Dy = controllerConfig.RightJoycon.InvertStickY ? -rightJoystickDy : rightJoystickDy }; } currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick); gamepadInputs.Add(new GamepadInput { PlayerId = (HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex, Buttons = currentButton, LStick = leftJoystick, RStick = rightJoystick }); } _device.Hid.Npads.SetGamepadsInput(gamepadInputs.ToArray()); // Hotkeys HotkeyButtons currentHotkeyButtons = KeyboardController.GetHotkeyButtons(OpenTK.Input.Keyboard.GetState()); if (currentHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync) && !_prevHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync)) { _device.EnableDeviceVsync = !_device.EnableDeviceVsync; } _prevHotkeyButtons = currentHotkeyButtons; //Touchscreen bool hasTouch = false; // Get screen touch position from left mouse click // OpenTK always captures mouse events, even if out of focus, so check if window is focused. if (IsFocused && _mousePressed) { int screenWidth = AllocatedWidth; int screenHeight = AllocatedHeight; if (AllocatedWidth > (AllocatedHeight * SwitchPanelWidth) / SwitchPanelHeight) { screenWidth = (AllocatedHeight * SwitchPanelWidth) / SwitchPanelHeight; } else { screenHeight = (AllocatedWidth * SwitchPanelHeight) / SwitchPanelWidth; } int startX = (AllocatedWidth - screenWidth) >> 1; int startY = (AllocatedHeight - screenHeight) >> 1; int endX = startX + screenWidth; int endY = startY + screenHeight; if (_mouseX >= startX && _mouseY >= startY && _mouseX < endX && _mouseY < endY) { int screenMouseX = (int)_mouseX - startX; int screenMouseY = (int)_mouseY - startY; int mX = (screenMouseX * SwitchPanelWidth) / screenWidth; int mY = (screenMouseY * SwitchPanelHeight) / screenHeight; TouchPoint currentPoint = new TouchPoint { X = (uint)mX, Y = (uint)mY, // Placeholder values till more data is acquired DiameterX = 10, DiameterY = 10, Angle = 90 }; hasTouch = true; _device.Hid.Touchscreen.Update(currentPoint); } } if (!hasTouch) { _device.Hid.Touchscreen.Update(); } _device.Hid.DebugPad.Update(); return(true); }
public InputActionFactory Create (Joysticks joystick, JoystickAxis joystickAxis, JoystickPosition joystickPosition) { __factoryConstructor = (type) => new InputAction (InputCode.toCode (joystick, joystickAxis, joystickPosition), type); return instance; }
public InputAction CreateSimpleAction (Joysticks joystick, JoystickAxis joystickAxis, JoystickPosition joystickPosition) { return new InputAction (InputCode.toCode (joystick, joystickAxis, joystickPosition), InputActionType.SINGLE); }
public virtual void JoystickChanged(JoystickPosition position) { }
/// <summary> /// Tos the code. /// </summary> /// <returns>The code.</returns> /// <param name="joy">Joy.</param> /// <param name="axis">Axis.</param> /// <param name="pos">Position.</param> public static int toCode (Joysticks joy, JoystickAxis axis, JoystickPosition pos) { return toCode (joy, axis, (int)pos); }
public InputState(JoystickPosition joystickPosition) : this(new HashSet <Button>(), joystickPosition) { }
protected void DecodeData(DeviceData data) { G13KeyState state = new G13KeyState(); var profile = ProfileRunner; if (profile == null || !profile.IsRunning) { return; } if (DeviceData.ReadStatus.Success == data.Status) { var bytes = data.Bytes; var reportId = bytes[0]; var j = new JoystickPosition(bytes[1] - 0x80, bytes[2] - 0x80); if (j.X != joystick.X || j.Y != joystick.Y) { joystick = j; profile.JoystickChanged(j); } state.B0 = bytes[3]; state.B1 = bytes[4]; state.B2 = bytes[5] < 0x80 ? bytes[5] : (byte)(bytes[5] - 0x80); state.B3 = bytes[6]; state.B4 = bytes[7] < 0x80 ? bytes[7] : (byte)(bytes[7] - 0x80); profile.KeyStateChanged(state); var keys = currentState.UL ^ state.UL; var pressed = (keys & state.UL) > 0; currentState = state; if (keys > 0) { if (pressed) { if (profile.SingleKeyEvents) { FireSingleKey(profile, keys, true); } else { profile.KeysPressed(keys); } } else { if (profile.SingleKeyEvents) { FireSingleKey(profile, keys, false); } else { profile.KeysReleased(keys); } } } } }
public Input(IEnumerable <Button> buttons, JoystickPosition joystickPosition) { this.Buttons = new HashSet <Button>(buttons); this.JoystickPosition = joystickPosition; }
public Input(JoystickPosition joystickPosition) { this.Buttons = new HashSet <Button>(); this.JoystickPosition = joystickPosition; }
public void SetPositionUpdateCallback(JoystickPosition posFunc) { positionCallback = posFunc; }
private bool UpdateFrame() { if (!_isActive) { return(true); } if (_isStopped) { return(false); } if (_isFocused) { Gtk.Application.Invoke(delegate { KeyboardState keyboard = OpenTK.Input.Keyboard.GetState(); HandleScreenState(keyboard); if (keyboard.IsKeyDown(OpenTK.Input.Key.Delete)) { if (!ParentWindow.State.HasFlag(Gdk.WindowState.Fullscreen)) { Ptc.Continue(); } } }); } List <GamepadInput> gamepadInputs = new List <GamepadInput>(NpadDevices.MaxControllers); List <SixAxisInput> motionInputs = new List <SixAxisInput>(NpadDevices.MaxControllers); MotionDevice motionDevice = new MotionDevice(_dsuClient); foreach (InputConfig inputConfig in ConfigurationState.Instance.Hid.InputConfig.Value) { ControllerKeys currentButton = 0; JoystickPosition leftJoystick = new JoystickPosition(); JoystickPosition rightJoystick = new JoystickPosition(); KeyboardInput? hidKeyboard = null; int leftJoystickDx = 0; int leftJoystickDy = 0; int rightJoystickDx = 0; int rightJoystickDy = 0; if (inputConfig.EnableMotion) { motionDevice.RegisterController(inputConfig.PlayerIndex); } if (inputConfig is KeyboardConfig keyboardConfig) { if (_isFocused) { // Keyboard Input KeyboardController keyboardController = new KeyboardController(keyboardConfig); currentButton = keyboardController.GetButtons(); (leftJoystickDx, leftJoystickDy) = keyboardController.GetLeftStick(); (rightJoystickDx, rightJoystickDy) = keyboardController.GetRightStick(); leftJoystick = new JoystickPosition { Dx = leftJoystickDx, Dy = leftJoystickDy }; rightJoystick = new JoystickPosition { Dx = rightJoystickDx, Dy = rightJoystickDy }; if (ConfigurationState.Instance.Hid.EnableKeyboard) { hidKeyboard = keyboardController.GetKeysDown(); } if (!hidKeyboard.HasValue) { hidKeyboard = new KeyboardInput { Modifier = 0, Keys = new int[0x8] }; } if (ConfigurationState.Instance.Hid.EnableKeyboard) { _device.Hid.Keyboard.Update(hidKeyboard.Value); } } } else if (inputConfig is Common.Configuration.Hid.ControllerConfig controllerConfig) { // Controller Input JoystickController joystickController = new JoystickController(controllerConfig); currentButton |= joystickController.GetButtons(); (leftJoystickDx, leftJoystickDy) = joystickController.GetLeftStick(); (rightJoystickDx, rightJoystickDy) = joystickController.GetRightStick(); leftJoystick = new JoystickPosition { Dx = controllerConfig.LeftJoycon.InvertStickX ? -leftJoystickDx : leftJoystickDx, Dy = controllerConfig.LeftJoycon.InvertStickY ? -leftJoystickDy : leftJoystickDy }; rightJoystick = new JoystickPosition { Dx = controllerConfig.RightJoycon.InvertStickX ? -rightJoystickDx : rightJoystickDx, Dy = controllerConfig.RightJoycon.InvertStickY ? -rightJoystickDy : rightJoystickDy }; } currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick); motionDevice.Poll(inputConfig, inputConfig.Slot); SixAxisInput sixAxisInput = new SixAxisInput() { PlayerId = (HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex, Accelerometer = motionDevice.Accelerometer, Gyroscope = motionDevice.Gyroscope, Rotation = motionDevice.Rotation, Orientation = motionDevice.Orientation }; motionInputs.Add(sixAxisInput); gamepadInputs.Add(new GamepadInput { PlayerId = (HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex, Buttons = currentButton, LStick = leftJoystick, RStick = rightJoystick }); if (inputConfig.ControllerType == Common.Configuration.Hid.ControllerType.JoyconPair) { if (!inputConfig.MirrorInput) { motionDevice.Poll(inputConfig, inputConfig.AltSlot); sixAxisInput = new SixAxisInput() { PlayerId = (HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex, Accelerometer = motionDevice.Accelerometer, Gyroscope = motionDevice.Gyroscope, Rotation = motionDevice.Rotation, Orientation = motionDevice.Orientation }; } motionInputs.Add(sixAxisInput); } } _device.Hid.Npads.Update(gamepadInputs); _device.Hid.Npads.UpdateSixAxis(motionInputs); _device.TamperMachine.UpdateInput(gamepadInputs); if (_isFocused) { // Hotkeys HotkeyButtons currentHotkeyButtons = KeyboardController.GetHotkeyButtons(OpenTK.Input.Keyboard.GetState()); if (currentHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync) && !_prevHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync)) { _device.EnableDeviceVsync = !_device.EnableDeviceVsync; Logger.Info?.Print(LogClass.Application, $"Vsync toggled to: {_device.EnableDeviceVsync}"); } _prevHotkeyButtons = currentHotkeyButtons; } //Touchscreen bool hasTouch = false; // Get screen touch position from left mouse click // OpenTK always captures mouse events, even if out of focus, so check if window is focused. if (_isFocused && _mousePressed) { float aspectWidth = SwitchPanelHeight * ConfigurationState.Instance.Graphics.AspectRatio.Value.ToFloat(); int screenWidth = AllocatedWidth; int screenHeight = AllocatedHeight; if (AllocatedWidth > AllocatedHeight * aspectWidth / SwitchPanelHeight) { screenWidth = (int)(AllocatedHeight * aspectWidth) / SwitchPanelHeight; } else { screenHeight = (AllocatedWidth * SwitchPanelHeight) / (int)aspectWidth; } int startX = (AllocatedWidth - screenWidth) >> 1; int startY = (AllocatedHeight - screenHeight) >> 1; int endX = startX + screenWidth; int endY = startY + screenHeight; if (_mouseX >= startX && _mouseY >= startY && _mouseX < endX && _mouseY < endY) { int screenMouseX = (int)_mouseX - startX; int screenMouseY = (int)_mouseY - startY; int mX = (screenMouseX * (int)aspectWidth) / screenWidth; int mY = (screenMouseY * SwitchPanelHeight) / screenHeight; TouchPoint currentPoint = new TouchPoint { X = (uint)mX, Y = (uint)mY, // Placeholder values till more data is acquired DiameterX = 10, DiameterY = 10, Angle = 90 }; hasTouch = true; _device.Hid.Touchscreen.Update(currentPoint); } } if (!hasTouch) { _device.Hid.Touchscreen.Update(); } _device.Hid.DebugPad.Update(); return(true); }
private new void UpdateFrame() { HotkeyButtons currentHotkeyButtons = 0; ControllerButtons currentButton = 0; JoystickPosition leftJoystick; JoystickPosition rightJoystick; HLE.Input.Keyboard?hidKeyboard = null; int leftJoystickDx = 0; int leftJoystickDy = 0; int rightJoystickDx = 0; int rightJoystickDy = 0; // Keyboard Input if (_keyboard.HasValue) { KeyboardState keyboard = _keyboard.Value; #if USE_PROFILING // Profiler input, lets the profiler get access to the main windows keyboard state _profileWindow.UpdateKeyInput(keyboard); #endif // Normal Input currentHotkeyButtons = Configuration.Instance.KeyboardControls.GetHotkeyButtons(keyboard); currentButton = Configuration.Instance.KeyboardControls.GetButtons(keyboard); if (Configuration.Instance.EnableKeyboard) { hidKeyboard = Configuration.Instance.KeyboardControls.GetKeysDown(keyboard); } (leftJoystickDx, leftJoystickDy) = Configuration.Instance.KeyboardControls.GetLeftStick(keyboard); (rightJoystickDx, rightJoystickDy) = Configuration.Instance.KeyboardControls.GetRightStick(keyboard); } if (!hidKeyboard.HasValue) { hidKeyboard = new HLE.Input.Keyboard { Modifier = 0, Keys = new int[0x8] }; } currentButton |= Configuration.Instance.JoystickControls.GetButtons(); // Keyboard has priority stick-wise if (leftJoystickDx == 0 && leftJoystickDy == 0) { (leftJoystickDx, leftJoystickDy) = Configuration.Instance.JoystickControls.GetLeftStick(); } if (rightJoystickDx == 0 && rightJoystickDy == 0) { (rightJoystickDx, rightJoystickDy) = Configuration.Instance.JoystickControls.GetRightStick(); } leftJoystick = new JoystickPosition { Dx = leftJoystickDx, Dy = leftJoystickDy }; rightJoystick = new JoystickPosition { Dx = rightJoystickDx, Dy = rightJoystickDy }; currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick); bool hasTouch = false; // Get screen touch position from left mouse click // OpenTK always captures mouse events, even if out of focus, so check if window is focused. if (Focused && _mouse?.LeftButton == ButtonState.Pressed) { MouseState mouse = _mouse.Value; int scrnWidth = Width; int scrnHeight = Height; if (Width > (Height * TouchScreenWidth) / TouchScreenHeight) { scrnWidth = (Height * TouchScreenWidth) / TouchScreenHeight; } else { scrnHeight = (Width * TouchScreenHeight) / TouchScreenWidth; } int startX = (Width - scrnWidth) >> 1; int startY = (Height - scrnHeight) >> 1; int endX = startX + scrnWidth; int endY = startY + scrnHeight; if (mouse.X >= startX && mouse.Y >= startY && mouse.X < endX && mouse.Y < endY) { int scrnMouseX = mouse.X - startX; int scrnMouseY = mouse.Y - startY; int mX = (scrnMouseX * TouchScreenWidth) / scrnWidth; int mY = (scrnMouseY * TouchScreenHeight) / scrnHeight; TouchPoint currentPoint = new TouchPoint { X = mX, Y = mY, // Placeholder values till more data is acquired DiameterX = 10, DiameterY = 10, Angle = 90 }; hasTouch = true; _device.Hid.SetTouchPoints(currentPoint); } } if (!hasTouch) { _device.Hid.SetTouchPoints(); } if (Configuration.Instance.EnableKeyboard && hidKeyboard.HasValue) { _device.Hid.WriteKeyboard(hidKeyboard.Value); } BaseController controller = _device.Hid.PrimaryController; controller.SendInput(currentButton, leftJoystick, rightJoystick); // Toggle vsync if (currentHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync) && !_prevHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync)) { _device.EnableDeviceVsync = !_device.EnableDeviceVsync; } _prevHotkeyButtons = currentHotkeyButtons; }