aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Input
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/Input')
-rw-r--r--Ryujinx.HLE/Input/Controller/BaseController.cs142
-rw-r--r--Ryujinx.HLE/Input/Controller/NpadController.cs68
-rw-r--r--Ryujinx.HLE/Input/Controller/ProController.cs42
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/BatteryState.cs12
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerButtons.cs35
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerColorDescription.cs10
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerConnectionState.cs11
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerDeviceState.cs18
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerDeviceType.cs12
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerHeader.cs19
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerId.cs16
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerLayouts.cs13
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerState.cs15
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerStateHeader.cs13
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/ControllerStatus.cs14
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/DeviceFlags.cs22
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/HotkeyButtons.cs10
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/JoystickPosition.cs8
-rw-r--r--Ryujinx.HLE/Input/Controller/Types/NpadColor.cs23
-rw-r--r--Ryujinx.HLE/Input/Hid.cs218
-rw-r--r--Ryujinx.HLE/Input/HidValues.cs63
-rw-r--r--Ryujinx.HLE/Input/IHidDevice.cs8
-rw-r--r--Ryujinx.HLE/Input/Keyboard/Keyboard.cs8
-rw-r--r--Ryujinx.HLE/Input/Keyboard/KeyboardEntry.cs15
-rw-r--r--Ryujinx.HLE/Input/Keyboard/KeyboardHeader.cs13
-rw-r--r--Ryujinx.HLE/Input/Touch/TouchData.cs18
-rw-r--r--Ryujinx.HLE/Input/Touch/TouchEntry.cs11
-rw-r--r--Ryujinx.HLE/Input/Touch/TouchHeader.cs14
-rw-r--r--Ryujinx.HLE/Input/Touch/TouchPoint.cs11
29 files changed, 0 insertions, 882 deletions
diff --git a/Ryujinx.HLE/Input/Controller/BaseController.cs b/Ryujinx.HLE/Input/Controller/BaseController.cs
deleted file mode 100644
index dfd54a83..00000000
--- a/Ryujinx.HLE/Input/Controller/BaseController.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using static Ryujinx.HLE.Input.Hid;
-
-namespace Ryujinx.HLE.Input
-{
- public abstract class BaseController : IHidDevice
- {
- protected ControllerStatus HidControllerType;
- protected ControllerId ControllerId;
-
- private long _currentLayoutOffset;
- private long _mainLayoutOffset;
-
- protected long DeviceStateOffset => Offset + 0x4188;
-
- protected Switch Device { get; }
-
- public long Offset { get; private set; }
- public bool Connected { get; protected set; }
-
- public ControllerHeader Header { get; private set; }
- public ControllerStateHeader CurrentStateHeader { get; private set; }
- public ControllerDeviceState DeviceState { get; private set; }
- public ControllerLayouts CurrentLayout { get; private set; }
- public ControllerState LastInputState { get; set; }
- public ControllerConnectionState ConnectionState { get; protected set; }
-
- public BaseController(Switch device, ControllerStatus controllerType)
- {
- Device = device;
- HidControllerType = controllerType;
- }
-
- protected void Initialize(
- bool isHalf,
- (NpadColor left, NpadColor right) bodyColors,
- (NpadColor left, NpadColor right) buttonColors,
- ControllerColorDescription singleColorDesc = 0,
- ControllerColorDescription splitColorDesc = 0,
- NpadColor singleBodyColor = 0,
- NpadColor singleButtonColor = 0
- )
- {
- Header = new ControllerHeader()
- {
- IsJoyConHalf = isHalf ? 1 : 0,
- LeftBodyColor = bodyColors.left,
- LeftButtonColor = buttonColors.left,
- RightBodyColor = bodyColors.right,
- RightButtonColor = buttonColors.right,
- Status = HidControllerType,
- SingleBodyColor = singleBodyColor,
- SingleButtonColor = singleButtonColor,
- SplitColorDescription = splitColorDesc,
- SingleColorDescription = singleColorDesc,
- };
-
- CurrentStateHeader = new ControllerStateHeader
- {
- EntryCount = HidEntryCount,
- MaxEntryCount = HidEntryCount - 1,
- CurrentEntryIndex = -1
- };
-
- DeviceState = new ControllerDeviceState()
- {
- PowerInfo0BatteryState = BatteryState.Percent100,
- PowerInfo1BatteryState = BatteryState.Percent100,
- PowerInfo2BatteryState = BatteryState.Percent100,
- DeviceType = ControllerDeviceType.NPadLeftController | ControllerDeviceType.NPadRightController,
- DeviceFlags = DeviceFlags.PowerInfo0Connected
- | DeviceFlags.PowerInfo1Connected
- | DeviceFlags.PowerInfo2Connected
- };
-
- LastInputState = new ControllerState()
- {
- SamplesTimestamp = -1,
- SamplesTimestamp2 = -1
- };
- }
-
- public virtual void Connect(ControllerId controllerId)
- {
- ControllerId = controllerId;
-
- Offset = Device.Hid.HidPosition + HidControllersOffset + (int)controllerId * HidControllerSize;
-
- _mainLayoutOffset = Offset + HidControllerHeaderSize
- + ((int)ControllerLayouts.Main * HidControllerLayoutsSize);
-
- Device.Memory.FillWithZeros(Offset, 0x5000);
- Device.Memory.WriteStruct(Offset, Header);
- Device.Memory.WriteStruct(DeviceStateOffset, DeviceState);
-
- Connected = true;
- }
-
- public void SetLayout(ControllerLayouts controllerLayout)
- {
- CurrentLayout = controllerLayout;
-
- _currentLayoutOffset = Offset + HidControllerHeaderSize
- + ((int)controllerLayout * HidControllerLayoutsSize);
- }
-
- public void SendInput(
- ControllerButtons buttons,
- JoystickPosition leftStick,
- JoystickPosition rightStick)
- {
- ControllerState currentInput = new ControllerState()
- {
- SamplesTimestamp = (long)LastInputState.SamplesTimestamp + 1,
- SamplesTimestamp2 = (long)LastInputState.SamplesTimestamp + 1,
- ButtonState = buttons,
- ConnectionState = ConnectionState,
- LeftStick = leftStick,
- RightStick = rightStick
- };
-
- ControllerStateHeader newInputStateHeader = new ControllerStateHeader
- {
- EntryCount = HidEntryCount,
- MaxEntryCount = HidEntryCount - 1,
- CurrentEntryIndex = (CurrentStateHeader.CurrentEntryIndex + 1) % HidEntryCount,
- Timestamp = GetTimestamp(),
- };
-
- Device.Memory.WriteStruct(_currentLayoutOffset, newInputStateHeader);
- Device.Memory.WriteStruct(_mainLayoutOffset, newInputStateHeader);
-
- long currentInputStateOffset = HidControllersLayoutHeaderSize
- + newInputStateHeader.CurrentEntryIndex * HidControllersInputEntrySize;
-
- Device.Memory.WriteStruct(_currentLayoutOffset + currentInputStateOffset, currentInput);
- Device.Memory.WriteStruct(_mainLayoutOffset + currentInputStateOffset, currentInput);
-
- LastInputState = currentInput;
- CurrentStateHeader = newInputStateHeader;
- }
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/NpadController.cs b/Ryujinx.HLE/Input/Controller/NpadController.cs
deleted file mode 100644
index b4304b8f..00000000
--- a/Ryujinx.HLE/Input/Controller/NpadController.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public class NpadController : BaseController
- {
- private (NpadColor Left, NpadColor Right) _npadBodyColors;
- private (NpadColor Left, NpadColor Right) _npadButtonColors;
-
- private bool _isHalf;
-
- public NpadController(
- ControllerStatus controllerStatus,
- Switch device,
- (NpadColor, NpadColor) npadBodyColors,
- (NpadColor, NpadColor) npadButtonColors) : base(device, controllerStatus)
- {
- _npadBodyColors = npadBodyColors;
- _npadButtonColors = npadButtonColors;
- }
-
- public override void Connect(ControllerId controllerId)
- {
- if (HidControllerType != ControllerStatus.NpadLeft && HidControllerType != ControllerStatus.NpadRight)
- {
- _isHalf = false;
- }
-
- ConnectionState = ControllerConnectionState.ControllerStateConnected;
-
- if (controllerId == ControllerId.ControllerHandheld)
- ConnectionState |= ControllerConnectionState.ControllerStateWired;
-
- ControllerColorDescription singleColorDesc =
- ControllerColorDescription.ColorDescriptionColorsNonexistent;
-
- ControllerColorDescription splitColorDesc = 0;
-
- NpadColor singleBodyColor = NpadColor.Black;
- NpadColor singleButtonColor = NpadColor.Black;
-
- Initialize(_isHalf,
- (_npadBodyColors.Left, _npadBodyColors.Right),
- (_npadButtonColors.Left, _npadButtonColors.Right),
- singleColorDesc,
- splitColorDesc,
- singleBodyColor,
- singleButtonColor );
-
- base.Connect(controllerId);
-
- var _currentLayout = ControllerLayouts.HandheldJoined;
-
- switch (HidControllerType)
- {
- case ControllerStatus.NpadLeft:
- _currentLayout = ControllerLayouts.Left;
- break;
- case ControllerStatus.NpadRight:
- _currentLayout = ControllerLayouts.Right;
- break;
- case ControllerStatus.NpadPair:
- _currentLayout = ControllerLayouts.Joined;
- break;
- }
-
- SetLayout(_currentLayout);
- }
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/ProController.cs b/Ryujinx.HLE/Input/Controller/ProController.cs
deleted file mode 100644
index ae574260..00000000
--- a/Ryujinx.HLE/Input/Controller/ProController.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public class ProController : BaseController
- {
- private bool _wired = false;
-
- private NpadColor _bodyColor;
- private NpadColor _buttonColor;
-
- public ProController(Switch device,
- NpadColor bodyColor,
- NpadColor buttonColor) : base(device, ControllerStatus.ProController)
- {
- _wired = true;
-
- _bodyColor = bodyColor;
- _buttonColor = buttonColor;
- }
-
- public override void Connect(ControllerId controllerId)
- {
- ControllerColorDescription singleColorDesc =
- ControllerColorDescription.ColorDescriptionColorsNonexistent;
-
- ControllerColorDescription splitColorDesc = 0;
-
- ConnectionState = ControllerConnectionState.ControllerStateConnected | ControllerConnectionState.ControllerStateWired;
-
- Initialize(false,
- (0, 0),
- (0, 0),
- singleColorDesc,
- splitColorDesc,
- _bodyColor,
- _buttonColor);
-
- base.Connect(controllerId);
-
- SetLayout(ControllerLayouts.ProController);
- }
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/BatteryState.cs b/Ryujinx.HLE/Input/Controller/Types/BatteryState.cs
deleted file mode 100644
index 4279d7a0..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/BatteryState.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public enum BatteryState : int
- {
- // TODO : Check if these are the correct states
- Percent0 = 0,
- Percent25 = 1,
- Percent50 = 2,
- Percent75 = 3,
- Percent100 = 4
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerButtons.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerButtons.cs
deleted file mode 100644
index 879257f2..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerButtons.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-
-namespace Ryujinx.HLE.Input
-{
- [Flags]
- public enum ControllerButtons : long
- {
- A = 1 << 0,
- B = 1 << 1,
- X = 1 << 2,
- Y = 1 << 3,
- StickLeft = 1 << 4,
- StickRight = 1 << 5,
- L = 1 << 6,
- R = 1 << 7,
- Zl = 1 << 8,
- Zr = 1 << 9,
- Plus = 1 << 10,
- Minus = 1 << 11,
- DpadLeft = 1 << 12,
- DpadUp = 1 << 13,
- DPadRight = 1 << 14,
- DpadDown = 1 << 15,
- LStickLeft = 1 << 16,
- LStickUp = 1 << 17,
- LStickRight = 1 << 18,
- LStickDown = 1 << 19,
- RStickLeft = 1 << 20,
- RStickUp = 1 << 21,
- RStickRight = 1 << 22,
- RStickDown = 1 << 23,
- Sl = 1 << 24,
- Sr = 1 << 25
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerColorDescription.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerColorDescription.cs
deleted file mode 100644
index c31f41a3..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerColorDescription.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-
-namespace Ryujinx.HLE.Input
-{
- [Flags]
- public enum ControllerColorDescription : int
- {
- ColorDescriptionColorsNonexistent = (1 << 1)
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerConnectionState.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerConnectionState.cs
deleted file mode 100644
index 526da1ff..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerConnectionState.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-
-namespace Ryujinx.HLE.Input
-{
- [Flags]
- public enum ControllerConnectionState : long
- {
- ControllerStateConnected = (1 << 0),
- ControllerStateWired = (1 << 1)
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerDeviceState.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerDeviceState.cs
deleted file mode 100644
index 45895a1e..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerDeviceState.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct ControllerDeviceState
- {
- public ControllerDeviceType DeviceType;
- public int Padding;
- public DeviceFlags DeviceFlags;
- public int UnintendedHomeButtonInputProtectionEnabled;
- public BatteryState PowerInfo0BatteryState;
- public BatteryState PowerInfo1BatteryState;
- public BatteryState PowerInfo2BatteryState;
- public fixed byte ControllerMac[16];
- public fixed byte ControllerMac2[16];
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerDeviceType.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerDeviceType.cs
deleted file mode 100644
index 8043d8a0..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerDeviceType.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Ryujinx.HLE.Input
-{
- [Flags]
- public enum ControllerDeviceType : int
- {
- ProController = 1 << 0,
- NPadLeftController = 1 << 4,
- NPadRightController = 1 << 5,
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerHeader.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerHeader.cs
deleted file mode 100644
index cbb5b6f5..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerHeader.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct ControllerHeader
- {
- public ControllerStatus Status;
- public int IsJoyConHalf;
- public ControllerColorDescription SingleColorDescription;
- public NpadColor SingleBodyColor;
- public NpadColor SingleButtonColor;
- public ControllerColorDescription SplitColorDescription;
- public NpadColor RightBodyColor;
- public NpadColor RightButtonColor;
- public NpadColor LeftBodyColor;
- public NpadColor LeftButtonColor;
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerId.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerId.cs
deleted file mode 100644
index c82056c6..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerId.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public enum ControllerId
- {
- ControllerPlayer1 = 0,
- ControllerPlayer2 = 1,
- ControllerPlayer3 = 2,
- ControllerPlayer4 = 3,
- ControllerPlayer5 = 4,
- ControllerPlayer6 = 5,
- ControllerPlayer7 = 6,
- ControllerPlayer8 = 7,
- ControllerHandheld = 8,
- ControllerUnknown = 9
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerLayouts.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerLayouts.cs
deleted file mode 100644
index fedc0399..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerLayouts.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public enum ControllerLayouts
- {
- ProController = 0,
- HandheldJoined = 1,
- Joined = 2,
- Left = 3,
- Right = 4,
- MainNoAnalog = 5,
- Main = 6
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerState.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerState.cs
deleted file mode 100644
index 4847438d..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerState.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct ControllerState
- {
- public long SamplesTimestamp;
- public long SamplesTimestamp2;
- public ControllerButtons ButtonState;
- public JoystickPosition LeftStick;
- public JoystickPosition RightStick;
- public ControllerConnectionState ConnectionState;
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerStateHeader.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerStateHeader.cs
deleted file mode 100644
index f885c00c..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerStateHeader.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct ControllerStateHeader
- {
- public long Timestamp;
- public long EntryCount;
- public long CurrentEntryIndex;
- public long MaxEntryCount;
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/ControllerStatus.cs b/Ryujinx.HLE/Input/Controller/Types/ControllerStatus.cs
deleted file mode 100644
index 9444d7b0..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/ControllerStatus.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-
-namespace Ryujinx.HLE.Input
-{
- [Flags]
- public enum ControllerStatus : int
- {
- ProController = 1 << 0,
- Handheld = 1 << 1,
- NpadPair = 1 << 2,
- NpadLeft = 1 << 3,
- NpadRight = 1 << 4
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Controller/Types/DeviceFlags.cs b/Ryujinx.HLE/Input/Controller/Types/DeviceFlags.cs
deleted file mode 100644
index 53913175..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/DeviceFlags.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-
-namespace Ryujinx.HLE.Input
-{
- [Flags]
- public enum DeviceFlags : long
- {
- PowerInfo0Charging = 1 << 0,
- PowerInfo1Charging = 1 << 1,
- PowerInfo2Charging = 1 << 2,
- PowerInfo0Connected = 1 << 3,
- PowerInfo1Connected = 1 << 4,
- PowerInfo2Connected = 1 << 5,
- UnsupportedButtonPressedNpadSystem = 1 << 9,
- UnsupportedButtonPressedNpadSystemExt = 1 << 10,
- AbxyButtonOriented = 1 << 11,
- SlSrButtonOriented = 1 << 12,
- PlusButtonCapability = 1 << 13,
- MinusButtonCapability = 1 << 14,
- DirectionalButtonsSupported = 1 << 15
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/HotkeyButtons.cs b/Ryujinx.HLE/Input/Controller/Types/HotkeyButtons.cs
deleted file mode 100644
index be76ee1e..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/HotkeyButtons.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-
-namespace Ryujinx.HLE.Input
-{
- [Flags]
- public enum HotkeyButtons
- {
- ToggleVSync = 1 << 0,
- }
-}
diff --git a/Ryujinx.HLE/Input/Controller/Types/JoystickPosition.cs b/Ryujinx.HLE/Input/Controller/Types/JoystickPosition.cs
deleted file mode 100644
index 1442bc60..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/JoystickPosition.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public struct JoystickPosition
- {
- public int Dx;
- public int Dy;
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Controller/Types/NpadColor.cs b/Ryujinx.HLE/Input/Controller/Types/NpadColor.cs
deleted file mode 100644
index a60f94aa..00000000
--- a/Ryujinx.HLE/Input/Controller/Types/NpadColor.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public enum NpadColor : int //Thanks to CTCaer
- {
- Black = 0,
-
- BodyGrey = 0x828282,
- BodyNeonBlue = 0x0AB9E6,
- BodyNeonRed = 0xFF3C28,
- BodyNeonYellow = 0xE6FF00,
- BodyNeonPink = 0xFF3278,
- BodyNeonGreen = 0x1EDC00,
- BodyRed = 0xE10F00,
-
- ButtonsGrey = 0x0F0F0F,
- ButtonsNeonBlue = 0x001E1E,
- ButtonsNeonRed = 0x1E0A0A,
- ButtonsNeonYellow = 0x142800,
- ButtonsNeonPink = 0x28001E,
- ButtonsNeonGreen = 0x002800,
- ButtonsRed = 0x280A0A
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Hid.cs b/Ryujinx.HLE/Input/Hid.cs
deleted file mode 100644
index 5cb7f09d..00000000
--- a/Ryujinx.HLE/Input/Hid.cs
+++ /dev/null
@@ -1,218 +0,0 @@
-using Ryujinx.Common;
-using Ryujinx.Configuration.Hid;
-using Ryujinx.HLE.HOS;
-using System;
-
-namespace Ryujinx.HLE.Input
-{
- public partial class Hid
- {
- private Switch _device;
-
- private long _touchScreenOffset;
- private long _touchEntriesOffset;
- private long _keyboardOffset;
-
- private TouchHeader _currentTouchHeader;
- private KeyboardHeader _currentKeyboardHeader;
- private KeyboardEntry _currentKeyboardEntry;
-
- public BaseController PrimaryController { get; private set; }
-
- internal long HidPosition;
-
- public Hid(Switch device, long hidPosition)
- {
- _device = device;
- HidPosition = hidPosition;
-
- device.Memory.FillWithZeros(hidPosition, Horizon.HidSize);
-
- _currentTouchHeader = new TouchHeader()
- {
- CurrentEntryIndex = -1,
- };
-
- _currentKeyboardHeader = new KeyboardHeader()
- {
- CurrentEntryIndex = -1,
- };
-
- _currentKeyboardEntry = new KeyboardEntry()
- {
- SamplesTimestamp = -1,
- SamplesTimestamp2 = -1
- };
-
- _touchScreenOffset = HidPosition + HidTouchScreenOffset;
- _touchEntriesOffset = _touchScreenOffset + HidTouchHeaderSize;
- _keyboardOffset = HidPosition + HidKeyboardOffset;
- }
-
- private static ControllerStatus ConvertControllerTypeToState(ControllerType controllerType)
- {
- switch (controllerType)
- {
- case ControllerType.Handheld: return ControllerStatus.Handheld;
- case ControllerType.NpadLeft: return ControllerStatus.NpadLeft;
- case ControllerType.NpadRight: return ControllerStatus.NpadRight;
- case ControllerType.NpadPair: return ControllerStatus.NpadPair;
- case ControllerType.ProController: return ControllerStatus.ProController;
- default: throw new NotImplementedException();
- }
- }
-
- public void InitializePrimaryController(ControllerType controllerType)
- {
- ControllerId controllerId = controllerType == ControllerType.Handheld ?
- ControllerId.ControllerHandheld : ControllerId.ControllerPlayer1;
-
- if (controllerType == ControllerType.ProController)
- {
- PrimaryController = new ProController(_device, NpadColor.Black, NpadColor.Black);
- }
- else
- {
- PrimaryController = new NpadController(ConvertControllerTypeToState(controllerType),
- _device,
- (NpadColor.BodyNeonRed, NpadColor.BodyNeonRed),
- (NpadColor.ButtonsNeonBlue, NpadColor.ButtonsNeonBlue));
- }
-
- PrimaryController.Connect(controllerId);
- }
-
- public ControllerButtons UpdateStickButtons(
- JoystickPosition leftStick,
- JoystickPosition rightStick)
- {
- ControllerButtons result = 0;
-
- if (rightStick.Dx < 0)
- {
- result |= ControllerButtons.RStickLeft;
- }
-
- if (rightStick.Dx > 0)
- {
- result |= ControllerButtons.RStickRight;
- }
-
- if (rightStick.Dy < 0)
- {
- result |= ControllerButtons.RStickDown;
- }
-
- if (rightStick.Dy > 0)
- {
- result |= ControllerButtons.RStickUp;
- }
-
- if (leftStick.Dx < 0)
- {
- result |= ControllerButtons.LStickLeft;
- }
-
- if (leftStick.Dx > 0)
- {
- result |= ControllerButtons.LStickRight;
- }
-
- if (leftStick.Dy < 0)
- {
- result |= ControllerButtons.LStickDown;
- }
-
- if (leftStick.Dy > 0)
- {
- result |= ControllerButtons.LStickUp;
- }
-
- return result;
- }
- public void SetTouchPoints(params TouchPoint[] points)
- {
- long timestamp = GetTimestamp();
- long sampleCounter = _currentTouchHeader.SamplesTimestamp + 1;
-
- var newTouchHeader = new TouchHeader
- {
- CurrentEntryIndex = (_currentTouchHeader.CurrentEntryIndex + 1) % HidEntryCount,
- EntryCount = HidEntryCount,
- MaxEntries = HidEntryCount - 1,
- SamplesTimestamp = sampleCounter,
- Timestamp = timestamp,
- };
-
- long currentTouchEntryOffset = _touchEntriesOffset + newTouchHeader.CurrentEntryIndex * HidTouchEntrySize;
-
- TouchEntry touchEntry = new TouchEntry()
- {
- SamplesTimestamp = sampleCounter,
- TouchCount = points.Length
- };
-
- _device.Memory.WriteStruct(currentTouchEntryOffset, touchEntry);
-
- currentTouchEntryOffset += HidTouchEntryHeaderSize;
-
- for (int i = 0; i < points.Length; i++)
- {
- TouchData touch = new TouchData()
- {
- Angle = points[i].Angle,
- DiameterX = points[i].DiameterX,
- DiameterY = points[i].DiameterY,
- Index = i,
- SampleTimestamp = sampleCounter,
- X = points[i].X,
- Y = points[i].Y
- };
-
- _device.Memory.WriteStruct(currentTouchEntryOffset, touch);
-
- currentTouchEntryOffset += HidTouchEntryTouchSize;
- }
-
- _device.Memory.WriteStruct(_touchScreenOffset, newTouchHeader);
-
- _currentTouchHeader = newTouchHeader;
- }
-
- public unsafe void WriteKeyboard(Keyboard keyboard)
- {
- long timestamp = GetTimestamp();
-
- var newKeyboardHeader = new KeyboardHeader()
- {
- CurrentEntryIndex = (_currentKeyboardHeader.CurrentEntryIndex + 1) % HidEntryCount,
- EntryCount = HidEntryCount,
- MaxEntries = HidEntryCount - 1,
- Timestamp = timestamp,
- };
-
- _device.Memory.WriteStruct(_keyboardOffset, newKeyboardHeader);
-
- long keyboardEntryOffset = _keyboardOffset + HidKeyboardHeaderSize;
- keyboardEntryOffset += newKeyboardHeader.CurrentEntryIndex * HidKeyboardEntrySize;
-
- var newkeyboardEntry = new KeyboardEntry()
- {
- SamplesTimestamp = _currentKeyboardEntry.SamplesTimestamp + 1,
- SamplesTimestamp2 = _currentKeyboardEntry.SamplesTimestamp2 + 1,
- Keys = keyboard.Keys,
- Modifier = keyboard.Modifier,
- };
-
- _device.Memory.WriteStruct(keyboardEntryOffset, newkeyboardEntry);
-
- _currentKeyboardEntry = newkeyboardEntry;
- _currentKeyboardHeader = newKeyboardHeader;
- }
-
- internal static long GetTimestamp()
- {
- return PerformanceCounter.ElapsedMilliseconds * 19200;
- }
- }
-}
diff --git a/Ryujinx.HLE/Input/HidValues.cs b/Ryujinx.HLE/Input/HidValues.cs
deleted file mode 100644
index 06fe8fc0..00000000
--- a/Ryujinx.HLE/Input/HidValues.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public partial class Hid
- {
- /*
- * Reference:
- * https://github.com/reswitched/libtransistor/blob/development/lib/hid.c
- * https://github.com/reswitched/libtransistor/blob/development/include/libtransistor/hid.h
- * https://github.com/switchbrew/libnx/blob/master/nx/source/services/hid.c
- * https://github.com/switchbrew/libnx/blob/master/nx/include/switch/services/hid.h
- */
-
- internal const int HidHeaderSize = 0x400;
- internal const int HidTouchScreenSize = 0x3000;
- internal const int HidMouseSize = 0x400;
- internal const int HidKeyboardSize = 0x400;
- internal const int HidUnkSection1Size = 0x400;
- internal const int HidUnkSection2Size = 0x400;
- internal const int HidUnkSection3Size = 0x400;
- internal const int HidUnkSection4Size = 0x400;
- internal const int HidUnkSection5Size = 0x200;
- internal const int HidUnkSection6Size = 0x200;
- internal const int HidUnkSection7Size = 0x200;
- internal const int HidUnkSection8Size = 0x800;
- internal const int HidControllerSerialsSize = 0x4000;
- internal const int HidControllersSize = 0x32000;
- internal const int HidUnkSection9Size = 0x800;
-
- internal const int HidKeyboardHeaderSize = 0x20;
- internal const int HidKeyboardEntrySize = 0x38;
-
- internal const int HidTouchHeaderSize = 0x28;
- internal const int HidTouchEntrySize = 0x298;
-
- internal const int HidTouchEntryHeaderSize = 0x10;
- internal const int HidTouchEntryTouchSize = 0x28;
-
- internal const int HidControllerSize = 0x5000;
- internal const int HidControllerHeaderSize = 0x28;
- internal const int HidControllerLayoutsSize = 0x350;
-
- internal const int HidControllersLayoutHeaderSize = 0x20;
- internal const int HidControllersInputEntrySize = 0x30;
-
- internal const int HidHeaderOffset = 0;
- internal const int HidTouchScreenOffset = HidHeaderOffset + HidHeaderSize;
- internal const int HidMouseOffset = HidTouchScreenOffset + HidTouchScreenSize;
- internal const int HidKeyboardOffset = HidMouseOffset + HidMouseSize;
- internal const int HidUnkSection1Offset = HidKeyboardOffset + HidKeyboardSize;
- internal const int HidUnkSection2Offset = HidUnkSection1Offset + HidUnkSection1Size;
- internal const int HidUnkSection3Offset = HidUnkSection2Offset + HidUnkSection2Size;
- internal const int HidUnkSection4Offset = HidUnkSection3Offset + HidUnkSection3Size;
- internal const int HidUnkSection5Offset = HidUnkSection4Offset + HidUnkSection4Size;
- internal const int HidUnkSection6Offset = HidUnkSection5Offset + HidUnkSection5Size;
- internal const int HidUnkSection7Offset = HidUnkSection6Offset + HidUnkSection6Size;
- internal const int HidUnkSection8Offset = HidUnkSection7Offset + HidUnkSection7Size;
- internal const int HidControllerSerialsOffset = HidUnkSection8Offset + HidUnkSection8Size;
- internal const int HidControllersOffset = HidControllerSerialsOffset + HidControllerSerialsSize;
- internal const int HidUnkSection9Offset = HidControllersOffset + HidControllersSize;
-
- internal const int HidEntryCount = 17;
- }
-}
diff --git a/Ryujinx.HLE/Input/IHidDevice.cs b/Ryujinx.HLE/Input/IHidDevice.cs
deleted file mode 100644
index 0b07e767..00000000
--- a/Ryujinx.HLE/Input/IHidDevice.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- interface IHidDevice
- {
- long Offset { get; }
- bool Connected { get; }
- }
-}
diff --git a/Ryujinx.HLE/Input/Keyboard/Keyboard.cs b/Ryujinx.HLE/Input/Keyboard/Keyboard.cs
deleted file mode 100644
index 7220e518..00000000
--- a/Ryujinx.HLE/Input/Keyboard/Keyboard.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public struct Keyboard
- {
- public int Modifier;
- public int[] Keys;
- }
-} \ No newline at end of file
diff --git a/Ryujinx.HLE/Input/Keyboard/KeyboardEntry.cs b/Ryujinx.HLE/Input/Keyboard/KeyboardEntry.cs
deleted file mode 100644
index be7d9399..00000000
--- a/Ryujinx.HLE/Input/Keyboard/KeyboardEntry.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct KeyboardEntry
- {
- public long SamplesTimestamp;
- public long SamplesTimestamp2;
- public long Modifier;
-
- [MarshalAs(UnmanagedType.ByValArray , SizeConst = 0x8)]
- public int[] Keys;
- }
-}
diff --git a/Ryujinx.HLE/Input/Keyboard/KeyboardHeader.cs b/Ryujinx.HLE/Input/Keyboard/KeyboardHeader.cs
deleted file mode 100644
index 882ccbab..00000000
--- a/Ryujinx.HLE/Input/Keyboard/KeyboardHeader.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct KeyboardHeader
- {
- public long Timestamp;
- public long EntryCount;
- public long CurrentEntryIndex;
- public long MaxEntries;
- }
-}
diff --git a/Ryujinx.HLE/Input/Touch/TouchData.cs b/Ryujinx.HLE/Input/Touch/TouchData.cs
deleted file mode 100644
index 8489ef70..00000000
--- a/Ryujinx.HLE/Input/Touch/TouchData.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct TouchData
- {
- public long SampleTimestamp;
- public int Padding;
- public int Index;
- public int X;
- public int Y;
- public int DiameterX;
- public int DiameterY;
- public int Angle;
- public int Padding2;
- }
-}
diff --git a/Ryujinx.HLE/Input/Touch/TouchEntry.cs b/Ryujinx.HLE/Input/Touch/TouchEntry.cs
deleted file mode 100644
index 2ef09d75..00000000
--- a/Ryujinx.HLE/Input/Touch/TouchEntry.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct TouchEntry
- {
- public long SamplesTimestamp;
- public long TouchCount;
- }
-}
diff --git a/Ryujinx.HLE/Input/Touch/TouchHeader.cs b/Ryujinx.HLE/Input/Touch/TouchHeader.cs
deleted file mode 100644
index dd93137c..00000000
--- a/Ryujinx.HLE/Input/Touch/TouchHeader.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace Ryujinx.HLE.Input
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct TouchHeader
- {
- public long Timestamp;
- public long EntryCount;
- public long CurrentEntryIndex;
- public long MaxEntries;
- public long SamplesTimestamp;
- }
-}
diff --git a/Ryujinx.HLE/Input/Touch/TouchPoint.cs b/Ryujinx.HLE/Input/Touch/TouchPoint.cs
deleted file mode 100644
index a9b095de..00000000
--- a/Ryujinx.HLE/Input/Touch/TouchPoint.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Ryujinx.HLE.Input
-{
- public struct TouchPoint
- {
- public int X;
- public int Y;
- public int DiameterX;
- public int DiameterY;
- public int Angle;
- }
-} \ No newline at end of file