mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Added hidIsVibrationDeviceMounted.
This commit is contained in:
parent
fa27331045
commit
e2b9b09b61
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user