hid: Added hidGetNpadJoyHoldType.

This commit is contained in:
yellows8 2019-11-28 15:01:42 -05:00
parent 8fe48e8eac
commit c9f6100e1c
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 23 additions and 0 deletions

View File

@ -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_*.

View File

@ -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);
}