Line 1: |
Line 1: |
| [[Category:File formats]] | | [[Category:File formats]] |
| === Overview === | | === Overview === |
− | 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 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. |
| | | |
| An example .CIA can be downloaded here [http://www.multiupload.com/5CJ2QQPOWE] Credit: [[User:Jl12|Jl12]]. It includes a .cia file, the .cia file in its extracted form, a screenshot of the application working and some information given by the 3DS. | | An example .CIA can be downloaded here [http://www.multiupload.com/5CJ2QQPOWE] Credit: [[User:Jl12|Jl12]]. It includes a .cia file, the .cia file in its extracted form, a screenshot of the application working and some information given by the 3DS. |
Line 48: |
Line 48: |
| | 0x14 | | | 0x14 |
| | 0x04 | | | 0x04 |
− | | Banner size (0 if no banner) | + | | Icon size (0 if no icon) |
| |- | | |- |
| | 0x18 | | | 0x18 |
Line 64: |
Line 64: |
| * TMD file data | | * TMD file data |
| * APP file data | | * APP file data |
− | * banner | + | * Icon |
| The APP data can be either encrypted or cleartext, retail [[Download Play]] CIAs' APP data is always encrypted. | | The APP data can be either encrypted or cleartext, retail [[Download Play]] CIAs' APP data is always encrypted. |
| | | |
− | == Banner == | + | == Icon == |
− | The banner starts with a 0xF0 large data block, whose purpose is currently unknown. | + | The actual [[SMDH|icon]] is located at offset 0x400 in the icon data. |
− | | |
− | Then at offset 0x400 into the banner section is the actual banner (or ICN file), 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"
| |
− | |-
| |
− | ! START
| |
− | ! SIZE
| |
− | ! DESCRIPTION
| |
− | |-
| |
− | | 0x00
| |
− | | 0x04
| |
− | | Magic: 'SMDH'
| |
− | |- | |
− | | 0x04
| |
− | | 0x04
| |
− | | Reserved = 0
| |
− | |}
| |
− | This header is immediately followed by meta-data:
| |
− | | |
− | === Application Titles ===
| |
− | | |
− | {| class="wikitable" border="1"
| |
− | |-
| |
− | ! START
| |
− | ! SIZE
| |
− | ! DESCRIPTION
| |
− | |-
| |
− | | 0x00
| |
− | | 0x80
| |
− | | Short Description
| |
− | |-
| |
− | | 0x80
| |
− | | 0x100
| |
− | | Long Description
| |
− | |-
| |
− | | 0x180
| |
− | | 0x80
| |
− | | Publisher
| |
− | |}
| |
− | | |
− | All encoded in UTF-16.
| |
− | This order will repeat 11 times (each block for different language supported).
| |
− | | |
− | The languages by order of appearance:
| |
− | | |
− | * 1st: Japanese title name
| |
− | * 2nd: English title name
| |
− | * 3rd: French title name
| |
− | * 4th: German title name
| |
− | * 5th: Italian title name
| |
− | * 6th: Spanish title name
| |
− | * 7th: Chinese title name
| |
− | * 8th: Korean title name
| |
− | * 9th: Dutch title name
| |
− | * 10th: Portuguese title name
| |
− | * 11th: Russian title name
| |
− | | |
− | === Icons ===
| |
− | | |
− | At offset 0x2400 into the banner (inside the Banner's meta-data) to the end, there are two icons:
| |
− | * Small- 24x24 (shown on top screen when pausing the app)
| |
− | * Large - 48x48 icon (the genral icon).
| |
− | | |
− | Both of the icons are encoded in RGB565 meaning 16bpp.
| |
− | | |
− | Don't be fooled though. The icons in offset 0x2400 in the banner (inside the Banner's meta-data) are not the actual icons the 3DS uses according to various tests!
| |
− | | |
− | Although both icons are known to be RGB565, developers have the option of encoding icons (and banners) with the following encodings :
| |
− | | |
− | * RGBA8
| |
− | * RGB8
| |
− | * RGBA5551
| |
− | * RGB565
| |
− | * RGBA4
| |
− | * LA8
| |
− | * HILO8
| |
− | * L8
| |
− | * A8
| |
− | * LA4
| |
− | * L4
| |
− | * ETC1
| |
− | * ETC1A4
| |
− | | |
− | This does not necessarily mean the other encodings will be used, it is just that those are the options when compiling. Like we've seen with Super Mario 3D Land Nintendo has changed save file encryption, and likewise they can encode icons and banners differently ''should they choose to''. Currently we've seen just RGB565 so don't be fooled if an icon doesn't show up right! It is probably one of these formats above. Although we will probably not see other formats used for a while it's nice to know they have an opportunity to change.
| |
− | | |
− | There's a header of 0x40 bytes and then comes the raw data.
| |
− | | |
− | The data is encoded in tiles (starting from size 8x8, continuing recursively).
| |
− | | |
− | If the buffer is like this:
| |
− | | |
− | {| class="wikitable" border="1"
| |
− | |-
| |
− | ! 0
| |
− | ! 1
| |
− | ! 2
| |
− | ! 3
| |
− | ! 4
| |
− | ! 5
| |
− | ! 6
| |
− | ! 7
| |
− | ! 8
| |
− | ! 9
| |
− | ! 10
| |
− | ! 11
| |
− | ! 12
| |
− | ! 13
| |
− | ! 14
| |
− | ! 15
| |
− | ! 16
| |
− | |-
| |
− | |}
| |
− | | |
− | Then the image would look like this:
| |
− | | |
− | {| class="wikitable" border="1"
| |
− | |-
| |
− | ! x=0
| |
− | ! x=1
| |
− | ! x=2
| |
− | ! x=3
| |
− | ! x=4
| |
− | |-
| |
− | | 0
| |
− | | 1
| |
− | | 4
| |
− | | 5
| |
− | | 16
| |
− | |-
| |
− | | 2
| |
− | | 3
| |
− | | 6
| |
− | | 7
| |
− | | ...
| |
− | |-
| |
− | | 8
| |
− | | 9
| |
− | | 12
| |
− | | 13
| |
− | |-
| |
− | | 10
| |
− | | 11
| |
− | | 14
| |
− | | 15
| |
− | |-
| |
− | |}
| |