Swapdoodle

Revision as of 21:15, 4 January 2025 by DaniElectra (talk | contribs) (ā†’ā€ŽBPK1: Fix typos)
(diff) ā† Older revision | Latest revision (diff) | Newer revision ā†’ (diff)

Swapdoodle is the successor of the Swapnote application that allows you to send doodles to friends using SpotPass.

Credits for Miles (with the BPK1 structures) and MrNbaYoh (with the custom CRC32 checksum) for providing information!

SpotPass usageEdit

Currently, only these SpotPass endpoints are known to exist:

  • https://npdl.cdn.nintendowifi.net/p01/nsa/<regionID>/RNG_LS1/dstsetting LZ11 compressed BPK1 structure
  • https://npdl.cdn.nintendowifi.net/p01/nsa/<regionID>/RNG_EC1/x.dlp BPK1 structure with all game lessons (x = 1, 2 or 3)
  • https://npdl.cdn.nintendowifi.net/p01/nsa/<regionID>/RNG_MD1/dstdatList.bin BPK1 structure with game metadata
  • https://npdl.cdn.nintendowifi.net/p01/nsa/<regionID>/RNG_NTX/<language>/ntx For game notifications (x = 1 or 2)

Where regionID goes the value from the below table.

Region ID
USA 0hFlOFo7pNTU2dyE
EUR 3vveLadT8H6xKkQH

Also, the game uses Hpp[1] servers for posting doodles and making status updates.

BPK1Edit

The BPK1 structure is used in almost all game data files. Some of the files that use this structure are either LZ11 or LZ10 compressed (like the ones used for doodles and stationery).

The structure starts with a BPK1 header, followed by all of its block headers, which can share names between each other. The headers are the followed by each block's data, which can hold any data (including another BPK1 structure).

All of the structure entries are stored as little-endian data.

Offset Size Description
0x0 0x40 BPK1 header
0x40 Block header
Additional block headers
Block data
Additional blocks data

BPK1 headerEdit

Offset Size Description
0x0 0x4 Header magic (BPK1)
0x4 0x4 Number of blocks
0x8 0x4 Maximum block name length?
0xC 0x4 Structure length
0x10 0x4 Header length
0x14 0x2C Padding

Block headerEdit

Offset Size Description
0x0 0x4 Block data offset
0x4 0x4 Block size
0x8 0x4 Checksum of block data
0x10 0x8 Block name (if the name is smaller than 0x8, the rest is filled with NULL bytes)

Block checksumEdit

The checksum of each block is calculated as a custom CRC-32 checksum of the block's data:

  • Polynomial: 4C11DB7
  • Initial value: 4C11DB7
  • Output XOR: 0

Stationery blocksEdit

The following blocks are used in the stationery files.

STAHED1Edit

This block holds the stationery file name and 0x79 byte padding.

THUMB2Edit

This block holds the thumbnail of the stationery as a JPEG image.

STBARD1Edit

There are two of these blocks. The first one holds a JPEG of the 2D part of the stationery, and the second one holds the 3D part.

STMASK1Edit

This block holds a 256x256 L4 data of the 3D part of the stationery.