Ejemplo n.º 1
0
        public static HidControllerID GetIndexFromNpadIdType(HidNpadIdType npadIdType)
        {
            switch (npadIdType)
            {
            case HidNpadIdType.Player1:  return(HidControllerID.Player1);

            case HidNpadIdType.Player2:  return(HidControllerID.Player2);

            case HidNpadIdType.Player3:  return(HidControllerID.Player3);

            case HidNpadIdType.Player4:  return(HidControllerID.Player4);

            case HidNpadIdType.Player5:  return(HidControllerID.Player5);

            case HidNpadIdType.Player6:  return(HidControllerID.Player6);

            case HidNpadIdType.Player7:  return(HidControllerID.Player7);

            case HidNpadIdType.Player8:  return(HidControllerID.Player8);

            case HidNpadIdType.Handheld: return(HidControllerID.Handheld);

            case HidNpadIdType.Unknown:  return(HidControllerID.Unknown);

            default: throw new ArgumentOutOfRangeException(nameof(npadIdType));
            }
        }
Ejemplo n.º 2
0
        // GetNpadIrCameraHandle(u32) -> nn::irsensor::IrCameraHandle
        public ResultCode GetNpadIrCameraHandle(ServiceCtx context)
        {
            HidNpadIdType npadIdType = (HidNpadIdType)context.RequestData.ReadUInt32();

            if (npadIdType > HidNpadIdType.Player8 &&
                npadIdType != HidNpadIdType.Unknown &&
                npadIdType != HidNpadIdType.Handheld)
            {
                return(ResultCode.NpadIdOutOfRange);
            }

            HidControllerID irCameraHandle = HidUtils.GetIndexFromNpadIdType(npadIdType);

            context.ResponseData.Write((int)irCameraHandle);

            // NOTE: If the irCameraHandle pointer is null this error is returned, Doesn't occur in our case.
            //       return ResultCode.HandlePointerIsNull;

            return(ResultCode.Success);
        }