From 2365ddfc363e76ac1ac9d2e32ef9b36b85463431 Mon Sep 17 00:00:00 2001 From: mageven <62494521+mageven@users.noreply.github.com> Date: Fri, 3 Apr 2020 05:40:02 +0530 Subject: HID SharedMem Rework (#1003) * Delete old HLE.Input * Add new HLE Input. git shows Hid.cs as modified because of the same name. It is new. * Change HID Service * Change Ryujinx UI to reflect new Input * Add basic ControllerApplet * Add DebugPad Should fix Kirby Star Allies * Address Ac_K's comments * Moved all of HLE.Input to Services.Hid * Separated all structs and enums each to a file * Removed vars * Made some naming changes to align with switchbrew * Added official joycon colors As an aside, fixed a mistake in touchscreen headers and added checks to important SharedMem structs at init time. * Further address Ac_K's comments * Addressed gdkchan's and some more Ac_K's comments * Address AcK's review comments * Address AcK's second review comments * Replace missed Marshal.SizeOf and address gdkchan's comments --- Ryujinx.HLE/Input/Controller/Types/BatteryState.cs | 12 -------- .../Input/Controller/Types/ControllerButtons.cs | 35 ---------------------- .../Controller/Types/ControllerColorDescription.cs | 10 ------- .../Controller/Types/ControllerConnectionState.cs | 11 ------- .../Controller/Types/ControllerDeviceState.cs | 18 ----------- .../Input/Controller/Types/ControllerDeviceType.cs | 12 -------- .../Input/Controller/Types/ControllerHeader.cs | 19 ------------ Ryujinx.HLE/Input/Controller/Types/ControllerId.cs | 16 ---------- .../Input/Controller/Types/ControllerLayouts.cs | 13 -------- .../Input/Controller/Types/ControllerState.cs | 15 ---------- .../Controller/Types/ControllerStateHeader.cs | 13 -------- .../Input/Controller/Types/ControllerStatus.cs | 14 --------- Ryujinx.HLE/Input/Controller/Types/DeviceFlags.cs | 22 -------------- .../Input/Controller/Types/HotkeyButtons.cs | 10 ------- .../Input/Controller/Types/JoystickPosition.cs | 8 ----- Ryujinx.HLE/Input/Controller/Types/NpadColor.cs | 23 -------------- 16 files changed, 251 deletions(-) delete mode 100644 Ryujinx.HLE/Input/Controller/Types/BatteryState.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerButtons.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerColorDescription.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerConnectionState.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerDeviceState.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerDeviceType.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerHeader.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerId.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerLayouts.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerState.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerStateHeader.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/ControllerStatus.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/DeviceFlags.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/HotkeyButtons.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/JoystickPosition.cs delete mode 100644 Ryujinx.HLE/Input/Controller/Types/NpadColor.cs (limited to 'Ryujinx.HLE/Input/Controller/Types') 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 -- cgit v1.2.3