mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
hid: Added support for GcErm vibration. Minor adjustments.
This commit is contained in:
parent
88cae40620
commit
5c7118a003
@ -552,10 +552,11 @@ typedef enum {
|
||||
HidNpadLuciaType_U = 3, ///< U
|
||||
} HidNpadLuciaType;
|
||||
|
||||
/// HidVibrationDeviceType
|
||||
/// Type values for HidVibrationDeviceInfo::type.
|
||||
typedef enum {
|
||||
HidVibrationDeviceType_Unknown = 0, ///< Unknown
|
||||
HidVibrationDeviceType_LinearResonantActuator = 1, ///< LinearResonantActuator
|
||||
HidVibrationDeviceType_GcErm = 2, ///< GcErm (::HidNpadStyleTag_NpadGc)
|
||||
} HidVibrationDeviceType;
|
||||
|
||||
/// VibrationDevicePosition
|
||||
@ -1581,6 +1582,7 @@ Result hidGetVibrationDeviceInfo(HidVibrationDeviceHandle handle, HidVibrationDe
|
||||
|
||||
/**
|
||||
* @brief Sends the \ref HidVibrationDeviceHandle to the specified device.
|
||||
* @note With ::HidVibrationDeviceType_GcErm, use \ref hidSendVibrationGcErmCommand instead.
|
||||
* @param[in] handle \ref HidVibrationDeviceHandle
|
||||
* @param[in] value \ref HidVibrationValue
|
||||
*/
|
||||
@ -1588,6 +1590,7 @@ Result hidSendVibrationValue(HidVibrationDeviceHandle handle, const HidVibration
|
||||
|
||||
/**
|
||||
* @brief Gets the current \ref HidVibrationValue for the specified device.
|
||||
* @note With ::HidVibrationDeviceType_GcErm, use \ref hidGetActualVibrationGcErmCommand instead.
|
||||
* @param[in] handle \ref HidVibrationDeviceHandle
|
||||
* @param[out] out \ref HidVibrationValue
|
||||
*/
|
||||
@ -1607,12 +1610,29 @@ Result hidIsVibrationPermitted(bool *flag);
|
||||
|
||||
/**
|
||||
* @brief Send vibration values[index] to handles[index].
|
||||
* @note With ::HidVibrationDeviceType_GcErm, use \ref hidSendVibrationGcErmCommand instead.
|
||||
* @param[in] handles Input array of \ref HidVibrationDeviceHandle.
|
||||
* @param[in] values Input array of \ref HidVibrationValue.
|
||||
* @param[in] count Total entries in the handles/values arrays.
|
||||
*/
|
||||
Result hidSendVibrationValues(const HidVibrationDeviceHandle *handles, const HidVibrationValue *values, s32 count);
|
||||
|
||||
/**
|
||||
* @brief Send \ref HidVibrationGcErmCommand to the specified device, for ::HidVibrationDeviceType_GcErm.
|
||||
* @note Only available on [4.0.0+].
|
||||
* @param[in] handle \ref HidVibrationDeviceHandle
|
||||
* @param[in] cmd \ref HidVibrationGcErmCommand
|
||||
*/
|
||||
Result hidSendVibrationGcErmCommand(HidVibrationDeviceHandle handle, HidVibrationGcErmCommand cmd);
|
||||
|
||||
/**
|
||||
* @brief Get \ref HidVibrationGcErmCommand for the specified device, for ::HidVibrationDeviceType_GcErm.
|
||||
* @note Only available on [4.0.0+].
|
||||
* @param[in] handle \ref HidVibrationDeviceHandle
|
||||
* @param[out] out \ref HidVibrationGcErmCommand
|
||||
*/
|
||||
Result hidGetActualVibrationGcErmCommand(HidVibrationDeviceHandle handle, HidVibrationGcErmCommand *out);
|
||||
|
||||
/**
|
||||
* @brief Gets whether vibration is available with the specified device.
|
||||
* @note Only available on [7.0.0+].
|
||||
|
@ -1260,8 +1260,9 @@ Result hidSendVibrationValue(HidVibrationDeviceHandle handle, const HidVibration
|
||||
Result hidGetActualVibrationValue(HidVibrationDeviceHandle handle, HidVibrationValue *out) {
|
||||
const struct {
|
||||
HidVibrationDeviceHandle handle;
|
||||
u32 pad;
|
||||
u64 AppletResourceUserId;
|
||||
} in = { handle, appletGetAppletResourceUserId() };
|
||||
} in = { handle, 0, appletGetAppletResourceUserId() };
|
||||
|
||||
return serviceDispatchInOut(&g_hidSrv, 202, in, *out,
|
||||
.in_send_pid = true,
|
||||
@ -1291,6 +1292,40 @@ Result hidSendVibrationValues(const HidVibrationDeviceHandle *handles, const Hid
|
||||
);
|
||||
}
|
||||
|
||||
Result hidSendVibrationGcErmCommand(HidVibrationDeviceHandle handle, HidVibrationGcErmCommand cmd) {
|
||||
if (hosversionBefore(4,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
const struct {
|
||||
HidVibrationDeviceHandle handle;
|
||||
u32 pad;
|
||||
u64 AppletResourceUserId;
|
||||
u64 cmd;
|
||||
} in = { handle, 0, appletGetAppletResourceUserId(), cmd };
|
||||
|
||||
return serviceDispatchIn(&g_hidSrv, 207, in,
|
||||
.in_send_pid = true,
|
||||
);
|
||||
}
|
||||
|
||||
Result hidGetActualVibrationGcErmCommand(HidVibrationDeviceHandle handle, HidVibrationGcErmCommand *out) {
|
||||
if (hosversionBefore(4,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
const struct {
|
||||
HidVibrationDeviceHandle handle;
|
||||
u32 pad;
|
||||
u64 AppletResourceUserId;
|
||||
} in = { handle, 0, appletGetAppletResourceUserId() };
|
||||
|
||||
u64 tmp=0;
|
||||
Result rc = serviceDispatchInOut(&g_hidSrv, 208, in, tmp,
|
||||
.in_send_pid = true,
|
||||
);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result hidIsVibrationDeviceMounted(HidVibrationDeviceHandle handle, bool *flag) {
|
||||
if (hosversionBefore(7,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
@ -1299,8 +1334,9 @@ Result hidIsVibrationDeviceMounted(HidVibrationDeviceHandle handle, bool *flag)
|
||||
|
||||
const struct {
|
||||
HidVibrationDeviceHandle handle;
|
||||
u32 pad;
|
||||
u64 AppletResourceUserId;
|
||||
} in = { handle, appletGetAppletResourceUserId() };
|
||||
} in = { handle, 0, appletGetAppletResourceUserId() };
|
||||
|
||||
u8 tmp=0;
|
||||
rc = serviceDispatchInOut(&g_hidSrv, 211, in, tmp,
|
||||
|
Loading…
Reference in New Issue
Block a user