mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
hid: Added hidGetNpadJoyHoldType.
This commit is contained in:
parent
8fe48e8eac
commit
c9f6100e1c
@ -778,6 +778,9 @@ Result hidAcquireNpadStyleSetUpdateEventHandle(HidControllerID id, Event* out_ev
|
||||
/// Sets the hold-type, see \ref HidJoyHoldType.
|
||||
Result hidSetNpadJoyHoldType(HidJoyHoldType type);
|
||||
|
||||
/// Gets the hold-type, see \ref HidJoyHoldType.
|
||||
Result hidGetNpadJoyHoldType(HidJoyHoldType *type);
|
||||
|
||||
/// Use this if you want to use a single joy-con as a dedicated CONTROLLER_PLAYER_*.
|
||||
/// When used, both joy-cons in a pair should be used with this (CONTROLLER_PLAYER_1 and CONTROLLER_PLAYER_2 for example).
|
||||
/// id must be CONTROLLER_PLAYER_*.
|
||||
|
@ -719,6 +719,19 @@ static Result _hidCmdOutU32(u32 *out, u32 cmd_id) {
|
||||
);
|
||||
}
|
||||
|
||||
static Result _hidCmdOutU64(u64 *out, u32 cmd_id) {
|
||||
Result rc;
|
||||
u64 AppletResourceUserId;
|
||||
|
||||
rc = appletGetAppletResourceUserId(&AppletResourceUserId);
|
||||
if (R_FAILED(rc))
|
||||
AppletResourceUserId = 0;
|
||||
|
||||
return serviceDispatchInOut(&g_hidSrv, cmd_id, AppletResourceUserId, *out,
|
||||
.in_send_pid = true,
|
||||
);
|
||||
}
|
||||
|
||||
static Result _hidCmdNoInOutU8(u8 *out, u32 cmd_id) {
|
||||
return serviceDispatchOut(&g_hidSrv, cmd_id, *out);
|
||||
}
|
||||
@ -835,6 +848,13 @@ Result hidSetNpadJoyHoldType(HidJoyHoldType type) {
|
||||
return _hidCmdWithInputU64(type, 120);
|
||||
}
|
||||
|
||||
Result hidGetNpadJoyHoldType(HidJoyHoldType *type) {
|
||||
u64 tmp=0;
|
||||
Result rc = _hidCmdOutU64(&tmp, 121);
|
||||
if (R_SUCCEEDED(rc) && type) *type = tmp;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result hidSetNpadJoyAssignmentModeSingleByDefault(HidControllerID id) {
|
||||
return _hidCmdWithInputU32(hidControllerIDToOfficial(id), 122);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user