Difference between revisions of "ExeFS"

From 3dbrew
Jump to navigation Jump to search
m
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
ExeFS or Executable Filesystem, is the part of the CXI, which is executed when the CXI is run. And contains:
+
ExeFS or Executable Filesystem contains information related to the executable program, and is the part of the [[NCCH#CXI|CXI]] format.  
  
 +
The ExeFS usually contains one or more of the following files:
 
* .code Contains the code binary, which can be optionally reverse-LZSS compressed via an exheader flag.
 
* .code Contains the code binary, which can be optionally reverse-LZSS compressed via an exheader flag.
* [[logo]] Contains distribution licensing Binary data.
+
* [[logo|logo]] Contains distribution licensing Binary data.
 
* [[File Formats|banner]] Contains the banner which homemenu uses for this CXI.
 
* [[File Formats|banner]] Contains the banner which homemenu uses for this CXI.
 
* [[SMDH|icon]] Contains the icon which homemenu displays for this CXI.
 
* [[SMDH|icon]] Contains the icon which homemenu displays for this CXI.
  
=== AFTER DECRYPTION ===
+
=== Format ===
  
The ExeFS header is 0x200 bytes long and follows this structure:
+
The ExeFS header is 0x200 bytes long and follows this simple structure:
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
START
+
Start
SIZE
+
Size
DESCRIPTION
+
Description
 
|-
 
|-
 
|  0x00
 
|  0x00
0x05
+
0xa0
Always '.code'
+
File headers (10 headers maximum, 16 bytes each)
 
|-
 
|-
0x05   
+
0xa0
|  0x03
+
|  0x20
|  Reserved
 
|-
 
|  0x08
 
|  0x04
 
|  ARM Code Offset*
 
|-
 
|  0x0C   
 
|  0x04
 
|  ARM Code Length 
 
|-
 
|  0x10     
 
|  0x06
 
|  Always 'banner'
 
|-
 
|  0x16   
 
|  0x02
 
|  Reserved
 
|-
 
|  0x18   
 
|  0x04
 
|  Banner Offset*
 
|-
 
|  0x1C   
 
|  0x04
 
|  Banner Length
 
|-
 
|  0x20    
 
|  0x04
 
|  Always 'icon'
 
|-
 
|  0x24   
 
|  0x04
 
|  Reserved
 
|-
 
|  0x28   
 
|  0x04
 
|  Icon Offset
 
|-
 
|  0x2C   
 
|  0x04
 
|  Icon Length
 
|-
 
|  0x30   
 
|  0x04
 
|  Always 'logo'**
 
|-
 
|  0x34   
 
|  0x04
 
 
|  Reserved
 
|  Reserved
 
|-
 
|-
0x38   
+
0xc0
|  0x04
 
|  Logo Offset* **
 
|-
 
|  0x3C   
 
|  0x04
 
|  Logo Length**
 
|-
 
|  0x40   
 
 
|  0x140
 
|  0x140
Reserved
+
File hashes (10 hashes maximum, 32 bytes each, one for each header)
 +
|}
 +
 
 +
File hashes are stored in reverse order, i.e. the hash at offset 0x1E0 corresponds to the first ExeFS section.
 +
 
 +
==== File headers ====
 +
There are a maximum of 10 file headers in the ExeFS format. (This maximum number of file headers is disputable, with makerom indicating a maximum of 8 sections and makecia indicating a maximum of 10. From a non-SDK point of view, the ExeFS header format can hold no more than 10 file headers within the currently define size of 0x200 bytes.) The file headers have the following structure:
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 0x180   
+
! Start
| 0x20
+
! Size
| Logo Hash**
+
! Description
 
|-
 
|-
0x1A0   
+
0x0
0x20
+
0x8
Icon Hash
+
File name
 
|-
 
|-
0x1C0   
+
0x8
0x20
+
0x4
Banner Hash
+
File offset
|-
 
|  0x1E0   
 
|  0x20
 
|  ARM Code Hash
 
 
|-
 
|-
 +
|  0xC
 +
|  0x4
 +
|  File size
 
|}
 
|}
  
<nowiki>* Offsets are non-inclusive of the header's size(0x200 bytes).</nowiki>
+
File offsets are non-inclusive of the header's size (0x200 bytes). Also, file headers which are not used are filled with all zeros.
  
<nowiki>** The 'Logo' is not a compulsory part of ExeFS, so an ExeFS without a 'Logo', will have these entries of the header filled with zeros.</nowiki>
+
==== File hashes ====
.
+
Each file header has a corresponding file hash, which is the SHA256 hash calculated over the entire file contents.

Latest revision as of 20:33, 20 March 2016

ExeFS or Executable Filesystem contains information related to the executable program, and is the part of the CXI format.

The ExeFS usually contains one or more of the following files:

  • .code Contains the code binary, which can be optionally reverse-LZSS compressed via an exheader flag.
  • logo Contains distribution licensing Binary data.
  • banner Contains the banner which homemenu uses for this CXI.
  • icon Contains the icon which homemenu displays for this CXI.

Format[edit]

The ExeFS header is 0x200 bytes long and follows this simple structure:

Start Size Description
0x00 0xa0 File headers (10 headers maximum, 16 bytes each)
0xa0 0x20 Reserved
0xc0 0x140 File hashes (10 hashes maximum, 32 bytes each, one for each header)

File hashes are stored in reverse order, i.e. the hash at offset 0x1E0 corresponds to the first ExeFS section.

File headers[edit]

There are a maximum of 10 file headers in the ExeFS format. (This maximum number of file headers is disputable, with makerom indicating a maximum of 8 sections and makecia indicating a maximum of 10. From a non-SDK point of view, the ExeFS header format can hold no more than 10 file headers within the currently define size of 0x200 bytes.) The file headers have the following structure:

Start Size Description
0x0 0x8 File name
0x8 0x4 File offset
0xC 0x4 File size

File offsets are non-inclusive of the header's size (0x200 bytes). Also, file headers which are not used are filled with all zeros.

File hashes[edit]

Each file header has a corresponding file hash, which is the SHA256 hash calculated over the entire file contents.