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,11 +432,24 @@ 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 {
@ -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).

View File

@ -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);

View File

@ -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;