Difference between revisions of "CIA"

From 3dbrew
Jump to navigation Jump to search
Line 1: Line 1:
 
=== Overview ===
 
=== Overview ===
CIA stands for '''C'''TR '''I'''mportable '''A'''rchieve. 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 channel.  
+
CIA stands for '''C'''TR '''I'''mportable '''A'''rchive. 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 channel.  
  
 
=== Format ===
 
=== Format ===
Line 6: Line 6:
 
The file is represented in little-endian.
 
The file is represented in little-endian.
 
== CIA Header ==
 
== CIA Header ==
 +
 +
This is a 32 bytes long header (8 x uint32).
 +
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
 
!  START
 
!  START
!  END
 
 
!  SIZE
 
!  SIZE
 
!  DESCRIPTION
 
!  DESCRIPTION
 
|-
 
|-
 
|  0x00
 
|  0x00
|  0x03
 
 
|  0x04  
 
|  0x04  
constant header size = 0x2020 bytes
+
Archive Header Size (=0x2020 bytes) (Starts with 0x80 @ offset 0x0020)
 
|-
 
|-
 
|  0x04
 
|  0x04
|  0x07
 
 
|  0x04
 
|  0x04
 
|  Reserved = 0
 
|  Reserved = 0
 
|-
 
|-
 
|  0x08     
 
|  0x08     
|  0x0B 
 
 
|  0x04
 
|  0x04
 
|  Certificate chain size   
 
|  Certificate chain size   
 
|-
 
|-
 
|  0x0C       
 
|  0x0C       
|  0x0F 
 
 
|  0x04
 
|  0x04
 
|  unknown (Ticket size?)  
 
|  unknown (Ticket size?)  
 
|-
 
|-
 
|  0x10     
 
|  0x10     
|  0x13 
 
 
|  0x04
 
|  0x04
 
|  TMD file size
 
|  TMD file size
 
|-
 
|-
 
|  0x14     
 
|  0x14     
|  0x17 
 
 
|  0x04
 
|  0x04
 
|  Banner size (0 if no banner)
 
|  Banner size (0 if no banner)
 
|-
 
|-
 
|  0x18     
 
|  0x18     
0x18 
+
0x04
|  0x01
 
 
|  0 (reserved, flag?)
 
|  0 (reserved, flag?)
 
|-
 
|-
|  0x19   
+
|  0x1C
|  0x1C  
 
 
|  0x04
 
|  0x04
 
|  APP file size
 
|  APP file size
|-
 
|  0x1D   
 
|  0x20 
 
|  0x04
 
|  unknown (0x80000000)
 
 
|}
 
|}
 
The order of the sections in the header also is the order of them in the CIA file:
 
The order of the sections in the header also is the order of them in the CIA file:

Revision as of 20:56, 10 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 channel.

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.

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 unknown (Ticket size?)
0x10 0x04 TMD file size
0x14 0x04 Banner size (0 if no banner)
0x18 0x04 0 (reserved, flag?)
0x1C 0x04 APP file size

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

The data of the files is decrypted.