libnx v4.10.0
Loading...
Searching...
No Matches
nfc.h
Go to the documentation of this file.
1/**
2 * @file nfc.h
3 * @brief Nintendo Figurine (amiibo) Platform (nfp:user) service IPC wrapper.
4 * @author averne
5 * @copyright libnx Authors
6 */
7
8#pragma once
9#include "../types.h"
10#include "../sf/service.h"
11#include "../services/mii.h"
12
13/// NfpServiceType
14typedef enum {
15 NfpServiceType_User = 0, ///< Initializes nfp:user.
16 NfpServiceType_Debug = 1, ///< Initializes nfp:dbg.
17 NfpServiceType_System = 2, ///< Initializes nfp:sys.
19
20/// NfcServiceType
21typedef enum {
22 NfcServiceType_User = 0, ///< Initializes nfc:user.
23 NfcServiceType_System = 1, ///< Initializes nfc:sys.
25
26typedef enum {
27 NfcState_NonInitialized = 0,
28 NfcState_Initialized = 1,
29} NfcState;
30
31typedef enum {
32 NfpDeviceState_Initialized = 0,
33 NfpDeviceState_SearchingForTag = 1,
34 NfpDeviceState_TagFound = 2,
35 NfpDeviceState_TagRemoved = 3,
36 NfpDeviceState_TagMounted = 4,
37 NfpDeviceState_Unavailable = 5,
38} NfpDeviceState;
39
40typedef enum {
41 NfcDeviceState_Initialized = 0,
42 NfcDeviceState_SearchingForTag = 1,
43 NfcDeviceState_TagFound = 2,
44 NfcDeviceState_TagRemoved = 3,
45 NfcDeviceState_TagMounted = 4,
46} NfcDeviceState;
47
48typedef enum {
49 NfcMifareDeviceState_Initialized = 0,
50 NfcMifareDeviceState_SearchingForTag = 1,
51 NfcMifareDeviceState_TagFound = 2,
52 NfcMifareDeviceState_TagRemoved = 3,
53 NfcMifareDeviceState_TagMounted = 4,
54 NfcMifareDeviceState_Unavailable = 5,
55} NfcMifareDeviceState;
56
57typedef enum {
58 NfpApplicationAreaVersion_3DS = 0, ///< Application area created by a 3DS game.
59 NfpApplicationAreaVersion_WiiU = 1, ///< Application area created by a Wii U game.
60 NfpApplicationAreaVersion_3DSv2 = 2, ///< Application area created by a (new?) 3DS game.
61 NfpApplicationAreaVersion_Switch = 3, ///< Application area created by a Switch game.
62 NfpApplicationAreaVersion_Invalid = 0xFF, ///< Invalid value (application area not created).
64
65typedef enum {
66 NfpDeviceType_Amiibo = 0,
67} NfpDeviceType;
68
69typedef enum {
70 NfpMountTarget_Rom = BIT(0),
71 NfpMountTarget_Ram = BIT(1),
72 NfpMountTarget_All = NfpMountTarget_Rom | NfpMountTarget_Ram,
73} NfpMountTarget;
74
75typedef enum {
76 NfcProtocol_None = 0,
77 NfcProtocol_TypeA = BIT(0), ///< ISO14443A
78 NfcProtocol_TypeB = BIT(1), ///< ISO14443B
79 NfcProtocol_TypeF = BIT(2), ///< Sony FeliCa
80 NfcProtocol_All = 0xFFFFFFFF,
82
83typedef enum {
84 NfcTagType_None = 0,
85 NfcTagType_Type1 = BIT(0), ///< ISO14443A RW. Topaz
86 NfcTagType_Type2 = BIT(1), ///< ISO14443A RW. Ultralight, NTAGX, ST25TN
87 NfcTagType_Type3 = BIT(2), ///< ISO14443A RW/RO. Sony FeliCa
88 NfcTagType_Type4A = BIT(3), ///< ISO14443A RW/RO. DESFire
89 NfcTagType_Type4B = BIT(4), ///< ISO14443B RW/RO. DESFire
90 NfcTagType_Type5 = BIT(5), ///< ISO15693 RW/RO. SLI, SLIX, ST25TV
91 NfcTagType_Mifare = BIT(6), ///< Mifare clasic. Skylanders
92 NfcTagType_All = 0xFFFFFFFF,
94
95typedef enum {
96 NfcMifareCommand_Read = 0x30,
97 NfcMifareCommand_AuthA = 0x60,
98 NfcMifareCommand_AuthB = 0x61,
99 NfcMifareCommand_Write = 0xA0,
100 NfcMifareCommand_Transfer = 0xB0,
101 NfcMifareCommand_Decrement = 0xC0,
102 NfcMifareCommand_Increment = 0xC1,
103 NfcMifareCommand_Store = 0xC2,
104} NfcMifareCommand;
105
106typedef enum {
107 NfpAmiiboFlag_Valid = BIT(0), ///< Initialized in system settings.
108 NfpAmiiboFlag_ApplicationAreaExists = BIT(1), ///< Application area exists.
110
111typedef enum {
112 NfpBreakType_Flush = 0,
113 NfpBreakType_Break1 = 1,
114 NfpBreakType_Break2 = 2,
115} NfpBreakType;
116
117typedef struct {
118 u16 year;
119 u8 month;
120 u8 day;
121} NfpDate;
122
123typedef struct {
124 u8 uid[10]; ///< UUID.
125 u8 uid_length; ///< UUID length.
126 u8 reserved[0x15];
127} NfcTagUid;
128
129typedef struct {
130 NfcTagUid uid; ///< UUID.
131 u32 protocol; ///< \ref NfcProtocol
132 u32 tag_type; ///< \ref NfcTagType
133 u8 reserved[0x30];
134} NfpTagInfo;
135
136typedef struct {
137 NfcTagUid uid; ///< UUID.
138 u32 protocol; ///< \ref NfcProtocol
139 u32 tag_type; ///< \ref NfcTagType
140 u8 reserved[0x30];
141} NfcTagInfo;
142
143typedef struct {
144 NfpDate last_write_date;
145 u16 write_counter;
146 u16 version;
147 u32 application_area_size;
148 u8 reserved[0x34];
150
151typedef struct {
152 union {
153 u8 character_id[3];
154 struct {
155 u16 game_character_id;
156 u8 character_variant;
157 } NX_PACKED;
158 };
159 u8 series_id; ///< Series.
160 u16 numbering_id; ///< Model number.
161 u8 nfp_type; ///< Figure type.
162 u8 reserved[0x39];
164
165typedef struct {
166 MiiCharInfo mii;
167 NfpDate first_write_date;
168 char amiibo_name[(10*4)+1]; ///< Amiibo name (utf-8, null-terminated).
169 u8 font_region;
170 u8 reserved[0x7A];
172
173typedef struct {
174 MiiStoreData mii_store_data;
175 NfpDate first_write_date;
176 char amiibo_name[(10*4)+1]; ///< Amiibo name (utf-8, null-terminated).
177 u8 font_region;
178 u8 reserved[0x8E];
180
181typedef struct {
182 u64 application_id;
183 u32 access_id;
184 u16 crc32_change_counter;
185 u8 flags;
186 u8 tag_type;
187 u8 application_area_version;
188 u8 reserved[0x2F];
190
191typedef struct {
192 u8 tag_magic; ///< Tag magic (always 0xA5: https://www.3dbrew.org/wiki/Amiibo#Page_layout).
193 u8 reserved1[0x1];
194 u16 tag_write_counter; ///< Incremented every tag write.
195 u32 crc32_1; ///< CRC32 of some internal 8-byte data.
196 u8 reserved2[0x38];
197 NfpDate last_write_date; ///< Updated every write.
198 u16 write_counter; ///< Incremented every write, until it maxes out at 0xFFFF.
199 u16 version; ///< Version.
200 u32 application_area_size; ///< Size of the application area.
201 u8 reserved3[0x34];
202 MiiVer3StoreData mii_v3; ///< Ver3StoreData (Mii format used in 3DS).
203 u8 pad[0x2];
204 u16 mii_v3_crc16; ///< CRC16 of Ver3StoreData.
206 NfpDate first_write_date; ///< Set when the amiibo is first written to.
207 u16 amiibo_name[10+1]; ///< Amiibo name (utf-16, null-terminated).
208 u8 font_region; ///< Font region.
209 u8 unknown1; ///< Normally zero
210 u32 crc32_2; ///< CRC32 of Ver3StoreData + application_id_byte + unknown1 + StoreDataExtension + unknown2 (0x7E bytes total)
211 u32 unknown2[0x5]; ///< Normally zero
212 u8 reserved4[0x64];
213 u64 application_id; ///< Modified application ID (Application ID & 0xFFFFFFFF0FFFFFFF | 0x30000000)
214 u32 access_id; ///< Application area access ID
215 u16 settings_crc32_change_counter;
216 u8 flags; ///< \ref NfpAmiiboFlag
217 u8 tag_type; ///< \ref NfcTagType
218 u8 application_area_version; ///< \ref NfpApplicationAreaVersion
219 u8 application_id_byte; ///< Application ID byte ((Application ID >> 28) & 0xFF)
220 u8 reserved5[0x2E];
221 u8 application_area[0xD8]; ///< Application area.
222} NfpData;
223
224typedef struct {
225 u8 mifare_command;
226 u8 unknown; ///< Usually 1
227 u8 reserved1[0x6];
228 u8 sector_key[0x6];
229 u8 reserved2[0x2];
231
232typedef struct {
233 u8 sector_number;
234 u8 reserved[0x7];
235 NfcSectorKey sector_key;
237
238typedef struct {
239 u8 data[0x10];
240 u8 sector_number;
241 u8 reserved[0x7];
243
244typedef struct {
245 u8 data[0x10];
246 u8 sector_number;
247 u8 reserved[0x7];
248 NfcSectorKey sector_key;
250
251typedef struct {
252 u64 version;
253 u64 reserved[3];
255
256/// Nfc/Nfp DeviceHandle
257typedef struct {
258 u8 handle[0x8]; ///< Handle.
260
261/// Initialize nfp:*.
263
264/// Exit nfp:*.
265void nfpExit(void);
266
267/// Initialize nfc:*.
269
270/// Exit nfc:*.
271void nfcExit(void);
272
273/// Initialize nfc:mf:u.
275
276/// Exit nfc:mf:u.
277void nfcMfExit(void);
278
279/// Gets the Service object for the actual nfp:* service session.
281
282/// Gets the Service object for the interface from nfp:*.
284
285/// Gets the Service object for the actual nfc:* service session.
287
288/// Gets the Service object for the interface from nfc:*.
290
291/// Gets the Service object for the actual nfc:mf:u service session.
293
294/// Gets the Service object for the interface from nfc:mf:u.
296
297Result nfpListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count);
298Result nfpStartDetection(const NfcDeviceHandle *handle);
299Result nfpStopDetection(const NfcDeviceHandle *handle);
300Result nfpMount(const NfcDeviceHandle *handle, NfpDeviceType device_type, NfpMountTarget mount_target);
301Result nfpUnmount(const NfcDeviceHandle *handle);
302
303/// Only available with [4.0.0+].
304Result nfcListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count);
305/// Only available with [4.0.0+].
307/// Only available with [4.0.0+].
309
310Result nfcMfListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count);
311Result nfcMfStartDetection(const NfcDeviceHandle *handle);
312Result nfcMfStopDetection(const NfcDeviceHandle *handle);
313
314/// Not available with ::NfpServiceType_System.
315/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
317
318/// Not available with ::NfpServiceType_System.
319/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram, and the application area to be opened.
320Result nfpGetApplicationArea(const NfcDeviceHandle *handle, void* buf, size_t buf_size, u32 *out_size);
321
322/// Not available with ::NfpServiceType_System.
323/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram, and the application area to be opened.
324Result nfpSetApplicationArea(const NfcDeviceHandle *handle, const void* buf, size_t buf_size);
325
326/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
328
329Result nfpRestore(const NfcDeviceHandle *handle);
330
331/// Not available with ::NfpServiceType_System.
332/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
333Result nfpCreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void* buf, size_t buf_size);
334
335/// Not available with ::NfpServiceType_System.
336/// Only available with [3.0.0+].
337/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram, and the application area to be opened.
338Result nfpRecreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void* buf, size_t buf_size);
339
340/// Not available with ::NfpServiceType_System.
341Result nfpGetApplicationAreaSize(const NfcDeviceHandle *handle, u32 *out_app_area_size);
342
343/// Not available with ::NfpServiceType_User.
345
346/// Not available with ::NfpServiceType_User.
348
349Result nfpGetTagInfo(const NfcDeviceHandle *handle, NfpTagInfo *out);
350
351/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
353
354/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
356
357/// Requires the amiibo to be mounted with ::NfpMountTarget_Rom.
359
360/// Not available with ::NfpServiceType_User.
361/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
363
364/// Only available with [4.0.0+].
366
367Result nfcMfGetTagInfo(const NfcDeviceHandle *handle, NfcTagInfo *out);
368
369/// Returned event will have autoclear off.
371/// Returned event will have autoclear off.
373
374/// Returned event will have autoclear off.
375/// Only available with [4.0.0+].
377/// Returned event will have autoclear off.
378/// Only available with [4.0.0+].
380
381/// Returned event will have autoclear off.
383/// Returned event will have autoclear off.
385
386Result nfpGetState(NfcState *out);
387Result nfpGetDeviceState(const NfcDeviceHandle *handle, NfpDeviceState *out);
388Result nfpGetNpadId(const NfcDeviceHandle *handle, u32 *out);
389
390/// Only available with [4.0.0+].
391Result nfcGetState(NfcState *out);
392/// Only available with [4.0.0+].
393Result nfcGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out);
394/// Only available with [4.0.0+].
396
397Result nfcMfGetState(NfcState *out);
398Result nfcMfGetDeviceState(const NfcDeviceHandle *handle, NfcMifareDeviceState *out);
399Result nfcMfGetNpadId(const NfcDeviceHandle *handle, u32 *out);
400
401/// Returned event will have autoclear on.
402/// Only available with [3.0.0+].
404/// Returned event will have autoclear on.
405/// Only available with [4.0.0+].
407/// Returned event will have autoclear on.
409
410/// Not available with ::NfpServiceType_User.
412
413/// Not available with ::NfpServiceType_User.
414/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
416
417/// Not available with ::NfpServiceType_User.
418/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
419Result nfpSetRegisterInfoPrivate(const NfcDeviceHandle *handle, const NfpRegisterInfoPrivate *register_info_private);
420
421/// Not available with ::NfpServiceType_User.
422/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
424
425/// Only available with ::NfpServiceType_Debug.
426/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
428
429/// Only available with ::NfpServiceType_Debug.
430/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
431Result nfpSetAll(const NfcDeviceHandle *handle, const NfpData *nfp_data);
432
433/// Only available with ::NfpServiceType_Debug.
434/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
436
437/// Only available with ::NfpServiceType_Debug.
438/// Requires the amiibo to be mounted with ::NfpMountTarget_Ram.
439Result nfpBreakTag(const NfcDeviceHandle *handle, NfpBreakType break_type);
440
441/// Only available with ::NfpServiceType_Debug.
442Result nfpReadBackupData(const NfcDeviceHandle *handle, void* out_buf, size_t buf_size, u32 *out_size);
443
444/// Only available with ::NfpServiceType_Debug.
445Result nfpWriteBackupData(const NfcDeviceHandle *handle, const void* buf, size_t buf_size);
446
447/// Only available with ::NfpServiceType_Debug.
448Result nfpWriteNtf(const NfcDeviceHandle *handle, u32 write_type, const void* buf, size_t buf_size);
449
450/// This uses nfc:*.
452
453/// Only available with [4.0.0+].
454Result nfcReadMifare(const NfcDeviceHandle *handle, NfcMifareReadBlockData *out_block_data, const NfcMifareReadBlockParameter *read_block_parameter, s32 count);
455/// Only available with [4.0.0+].
456Result nfcWriteMifare(const NfcDeviceHandle *handle, const NfcMifareWriteBlockParameter *write_block_parameter, s32 count);
457
458Result nfcMfReadMifare(const NfcDeviceHandle *handle, NfcMifareReadBlockData *out_block_data, const NfcMifareReadBlockParameter *read_block_parameter, s32 count);
459Result nfcMfWriteMifare(const NfcDeviceHandle *handle, const NfcMifareWriteBlockParameter *write_block_parameter, s32 count);
460
461/// Only available with [4.0.0+].
462Result nfcSendCommandByPassThrough(const NfcDeviceHandle *handle, u64 timeout, const void* cmd_buf, size_t cmd_buf_size, void* reply_buf, size_t reply_buf_size, u64 *out_size);
463/// Only available with [4.0.0+].
465/// Only available with [4.0.0+].
Result nfcGetNpadId(const NfcDeviceHandle *handle, u32 *out)
Only available with [4.0.0+].
Result nfpSetRegisterInfoPrivate(const NfcDeviceHandle *handle, const NfpRegisterInfoPrivate *register_info_private)
Not available with NfpServiceType_User.
NfpApplicationAreaVersion
Definition nfc.h:57
@ NfpApplicationAreaVersion_3DS
Application area created by a 3DS game.
Definition nfc.h:58
@ NfpApplicationAreaVersion_3DSv2
Application area created by a (new?) 3DS game.
Definition nfc.h:60
@ NfpApplicationAreaVersion_WiiU
Application area created by a Wii U game.
Definition nfc.h:59
@ NfpApplicationAreaVersion_Invalid
Invalid value (application area not created).
Definition nfc.h:62
@ NfpApplicationAreaVersion_Switch
Application area created by a Switch game.
Definition nfc.h:61
Result nfcAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfpFlush(const NfcDeviceHandle *handle)
Requires the amiibo to be mounted with NfpMountTarget_Ram.
Result nfpGetCommonInfo(const NfcDeviceHandle *handle, NfpCommonInfo *out)
Requires the amiibo to be mounted with NfpMountTarget_Ram.
Result nfpAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
NfcServiceType
NfcServiceType.
Definition nfc.h:21
@ NfcServiceType_System
Initializes nfc:sys.
Definition nfc.h:23
@ NfcServiceType_User
Initializes nfc:user.
Definition nfc.h:22
Result nfpWriteBackupData(const NfcDeviceHandle *handle, const void *buf, size_t buf_size)
Only available with NfpServiceType_Debug.
void nfcExit(void)
Exit nfc:*.
Result nfcAttachAvailabilityChangeEvent(Event *out_event)
Returned event will have autoclear on.
Result nfcMfAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfcInitialize(NfcServiceType service_type)
Initialize nfc:*.
Result nfcWriteMifare(const NfcDeviceHandle *handle, const NfcMifareWriteBlockParameter *write_block_parameter, s32 count)
Only available with [4.0.0+].
Result nfpInitialize(NfpServiceType service_type)
Initialize nfp:*.
Result nfpRecreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void *buf, size_t buf_size)
Not available with NfpServiceType_System.
Result nfpSetApplicationArea(const NfcDeviceHandle *handle, const void *buf, size_t buf_size)
Not available with NfpServiceType_System.
Result nfpGetApplicationAreaSize(const NfcDeviceHandle *handle, u32 *out_app_area_size)
Not available with NfpServiceType_System.
Result nfpAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfpReadBackupData(const NfcDeviceHandle *handle, void *out_buf, size_t buf_size, u32 *out_size)
Only available with NfpServiceType_Debug.
NfcProtocol
Definition nfc.h:75
@ NfcProtocol_TypeA
ISO14443A.
Definition nfc.h:77
@ NfcProtocol_TypeB
ISO14443B.
Definition nfc.h:78
@ NfcProtocol_TypeF
Sony FeliCa.
Definition nfc.h:79
Result nfcStartDetection(const NfcDeviceHandle *handle, NfcProtocol protocol)
Only available with [4.0.0+].
Result nfcMfAttachAvailabilityChangeEvent(Event *out_event)
Returned event will have autoclear on.
Result nfpBreakTag(const NfcDeviceHandle *handle, NfpBreakType break_type)
Only available with NfpServiceType_Debug.
Result nfpWriteNtf(const NfcDeviceHandle *handle, u32 write_type, const void *buf, size_t buf_size)
Only available with NfpServiceType_Debug.
Result nfpAttachAvailabilityChangeEvent(Event *out_event)
Returned event will have autoclear on.
Result nfcGetState(NfcState *out)
Only available with [4.0.0+].
Result nfcGetTagInfo(const NfcDeviceHandle *handle, NfcTagInfo *out)
Only available with [4.0.0+].
Service * nfpGetServiceSession(void)
Gets the Service object for the actual nfp:* service session.
void nfcMfExit(void)
Exit nfc:mf:u.
Result nfpGetRegisterInfoPrivate(const NfcDeviceHandle *handle, NfpRegisterInfoPrivate *out)
Not available with NfpServiceType_User.
Result nfcAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfpFlushDebug(const NfcDeviceHandle *handle)
Only available with NfpServiceType_Debug.
Result nfpGetAdminInfo(const NfcDeviceHandle *handle, NfpAdminInfo *out)
Not available with NfpServiceType_User.
Result nfcStopDetection(const NfcDeviceHandle *handle)
Only available with [4.0.0+].
Result nfcListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count)
Only available with [4.0.0+].
NfcTagType
Definition nfc.h:83
@ NfcTagType_Type4B
ISO14443B RW/RO. DESFire.
Definition nfc.h:89
@ NfcTagType_Type4A
ISO14443A RW/RO. DESFire.
Definition nfc.h:88
@ NfcTagType_Mifare
Mifare clasic. Skylanders.
Definition nfc.h:91
@ NfcTagType_Type3
ISO14443A RW/RO. Sony FeliCa.
Definition nfc.h:87
@ NfcTagType_Type2
ISO14443A RW. Ultralight, NTAGX, ST25TN.
Definition nfc.h:86
@ NfcTagType_Type1
ISO14443A RW. Topaz.
Definition nfc.h:85
@ NfcTagType_Type5
ISO15693 RW/RO. SLI, SLIX, ST25TV.
Definition nfc.h:90
Result nfcReleasePassThroughSession(const NfcDeviceHandle *handle)
Only available with [4.0.0+].
Result nfcMfInitialize()
Initialize nfc:mf:u.
Result nfpOpenApplicationArea(const NfcDeviceHandle *handle, u32 app_id)
Not available with NfpServiceType_System.
Result nfpGetApplicationArea(const NfcDeviceHandle *handle, void *buf, size_t buf_size, u32 *out_size)
Not available with NfpServiceType_System.
NfpAmiiboFlag
Definition nfc.h:106
@ NfpAmiiboFlag_ApplicationAreaExists
Application area exists.
Definition nfc.h:108
@ NfpAmiiboFlag_Valid
Initialized in system settings.
Definition nfc.h:107
NfpServiceType
NfpServiceType.
Definition nfc.h:14
@ NfpServiceType_User
Initializes nfp:user.
Definition nfc.h:15
@ NfpServiceType_System
Initializes nfp:sys.
Definition nfc.h:17
@ NfpServiceType_Debug
Initializes nfp:dbg.
Definition nfc.h:16
Result nfcMfAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfcReadMifare(const NfcDeviceHandle *handle, NfcMifareReadBlockData *out_block_data, const NfcMifareReadBlockParameter *read_block_parameter, s32 count)
Only available with [4.0.0+].
Result nfcSendCommandByPassThrough(const NfcDeviceHandle *handle, u64 timeout, const void *cmd_buf, size_t cmd_buf_size, void *reply_buf, size_t reply_buf_size, u64 *out_size)
Only available with [4.0.0+].
Result nfpGetModelInfo(const NfcDeviceHandle *handle, NfpModelInfo *out)
Requires the amiibo to be mounted with NfpMountTarget_Rom.
Result nfpGetRegisterInfo(const NfcDeviceHandle *handle, NfpRegisterInfo *out)
Requires the amiibo to be mounted with NfpMountTarget_Ram.
Result nfpDeleteApplicationArea(const NfcDeviceHandle *handle)
Not available with NfpServiceType_User.
Result nfcKeepPassThroughSession(const NfcDeviceHandle *handle)
Only available with [4.0.0+].
Service * nfpGetServiceSession_Interface(void)
Gets the Service object for the interface from nfp:*.
Service * nfcMfGetServiceSession(void)
Gets the Service object for the actual nfc:mf:u service session.
Result nfpCreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void *buf, size_t buf_size)
Not available with NfpServiceType_System.
Service * nfcGetServiceSession(void)
Gets the Service object for the actual nfc:* service session.
void nfpExit(void)
Exit nfp:*.
Result nfpFormat(const NfcDeviceHandle *handle)
Not available with NfpServiceType_User.
Result nfpDeleteRegisterInfo(const NfcDeviceHandle *handle)
Not available with NfpServiceType_User.
Service * nfcGetServiceSession_Interface(void)
Gets the Service object for the interface from nfc:*.
Result nfpExistsApplicationArea(const NfcDeviceHandle *handle, bool *out)
Not available with NfpServiceType_User.
Result nfcGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out)
Only available with [4.0.0+].
Result nfcIsNfcEnabled(bool *out)
This uses nfc:*.
Result nfpSetAll(const NfcDeviceHandle *handle, const NfpData *nfp_data)
Only available with NfpServiceType_Debug.
Result nfpGetAll(const NfcDeviceHandle *handle, NfpData *out)
Only available with NfpServiceType_Debug.
Service * nfcMfGetServiceSession_Interface(void)
Gets the Service object for the interface from nfc:mf:u.
Kernel-mode event structure.
Definition event.h:13
Definition mii.h:62
Definition mii.h:126
Definition mii.h:116
Definition mii.h:121
Nfc/Nfp DeviceHandle.
Definition nfc.h:257
Definition nfc.h:238
Definition nfc.h:232
Definition nfc.h:244
Definition nfc.h:251
Definition nfc.h:224
u8 unknown
Usually 1.
Definition nfc.h:226
Definition nfc.h:136
NfcTagUid uid
UUID.
Definition nfc.h:137
u32 tag_type
NfcTagType
Definition nfc.h:139
u32 protocol
NfcProtocol
Definition nfc.h:138
Definition nfc.h:123
u8 uid_length
UUID length.
Definition nfc.h:125
Definition nfc.h:181
Definition nfc.h:143
Definition nfc.h:191
u8 application_area_version
NfpApplicationAreaVersion
Definition nfc.h:218
u8 unknown1
Normally zero.
Definition nfc.h:209
u16 mii_v3_crc16
CRC16 of Ver3StoreData.
Definition nfc.h:204
NfpDate first_write_date
Set when the amiibo is first written to.
Definition nfc.h:206
u8 flags
NfpAmiiboFlag
Definition nfc.h:216
u64 application_id
Modified application ID (Application ID & 0xFFFFFFFF0FFFFFFF | 0x30000000)
Definition nfc.h:213
u8 font_region
Font region.
Definition nfc.h:208
u32 crc32_1
CRC32 of some internal 8-byte data.
Definition nfc.h:195
u16 tag_write_counter
Incremented every tag write.
Definition nfc.h:194
NfpDate last_write_date
Updated every write.
Definition nfc.h:197
u32 access_id
Application area access ID.
Definition nfc.h:214
u16 version
Version.
Definition nfc.h:199
u32 application_area_size
Size of the application area.
Definition nfc.h:200
u8 tag_magic
Tag magic (always 0xA5: https://www.3dbrew.org/wiki/Amiibo#Page_layout).
Definition nfc.h:192
u32 crc32_2
CRC32 of Ver3StoreData + application_id_byte + unknown1 + StoreDataExtension + unknown2 (0x7E bytes t...
Definition nfc.h:210
u16 write_counter
Incremented every write, until it maxes out at 0xFFFF.
Definition nfc.h:198
MiiNfpStoreDataExtension mii_store_data_extension
StoreDataExtension.
Definition nfc.h:205
u8 application_id_byte
Application ID byte ((Application ID >> 28) & 0xFF)
Definition nfc.h:219
MiiVer3StoreData mii_v3
Ver3StoreData (Mii format used in 3DS).
Definition nfc.h:202
u8 tag_type
NfcTagType
Definition nfc.h:217
Definition nfc.h:117
Definition nfc.h:151
u16 numbering_id
Model number.
Definition nfc.h:160
u8 series_id
Series.
Definition nfc.h:159
u8 nfp_type
Figure type.
Definition nfc.h:161
Definition nfc.h:173
Definition nfc.h:165
Definition nfc.h:129
NfcTagUid uid
UUID.
Definition nfc.h:130
u32 protocol
NfcProtocol
Definition nfc.h:131
u32 tag_type
NfcTagType
Definition nfc.h:132
Service object structure.
Definition service.h:14
#define BIT(n)
Creates a bitmask from a bit number.
Definition types.h:54
uint64_t u64
64-bit unsigned integer.
Definition types.h:22
uint8_t u8
8-bit unsigned integer.
Definition types.h:19
#define NX_PACKED
Packs a struct so that it won't include padding bytes.
Definition types.h:63
uint16_t u16
16-bit unsigned integer.
Definition types.h:20
u32 Result
Function error code result type.
Definition types.h:44
int32_t s32
32-bit signed integer.
Definition types.h:27
uint32_t u32
32-bit unsigned integer.
Definition types.h:21