CXI: Difference between revisions
Add category 'File formats' |
m Redirected page to NCCH#CXI |
||
(15 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
#REDIRECT [[NCCH#CXI]] | |||
[[Category:File formats]] | [[Category:File formats]] | ||
The following text tries to document the structure of the CTR Executable Image (CXI) format. | The following text tries to document the structure of the CTR Executable Image (CXI) format. | ||
== Overview == | |||
The CXI format is a specialization of an NCCH container. Generally the CXI will contain executable code, which runs on a single ARM11 core. It can communicate through SVC calls with the other ARM11 core running the 'system' program code. For reasons of clarity, the ARM11 cores will sometimes be called the 'appcore' and 'syscore' respectively. | |||
The CXI | The CXI format is structured in the following order: | ||
* first a NCCH header, | |||
* first | |||
* followed by an extended header, | * followed by an extended header, | ||
* followed by a plain binary region, | * followed by a plain binary region, | ||
* followed by an embedded executable filesystem (ExeFS), | * followed by an embedded executable filesystem ([[ExeFS]]) - (contains ARM11 code, Home menu icn/bnr and logo), | ||
* and finally followed by a read-only filesystem (RomFS). | * and finally followed by a read-only filesystem ([[RomFS]]) - (Used for external file storage). | ||
There are specializations of NCCH containers which are not executable, but are used in conjunction with CXI NCCH files. For instance the DLP Child Container and the Home Menu App Manual. (There is a system update NCCH which follows this format, but is used by the 3DS rather than the Application NCCH, and only works when embedded in the [[CCI]] format because the nVer is kept in the header of retail [[CCI]] files instead of the application NCCH) | |||
Non-Executable NCCH files are structured in the following order: | |||
* first a NCCH header, | |||
* followed by a read-only filesystem ([[RomFS]]) | |||
Non-Executable NCCH file examples(Includes Decrypted [[RomFS]]): | |||
[http://depositfiles.com/files/d8ej64571 DLPChildContainer] | |||
[http://depositfiles.com/files/en9g37b0j Manual] | |||
The extended header contains additional information regarding access control. | The extended header contains additional information regarding access control. | ||
The plain binary region is an area specifically stored in plaintext, mostly containing SDK library strings for identification. | The plain binary region is an area specifically stored in plaintext, mostly containing SDK library strings for identification. | ||
The extended header, the ExeFS and the RomFS are encrypted using 128-bit AES CTR. | The extended header, the [[ExeFS]] and the RomFS are encrypted using 128-bit AES CTR. | ||
By default encrypted regions are compressed with an LZ77 variant, then encrypted. The spec allows for both unencrypted and uncompressed regions to exist. System titles expect a fixed system key. | By default encrypted regions are compressed with an LZ77 variant, then encrypted. The spec allows for both unencrypted and uncompressed regions to exist. System titles expect a fixed system key. | ||
== NCCH Header == | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 134: | Line 144: | ||
| 0x1C0 | | 0x1C0 | ||
| 0x20 | | 0x20 | ||
| ExeFS superblock hash | | ExeFS superblock hash, over the cleartext ExeFS | ||
|- | |- | ||
| 0x1E0 | | 0x1E0 | ||
Line 141: | Line 151: | ||
|} | |} | ||
=== NCCH header example for Lego Starwars III === | |||
Signature: 720FF8F83F2A1E998322A026D1434165 | Signature: 720FF8F83F2A1E998322A026D1434165 | ||
ED19642ABC1CB2722135AA202BEAD60A | ED19642ABC1CB2722135AA202BEAD60A | ||
Line 184: | Line 194: | ||
Note: Offsets and sizes in media units have been converted to byte sizes. | Note: Offsets and sizes in media units have been converted to byte sizes. | ||
=== Plain region example for Lego Starwars III === | |||
0004a00: 5b 53 44 4b 2b 4e 49 4e 54 45 4e 44 4f 3a 43 54 [SDK+NINTENDO:CT [SDK+NINTENDO:CTR_SDK-0_14_23_200_none] | 0004a00: 5b 53 44 4b 2b 4e 49 4e 54 45 4e 44 4f 3a 43 54 [SDK+NINTENDO:CT [SDK+NINTENDO:CTR_SDK-0_14_23_200_none] | ||
0004a10: 52 5f 53 44 4b 2d 30 5f 31 34 5f 32 33 5f 32 30 R_SDK-0_14_23_20 | 0004a10: 52 5f 53 44 4b 2d 30 5f 31 34 5f 32 33 5f 32 30 R_SDK-0_14_23_20 | ||
Line 203: | Line 213: | ||
A tool for parsing this format is available [http://github.com/3dshax/ctr/tree/master/ctrtool here] | A tool for parsing this format is available [http://github.com/3dshax/ctr/tree/master/ctrtool here] | ||
=== Example dependency list from the extended header === | |||
00850 41 50 54 3A 55 00 00 00 24 68 69 6F 46 49 4F 00 APT:U...$hioFIO. | 00850 41 50 54 3A 55 00 00 00 24 68 69 6F 46 49 4F 00 APT:U...$hioFIO. | ||
00860 24 68 6F 73 74 69 6F 30 24 68 6F 73 74 69 6F 31 $hostio0$hostio1 | 00860 24 68 6F 73 74 69 6F 30 24 68 6F 73 74 69 6F 31 $hostio0$hostio1 | ||
Line 227: | Line 237: | ||
009F0 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 02 . ............. | 009F0 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 02 . ............. | ||
00A00 5B 53 44 4B 2B 4E 49 4E 54 45 4E 44 4F 3A 43 54 [SDK+NINTENDO:CT | 00A00 5B 53 44 4B 2B 4E 49 4E 54 45 4E 44 4F 3A 43 54 [SDK+NINTENDO:CT | ||
=== Extended Header === | |||
'''NOTE: AFTER DECRYPTION''' | |||
{| class="wikitable" border="1" | |||
|- | |||
! OFFSET | |||
! SIZE | |||
! DESCRIPTION | |||
|- | |||
| 0x399 | |||
| 1 | |||
| Memory type (00 = Base, 01 = Application, 02 = System) | |||
|} |