mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Added hidGetNpadInterfaceType.
This commit is contained in:
parent
81781f0782
commit
326619c271
@ -792,3 +792,7 @@ Result hidGetSevenSixAxisSensorFusionStrength(float *strength);
|
|||||||
/// Resets the timestamp for the SevenSixAxisSensor. Only available on [6.0.0+].
|
/// Resets the timestamp for the SevenSixAxisSensor. Only available on [6.0.0+].
|
||||||
Result hidResetSevenSixAxisSensorTimestamp(void);
|
Result hidResetSevenSixAxisSensorTimestamp(void);
|
||||||
|
|
||||||
|
/// Gets the NpadInterfaceType for the specified controller.
|
||||||
|
/// Only available on [4.0.0+].
|
||||||
|
Result hidGetNpadInterfaceType(HidControllerID id, u8 *out);
|
||||||
|
|
||||||
|
@ -1739,3 +1739,44 @@ Result hidResetSevenSixAxisSensorTimestamp(void) {
|
|||||||
return _hidCmdWithNoInput(310);
|
return _hidCmdWithNoInput(310);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result hidGetNpadInterfaceType(HidControllerID id, u8 *out) {
|
||||||
|
if (hosversionBefore(4,0,0))
|
||||||
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
|
Result rc;
|
||||||
|
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u32 id;
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 405;
|
||||||
|
raw->id = hidControllerIDToOfficial(id);
|
||||||
|
|
||||||
|
rc = serviceIpcDispatch(&g_hidSrv);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
u8 out;
|
||||||
|
} *resp = r.Raw;
|
||||||
|
|
||||||
|
rc = resp->result;
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc) && out) *out = resp->out;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user