diff --git a/nx/include/switch/services/hid.h b/nx/include/switch/services/hid.h index 348de2ab..b9257d06 100644 --- a/nx/include/switch/services/hid.h +++ b/nx/include/switch/services/hid.h @@ -432,16 +432,29 @@ typedef enum { HidGyroscopeZeroDriftMode_Tight = 2, ///< Tight } HidGyroscopeZeroDriftMode; -/// JoyHoldType +/// NpadJoyHoldType typedef enum { - HidJoyHoldType_Default = 0, ///< Default / Joy-Con held vertically. - HidJoyHoldType_Horizontal = 1, ///< Joy-Con held horizontally with HID state orientation adjustment. -} HidJoyHoldType; + HidNpadJoyHoldType_Vertical = 0, ///< Default / Joy-Con held vertically. + HidNpadJoyHoldType_Horizontal = 1, ///< Joy-Con held horizontally. +} HidNpadJoyHoldType; + +/// NpadJoyDeviceType +typedef enum { + HidNpadJoyDeviceType_Left = 0, ///< Left + HidNpadJoyDeviceType_Right = 1, ///< Right +} HidNpadJoyDeviceType; + +/// NpadHandheldActivationMode +typedef enum { + HidNpadHandheldActivationMode_Dual = 0, ///< Dual + HidNpadHandheldActivationMode_Single = 1, ///< Single + HidNpadHandheldActivationMode_Unknown2 = 2, ///< Unknown +} HidNpadHandheldActivationMode; /// NpadJoyAssignmentMode typedef enum { - HidNpadJoyAssignmentMode_Dual = 0, ///< Dual (Set by \ref hidSetNpadJoyAssignmentModeDual) - HidNpadJoyAssignmentMode_Single = 1, ///< Single (Set by hidSetNpadJoyAssignmentModeSingle*()) + HidNpadJoyAssignmentMode_Dual = 0, ///< Dual (Set by \ref hidSetNpadJoyAssignmentModeDual) + HidNpadJoyAssignmentMode_Single = 1, ///< Single (Set by hidSetNpadJoyAssignmentModeSingle*()) } HidNpadJoyAssignmentMode; /// DeviceType (system) @@ -539,6 +552,26 @@ typedef enum { HidNpadLuciaType_U = 3, ///< U } HidNpadLuciaType; +/// HidVibrationDeviceType +typedef enum { + HidVibrationDeviceType_Unknown = 0, ///< Unknown + HidVibrationDeviceType_LinearResonantActuator = 1, ///< LinearResonantActuator +} HidVibrationDeviceType; + +/// VibrationDevicePosition +typedef enum { + HidVibrationDevicePosition_None = 0, ///< None + HidVibrationDevicePosition_Left = 1, ///< Left + HidVibrationDevicePosition_Right = 2, ///< Right +} HidVibrationDevicePosition; + +/// VibrationGcErmCommand +typedef enum { + HidVibrationGcErmCommand_Stop = 0, ///< Stop + HidVibrationGcErmCommand_Start = 1, ///< Start + HidVibrationGcErmCommand_Unknown2 = 2, ///< Unknown +} HidVibrationGcErmCommand; + /// touchPosition typedef struct touchPosition { u32 id; @@ -1092,8 +1125,8 @@ typedef union HidVibrationDeviceHandle { /// HidVibrationDeviceInfo typedef struct HidVibrationDeviceInfo { - u32 unk_x0; - u32 unk_x4; ///< 0x1 for left-joycon, 0x2 for right-joycon. + u32 type; ///< \ref HidVibrationDeviceType + u32 position; ///< \ref HidVibrationDevicePosition } HidVibrationDeviceInfo; /// HidVibrationValue @@ -1495,17 +1528,17 @@ Result hidSetSupportedNpadIdType(const HidNpadIdType *ids, size_t count); Result hidAcquireNpadStyleSetUpdateEventHandle(HidNpadIdType id, Event* out_event, bool autoclear); /** - * @brief Sets the \ref HidJoyHoldType. + * @brief Sets the \ref HidNpadJoyHoldType. * @note Used automatically by \ref hidScanInput when required. - * @param[in] type \ref HidJoyHoldType + * @param[in] type \ref HidNpadJoyHoldType */ -Result hidSetNpadJoyHoldType(HidJoyHoldType type); +Result hidSetNpadJoyHoldType(HidNpadJoyHoldType type); /** - * @brief Gets the \ref HidJoyHoldType. - * @param[out] type \ref HidJoyHoldType + * @brief Gets the \ref HidNpadJoyHoldType. + * @param[out] type \ref HidNpadJoyHoldType */ -Result hidGetNpadJoyHoldType(HidJoyHoldType *type); +Result hidGetNpadJoyHoldType(HidNpadJoyHoldType *type); /** * @brief Use this if you want to use a single joy-con as a dedicated HidNpadIdType_No*. When used, both joy-cons in a pair should be used with this (HidNpadIdType_No1 and HidNpadIdType_No2 for example). diff --git a/nx/source/applets/hid_la.c b/nx/source/applets/hid_la.c index 6432ee3f..3c2d3509 100644 --- a/nx/source/applets/hid_la.c +++ b/nx/source/applets/hid_la.c @@ -93,7 +93,7 @@ static Result _hidLaShowControllerFirmwareUpdateCore(const HidLaControllerFirmwa static Result _hidLaSetupControllerSupportArgPrivate(HidLaControllerSupportArgPrivate *private_arg) { Result rc=0; u32 style_set; - HidJoyHoldType hold_type; + HidNpadJoyHoldType hold_type; rc = hidGetSupportedNpadStyleSet(&style_set); if (R_SUCCEEDED(rc)) rc = hidGetNpadJoyHoldType(&hold_type); @@ -185,7 +185,7 @@ Result hidLaShowControllerSupportForSystem(HidLaControllerSupportResultInfo *res } else { private_arg.npad_style_set = 0; - private_arg.npad_joy_hold_type = HidJoyHoldType_Horizontal; + private_arg.npad_joy_hold_type = HidNpadJoyHoldType_Horizontal; } if (R_SUCCEEDED(rc)) rc = _hidLaShowControllerSupportCore(result_info, arg, &private_arg); diff --git a/nx/source/services/hid.c b/nx/source/services/hid.c index 673f754a..d06f2fab 100644 --- a/nx/source/services/hid.c +++ b/nx/source/services/hid.c @@ -148,7 +148,7 @@ void hidScanInput(void) { rc = _hidSetDualModeAll(); if (R_FAILED(rc)) diagAbortWithResult(rc); - rc = hidSetNpadJoyHoldType(HidJoyHoldType_Default); + rc = hidSetNpadJoyHoldType(HidNpadJoyHoldType_Vertical); if (R_FAILED(rc)) diagAbortWithResult(rc); g_scanInputInitialized = true; @@ -1202,11 +1202,11 @@ Result hidAcquireNpadStyleSetUpdateEventHandle(HidNpadIdType id, Event* out_even return rc; } -Result hidSetNpadJoyHoldType(HidJoyHoldType type) { +Result hidSetNpadJoyHoldType(HidNpadJoyHoldType type) { return _hidCmdWithInputU64(type, 120); } -Result hidGetNpadJoyHoldType(HidJoyHoldType *type) { +Result hidGetNpadJoyHoldType(HidNpadJoyHoldType *type) { u64 tmp=0; Result rc = _hidCmdOutU64(&tmp, 121); if (R_SUCCEEDED(rc) && type) *type = tmp;