mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-07 08:39:24 +02:00
hid: Add hid{Set,Get}NpadHandheldActivationMode
This commit is contained in:
parent
639ba8ef78
commit
eaeabad315
@ -1563,6 +1563,18 @@ Result hidSetNpadJoyAssignmentModeDual(HidNpadIdType id);
|
|||||||
*/
|
*/
|
||||||
Result hidMergeSingleJoyAsDualJoy(HidNpadIdType id0, HidNpadIdType id1);
|
Result hidMergeSingleJoyAsDualJoy(HidNpadIdType id0, HidNpadIdType id1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the \ref HidNpadHandheldActivationMode.
|
||||||
|
* @param[in] mode \ref HidNpadHandheldActivationMode
|
||||||
|
*/
|
||||||
|
Result hidSetNpadHandheldActivationMode(HidNpadHandheldActivationMode mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the \ref HidNpadHandheldActivationMode.
|
||||||
|
* @param[out] out \ref HidNpadHandheldActivationMode
|
||||||
|
*/
|
||||||
|
Result hidGetNpadHandheldActivationMode(HidNpadHandheldActivationMode *out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets and initializes vibration handles.
|
* @brief Gets and initializes vibration handles.
|
||||||
* @note Only the following styles support total_handles 2: ::HidNpadStyleTag_NpadFullKey, ::HidNpadStyleTag_NpadHandheld, ::HidNpadStyleTag_NpadJoyDual, ::HidNpadStyleTag_NpadHandheldLark, ::HidNpadStyleTag_NpadSystem, ::HidNpadStyleTag_NpadSystemExt.
|
* @note Only the following styles support total_handles 2: ::HidNpadStyleTag_NpadFullKey, ::HidNpadStyleTag_NpadHandheld, ::HidNpadStyleTag_NpadJoyDual, ::HidNpadStyleTag_NpadHandheldLark, ::HidNpadStyleTag_NpadSystem, ::HidNpadStyleTag_NpadSystemExt.
|
||||||
|
@ -1008,7 +1008,7 @@ static Result _hidCmdInU32AruidNoOut(u32 inval, u32 cmd_id) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _hidCmdWithInputU64(u64 inval, u32 cmd_id) {
|
static Result _hidCmdInU64AruidNoOut(u64 inval, u32 cmd_id) {
|
||||||
const struct {
|
const struct {
|
||||||
u64 AppletResourceUserId;
|
u64 AppletResourceUserId;
|
||||||
u64 inval;
|
u64 inval;
|
||||||
@ -1019,7 +1019,7 @@ static Result _hidCmdWithInputU64(u64 inval, u32 cmd_id) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _hidCmdOutU32(u32 *out, u32 cmd_id) {
|
static Result _hidCmdInAruidOutU32(u32 *out, u32 cmd_id) {
|
||||||
u64 AppletResourceUserId = appletGetAppletResourceUserId();
|
u64 AppletResourceUserId = appletGetAppletResourceUserId();
|
||||||
|
|
||||||
return serviceDispatchInOut(&g_hidSrv, cmd_id, AppletResourceUserId, *out,
|
return serviceDispatchInOut(&g_hidSrv, cmd_id, AppletResourceUserId, *out,
|
||||||
@ -1027,7 +1027,7 @@ static Result _hidCmdOutU32(u32 *out, u32 cmd_id) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _hidCmdOutU64(u64 *out, u32 cmd_id) {
|
static Result _hidCmdInAruidOutU64(u64 *out, u32 cmd_id) {
|
||||||
u64 AppletResourceUserId = appletGetAppletResourceUserId();
|
u64 AppletResourceUserId = appletGetAppletResourceUserId();
|
||||||
|
|
||||||
return serviceDispatchInOut(&g_hidSrv, cmd_id, AppletResourceUserId, *out,
|
return serviceDispatchInOut(&g_hidSrv, cmd_id, AppletResourceUserId, *out,
|
||||||
@ -1160,7 +1160,7 @@ static Result _hidActivateGesture(void) {
|
|||||||
|
|
||||||
Result hidGetSupportedNpadStyleSet(u32 *style_set) {
|
Result hidGetSupportedNpadStyleSet(u32 *style_set) {
|
||||||
u32 tmp=0;
|
u32 tmp=0;
|
||||||
Result rc = _hidCmdOutU32(&tmp, 101);
|
Result rc = _hidCmdInAruidOutU32(&tmp, 101);
|
||||||
if (R_SUCCEEDED(rc) && style_set) *style_set = tmp;
|
if (R_SUCCEEDED(rc) && style_set) *style_set = tmp;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -1211,12 +1211,12 @@ Result hidAcquireNpadStyleSetUpdateEventHandle(HidNpadIdType id, Event* out_even
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result hidSetNpadJoyHoldType(HidNpadJoyHoldType type) {
|
Result hidSetNpadJoyHoldType(HidNpadJoyHoldType type) {
|
||||||
return _hidCmdWithInputU64(type, 120);
|
return _hidCmdInU64AruidNoOut(type, 120);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result hidGetNpadJoyHoldType(HidNpadJoyHoldType *type) {
|
Result hidGetNpadJoyHoldType(HidNpadJoyHoldType *type) {
|
||||||
u64 tmp=0;
|
u64 tmp=0;
|
||||||
Result rc = _hidCmdOutU64(&tmp, 121);
|
Result rc = _hidCmdInAruidOutU64(&tmp, 121);
|
||||||
if (R_SUCCEEDED(rc) && type) *type = tmp;
|
if (R_SUCCEEDED(rc) && type) *type = tmp;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -1240,6 +1240,17 @@ Result hidMergeSingleJoyAsDualJoy(HidNpadIdType id0, HidNpadIdType id1) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result hidSetNpadHandheldActivationMode(HidNpadHandheldActivationMode mode) {
|
||||||
|
return _hidCmdInU64AruidNoOut(mode, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result hidGetNpadHandheldActivationMode(HidNpadHandheldActivationMode *out) {
|
||||||
|
u64 tmp=0;
|
||||||
|
Result rc = _hidCmdInAruidOutU64(&tmp, 129);
|
||||||
|
if (R_SUCCEEDED(rc) && out) *out = tmp; // Official sw would abort if tmp isn't 0-2.
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
static Result _hidCreateActiveVibrationDeviceList(Service* srv_out) {
|
static Result _hidCreateActiveVibrationDeviceList(Service* srv_out) {
|
||||||
return _hidCmdGetSession(srv_out, 203);
|
return _hidCmdGetSession(srv_out, 203);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user