mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2026-02-20 18:06:51 -05:00
Merge branch 'master' into master
This commit is contained in:
@@ -27,7 +27,8 @@ namespace Ryujinx.Input.HLE
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly HLEButtonMappingEntry[] _hleButtonMapping = {
|
||||
private static readonly HLEButtonMappingEntry[] _hleButtonMapping =
|
||||
[
|
||||
new(GamepadButtonInputId.A, ControllerKeys.A),
|
||||
new(GamepadButtonInputId.B, ControllerKeys.B),
|
||||
new(GamepadButtonInputId.X, ControllerKeys.X),
|
||||
@@ -48,8 +49,8 @@ namespace Ryujinx.Input.HLE
|
||||
new(GamepadButtonInputId.SingleLeftTrigger0, ControllerKeys.SlLeft),
|
||||
new(GamepadButtonInputId.SingleRightTrigger0, ControllerKeys.SrLeft),
|
||||
new(GamepadButtonInputId.SingleLeftTrigger1, ControllerKeys.SlRight),
|
||||
new(GamepadButtonInputId.SingleRightTrigger1, ControllerKeys.SrRight),
|
||||
};
|
||||
new(GamepadButtonInputId.SingleRightTrigger1, ControllerKeys.SrRight)
|
||||
];
|
||||
|
||||
private class HLEKeyboardMappingEntry
|
||||
{
|
||||
@@ -63,7 +64,8 @@ namespace Ryujinx.Input.HLE
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly HLEKeyboardMappingEntry[] _keyMapping = {
|
||||
private static readonly HLEKeyboardMappingEntry[] _keyMapping =
|
||||
[
|
||||
new(Key.A, 0x4),
|
||||
new(Key.B, 0x5),
|
||||
new(Key.C, 0x6),
|
||||
@@ -186,10 +188,11 @@ namespace Ryujinx.Input.HLE
|
||||
new(Key.ControlRight, 0xE4),
|
||||
new(Key.ShiftRight, 0xE5),
|
||||
new(Key.AltRight, 0xE6),
|
||||
new(Key.WinRight, 0xE7),
|
||||
};
|
||||
new(Key.WinRight, 0xE7)
|
||||
];
|
||||
|
||||
private static readonly HLEKeyboardMappingEntry[] _keyModifierMapping = {
|
||||
private static readonly HLEKeyboardMappingEntry[] _keyModifierMapping =
|
||||
[
|
||||
new(Key.ControlLeft, 0),
|
||||
new(Key.ShiftLeft, 1),
|
||||
new(Key.AltLeft, 2),
|
||||
@@ -200,8 +203,8 @@ namespace Ryujinx.Input.HLE
|
||||
new(Key.WinRight, 7),
|
||||
new(Key.CapsLock, 8),
|
||||
new(Key.ScrollLock, 9),
|
||||
new(Key.NumLock, 10),
|
||||
};
|
||||
new(Key.NumLock, 10)
|
||||
];
|
||||
|
||||
private MotionInput _leftMotionInput;
|
||||
private MotionInput _rightMotionInput;
|
||||
@@ -277,7 +280,7 @@ namespace Ryujinx.Input.HLE
|
||||
public void Update()
|
||||
{
|
||||
// _gamepad may be altered by other threads
|
||||
var gamepad = _gamepad;
|
||||
IGamepad gamepad = _gamepad;
|
||||
|
||||
if (gamepad != null && GamepadDriver != null)
|
||||
{
|
||||
@@ -504,7 +507,7 @@ namespace Ryujinx.Input.HLE
|
||||
|
||||
public static KeyboardInput GetHLEKeyboardInput(IGamepadDriver KeyboardDriver)
|
||||
{
|
||||
var keyboard = KeyboardDriver.GetGamepad("0") as IKeyboard;
|
||||
IKeyboard keyboard = KeyboardDriver.GetGamepad("0") as IKeyboard;
|
||||
|
||||
KeyboardStateSnapshot keyboardState = keyboard.GetKeyboardStateSnapshot();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using CemuHookClient = Ryujinx.Input.Motion.CemuHook.Client;
|
||||
@@ -45,7 +46,7 @@ namespace Ryujinx.Input.HLE
|
||||
_keyboardDriver = keyboardDriver;
|
||||
_gamepadDriver = gamepadDriver;
|
||||
_mouseDriver = mouseDriver;
|
||||
_inputConfig = new List<InputConfig>();
|
||||
_inputConfig = [];
|
||||
|
||||
_gamepadDriver.OnGamepadConnected += HandleOnGamepadConnected;
|
||||
_gamepadDriver.OnGamepadDisconnected += HandleOnGamepadDisconnected;
|
||||
@@ -55,8 +56,8 @@ namespace Ryujinx.Input.HLE
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
List<InputConfig> validInputs = new();
|
||||
foreach (var inputConfigEntry in _inputConfig)
|
||||
List<InputConfig> validInputs = [];
|
||||
foreach (InputConfig inputConfigEntry in _inputConfig)
|
||||
{
|
||||
if (_controllers[(int)inputConfigEntry.PlayerIndex] != null)
|
||||
{
|
||||
@@ -123,7 +124,7 @@ namespace Ryujinx.Input.HLE
|
||||
{
|
||||
NpadController[] oldControllers = _controllers.ToArray();
|
||||
|
||||
List<InputConfig> validInputs = new();
|
||||
List<InputConfig> validInputs = [];
|
||||
|
||||
foreach (InputConfig inputConfigEntry in inputConfig)
|
||||
{
|
||||
@@ -204,7 +205,7 @@ namespace Ryujinx.Input.HLE
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
List<GamepadInput> hleInputStates = new();
|
||||
List<GamepadInput> hleInputStates = [];
|
||||
List<SixAxisInput> hleMotionStates = new(NpadDevices.MaxControllers);
|
||||
|
||||
KeyboardInput? hleKeyboardInput = null;
|
||||
@@ -234,7 +235,7 @@ namespace Ryujinx.Input.HLE
|
||||
|
||||
isJoyconPair = inputConfig.ControllerType == ControllerType.JoyconPair;
|
||||
|
||||
var altMotionState = isJoyconPair ? controller.GetHLEMotionState(true) : default;
|
||||
SixAxisInput altMotionState = isJoyconPair ? controller.GetHLEMotionState(true) : default;
|
||||
|
||||
motionState = (controller.GetHLEMotionState(), altMotionState);
|
||||
}
|
||||
@@ -273,9 +274,9 @@ namespace Ryujinx.Input.HLE
|
||||
|
||||
if (_enableMouse)
|
||||
{
|
||||
var mouse = _mouseDriver.GetGamepad("0") as IMouse;
|
||||
IMouse mouse = _mouseDriver.GetGamepad("0") as IMouse;
|
||||
|
||||
var mouseInput = IMouse.GetMouseStateSnapshot(mouse);
|
||||
MouseStateSnapshot mouseInput = IMouse.GetMouseStateSnapshot(mouse);
|
||||
|
||||
uint buttons = 0;
|
||||
|
||||
@@ -304,7 +305,7 @@ namespace Ryujinx.Input.HLE
|
||||
buttons |= 1 << 4;
|
||||
}
|
||||
|
||||
var position = IMouse.GetScreenPosition(mouseInput.Position, mouse.ClientSize, aspectRatio);
|
||||
Vector2 position = IMouse.GetScreenPosition(mouseInput.Position, mouse.ClientSize, aspectRatio);
|
||||
|
||||
_device.Hid.Mouse.Update((int)position.X, (int)position.Y, buttons, (int)mouseInput.Scroll.X, (int)mouseInput.Scroll.Y, true);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using Ryujinx.HLE;
|
||||
using Ryujinx.HLE.HOS.Services.Hid;
|
||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.TouchScreen;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Ryujinx.Input.HLE
|
||||
{
|
||||
@@ -29,7 +30,7 @@ namespace Ryujinx.Input.HLE
|
||||
if (_wasClicking && !isClicking)
|
||||
{
|
||||
MouseStateSnapshot snapshot = IMouse.GetMouseStateSnapshot(_mouse);
|
||||
var touchPosition = IMouse.GetScreenPosition(snapshot.Position, _mouse.ClientSize, aspectRatio);
|
||||
Vector2 touchPosition = IMouse.GetScreenPosition(snapshot.Position, _mouse.ClientSize, aspectRatio);
|
||||
|
||||
TouchPoint currentPoint = new()
|
||||
{
|
||||
@@ -58,7 +59,7 @@ namespace Ryujinx.Input.HLE
|
||||
if (aspectRatio > 0)
|
||||
{
|
||||
MouseStateSnapshot snapshot = IMouse.GetMouseStateSnapshot(_mouse);
|
||||
var touchPosition = IMouse.GetScreenPosition(snapshot.Position, _mouse.ClientSize, aspectRatio);
|
||||
Vector2 touchPosition = IMouse.GetScreenPosition(snapshot.Position, _mouse.ClientSize, aspectRatio);
|
||||
|
||||
TouchAttribute attribute = TouchAttribute.None;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user