Difference between revisions of "RomFS"

From 3dbrew
Jump to navigation Jump to search
Line 38: Line 38:
 
| 0x08
 
| 0x08
 
| 0x4
 
| 0x4
| Master hashes size
+
| Master hash size
 
|-
 
|-
 
| 0x0C
 
| 0x0C
 
| 0x8
 
| 0x8
| size
+
| Level 1 logical offset
 
|-
 
|-
| 0x14
+
| 0x14
| 0x8
+
| 0x8
| 2nd content size
+
| Level 1 hashdata size
 
|-
 
|-
| 0x1C
+
| 0x1C
| 0x4
+
| 0x4
| Level 1 block size, in log2.
+
| Level 1 block size, in log2
 
|-
 
|-
| 0x24
+
| 0x20
| 0x8
+
| 0x4
| size
+
| Reserved
 
|-
 
|-
| 0x2C
+
| 0x24
| 0x8
+
| 0x8
| size
+
| Level 2 logical offset
 
|-
 
|-
| 0x34
+
| 0x2C
| 0x4
+
| 0x8
| Level 2 block size, in log2.
+
| Level 2 hashdata size
 
|-
 
|-
| 0x3C
+
| 0x34
| 0x8
+
| 0x4
|
+
| Level 2 block size, in log2.
 
|-
 
|-
| 0x44
+
| 0x38
| 0x8
+
| 0x4
| Main content size
+
| Reserved
 
|-
 
|-
| 0x4C
+
| 0x3C
| 0x4
+
| 0x8
| Level 3 block size, in log2.
+
| Level 3 logical offset
 
|-
 
|-
| 0x58
+
| 0x44
| 0x4
+
| 0x8
| Optional info size.
+
| Level 3 hashdata size
 
|-
 
|-
| 0x60
+
| 0x4C
| 0x20 * N
+
| 0x4
| Master hashes
+
| Level 3 block size, in log2.
 +
|-
 +
| 0x50
 +
| 0x4
 +
| Reserved
 +
|-
 +
| 0x54
 +
| 0x4
 +
| Reserved
 +
|-
 +
| 0x58
 +
| 0x4
 +
| Optional info size.
 
|}
 
|}
  
  
+
 
  
 
The block hash from the header hashes the second block at 0x2000.
 
The block hash from the header hashes the second block at 0x2000.

Revision as of 04:54, 2 September 2012

Overview

RomFS or Read-Only Filesystem is part of the NCCH format, and is used as external file storage.

RomFS can be used:

  • in conjunction with the ExeFS of a NCCH
  • to contain the game manual accessible from the Home Menu
  • or to contain game cartridge update data

(There may be more implementations in the future)


Format

All of the content (including the header) in RomFS appears to be aligned to 0x1000 byte blocks, the first block starts at 0x1000. Starting with the second block, every block begins with a SHA-256 hash. This hashes the whole 0x1000-byte block following this block. For the last block, this hash hashes the first block at 0x1000. The total RomFS filesize is always at least 0x4000.

The RomFS header is 0x80 bytes long and following is known about the structure:

START SIZE DESCRIPTION
0x00 0x4 Magic "IVFC"
0x04 0x4 Magic number 0x10000
0x08 0x4 Master hash size
0x0C 0x8 Level 1 logical offset
0x14 0x8 Level 1 hashdata size
0x1C 0x4 Level 1 block size, in log2
0x20 0x4 Reserved
0x24 0x8 Level 2 logical offset
0x2C 0x8 Level 2 hashdata size
0x34 0x4 Level 2 block size, in log2.
0x38 0x4 Reserved
0x3C 0x8 Level 3 logical offset
0x44 0x8 Level 3 hashdata size
0x4C 0x4 Level 3 block size, in log2.
0x50 0x4 Reserved
0x54 0x4 Reserved
0x58 0x4 Optional info size.



The block hash from the header hashes the second block at 0x2000.