mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 10:52:15 +02:00
nfc: restore NfpuInitConfig, allow custom configs when initializing the service
This commit is contained in:
parent
1eb6a6ef25
commit
c3b934b69a
@ -96,6 +96,13 @@ typedef struct {
|
||||
u8 reserved[0x99];
|
||||
} PACKED NfpuRegisterInfo;
|
||||
|
||||
typedef struct {
|
||||
u64 unk1;
|
||||
u64 reserved1[3];
|
||||
u64 unk2;
|
||||
u64 reserved2[3];
|
||||
} NfpuInitConfig;
|
||||
|
||||
typedef enum {
|
||||
NfpuState_NonInitialized = 0,
|
||||
NfpuState_Initialized = 1,
|
||||
|
@ -12,6 +12,14 @@ static Service g_nfcuSrv;
|
||||
static Service g_nfpuInterface;
|
||||
static Service g_nfcuInterface;
|
||||
|
||||
// This is the data passed by every application this was tested with
|
||||
static const NfpuInitConfig g_nfpuDefaultInitConfig = {
|
||||
.unk1 = 0x00000001000a0003,
|
||||
.reserved1 = {0},
|
||||
.unk2 = 0x0000000300040003,
|
||||
.reserved2 = {0},
|
||||
};
|
||||
|
||||
static Result _nfpuCreateInterface(Service* srv, Service* out);
|
||||
static Result _nfpuInterfaceInitialize(Service* srv, u64 cmd_id, u64 aruid, const void *config, size_t config_size);
|
||||
static Result _nfpuInterfaceFinalize(Service* srv, u64 cmd_id);
|
||||
@ -27,6 +35,11 @@ Result nfpuInitialize(const void *config, size_t config_size) {
|
||||
if (serviceIsActive(&g_nfpuInterface) && serviceIsActive(&g_nfcuInterface))
|
||||
return 0;
|
||||
|
||||
if (config == NULL) {
|
||||
config = &g_nfpuDefaultInitConfig;
|
||||
config_size = sizeof(g_nfpuDefaultInitConfig);
|
||||
}
|
||||
|
||||
// If this fails (for example because we're a sysmodule) aruid stays zero
|
||||
u64 aruid = 0;
|
||||
appletGetAppletResourceUserId(&aruid);
|
||||
|
Loading…
Reference in New Issue
Block a user