mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 10:52:15 +02:00
nfc: add nfpuSetApplicationArea, nfpuCreateApplicationArea, nfpuFlush and nfpuRestore, remove NfpuAppId
This commit is contained in:
parent
2fdde95503
commit
2d6b494828
@ -128,10 +128,6 @@ typedef enum {
|
|||||||
NfpuMountTarget_All = 3,
|
NfpuMountTarget_All = 3,
|
||||||
} NfpuMountTarget;
|
} NfpuMountTarget;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
NfpuAppId_SSBU = 0x34f80200,
|
|
||||||
} NfpuAppId;
|
|
||||||
|
|
||||||
const NfpuInitConfig *nfpuGetDefaultInitConfig(void);
|
const NfpuInitConfig *nfpuGetDefaultInitConfig(void);
|
||||||
|
|
||||||
Result nfpuInitialize(void);
|
Result nfpuInitialize(void);
|
||||||
@ -161,8 +157,13 @@ Result nfpuGetRegisterInfo(HidControllerID id, NfpuRegisterInfo *out);
|
|||||||
Result nfpuGetCommonInfo(HidControllerID id, NfpuCommonInfo *out);
|
Result nfpuGetCommonInfo(HidControllerID id, NfpuCommonInfo *out);
|
||||||
Result nfpuGetModelInfo(HidControllerID id, NfpuModelInfo *out);
|
Result nfpuGetModelInfo(HidControllerID id, NfpuModelInfo *out);
|
||||||
|
|
||||||
Result nfpuOpenApplicationArea(HidControllerID id, NfpuAppId app_id, u32* npad_id);
|
Result nfpuOpenApplicationArea(HidControllerID id, u32 app_id, u32 *npad_id);
|
||||||
Result nfpuGetApplicationArea(HidControllerID id, void *buf, size_t buf_size);
|
Result nfpuGetApplicationArea(HidControllerID id, void *buf, size_t buf_size);
|
||||||
|
Result nfpuSetApplicationArea(HidControllerID id, void *buf, size_t buf_size);
|
||||||
|
Result nfpuCreateApplicationArea(HidControllerID id, u32 app_id, void *buf, size_t buf_size);
|
||||||
|
|
||||||
|
Result nfpuFlush(HidControllerID id);
|
||||||
|
Result nfpuRestore(HidControllerID id);
|
||||||
|
|
||||||
/// Calls nfc:user.
|
/// Calls nfc:user.
|
||||||
Result nfpuIsNfcEnabled(bool *out);
|
Result nfpuIsNfcEnabled(bool *out);
|
||||||
|
@ -609,7 +609,7 @@ inline Result nfpuGetModelInfo(HidControllerID id, NfpuModelInfo *out) {
|
|||||||
return _nfpuInterfaceCmdInIdOutBuffer(&g_nfpuInterface, 16, id, out, sizeof(NfpuModelInfo));
|
return _nfpuInterfaceCmdInIdOutBuffer(&g_nfpuInterface, 16, id, out, sizeof(NfpuModelInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result nfpuOpenApplicationArea(HidControllerID id, NfpuAppId app_id, u32* npad_id) {
|
Result nfpuOpenApplicationArea(HidControllerID id, u32 app_id, u32 *npad_id) {
|
||||||
if (id == CONTROLLER_P1_AUTO)
|
if (id == CONTROLLER_P1_AUTO)
|
||||||
return nfpuOpenApplicationArea(g_controllerP1AutoID, app_id, npad_id);
|
return nfpuOpenApplicationArea(g_controllerP1AutoID, app_id, npad_id);
|
||||||
|
|
||||||
@ -691,6 +691,98 @@ Result nfpuGetApplicationArea(HidControllerID id, void* buf, size_t buf_size) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result nfpuSetApplicationArea(HidControllerID id, void *buf, size_t buf_size) {
|
||||||
|
if (id == CONTROLLER_P1_AUTO)
|
||||||
|
return nfpuSetApplicationArea(g_controllerP1AutoID, buf, buf_size);
|
||||||
|
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
|
||||||
|
ipcAddSendBuffer(&c, buf, buf_size, BufferType_Normal);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u64 id;
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = serviceIpcPrepareHeader(&g_nfpuInterface, &c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 9;
|
||||||
|
raw->id = hidControllerIDToOfficial(id);
|
||||||
|
|
||||||
|
Result rc = serviceIpcDispatch(&g_nfpuInterface);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
} *resp;
|
||||||
|
|
||||||
|
serviceIpcParse(&g_nfpuInterface, &r, sizeof(*resp));
|
||||||
|
resp = r.Raw;
|
||||||
|
|
||||||
|
rc = resp->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result nfpuCreateApplicationArea(HidControllerID id, u32 app_id, void *buf, size_t buf_size) {
|
||||||
|
if (id == CONTROLLER_P1_AUTO)
|
||||||
|
return nfpuGetApplicationArea(g_controllerP1AutoID, buf, buf_size);
|
||||||
|
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
|
||||||
|
ipcAddSendBuffer(&c, buf, buf_size, BufferType_Normal);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u64 id;
|
||||||
|
u32 app_id;
|
||||||
|
} PACKED *raw;
|
||||||
|
|
||||||
|
raw = serviceIpcPrepareHeader(&g_nfpuInterface, &c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 9;
|
||||||
|
raw->id = hidControllerIDToOfficial(id);
|
||||||
|
raw->app_id = app_id;
|
||||||
|
|
||||||
|
Result rc = serviceIpcDispatch(&g_nfpuInterface);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
} *resp;
|
||||||
|
|
||||||
|
serviceIpcParse(&g_nfpuInterface, &r, sizeof(*resp));
|
||||||
|
resp = r.Raw;
|
||||||
|
|
||||||
|
rc = resp->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result nfpuFlush(HidControllerID id) {
|
||||||
|
if (id == CONTROLLER_P1_AUTO)
|
||||||
|
return _nfpuInterfaceCmdInIdNoOut(&g_nfpuInterface, 10, g_controllerP1AutoID);
|
||||||
|
return _nfpuInterfaceCmdInIdNoOut(&g_nfpuInterface, 10, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result nfpuRestore(HidControllerID id) {
|
||||||
|
if (id == CONTROLLER_P1_AUTO)
|
||||||
|
return _nfpuInterfaceCmdInIdNoOut(&g_nfpuInterface, 11, g_controllerP1AutoID);
|
||||||
|
return _nfpuInterfaceCmdInIdNoOut(&g_nfpuInterface, 11, id);
|
||||||
|
}
|
||||||
|
|
||||||
Result nfpuIsNfcEnabled(bool *out) {
|
Result nfpuIsNfcEnabled(bool *out) {
|
||||||
IpcCommand c;
|
IpcCommand c;
|
||||||
ipcInitialize(&c);
|
ipcInitialize(&c);
|
||||||
|
Loading…
Reference in New Issue
Block a user