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
This commit is contained in:
parent
5b5239ab5b
commit
2365ddfc36
105 changed files with 1500 additions and 1044 deletions
|
@ -1,46 +1,39 @@
|
|||
using Ryujinx.HLE.Input;
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Hid.HidServer
|
||||
{
|
||||
static class HidUtils
|
||||
{
|
||||
public static ControllerId GetIndexFromNpadIdType(HidNpadIdType npadIdType)
|
||||
public static PlayerIndex GetIndexFromNpadIdType(NpadIdType npadIdType)
|
||||
=> npadIdType switch
|
||||
{
|
||||
switch (npadIdType)
|
||||
{
|
||||
case HidNpadIdType.Player1: return ControllerId.ControllerPlayer1;
|
||||
case HidNpadIdType.Player2: return ControllerId.ControllerPlayer2;
|
||||
case HidNpadIdType.Player3: return ControllerId.ControllerPlayer3;
|
||||
case HidNpadIdType.Player4: return ControllerId.ControllerPlayer4;
|
||||
case HidNpadIdType.Player5: return ControllerId.ControllerPlayer5;
|
||||
case HidNpadIdType.Player6: return ControllerId.ControllerPlayer6;
|
||||
case HidNpadIdType.Player7: return ControllerId.ControllerPlayer7;
|
||||
case HidNpadIdType.Player8: return ControllerId.ControllerPlayer8;
|
||||
case HidNpadIdType.Handheld: return ControllerId.ControllerHandheld;
|
||||
case HidNpadIdType.Unknown: return ControllerId.ControllerUnknown;
|
||||
NpadIdType.Player1 => PlayerIndex.Player1,
|
||||
NpadIdType.Player2 => PlayerIndex.Player2,
|
||||
NpadIdType.Player3 => PlayerIndex.Player3,
|
||||
NpadIdType.Player4 => PlayerIndex.Player4,
|
||||
NpadIdType.Player5 => PlayerIndex.Player5,
|
||||
NpadIdType.Player6 => PlayerIndex.Player6,
|
||||
NpadIdType.Player7 => PlayerIndex.Player7,
|
||||
NpadIdType.Player8 => PlayerIndex.Player8,
|
||||
NpadIdType.Handheld => PlayerIndex.Handheld,
|
||||
NpadIdType.Unknown => PlayerIndex.Unknown,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(npadIdType))
|
||||
};
|
||||
|
||||
default: throw new ArgumentOutOfRangeException(nameof(npadIdType));
|
||||
}
|
||||
}
|
||||
|
||||
public static HidNpadIdType GetNpadIdTypeFromIndex(ControllerId index)
|
||||
public static NpadIdType GetNpadIdTypeFromIndex(PlayerIndex index)
|
||||
=> index switch
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case ControllerId.ControllerPlayer1: return HidNpadIdType.Player1;
|
||||
case ControllerId.ControllerPlayer2: return HidNpadIdType.Player2;
|
||||
case ControllerId.ControllerPlayer3: return HidNpadIdType.Player3;
|
||||
case ControllerId.ControllerPlayer4: return HidNpadIdType.Player4;
|
||||
case ControllerId.ControllerPlayer5: return HidNpadIdType.Player5;
|
||||
case ControllerId.ControllerPlayer6: return HidNpadIdType.Player6;
|
||||
case ControllerId.ControllerPlayer7: return HidNpadIdType.Player7;
|
||||
case ControllerId.ControllerPlayer8: return HidNpadIdType.Player8;
|
||||
case ControllerId.ControllerHandheld: return HidNpadIdType.Handheld;
|
||||
case ControllerId.ControllerUnknown: return HidNpadIdType.Unknown;
|
||||
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index));
|
||||
}
|
||||
}
|
||||
PlayerIndex.Player1 => NpadIdType.Player1,
|
||||
PlayerIndex.Player2 => NpadIdType.Player2,
|
||||
PlayerIndex.Player3 => NpadIdType.Player3,
|
||||
PlayerIndex.Player4 => NpadIdType.Player4,
|
||||
PlayerIndex.Player5 => NpadIdType.Player5,
|
||||
PlayerIndex.Player6 => NpadIdType.Player6,
|
||||
PlayerIndex.Player7 => NpadIdType.Player7,
|
||||
PlayerIndex.Player8 => NpadIdType.Player8,
|
||||
PlayerIndex.Handheld => NpadIdType.Handheld,
|
||||
PlayerIndex.Unknown => NpadIdType.Unknown,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(index))
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public enum HidNpadHandheldActivationMode
|
||||
{
|
||||
Dual,
|
||||
Single,
|
||||
None
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public enum HidNpadJoyAssignmentMode
|
||||
{
|
||||
Dual,
|
||||
Single
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public enum HidNpadJoyDeviceType
|
||||
{
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public struct HidAccelerometerParameters
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public enum HidGyroscopeZeroDriftMode
|
||||
{
|
||||
Loose,
|
||||
Standard,
|
||||
Tight
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public struct HidSensorFusionParameters
|
||||
{
|
||||
public float RevisePower;
|
||||
public float ReviseRange;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public enum HidVibrationDevicePosition
|
||||
{
|
||||
None,
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public enum HidVibrationDeviceType
|
||||
{
|
||||
None,
|
||||
LinearResonantActuator
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public struct HidVibrationDeviceValue
|
||||
{
|
||||
public HidVibrationDeviceType DeviceType;
|
||||
public HidVibrationDevicePosition Position;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||
{
|
||||
public struct HidVibrationValue
|
||||
{
|
||||
public float AmplitudeLow;
|
||||
public float FrequencyLow;
|
||||
public float AmplitudeHigh;
|
||||
public float FrequencyHigh;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue