mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
hid: Added hidSetSixAxisSensorFusionParameters, hidGetSixAxisSensorFusionParameters, and hidResetSixAxisSensorFusionParameters.
This commit is contained in:
parent
f040706743
commit
cbe9fae600
@ -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);
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user