Line 3:
Line 3:
On New3DS NFC module uses the [[I2C_Registers|NFC]] hardware via the [[I2C_Services|i2c::NFC]] and [[GPIO_Services|gpio:NFC]] services. On Old3DS NFC module communicates with a NFC peripheral via IR with the IRUSER service.
On New3DS NFC module uses the [[I2C_Registers|NFC]] hardware via the [[I2C_Services|i2c::NFC]] and [[GPIO_Services|gpio:NFC]] services. On Old3DS NFC module communicates with a NFC peripheral via IR with the IRUSER service.
−
A total of 6 sessions can be open simultaneously for all of these services combined.
+
Only 1 session can be open for all of these services combined. Commands for each service are handled by the main-thread.
=NFC services=
=NFC services=
Line 26:
Line 26:
| u32 unknownA, u32 unknownB, u32 unknownC, u32 (sizeof(*buffer) << 14 <nowiki>|</nowiki> 0x402), void * buffer
| u32 unknownA, u32 unknownB, u32 unknownC, u32 (sizeof(*buffer) << 14 <nowiki>|</nowiki> 0x402), void * buffer
| s32 result
| s32 result
−
|
+
| Used when resetting an amiibo from amiibo Settings.
|-
|-
| 0x04020000
| 0x04020000
| [[9.3.0-21|9.3.0-X]]
| [[9.3.0-21|9.3.0-X]]
−
| ???
+
| [[NFCM:GetAdminInfo|GetAdminInfo]]
−
| void
+
|
−
| s32 result, u32 unknownA[16]
+
|
−
| Output seems to be a struct
+
|
|-
|-
| 0x04030000
| 0x04030000
| [[9.3.0-21|9.3.0-X]]
| [[9.3.0-21|9.3.0-X]]
−
| ???
+
| [[NFCM:GetEmptyRegisterInfo|GetEmptyRegisterInfo]]
−
| void
+
|
−
| s32 result, u32 unknownA[41]
+
|
|
|
|-
|-
| 0x04040A40
| 0x04040A40
| [[9.3.0-21|9.3.0-X]]
| [[9.3.0-21|9.3.0-X]]
−
| [[NFCM:SetAmiiboSettings|SetAmiiboSettings]]
+
| [[NFCM:SetRegisterInfo|SetRegisterInfo]]
−
|
+
|
−
|
+
|
+
|
+
|-
+
| 0x04050000
+
| [[9.3.0-21|9.3.0-X]]
+
| [[NFCM:DeleteRegisterInfo|DeleteRegisterInfo]]
+
|
+
|
|
|
|-
|-
| 0x04060000
| 0x04060000
| [[9.3.0-21|9.3.0-X]]
| [[9.3.0-21|9.3.0-X]]
−
| ???
+
| [[NFCM:DeleteApplicationArea|DeleteApplicationArea]]
−
| void
+
|
−
| s32 result
+
|
|
|
|-
|-
| 0x04070000
| 0x04070000
| [[9.3.0-21|9.3.0-X]]
| [[9.3.0-21|9.3.0-X]]
−
| ???
+
| [[NFCM:ExistsApplicationArea|ExistsApplicationArea]]
−
| void
+
|
−
| s32 result, u32 unknownA
+
|
|
|
|-
|-
Line 102:
Line 109:
==NFC development service "nfc:dev"==
==NFC development service "nfc:dev"==
−
This service seems to be intended for use only on dev-units(or at least some of the command(s)).
+
{| class="wikitable" border="1"
+
|-
+
! Command header
+
! Available since system-version
+
! Description
+
|-
+
| 0x00110100
+
|
+
| [[NFCDEV:ReadRawPages|ReadRawPages]]
+
|-
+
| 0x001200C0
+
|
+
| [[NFCDEV:WriteRawPage|WriteRawPage]]
+
|}
+
+
Some of these commands seems to be intended for use only on dev-units.
Unlike the New3DS NFC-module, at least some of these commands are stubbed in the Old3DS NFC-module(only returns an error).
Unlike the New3DS NFC-module, at least some of these commands are stubbed in the Old3DS NFC-module(only returns an error).
Line 128:
Line 150:
|
|
| ?
| ?
+
|-
+
| 0x000500C2
+
|
+
| [[NFCP:SendTagCommand|SendTagCommand]]
+
|-
+
| 0x00060000
+
|
+
| GetTagInfo
|-
|-
| 0x00070000
| 0x00070000
Line 134:
Line 164:
|-
|-
| 0x00080000
| 0x00080000
+
|
+
| Writes a handle to cmdreply[3].
+
|-
+
| 0x00090000
|
|
| Writes a handle to cmdreply[3].
| Writes a handle to cmdreply[3].
Line 140:
Line 174:
|
|
| Unknown. Writes an output value to cmdreply[2].
| Unknown. Writes an output value to cmdreply[2].
+
|-
+
| 0x000B0000
+
|
+
| Unknown. Writes 0x60-bytes of output starting at cmdreply[2]. u16 +0 is the size of the data at +4, +2 is not initialized, u8 +3 is loaded from state, u32 +0x2C is loaded from state, and the data at +4 with the previously mentioned size is copied from state.
+
|-
+
| 0x000C0040
+
|
+
| (u32 outputsize) Writes output to static_buf_id=0, outputsize 1 is used when it's >=1.
+
|-
+
| 0x000D0040
+
|
+
| (u32 outputsize) Writes output to static_buf_id=0, outputsize 1 is used when it's >=1.
+
|-
+
| 0x000E0080
+
|
+
| (u8 unk, u32 outputsize) Writes output to static_buf_id=0, outputsize 2 is used when it's >=2.
+
|-
+
| 0x000F0040
+
|
+
| (u32 outputsize) Writes output to static_buf_id=0, outputsize 2 is used when it's >=2.
+
|-
+
| 0x00100000
+
|
+
| Unknown.
+
|-
+
| 0x00110000
+
|
+
| Unknown.
+
|-
+
| 0x00120000
+
|
+
| Unknown. Writes an output u32 to cmdreply[2].
+
|-
+
| 0x00130000
+
|
+
| Unknown. Writes an output u32 to cmdreply[2].
|}
|}
Line 156:
Line 226:
! Available since system-version
! Available since system-version
! Description
! Description
+
|-
+
| 0x00130102
+
|
+
| [[NFCS:SendTagCommand|SendTagCommand]]
|-
|-
| 0x00230000
| 0x00230000
Line 334:
Line 408:
| 0x00170000
| 0x00170000
|
|
−
| [[NFC:GetAmiiboSettings|GetAmiiboSettings]]
+
| [[NFC:GetRegisterInfo|GetRegisterInfo]]
|
|
|
|
Line 341:
Line 415:
| 0x00180000
| 0x00180000
|
|
−
| [[NFC:GetAmiiboConfig|GetAmiiboConfig]]
+
| [[NFC:GetCommonInfo|GetCommonInfo]]
|
|
|
|
Line 362:
Line 436:
| 0x001B0000
| 0x001B0000
|
|
−
|
+
| [[NFC:GetModelInfo|GetModelInfo]]
−
| None
+
|
−
| 0x36-byte output structure starting at cmdreply[2].
+
|
|
|
|-
|-
Line 390:
Line 464:
| 0x001F0080
| 0x001F0080
| [[10.0.0-27|10.0.0-X]]
| [[10.0.0-27|10.0.0-X]]
−
| ?
+
| [[NFC:StartOtherTagScanning|StartOtherTagScanning]]
−
| u16, u32
+
|
|
|
| Used by JPN eShop app "Megami Meguri".
| Used by JPN eShop app "Megami Meguri".
Line 397:
Line 471:
| 0x00200102
| 0x00200102
| [[10.0.0-27|10.0.0-X]]
| [[10.0.0-27|10.0.0-X]]
−
| ?
+
| [[NFC:SendTagCommand|SendTagCommand]]
−
| [1]=u32_inputsize, [2]=u32_outputsize, [3]=u32_unk1, [4]=u32_unk2, [5]={static ipc buf translate-header with static_buf_id=0}, [6]=inbufaddr
+
|
−
| [2]=u32_actual_output_size, 3={static ipc buf translate-header with static_buf_id=0}, 4=outbufaddr
+
|
−
| outputsize value 0x800 will be used when it's >=0x800.
+
|
|-
|-
| 0x00210000
| 0x00210000
Line 407:
Line 481:
|
|
|
|
−
| Used by JPN eShop app "Megami Meguri".
+
| Used by JPN eShop app "Megami Meguri". This can only be used when [[NFC:Initialize|initialized]] with type3, and when the [[NFC:GetTagState|TagState]] is 3.
|-
|-
| 0x00220000
| 0x00220000
Line 414:
Line 488:
|
|
|
|
−
|
+
| This can only be used when [[NFC:Initialize|initialized]] with type3, and when the [[NFC:GetTagState|TagState]] is 3.
|}
|}
Line 549:
Line 623:
| 0xc8a17600
| 0xc8a17600
| The current NFC tag [[NFC:GetTagState|state]], or other NFC state, is invalid with the NFC command which was used.
| The current NFC tag [[NFC:GetTagState|state]], or other NFC state, is invalid with the NFC command which was used.
+
|}
+
+
=Data Types=
+
+
==AdminInfo==
+
{| class="wikitable" border="1"
+
|-
+
! Offset
+
! Size
+
! Description
+
|-
+
| 0x00
+
| 0x08
+
| Program ID (From the Wii U, 3DS or Switch title who created the application area)
+
|-
+
| 0x08
+
| 0x04
+
| [[Amiibo#Games_using_Amiibo_AppData|App ID]]
+
|-
+
| 0x0C
+
| 0x02
+
| CRC32 Change Counter
+
|-
+
| 0x0E
+
| 0x01
+
| Flags (bit0 = amiibo initialized, bit1 = has application area, bit2/bit3 unknown)
+
|-
+
| 0x0F
+
| 0x01
+
| Unknown, hardcoded to 0x2
+
|-
+
| 0x10
+
| 0x1
+
| 0xFF if there is no application area, related to the console of the application area game otherwise (0/2 = 3DS, 1 = Wii U, 3 = Switch)
+
|-
+
| 0x11
+
| 0x07
+
| Padding
+
|-
+
| 0x18
+
| 0x28
+
| Reserved
+
|}
+
+
==RegisterInfo==
+
{| class="wikitable" border="1"
+
|-
+
! Offset
+
! Size
+
! Description
+
|-
+
| 0x00
+
| 0x60
+
| [[Mii_Maker#Mii_QR_Code_format|Exported Mii Data]] (minus the AES-CCM used in the linked format)
+
|-
+
| 0x60
+
| 0x16
+
| Amiibo Name (NUL-Terminated)
+
|-
+
| 0x76
+
| 0x01
+
| Flags (bit0 = amiibo initialized, bit1 = has application area)
+
|-
+
| 0x77
+
| 0x01
+
| Font Region
+
|-
+
| 0x78
+
| 0x04
+
| Creation [[#Date|Date]]
+
|-
+
| 0x7C
+
| 0x2C
+
| Reserved
+
|}
+
+
This data originates from the [[Amiibo]] settings data stored under the encrypted NFC data.
+
+
==CommonInfo==
+
{| class="wikitable" border="1"
+
|-
+
! Offset
+
! Size
+
! Description
+
|-
+
| 0x00
+
| 0x04
+
| Last Write [[#Date|Date]]
+
|-
+
| 0x04
+
| 0x02
+
| Write Counter
+
|-
+
| 0x06
+
| 0x02
+
| Character ID
+
|-
+
| 0x08
+
| 0x01
+
| Character Variant
+
|-
+
| 0x09
+
| 0x01
+
| Amiibo Series
+
|-
+
| 0x0A
+
| 0x02
+
| Model Number
+
|-
+
| 0x0C
+
| 0x01
+
| Amiibo Type
+
|-
+
| 0x0D
+
| 0x01
+
| Version
+
|-
+
| 0x0E
+
| 0x02
+
| Application Area Size (hardcoded to 0xD8)
+
|-
+
| 0x10
+
| 0x30
+
| Reserved
+
|}
+
+
This data originates from the [[Amiibo]] NFC data.
+
+
==ModelInfo==
+
{| class="wikitable" border="1"
+
|-
+
! Offset
+
! Size
+
! Description
+
|-
+
| 0x00
+
| 0x02
+
| Character ID
+
|-
+
| 0x02
+
| 0x01
+
| Character Variant
+
|-
+
| 0x03
+
| 0x01
+
| Amiibo Series
+
|-
+
| 0x04
+
| 0x02
+
| Model Number
+
|-
+
| 0x06
+
| 0x01
+
| Amiibo Type
+
|-
+
| 0x07
+
| 0x01
+
| Version
+
|-
+
| 0x08
+
| 0x2E
+
| Reserved
+
|}
+
+
This data originates from the [[Amiibo]] NFC data.
+
+
==Date==
+
+
{| class="wikitable" border="1"
+
|-
+
! Offset
+
! Size
+
! Description
+
|-
+
| 0x00
+
| 0x02
+
| Year
+
|-
+
| 0x02
+
| 0x01
+
| Month
+
|-
+
| 0x03
+
| 0x01
+
| Day
|}
|}