NdsHeader

NdsHeader is a library that can read and verify certain portions of the headers on Nintendo DS roms. It aims to provide these facilities:

  • CRC checking (data integrity verification)
  • Encryption/Decryption support
  • Filesystem Extraction
  • Header information (Codes, Titles, Banners, Icons)

The output for Nintendo's Touch! Kirby is presented below. Note that banner title's are stored in unicode, and decyphered using python's native unicode support. Upper ascii works, too (like the accented 'e' in Pokémon or the titles of french games). The only thing that is not implemented is the Segment3 CRC code. The writers of NDStool claim that Nintendo is using ccitt instead of crc16, but I am unsure why. I haven't been able to dump (or find a dump of) a rom that actually checksums using ccitt to the magic number in NDStool, so I'm putting this feature on hold until I figure out it's usefulness.

Header Information:
0x00    Game title                      TOUCH!KIRBY
0x0C    Game code                       ATKJ (NTR-ATKJ-JPN)
0x10    Maker code                      01 (Nintendo)
0x12    Unit code                       0x00
0x13    Device type                     0x00
0x14    Device capacity                 0x09 (512 Mbit)
0x15    Reserved 1                      000000000000000000
0x1E    ROM version                     0x00
0x1F    Reserved 2                      0x00
0x20    ARM9 ROM offset                 0x4000
0x24    ARM9 entry address              0x2000800
0x28    ARM9 RAM address                0x2000000
0x2C    ARM9 code size                  0xD66F8
0x30    ARM7 ROM offset                 0x1B0800
0x34    ARM7 entry address              0x2380000
0x38    ARM7 RAM address                0x2380000
0x3C    ARM7 code size                  0x2352C
0x40    File name table offset          0x1D3E00
0x44    File name table size            0xB960
0x48    FAT offset                      0x1DF800
0x4C    FAT size                        0x4508
0x50    ARM9 overlay offset             0xDA800
0x54    ARM9 overlay size               0x120
0x58    ARM7 overlay offset             0x00
0x5C    ARM7 overlay size               0x00
0x60    ROM control info 1              0x00586000
0x64    ROM control info 2              0x001808F8
0x6E    ROM control info 3              0x051E
0x68    Icon/Title offset               0x1E3E00
0x6C    Secure area CRC                 0x1EE7 (OK, decrypted)
0x70    ARM9 ?                          0x02000A10
0x74    ARM7 ?                          0x02380118
0x78    Magic 1                         0x00000000
0x7C    Magic 2                         0x00000000
0x80    Application end offset          0x032B7960
0x84    ROM header size                 0x00004000
0x15C   Logo CRC                        0xCF56 (OK)
0x15E   Header CRC                      0x4EA8 (OK)

Banner CRC:                             0x5257 (OK)
Japanese banner text, line 1:           タッチ!カービィ
Japanese banner text, line 2:           Nintendo

ARM9 footer found.

Security data CRC (0x1000-0x2FFF)       0x6FFF
Segment3 CRC (0x3000-0x3FFF)            (NYI)