Added hidIsVibrationDeviceMounted.

This commit is contained in:
yellows8 2019-11-01 19:04:14 -04:00
parent fa27331045
commit e2b9b09b61
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 27 additions and 0 deletions

View File

@ -814,6 +814,9 @@ Result hidIsVibrationPermitted(bool *flag);
/// Send VibrationValues[index] to VibrationDeviceHandles[index], where count is the number of entries in the VibrationDeviceHandles/VibrationValues arrays.
Result hidSendVibrationValues(u32 *VibrationDeviceHandles, HidVibrationValue *VibrationValues, s32 count);
/// Gets whether vibration is available with the specified device. Only available on [7.0.0+].
Result hidIsVibrationDeviceMounted(u32 *VibrationDeviceHandle, bool *flag);
/// Gets SixAxisSensorHandles. total_handles==2 can only be used with TYPE_JOYCON_PAIR.
Result hidGetSixAxisSensorHandles(u32 *SixAxisSensorHandles, s32 total_handles, HidControllerID id, HidControllerType type);

View File

@ -929,6 +929,30 @@ Result hidSendVibrationValues(u32 *VibrationDeviceHandles, HidVibrationValue *Vi
);
}
Result hidIsVibrationDeviceMounted(u32 *VibrationDeviceHandle, bool *flag) {
if (hosversionBefore(7,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
Result rc;
u64 AppletResourceUserId;
rc = appletGetAppletResourceUserId(&AppletResourceUserId);
if (R_FAILED(rc))
AppletResourceUserId = 0;
const struct {
u32 VibrationDeviceHandle;
u64 AppletResourceUserId;
} in = { *VibrationDeviceHandle, AppletResourceUserId };
u8 tmp=0;
rc = serviceDispatchInOut(&g_hidSrv, 211, in, tmp,
.in_send_pid = true,
);
if (R_SUCCEEDED(rc) && flag) *flag = tmp & 1;
return rc;
}
static Result _hidGetDeviceHandles(u32 devicetype, u32 *DeviceHandles, s32 total_handles, HidControllerID id, HidControllerType type) {
Result rc=0;
u32 tmp_type = type & 0xff;