Split main project into core,graphics and chocolarm4 subproject (#29)
This commit is contained in:
parent
cb665bb715
commit
62b827f474
257 changed files with 415 additions and 285 deletions
188
Ryujinx.Core/Hid/HidController.cs
Normal file
188
Ryujinx.Core/Hid/HidController.cs
Normal file
|
@ -0,0 +1,188 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Core
|
||||
{
|
||||
[Flags]
|
||||
public enum HidControllerKeys
|
||||
{
|
||||
KEY_A = (1 << 0),
|
||||
KEY_B = (1 << 1),
|
||||
KEY_X = (1 << 2),
|
||||
KEY_Y = (1 << 3),
|
||||
KEY_LSTICK = (1 << 4),
|
||||
KEY_RSTICK = (1 << 5),
|
||||
KEY_L = (1 << 6),
|
||||
KEY_R = (1 << 7),
|
||||
KEY_ZL = (1 << 8),
|
||||
KEY_ZR = (1 << 9),
|
||||
KEY_PLUS = (1 << 10),
|
||||
KEY_MINUS = (1 << 11),
|
||||
KEY_DLEFT = (1 << 12),
|
||||
KEY_DUP = (1 << 13),
|
||||
KEY_DRIGHT = (1 << 14),
|
||||
KEY_DDOWN = (1 << 15),
|
||||
KEY_LSTICK_LEFT = (1 << 16),
|
||||
KEY_LSTICK_UP = (1 << 17),
|
||||
KEY_LSTICK_RIGHT = (1 << 18),
|
||||
KEY_LSTICK_DOWN = (1 << 19),
|
||||
KEY_RSTICK_LEFT = (1 << 20),
|
||||
KEY_RSTICK_UP = (1 << 21),
|
||||
KEY_RSTICK_RIGHT = (1 << 22),
|
||||
KEY_RSTICK_DOWN = (1 << 23),
|
||||
KEY_SL = (1 << 24),
|
||||
KEY_SR = (1 << 25),
|
||||
|
||||
// Pseudo-key for at least one finger on the touch screen
|
||||
KEY_TOUCH = (1 << 26),
|
||||
|
||||
// Buttons by orientation (for single Joy-Con), also works with Joy-Con pairs, Pro Controller
|
||||
KEY_JOYCON_RIGHT = (1 << 0),
|
||||
KEY_JOYCON_DOWN = (1 << 1),
|
||||
KEY_JOYCON_UP = (1 << 2),
|
||||
KEY_JOYCON_LEFT = (1 << 3),
|
||||
|
||||
// Generic catch-all directions, also works for single Joy-Con
|
||||
KEY_UP = KEY_DUP | KEY_LSTICK_UP | KEY_RSTICK_UP,
|
||||
KEY_DOWN = KEY_DDOWN | KEY_LSTICK_DOWN | KEY_RSTICK_DOWN,
|
||||
KEY_LEFT = KEY_DLEFT | KEY_LSTICK_LEFT | KEY_RSTICK_LEFT,
|
||||
KEY_RIGHT = KEY_DRIGHT | KEY_LSTICK_RIGHT | KEY_RSTICK_RIGHT,
|
||||
}
|
||||
|
||||
public enum HidControllerID
|
||||
{
|
||||
CONTROLLER_PLAYER_1 = 0,
|
||||
CONTROLLER_PLAYER_2 = 1,
|
||||
CONTROLLER_PLAYER_3 = 2,
|
||||
CONTROLLER_PLAYER_4 = 3,
|
||||
CONTROLLER_PLAYER_5 = 4,
|
||||
CONTROLLER_PLAYER_6 = 5,
|
||||
CONTROLLER_PLAYER_7 = 6,
|
||||
CONTROLLER_PLAYER_8 = 7,
|
||||
CONTROLLER_HANDHELD = 8,
|
||||
CONTROLLER_UNKNOWN = 9
|
||||
}
|
||||
|
||||
public enum HidControllerJoystick
|
||||
{
|
||||
Joystick_Left = 0,
|
||||
Joystick_Right = 1,
|
||||
Joystick_Num_Sticks = 2
|
||||
}
|
||||
|
||||
public enum HidControllerLayouts
|
||||
{
|
||||
Pro_Controller,
|
||||
Handheld_Joined,
|
||||
Joined,
|
||||
Left,
|
||||
Right,
|
||||
Main_No_Analog,
|
||||
Main
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum HidControllerConnectionState
|
||||
{
|
||||
Controller_State_Connected = (1 << 0),
|
||||
Controller_State_Wired = (1 << 1)
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum HidControllerType
|
||||
{
|
||||
ControllerType_ProController = (1 << 0),
|
||||
ControllerType_Handheld = (1 << 1),
|
||||
ControllerType_JoyconPair = (1 << 2),
|
||||
ControllerType_JoyconLeft = (1 << 3),
|
||||
ControllerType_JoyconRight = (1 << 4)
|
||||
}
|
||||
|
||||
public enum HidControllerColorDescription
|
||||
{
|
||||
ColorDesc_ColorsNonexistent = (1 << 1),
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x8)]
|
||||
public struct JoystickPosition
|
||||
{
|
||||
public int DX;
|
||||
public int DY;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x20)]
|
||||
public struct HidControllerMAC
|
||||
{
|
||||
public ulong Timestamp;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public byte[] MAC;
|
||||
public ulong Unknown;
|
||||
public ulong Timestamp_2;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x28)]
|
||||
public struct HidControllerHeader
|
||||
{
|
||||
public uint Type;
|
||||
public uint IsHalf;
|
||||
public uint SingleColorsDescriptor;
|
||||
public uint SingleColorBody;
|
||||
public uint SingleColorButtons;
|
||||
public uint SplitColorsDescriptor;
|
||||
public uint LeftColorBody;
|
||||
public uint LeftColorButtons;
|
||||
public uint RightColorBody;
|
||||
public uint RightColorButtons;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x20)]
|
||||
public struct HidControllerLayoutHeader
|
||||
{
|
||||
public ulong TimestampTicks;
|
||||
public ulong NumEntries;
|
||||
public ulong LatestEntry;
|
||||
public ulong MaxEntryIndex;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x30)]
|
||||
public struct HidControllerInputEntry
|
||||
{
|
||||
public ulong Timestamp;
|
||||
public ulong Timestamp_2;
|
||||
public ulong Buttons;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)HidControllerJoystick.Joystick_Num_Sticks)]
|
||||
public JoystickPosition[] Joysticks;
|
||||
public ulong ConnectionState;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x350)]
|
||||
public struct HidControllerLayout
|
||||
{
|
||||
public HidControllerLayoutHeader Header;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
|
||||
public HidControllerInputEntry[] Entries;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x5000)]
|
||||
public struct HidController
|
||||
{
|
||||
public HidControllerHeader Header;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
|
||||
public HidControllerLayout[] Layouts;
|
||||
/*
|
||||
pro_controller
|
||||
handheld_joined
|
||||
joined
|
||||
left
|
||||
right
|
||||
main_no_analog
|
||||
main
|
||||
*/
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x2A70)]
|
||||
public byte[] Unknown_1;
|
||||
public HidControllerMAC MacLeft;
|
||||
public HidControllerMAC MacRight;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xDF8)]
|
||||
public byte[] Unknown_2;
|
||||
}
|
||||
}
|
33
Ryujinx.Core/Hid/HidKeyboard.cs
Normal file
33
Ryujinx.Core/Hid/HidKeyboard.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Core
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x20)]
|
||||
public struct HidKeyboardHeader
|
||||
{
|
||||
public ulong TimestampTicks;
|
||||
public ulong NumEntries;
|
||||
public ulong LatestEntry;
|
||||
public ulong MaxEntryIndex;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x38)]
|
||||
public struct HidKeyboardEntry
|
||||
{
|
||||
public ulong Timestamp;
|
||||
public ulong Timestamp_2;
|
||||
public ulong Modifier;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public uint[] Keys;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x400)]
|
||||
public struct HidKeyboard
|
||||
{
|
||||
public HidKeyboardHeader Header;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
|
||||
public HidKeyboardEntry[] Entries;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x28)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
}
|
37
Ryujinx.Core/Hid/HidMouse.cs
Normal file
37
Ryujinx.Core/Hid/HidMouse.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Core
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x20)]
|
||||
public struct HidMouseHeader
|
||||
{
|
||||
public ulong TimestampTicks;
|
||||
public ulong NumEntries;
|
||||
public ulong LatestEntry;
|
||||
public ulong MaxEntryIndex;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x30)]
|
||||
public struct HidMouseEntry
|
||||
{
|
||||
public ulong Timestamp;
|
||||
public ulong Timestamp_2;
|
||||
public uint X;
|
||||
public uint Y;
|
||||
public uint VelocityX;
|
||||
public uint VelocityY;
|
||||
public uint ScrollVelocityX;
|
||||
public uint ScrollVelocityY;
|
||||
public ulong Buttons;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x400)]
|
||||
public struct HidMouse
|
||||
{
|
||||
public HidMouseHeader Header;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
|
||||
public HidMouseEntry[] Entries;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xB0)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
}
|
54
Ryujinx.Core/Hid/HidTouchScreen.cs
Normal file
54
Ryujinx.Core/Hid/HidTouchScreen.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Core
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x28)]
|
||||
public struct HidTouchScreenHeader
|
||||
{
|
||||
public ulong TimestampTicks;
|
||||
public ulong NumEntries;
|
||||
public ulong LatestEntry;
|
||||
public ulong MaxEntryIndex;
|
||||
public ulong Timestamp;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x10)]
|
||||
public struct HidTouchScreenEntryHeader
|
||||
{
|
||||
public ulong Timestamp;
|
||||
public ulong NumTouches;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x28)]
|
||||
public struct HidTouchScreenEntryTouch
|
||||
{
|
||||
public ulong Timestamp;
|
||||
public uint Padding;
|
||||
public uint TouchIndex;
|
||||
public uint X;
|
||||
public uint Y;
|
||||
public uint DiameterX;
|
||||
public uint DiameterY;
|
||||
public uint Angle;
|
||||
public uint Padding_2;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x298)]
|
||||
public struct HidTouchScreenEntry
|
||||
{
|
||||
public HidTouchScreenEntryHeader Header;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public HidTouchScreenEntryTouch[] Touches;
|
||||
public ulong Unknown;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x3000)]
|
||||
public struct HidTouchScreen
|
||||
{
|
||||
public HidTouchScreenHeader Header;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
|
||||
public HidTouchScreenEntry[] Entries;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x3C0)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
}
|
81
Ryujinx.Core/Hid/HidUnknown.cs
Normal file
81
Ryujinx.Core/Hid/HidUnknown.cs
Normal file
|
@ -0,0 +1,81 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Core
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x400)]
|
||||
public struct HidSharedMemHeader
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x400)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x400)]
|
||||
public struct HidUnknownSection1
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x400)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x400)]
|
||||
public struct HidUnknownSection2
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x400)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x400)]
|
||||
public struct HidUnknownSection3
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x400)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x400)]
|
||||
public struct HidUnknownSection4
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x400)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x200)]
|
||||
public struct HidUnknownSection5
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x200)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x200)]
|
||||
public struct HidUnknownSection6
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x200)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x200)]
|
||||
public struct HidUnknownSection7
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x200)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x800)]
|
||||
public struct HidUnknownSection8
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x800)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x4000)]
|
||||
public struct HidControllerSerials
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4000)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 0x4600)]
|
||||
public struct HidUnknownSection9
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4600)]
|
||||
public byte[] Padding;
|
||||
}
|
||||
}
|
66
Ryujinx.Core/Hid/JoyCon.cs
Normal file
66
Ryujinx.Core/Hid/JoyCon.cs
Normal file
|
@ -0,0 +1,66 @@
|
|||
namespace Ryujinx
|
||||
{
|
||||
/// <summary>
|
||||
/// Common RGB color hex codes for JoyCon coloring.
|
||||
/// </summary>
|
||||
public enum JoyConColor //Thanks to CTCaer
|
||||
{
|
||||
Body_Grey = 0x828282,
|
||||
Body_Neon_Blue = 0x0AB9E6,
|
||||
Body_Neon_Red = 0xFF3C28,
|
||||
Body_Neon_Yellow = 0xE6FF00,
|
||||
Body_Neon_Pink = 0xFF3278,
|
||||
Body_Neon_Green = 0x1EDC00,
|
||||
Body_Red = 0xE10F00,
|
||||
|
||||
Buttons_Grey = 0x0F0F0F,
|
||||
Buttons_Neon_Blue = 0x001E1E,
|
||||
Buttons_Neon_Red = 0x1E0A0A,
|
||||
Buttons_Neon_Yellow = 0x142800,
|
||||
Buttons_Neon_Pink = 0x28001E,
|
||||
Buttons_Neon_Green = 0x002800,
|
||||
Buttons_Red = 0x280A0A
|
||||
}
|
||||
|
||||
public struct JoyConLeft
|
||||
{
|
||||
public int StickUp;
|
||||
public int StickDown;
|
||||
public int StickLeft;
|
||||
public int StickRight;
|
||||
public int StickButton;
|
||||
public int DPadUp;
|
||||
public int DPadDown;
|
||||
public int DPadLeft;
|
||||
public int DPadRight;
|
||||
public int ButtonMinus;
|
||||
public int ButtonL;
|
||||
public int ButtonZL;
|
||||
public int ButtonSL;
|
||||
public int ButtonSR;
|
||||
}
|
||||
|
||||
public struct JoyConRight
|
||||
{
|
||||
public int StickUp;
|
||||
public int StickDown;
|
||||
public int StickLeft;
|
||||
public int StickRight;
|
||||
public int StickButton;
|
||||
public int ButtonA;
|
||||
public int ButtonB;
|
||||
public int ButtonX;
|
||||
public int ButtonY;
|
||||
public int ButtonPlus;
|
||||
public int ButtonR;
|
||||
public int ButtonZR;
|
||||
public int ButtonSL;
|
||||
public int ButtonSR;
|
||||
}
|
||||
|
||||
public struct JoyCon
|
||||
{
|
||||
public JoyConLeft Left;
|
||||
public JoyConRight Right;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue