Difference between revisions of "CIA"

From 3dbrew
Jump to navigation Jump to search
(added banner info)
Line 61: Line 61:
  
 
== Banner ==
 
== Banner ==
The banner starts with a 0xF0 large data block, whose purpose is currently unknown. Then at offset 0x400 into the banner section is the actual banner, which contains information about the creator and title of the app (you can see them in the system settings):
+
The banner starts with a 0xF0 large data block, whose purpose is currently unknown. Then at offset 0x400 into the banner section is the actual banner, which contains information about the creator, the first title and the second title (you can see them in the system settings):
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 76: Line 76:
 
|  Reserved = 0
 
|  Reserved = 0
 
|}
 
|}
 +
This small 'header' is immediately followed by a 0x80 large block for the application name (first title) and then a 0x100 bytes large block for the second title (this title will be shown in the system settings). After that there's alway the same order:
 +
* publisher name (aligned to 0x80 bytes)
 +
* first title (aligned to 0x80 bytes)
 +
* second title (aligned to 0x100 bytes)
 +
This order will repeat 10 times, thus there's a 0x1660 bytes large space for these information.

Revision as of 21:32, 11 November 2011

Overview

CIA stands for CTR Importable Archive. These files contain a compiled application which can be installed on CTR NAND, TWL NAND (part of the NAND used by DSi applications) and on the SD card. CIA files can be created with the Nintendo 3DS SDK and installed on the 3DS test units by the Dev Menu.

Format

The CIA format based on WAD format, so the structure is very similar to the WAD structure.

The file is represented in little-endian.

The data is aligned in 64 byte blocks (if a content ends at the middle of the block, the next content will begin from a new block).

CIA Header

This is a 32 bytes long header (8 x uint32).

START SIZE DESCRIPTION
0x00 0x04 Archive Header Size (=0x2020 bytes) (Starts with 0x80 @ offset 0x0020)
0x04 0x04 Reserved = 0
0x08 0x04 Certificate chain size
0x0C 0x04 Ticket size
0x10 0x04 TMD file size
0x14 0x04 Banner size (0 if no banner)
0x18 0x04 APP file size
0x1C 0x04 0x80000000

The order of the sections in the header also is the order of them in the CIA file:

  • certificate chain
  • Ticket
  • TMD file data
  • APP file data
  • banner

The data of the files is decrypted.

The banner starts with a 0xF0 large data block, whose purpose is currently unknown. Then at offset 0x400 into the banner section is the actual banner, which contains information about the creator, the first title and the second title (you can see them in the system settings):

START SIZE DESCRIPTION
0x00 0x04 Magic: 'SMDH'
0x05 0x04 Reserved = 0

This small 'header' is immediately followed by a 0x80 large block for the application name (first title) and then a 0x100 bytes large block for the second title (this title will be shown in the system settings). After that there's alway the same order:

  • publisher name (aligned to 0x80 bytes)
  • first title (aligned to 0x80 bytes)
  • second title (aligned to 0x100 bytes)

This order will repeat 10 times, thus there's a 0x1660 bytes large space for these information.