hid: Added/updated enums and updated HidVibrationDeviceInfo.

This commit is contained in:
yellows8 2020-11-25 15:09:18 -05:00 committed by fincs
parent 8e0c514044
commit 88cae40620
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
3 changed files with 52 additions and 19 deletions

View File

@ -432,16 +432,29 @@ typedef enum {
HidGyroscopeZeroDriftMode_Tight = 2, ///< Tight HidGyroscopeZeroDriftMode_Tight = 2, ///< Tight
} HidGyroscopeZeroDriftMode; } HidGyroscopeZeroDriftMode;
/// JoyHoldType /// NpadJoyHoldType
typedef enum { typedef enum {
HidJoyHoldType_Default = 0, ///< Default / Joy-Con held vertically. HidNpadJoyHoldType_Vertical = 0, ///< Default / Joy-Con held vertically.
HidJoyHoldType_Horizontal = 1, ///< Joy-Con held horizontally with HID state orientation adjustment. HidNpadJoyHoldType_Horizontal = 1, ///< Joy-Con held horizontally.
} HidJoyHoldType; } 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 /// NpadJoyAssignmentMode
typedef enum { typedef enum {
HidNpadJoyAssignmentMode_Dual = 0, ///< Dual (Set by \ref hidSetNpadJoyAssignmentModeDual) HidNpadJoyAssignmentMode_Dual = 0, ///< Dual (Set by \ref hidSetNpadJoyAssignmentModeDual)
HidNpadJoyAssignmentMode_Single = 1, ///< Single (Set by hidSetNpadJoyAssignmentModeSingle*()) HidNpadJoyAssignmentMode_Single = 1, ///< Single (Set by hidSetNpadJoyAssignmentModeSingle*())
} HidNpadJoyAssignmentMode; } HidNpadJoyAssignmentMode;
/// DeviceType (system) /// DeviceType (system)
@ -539,6 +552,26 @@ typedef enum {
HidNpadLuciaType_U = 3, ///< U HidNpadLuciaType_U = 3, ///< U
} HidNpadLuciaType; } 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 /// touchPosition
typedef struct touchPosition { typedef struct touchPosition {
u32 id; u32 id;
@ -1092,8 +1125,8 @@ typedef union HidVibrationDeviceHandle {
/// HidVibrationDeviceInfo /// HidVibrationDeviceInfo
typedef struct HidVibrationDeviceInfo { typedef struct HidVibrationDeviceInfo {
u32 unk_x0; u32 type; ///< \ref HidVibrationDeviceType
u32 unk_x4; ///< 0x1 for left-joycon, 0x2 for right-joycon. u32 position; ///< \ref HidVibrationDevicePosition
} HidVibrationDeviceInfo; } HidVibrationDeviceInfo;
/// HidVibrationValue /// HidVibrationValue
@ -1495,17 +1528,17 @@ Result hidSetSupportedNpadIdType(const HidNpadIdType *ids, size_t count);
Result hidAcquireNpadStyleSetUpdateEventHandle(HidNpadIdType id, Event* out_event, bool autoclear); 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. * @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. * @brief Gets the \ref HidNpadJoyHoldType.
* @param[out] type \ref HidJoyHoldType * @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). * @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).

View File

@ -93,7 +93,7 @@ static Result _hidLaShowControllerFirmwareUpdateCore(const HidLaControllerFirmwa
static Result _hidLaSetupControllerSupportArgPrivate(HidLaControllerSupportArgPrivate *private_arg) { static Result _hidLaSetupControllerSupportArgPrivate(HidLaControllerSupportArgPrivate *private_arg) {
Result rc=0; Result rc=0;
u32 style_set; u32 style_set;
HidJoyHoldType hold_type; HidNpadJoyHoldType hold_type;
rc = hidGetSupportedNpadStyleSet(&style_set); rc = hidGetSupportedNpadStyleSet(&style_set);
if (R_SUCCEEDED(rc)) rc = hidGetNpadJoyHoldType(&hold_type); if (R_SUCCEEDED(rc)) rc = hidGetNpadJoyHoldType(&hold_type);
@ -185,7 +185,7 @@ Result hidLaShowControllerSupportForSystem(HidLaControllerSupportResultInfo *res
} }
else { else {
private_arg.npad_style_set = 0; 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); if (R_SUCCEEDED(rc)) rc = _hidLaShowControllerSupportCore(result_info, arg, &private_arg);

View File

@ -148,7 +148,7 @@ void hidScanInput(void) {
rc = _hidSetDualModeAll(); rc = _hidSetDualModeAll();
if (R_FAILED(rc)) diagAbortWithResult(rc); if (R_FAILED(rc)) diagAbortWithResult(rc);
rc = hidSetNpadJoyHoldType(HidJoyHoldType_Default); rc = hidSetNpadJoyHoldType(HidNpadJoyHoldType_Vertical);
if (R_FAILED(rc)) diagAbortWithResult(rc); if (R_FAILED(rc)) diagAbortWithResult(rc);
g_scanInputInitialized = true; g_scanInputInitialized = true;
@ -1202,11 +1202,11 @@ Result hidAcquireNpadStyleSetUpdateEventHandle(HidNpadIdType id, Event* out_even
return rc; return rc;
} }
Result hidSetNpadJoyHoldType(HidJoyHoldType type) { Result hidSetNpadJoyHoldType(HidNpadJoyHoldType type) {
return _hidCmdWithInputU64(type, 120); return _hidCmdWithInputU64(type, 120);
} }
Result hidGetNpadJoyHoldType(HidJoyHoldType *type) { Result hidGetNpadJoyHoldType(HidNpadJoyHoldType *type) {
u64 tmp=0; u64 tmp=0;
Result rc = _hidCmdOutU64(&tmp, 121); Result rc = _hidCmdOutU64(&tmp, 121);
if (R_SUCCEEDED(rc) && type) *type = tmp; if (R_SUCCEEDED(rc) && type) *type = tmp;