mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
hid: Added hidBeginPermitVibrationSession/hidEndPermitVibrationSession.
This commit is contained in:
parent
5c7118a003
commit
01457fb3b1
@ -1633,6 +1633,18 @@ Result hidSendVibrationGcErmCommand(HidVibrationDeviceHandle handle, HidVibratio
|
||||
*/
|
||||
Result hidGetActualVibrationGcErmCommand(HidVibrationDeviceHandle handle, HidVibrationGcErmCommand *out);
|
||||
|
||||
/**
|
||||
* @brief Begins a forced-permitted vibration session.
|
||||
* @note Only available on [4.0.0+].
|
||||
*/
|
||||
Result hidBeginPermitVibrationSession(void);
|
||||
|
||||
/**
|
||||
* @brief Ends the session started by \ref hidBeginPermitVibrationSession.
|
||||
* @note Only available on [4.0.0+].
|
||||
*/
|
||||
Result hidEndPermitVibrationSession(void);
|
||||
|
||||
/**
|
||||
* @brief Gets whether vibration is available with the specified device.
|
||||
* @note Only available on [7.0.0+].
|
||||
|
@ -955,6 +955,10 @@ static Result _hidSetDualModeAll(void) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _hidCmdNoIO(Service* srv, u32 cmd_id) {
|
||||
return serviceDispatch(srv, cmd_id);
|
||||
}
|
||||
|
||||
static Result _hidCmdGetHandle(Service* srv, Handle* handle_out, u32 cmd_id) {
|
||||
return serviceDispatch(srv, cmd_id,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
||||
@ -989,6 +993,10 @@ static Result _hidCmdInU32NoOut(Service* srv, u32 inval, u32 cmd_id) {
|
||||
return serviceDispatchIn(srv, cmd_id, inval);
|
||||
}
|
||||
|
||||
static Result _hidCmdInU64NoOut(Service* srv, u64 inval, u32 cmd_id) {
|
||||
return serviceDispatchIn(srv, cmd_id, inval);
|
||||
}
|
||||
|
||||
static Result _hidCmdInU32AruidNoOut(u32 inval, u32 cmd_id) {
|
||||
const struct {
|
||||
u32 inval;
|
||||
@ -1326,6 +1334,20 @@ Result hidGetActualVibrationGcErmCommand(HidVibrationDeviceHandle handle, HidVib
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result hidBeginPermitVibrationSession(void) {
|
||||
if (hosversionBefore(4,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidCmdInU64NoOut(&g_hidSrv, appletGetAppletResourceUserId(), 209);
|
||||
}
|
||||
|
||||
Result hidEndPermitVibrationSession(void) {
|
||||
if (hosversionBefore(4,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidCmdNoIO(&g_hidSrv, 210);
|
||||
}
|
||||
|
||||
Result hidIsVibrationDeviceMounted(HidVibrationDeviceHandle handle, bool *flag) {
|
||||
if (hosversionBefore(7,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
Loading…
Reference in New Issue
Block a user