hid: Moved funcs to match cmd order.

This commit is contained in:
yellows8 2020-11-26 12:51:43 -05:00 committed by fincs
parent d4ccf6ab03
commit 004d2f4f63
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
2 changed files with 40 additions and 39 deletions

View File

@ -1456,6 +1456,28 @@ u32 hidSixAxisSensorValuesRead(SixAxisSensorValues *values, HidControllerID id,
*/ */
bool hidGetHandheldMode(void); bool hidGetHandheldMode(void);
/**
* @brief Gets SixAxisSensorHandles.
* @note Only ::HidNpadStyleTag_NpadJoyDual supports total_handles==2.
* @param[out] handles Output array of \ref HidSixAxisSensorHandle.
* @param[in] total_handles Total handles for the handles array. Must be 1 or 2, if 2 handles aren't supported by the specified style an error is thrown.
* @param[in] id \ref HidNpadIdType
* @param[in] style \ref HidNpadStyleTag
*/
Result hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 total_handles, HidNpadIdType id, HidNpadStyleTag style);
/**
* @brief Starts the SixAxisSensor for the specified handle.
* @param[in] handle \ref HidSixAxisSensorHandle
*/
Result hidStartSixAxisSensor(HidSixAxisSensorHandle handle);
/**
* @brief Stops the SixAxisSensor for the specified handle.
* @param[in] handle \ref HidSixAxisSensorHandle
*/
Result hidStopSixAxisSensor(HidSixAxisSensorHandle handle);
/** /**
* @brief IsSixAxisSensorFusionEnabled * @brief IsSixAxisSensorFusionEnabled
* @param[in] handle \ref HidSixAxisSensorHandle * @param[in] handle \ref HidSixAxisSensorHandle
@ -1694,28 +1716,6 @@ Result hidEndPermitVibrationSession(void);
*/ */
Result hidIsVibrationDeviceMounted(HidVibrationDeviceHandle handle, bool *flag); Result hidIsVibrationDeviceMounted(HidVibrationDeviceHandle handle, bool *flag);
/**
* @brief Gets SixAxisSensorHandles.
* @note Only ::HidNpadStyleTag_NpadJoyDual supports total_handles==2.
* @param[out] handles Output array of \ref HidSixAxisSensorHandle.
* @param[in] total_handles Total handles for the handles array. Must be 1 or 2, if 2 handles aren't supported by the specified style an error is thrown.
* @param[in] id \ref HidNpadIdType
* @param[in] style \ref HidNpadStyleTag
*/
Result hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 total_handles, HidNpadIdType id, HidNpadStyleTag style);
/**
* @brief Starts the SixAxisSensor for the specified handle.
* @param[in] handle \ref HidSixAxisSensorHandle
*/
Result hidStartSixAxisSensor(HidSixAxisSensorHandle handle);
/**
* @brief Stops the SixAxisSensor for the specified handle.
* @param[in] handle \ref HidSixAxisSensorHandle
*/
Result hidStopSixAxisSensor(HidSixAxisSensorHandle handle);
/** /**
* @brief Starts the SevenSixAxisSensor. * @brief Starts the SevenSixAxisSensor.
* @note Only available on [5.0.0+]. * @note Only available on [5.0.0+].

View File

@ -49,6 +49,7 @@ static Result _hidActivateGesture(void);
static Result _hidSetDualModeAll(void); static Result _hidSetDualModeAll(void);
static u8 _hidGetSixAxisSensorHandleNpadStyleIndex(HidSixAxisSensorHandle handle); static u8 _hidGetSixAxisSensorHandleNpadStyleIndex(HidSixAxisSensorHandle handle);
static Result _hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 total_handles, HidNpadIdType id, HidNpadStyleTag style);
NX_GENERATE_SERVICE_GUARD(hid); NX_GENERATE_SERVICE_GUARD(hid);
@ -1109,6 +1110,19 @@ static Result _hidActivateKeyboard(void) {
return _hidCmdInAruidNoOut(31); return _hidCmdInAruidNoOut(31);
} }
Result hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 total_handles, HidNpadIdType id, HidNpadStyleTag style) {
if (id == (HidNpadIdType)CONTROLLER_HANDHELD) id = HidNpadIdType_Handheld; // Correct enum value for old users passing HidControllerID instead (avoids a hid sysmodule fatal later on)
return _hidGetSixAxisSensorHandles(handles, total_handles, id, style);
}
Result hidStartSixAxisSensor(HidSixAxisSensorHandle handle) {
return _hidCmdInU32AruidNoOut(handle.type_value, 66);
}
Result hidStopSixAxisSensor(HidSixAxisSensorHandle handle) {
return _hidCmdInU32AruidNoOut(handle.type_value, 67);
}
Result hidIsSixAxisSensorFusionEnabled(HidSixAxisSensorHandle handle, bool *out) { Result hidIsSixAxisSensorFusionEnabled(HidSixAxisSensorHandle handle, bool *out) {
return _hidCmdInU32AruidOutBool(handle.type_value, out, 68); return _hidCmdInU32AruidOutBool(handle.type_value, out, 68);
} }
@ -1204,16 +1218,16 @@ Result hidIsFirmwareUpdateAvailableForSixAxisSensor(HidSixAxisSensorHandle handl
return _hidCmdInU32AruidOutBool(handle.type_value, out, 83); return _hidCmdInU32AruidOutBool(handle.type_value, out, 83);
} }
Result hidSetSupportedNpadStyleSet(u32 style_set) {
return _hidCmdInU32AruidNoOut(style_set, 100);
}
static Result _hidActivateGesture(void) { static Result _hidActivateGesture(void) {
u32 val=1; u32 val=1;
return _hidCmdInU32AruidNoOut(val, 91); // ActivateGesture return _hidCmdInU32AruidNoOut(val, 91); // ActivateGesture
} }
Result hidSetSupportedNpadStyleSet(u32 style_set) {
return _hidCmdInU32AruidNoOut(style_set, 100);
}
Result hidGetSupportedNpadStyleSet(u32 *style_set) { Result hidGetSupportedNpadStyleSet(u32 *style_set) {
u32 tmp=0; u32 tmp=0;
Result rc = _hidCmdInAruidOutU32(&tmp, 101); Result rc = _hidCmdInAruidOutU32(&tmp, 101);
@ -1613,19 +1627,6 @@ Result hidInitializeVibrationDevices(HidVibrationDeviceHandle *handles, s32 tota
return rc; return rc;
} }
Result hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 total_handles, HidNpadIdType id, HidNpadStyleTag style) {
if (id == (HidNpadIdType)CONTROLLER_HANDHELD) id = HidNpadIdType_Handheld; // Correct enum value for old users passing HidControllerID instead (avoids a hid sysmodule fatal later on)
return _hidGetSixAxisSensorHandles(handles, total_handles, id, style);
}
Result hidStartSixAxisSensor(HidSixAxisSensorHandle handle) {
return _hidCmdInU32AruidNoOut(handle.type_value, 66);
}
Result hidStopSixAxisSensor(HidSixAxisSensorHandle handle) {
return _hidCmdInU32AruidNoOut(handle.type_value, 67);
}
static Result _hidActivateConsoleSixAxisSensor(void) { static Result _hidActivateConsoleSixAxisSensor(void) {
if (hosversionBefore(3,0,0)) if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);