2019-06-27 09:02:41 -07:00
|
|
|
|
using Ryujinx.HLE.Input;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Hid
|
|
|
|
|
{
|
|
|
|
|
static class HidUtils
|
|
|
|
|
{
|
2019-07-22 10:15:46 -07:00
|
|
|
|
public static ControllerId GetIndexFromNpadIdType(NpadIdType npadIdType)
|
2019-06-27 09:02:41 -07:00
|
|
|
|
{
|
|
|
|
|
switch (npadIdType)
|
|
|
|
|
{
|
2019-07-22 10:15:46 -07:00
|
|
|
|
case NpadIdType.Player1: return ControllerId.ControllerPlayer1;
|
|
|
|
|
case NpadIdType.Player2: return ControllerId.ControllerPlayer2;
|
|
|
|
|
case NpadIdType.Player3: return ControllerId.ControllerPlayer3;
|
|
|
|
|
case NpadIdType.Player4: return ControllerId.ControllerPlayer4;
|
|
|
|
|
case NpadIdType.Player5: return ControllerId.ControllerPlayer5;
|
|
|
|
|
case NpadIdType.Player6: return ControllerId.ControllerPlayer6;
|
|
|
|
|
case NpadIdType.Player7: return ControllerId.ControllerPlayer7;
|
|
|
|
|
case NpadIdType.Player8: return ControllerId.ControllerPlayer8;
|
|
|
|
|
case NpadIdType.Handheld: return ControllerId.ControllerHandheld;
|
|
|
|
|
case NpadIdType.Unknown: return ControllerId.ControllerUnknown;
|
2019-06-27 09:02:41 -07:00
|
|
|
|
|
|
|
|
|
default: throw new ArgumentOutOfRangeException(nameof(npadIdType));
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-06-28 04:08:23 -07:00
|
|
|
|
|
2019-07-22 10:15:46 -07:00
|
|
|
|
public static NpadIdType GetNpadIdTypeFromIndex(ControllerId index)
|
2019-06-28 04:08:23 -07:00
|
|
|
|
{
|
|
|
|
|
switch (index)
|
|
|
|
|
{
|
2019-07-22 10:15:46 -07:00
|
|
|
|
case ControllerId.ControllerPlayer1: return NpadIdType.Player1;
|
|
|
|
|
case ControllerId.ControllerPlayer2: return NpadIdType.Player2;
|
|
|
|
|
case ControllerId.ControllerPlayer3: return NpadIdType.Player3;
|
|
|
|
|
case ControllerId.ControllerPlayer4: return NpadIdType.Player4;
|
|
|
|
|
case ControllerId.ControllerPlayer5: return NpadIdType.Player5;
|
|
|
|
|
case ControllerId.ControllerPlayer6: return NpadIdType.Player6;
|
|
|
|
|
case ControllerId.ControllerPlayer7: return NpadIdType.Player7;
|
|
|
|
|
case ControllerId.ControllerPlayer8: return NpadIdType.Player8;
|
|
|
|
|
case ControllerId.ControllerHandheld: return NpadIdType.Handheld;
|
|
|
|
|
case ControllerId.ControllerUnknown: return NpadIdType.Unknown;
|
2019-06-28 04:08:23 -07:00
|
|
|
|
|
|
|
|
|
default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-06-27 09:02:41 -07:00
|
|
|
|
}
|
|
|
|
|
}
|