hid: Added hidSetSixAxisSensorFusionParameters, hidGetSixAxisSensorFusionParameters, and hidResetSixAxisSensorFusionParameters.

This commit is contained in:
yellows8 2020-01-11 22:37:07 -05:00
parent f040706743
commit cbe9fae600
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 64 additions and 0 deletions

View File

@ -760,6 +760,15 @@ u32 hidSixAxisSensorValuesRead(SixAxisSensorValues *values, HidControllerID id,
/// Returns 0 when CONTROLLER_PLAYER_1 is connected, otherwise returns 1 for handheld-mode. /// Returns 0 when CONTROLLER_PLAYER_1 is connected, otherwise returns 1 for handheld-mode.
bool hidGetHandheldMode(void); bool hidGetHandheldMode(void);
/// SetSixAxisSensorFusionParameters. unk0 must be 0.0f-1.0f.
Result hidSetSixAxisSensorFusionParameters(u32 SixAxisSensorHandle, float unk0, float unk1);
/// GetSixAxisSensorFusionParameters
Result hidGetSixAxisSensorFusionParameters(u32 SixAxisSensorHandle, float *unk0, float *unk1);
/// ResetSixAxisSensorFusionParameters
Result hidResetSixAxisSensorFusionParameters(u32 SixAxisSensorHandle);
/// Sets which controller types are supported. This is automatically called with all types in \ref hidInitialize. /// Sets which controller types are supported. This is automatically called with all types in \ref hidInitialize.
Result hidSetSupportedNpadStyleSet(HidControllerType type); Result hidSetSupportedNpadStyleSet(HidControllerType type);

View File

@ -755,6 +755,61 @@ static Result _hidGetSharedMemoryHandle(Service* srv, Handle* handle_out) {
return _hidCmdGetHandle(srv, handle_out, 0); return _hidCmdGetHandle(srv, handle_out, 0);
} }
Result hidSetSixAxisSensorFusionParameters(u32 SixAxisSensorHandle, float unk0, float unk1) {
if (unk0 < 0.0f || unk0 > 1.0f)
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
Result rc;
u64 AppletResourceUserId;
rc = appletGetAppletResourceUserId(&AppletResourceUserId);
if (R_FAILED(rc))
AppletResourceUserId = 0;
const struct {
u32 SixAxisSensorHandle;
float unk0;
float unk1;
u32 pad;
u64 AppletResourceUserId;
} in = { SixAxisSensorHandle, unk0, unk1, 0, AppletResourceUserId };
return serviceDispatchIn(&g_hidSrv, 70, in,
.in_send_pid = true,
);
}
Result hidGetSixAxisSensorFusionParameters(u32 SixAxisSensorHandle, float *unk0, float *unk1) {
Result rc;
u64 AppletResourceUserId;
rc = appletGetAppletResourceUserId(&AppletResourceUserId);
if (R_FAILED(rc))
AppletResourceUserId = 0;
const struct {
u32 SixAxisSensorHandle;
u32 pad;
u64 AppletResourceUserId;
} in = { SixAxisSensorHandle, 0, AppletResourceUserId };
struct {
float unk0;
float unk1;
} out;
rc = serviceDispatchInOut(&g_hidSrv, 71, in, out,
.in_send_pid = true,
);
if (R_SUCCEEDED(rc) && unk0) *unk0 = out.unk0;
if (R_SUCCEEDED(rc) && unk1) *unk1 = out.unk1;
return rc;
}
Result hidResetSixAxisSensorFusionParameters(u32 SixAxisSensorHandle) {
return _hidCmdWithInputU32(SixAxisSensorHandle, 72);
}
Result hidSetSupportedNpadStyleSet(HidControllerType type) { Result hidSetSupportedNpadStyleSet(HidControllerType type) {
return _hidCmdWithInputU32(type, 100); return _hidCmdWithInputU32(type, 100);
} }