- Joined
- Nov 13, 2008
- Messages
- 1,634
- Reaction score
- 145
- Trophies
- 1
- Age
- 31
- Location
- Your house
- Website
- youtek.net
- XP
- 1,635
- Country

This is very interesting. It is kind of a nerd read tho, but still read it up.
Overview
A CXI file contains the 'application' program 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 file format contains application ARM11 code, the menu icon, the menu 3D model, and an embedded read-only (ROM) filesystem for external filestorage. In fact, the application ARM11 code, menu icon, and menu 3D model are embedded into its own filesystem too, called the ExeFS.
More specifically, the CXI file format is structured in the following order:
first an NCCH header,
followed by an extended header,
followed by a plain binary region,
followed by an embedded executable filesystem (ExeFS),
and finally followed by a read-only filesystem (RomFS).
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 extended header, the ExeFS and the RomFS are encrypted using AES CTR.
NCCH Header
NCCH header example for Lego Starwars III
Plain region example for Lego Starwars III
Credit goes to Neimod and all people who worked on this document
http://3dbrew.org/wiki/CXI
Overview
A CXI file contains the 'application' program 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 file format contains application ARM11 code, the menu icon, the menu 3D model, and an embedded read-only (ROM) filesystem for external filestorage. In fact, the application ARM11 code, menu icon, and menu 3D model are embedded into its own filesystem too, called the ExeFS.
More specifically, the CXI file format is structured in the following order:
first an NCCH header,
followed by an extended header,
followed by a plain binary region,
followed by an embedded executable filesystem (ExeFS),
and finally followed by a read-only filesystem (RomFS).
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 extended header, the ExeFS and the RomFS are encrypted using AES CTR.
NCCH Header
Code:
OFFSETÂÂÂÂ SIZEÂÂÂÂ DESCRIPTION
0x000ÂÂÂÂ 0x100ÂÂÂÂ RSA-2048 signature of the NCCH header, using SHA-256.
0x100ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Magic ID, always 'NCCH'
0x104ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Content size, in media units (1 media unit = 0x200 bytes)
0x108ÂÂÂÂ 8ÂÂÂÂÂÂÂÂÂÂÂÂ Partition ID
0x110ÂÂÂÂ 2ÂÂÂÂÂÂÂÂÂÂÂÂ Maker code
0x112ÂÂÂÂ 2ÂÂÂÂÂÂÂÂÂÂÂÂ Version
0x114ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Reserved
0x118ÂÂÂÂ 8ÂÂÂÂÂÂÂÂÂÂÂÂ Program ID
0x120ÂÂÂÂ 1ÂÂÂÂÂÂÂÂÂÂÂÂ Temp flag
0x121ÂÂÂÂ 0x2FÂÂÂÂÂÂÂÂÂÂÂÂ Reserved
0x150ÂÂÂÂ 0x10ÂÂÂÂ Product code
0x160ÂÂÂÂ 0x20ÂÂÂÂ Extended header hash
0x180ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Extended header size
0x184ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Reserved
0x188ÂÂÂÂ 8ÂÂÂÂÂÂÂÂÂÂÂÂ Flags
0x190ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Plain region offset, in media units
0x194ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Plain region size, in media units
0x198ÂÂÂÂ 8ÂÂÂÂÂÂÂÂÂÂÂÂ Reserved
0x1A0ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ ExeFS offset, in media units
0x1A4ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ ExeFS size, in media units
0x1A8ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ ExeFS hash region size, in media units
0x1ACÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Reserved
0x1B0ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ RomFS offset, in media units
0x1B4ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ RomFS size, in media units
0x1B8ÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ RomFS hash region size, in media units
0x1BCÂÂÂÂ 4ÂÂÂÂÂÂÂÂÂÂÂÂ Reserved
0x1C0ÂÂÂÂ 0x20ÂÂÂÂ ExeFS superblock hash
0x1E0ÂÂÂÂ 0x20ÂÂÂÂ RomFS superblock hash
Code:
Signature:ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ720FF8F83F2A1E998322A026D1434165
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂED19642ABC1CB2722135AA202BEAD60A
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ80BCD21C768C597B8268FEF2C64EA710
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ4C9BA5E12CFFBD1D0C619F4EF7B42CA7
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂDD8482CB4EB26720AD66CDA57ABCBCFB
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂD63268A6E2896A59B3B744E39E45B88A
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂABB4C0980ACC6210818DCE6DAC838A10
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ95D0F66B352474D4B3DA4B333F49912D
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ29AF7EA58BC8C890B18C70B7D540A9FB
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂEBE24A5312055617D3353B28C3EB1D17
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ61021BEFF6AD22C384835B40BD44DFAD
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ981F6350F9458B17BCB5F768C92ABC93
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ2BCE9888855A8998F4CDE40C9543514A
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂC57B84EB75A680E7C742632614620D1D
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂA253284DF3DC01091EB3800C36FD62EE
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂBA15340F1FD498FAB67C0302E9CDA397
Magic:ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂNCCH
Content size:ÂÂÂÂÂÂÂÂÂÂ 0x1cfef400
Partition id:ÂÂÂÂÂÂÂÂÂÂ 0004000000038c00
Maker code:ÂÂÂÂÂÂÂÂÂÂÂÂ 3436 ("46")
Version:ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ0002
Program id:ÂÂÂÂÂÂÂÂÂÂÂÂ 0004000000038c00
Temp flag:ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ00
Product code:ÂÂÂÂÂÂÂÂÂÂ CTR-P-ALGP
Extended header hash:ÂÂ 0C27E3C1DE7B2AE2D3114F32A4EEBF46
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ9AFD0CF352C11D4984C2A9F1D2144C63
Extended header size:ÂÂ 00000400
Flags:ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ0000030100000000
Plain region offset:ÂÂÂÂ0x00004a00
Plain region size:ÂÂÂÂÂÂ0x00000200
ExeFS offset:ÂÂÂÂÂÂÂÂÂÂ 0x00004c00
ExeFS size:ÂÂÂÂÂÂÂÂÂÂÂÂ 0x00143800
ExeFS hash region size: 0x00000200
RomFS offset:ÂÂÂÂÂÂÂÂÂÂ 0x00148400
RomFS size:ÂÂÂÂÂÂÂÂÂÂÂÂ 0x1ceab000
RomFS hash region size: 0x00000200
ExeFS Superblock Hash:ÂÂ130C042615F647C4C63225EA9E67F8A2
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ7B15246B88FBC7A927257B84977B787B
RomFS Superblock Hash:ÂÂA65BEE1060BB6A6821BBCEC600035B7E
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ64FB6EACA7F0960CFB1F5A37087728F7
Note: Offsets and sizes in media units have been converted to byte sizes.
Plain region example for Lego Starwars III
Code:
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
0004a20: 30 5f 6e 6f 6e 65 5d 00 5b 53 44 4b 2b 4e 49 4eÂÂ0_none].[SDK+NINÂÂÂÂ[SDK+NINTENDO:Firmware-02_27]
0004a30: 54 45 4e 44 4f 3a 46 69 72 6d 77 61 72 65 2d 30ÂÂTENDO:Firmware-0
0004a40: 32 5f 32 37 5d 00 5b 53 44 4b 2b 4d 6f 62 69 63ÂÂ2_27].[SDK+MobicÂÂÂÂ[SDK+Mobiclip:Deblocker_1_0_2]
0004a50: 6c 69 70 3a 44 65 62 6c 6f 63 6b 65 72 5f 31 5fÂÂlip:Deblocker_1_
0004a60: 30 5f 32 5d 00 5b 53 44 4b 2b 4d 6f 62 69 63 6cÂÂ0_2].[SDK+MobiclÂÂÂÂ[SDK+Mobiclip:ImaAdpcmDec_1_0_0]
0004a70: 69 70 3a 49 6d 61 41 64 70 63 6d 44 65 63 5f 31ÂÂip:ImaAdpcmDec_1
0004a80: 5f 30 5f 30 5d 00 5b 53 44 4b 2b 4d 6f 62 69 63ÂÂ_0_0].[SDK+MobicÂÂÂÂ[SDK+Mobiclip:MobiclipDec_1_0_1]
0004a90: 6c 69 70 3a 4d 6f 62 69 63 6c 69 70 44 65 63 5fÂÂlip:MobiclipDec_
0004aa0: 31 5f 30 5f 31 5d 00 5b 53 44 4b 2b 4d 6f 62 69ÂÂ1_0_1].[SDK+MobiÂÂÂÂ[SDK+Mobiclip:MoflexDemuxer_1_0_2]
0004ab0: 63 6c 69 70 3a 4d 6f 66 6c 65 78 44 65 6d 75 78ÂÂclip:MoflexDemux
0004ac0: 65 72 5f 31 5f 30 5f 32 5d 00 00 00 00 00 00 00ÂÂer_1_0_2].......
0004ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00ÂÂ................
0004ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00ÂÂ................
Credit goes to Neimod and all people who worked on this document
http://3dbrew.org/wiki/CXI














