<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://switchbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jakcron</id>
	<title>Nintendo Switch Brew - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://switchbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jakcron"/>
	<link rel="alternate" type="text/html" href="https://switchbrew.org/wiki/Special:Contributions/Jakcron"/>
	<updated>2026-05-11T20:59:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=NCA&amp;diff=8862</id>
		<title>NCA</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=NCA&amp;diff=8862"/>
		<updated>2020-03-04T11:21:33Z</updated>

		<summary type="html">&lt;p&gt;Jakcron: How did we miss this xD&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The entire raw NCAs are encrypted.&lt;br /&gt;
&lt;br /&gt;
The only known area which is not encrypted in the raw NCA is the logo section, when the NCA includes that section. Everything else documented on this page is for the plaintext version of that data.&lt;br /&gt;
&lt;br /&gt;
= Encryption =&lt;br /&gt;
The first 0xC00 bytes are encrypted with AES-XTS with sector size 0x200 with a non-standard &amp;quot;tweak&amp;quot; (endianness is reversed, see [https://gist.github.com/SciresM/fe8a631d13c069bd66e9c656ab5b3f7f here]), this encrypted data is an 0x400 NCA header + an 0x200 header for each section in the section table.&lt;br /&gt;
&lt;br /&gt;
For pre-1.0.0 &amp;quot;NCA2&amp;quot; NCAs, the first 0x400 byte are encrypted the same way as in NCA3. However, each section header is individually encrypted as though it were sector 0, instead of the appropriate sector as in NCA3.&lt;br /&gt;
&lt;br /&gt;
= Header =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 signature over the header (data from 0x200 to 0x400) using a fixed key&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 signature over the header (data from 0x200 to 0x400) using a key from [[NPDM]] (or zeroes if not a program)&lt;br /&gt;
|-&lt;br /&gt;
| 0x200&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;NCA3&amp;quot; (&amp;quot;NCA2&amp;quot;, &amp;quot;NCA1&amp;quot; or &amp;quot;NCA0&amp;quot; for pre-1.0.0 NCAs)&lt;br /&gt;
|-&lt;br /&gt;
| 0x204&lt;br /&gt;
| 0x1&lt;br /&gt;
| Distribution Type (0x00 = System NCA, 0x01 = Gamecard NCA)&lt;br /&gt;
|-&lt;br /&gt;
| 0x205&lt;br /&gt;
| 0x1&lt;br /&gt;
| Content Type (0x00 = Program, 0x01 = Meta, 0x02 = Control, 0x03 = Manual, 0x04 = Data, 0x05 = PublicData)&lt;br /&gt;
|-&lt;br /&gt;
| 0x206&lt;br /&gt;
| 0x1&lt;br /&gt;
| Old Key Generation (0x00 = [[1.0.0]], 0x01 = Unused, 0x02 = [[3.0.0]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x207&lt;br /&gt;
| 0x1&lt;br /&gt;
| Key Area Encryption Key Index (0x00 = Application, 0x01 = Ocean, 0x02 = System)&lt;br /&gt;
|-&lt;br /&gt;
| 0x208&lt;br /&gt;
| 0x8&lt;br /&gt;
| Size of the entire NCA&lt;br /&gt;
|-&lt;br /&gt;
| 0x210&lt;br /&gt;
| 0x8&lt;br /&gt;
| Title ID&lt;br /&gt;
|-&lt;br /&gt;
| 0x218&lt;br /&gt;
| 0x4&lt;br /&gt;
| Content Index&lt;br /&gt;
|-&lt;br /&gt;
| 0x21C&lt;br /&gt;
| 0x4&lt;br /&gt;
| SDK AddOn Version (used in &amp;quot;FS_ACCESS: { sdk_version: {byte3}.{byte2}.{byte1}, ...&amp;quot; with byte0 set to 0 and compared with a required minimum value: 0x000B0000)&lt;br /&gt;
|-&lt;br /&gt;
| 0x220&lt;br /&gt;
| 0x1&lt;br /&gt;
| Key Generation (0x03 = [[3.0.1]], 0x04 = [[4.0.0]], 0x05 = [[5.0.0]], 0x06 = [[6.0.0]], 0x07 = [[6.2.0]], 0x08 = [[7.0.0]], 0x09 = [[8.1.0]], 0x0A = [[9.0.0]], 0x0B = [[9.1.0]], 0xFF = Invalid)&lt;br /&gt;
|-&lt;br /&gt;
| 0x221&lt;br /&gt;
| 0x1&lt;br /&gt;
| [9.0.0+] Signature Key Generation (for signature[0]) (0x00 = [[1.0.0]], 0x01 = [[9.0.0]]?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x230&lt;br /&gt;
| 0x10&lt;br /&gt;
| Rights ID ([[Ticket]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x240&lt;br /&gt;
| 0x10*0x4(0x40)&lt;br /&gt;
| Table for each section (see below)&lt;br /&gt;
|-&lt;br /&gt;
| 0x280&lt;br /&gt;
| 0x20*0x4(0x80)&lt;br /&gt;
| Table of SHA256 hashes (over each 0x200-byte [[#Section Header Block|Section Header Block]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x300&lt;br /&gt;
| 0x10*0x4(0x40)&lt;br /&gt;
| Key area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The header is 0x400-bytes, at NCA+0.&lt;br /&gt;
&lt;br /&gt;
When the above &#039;&#039;&#039;Old Key Generation&#039;&#039;&#039; field is 0x2 on &amp;gt;= v3.0, different {crypto/keydata} is used for the sections&#039; data. With system content, this is used with every ncatype except ncatype0. The only other exception is {data-content} for the firm titles: this is required in order for older-system-versions to install it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key Generation&#039;&#039;&#039; 0x3 (with &#039;&#039;&#039;Old Key Generation&#039;&#039;&#039; set to 0x2) is used for all [[3.0.1]] sysmodules and the [[System_Version_Title]]. With [[3.0.2]], all updated titles use the crypto from [[3.0.1]] for non-ncatype0, except for firm {data-content}. In some cases various game content uses the above newer crypto as well.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key Generation&#039;&#039;&#039; is always &#039;&#039;&#039;Master Key Version&#039;&#039;&#039; + 1, except for generations 0 and 1 which are both version 0.&lt;br /&gt;
&lt;br /&gt;
The keyindex passed to &amp;lt;key-generation-related code&amp;gt; is determined as follows:&lt;br /&gt;
* Pre-[[3.0.0]]: The &#039;&#039;&#039;Key Area Encryption Key Index&#039;&#039;&#039; field (0x207) is passed directly.&lt;br /&gt;
* [[3.0.0]]+: It&#039;s determined using the &#039;&#039;&#039;Key Area Encryption Key Index&#039;&#039;&#039; field (0x207) and the &#039;&#039;&#039;Old Key Generation&#039;&#039;&#039; field (0x206). The latter field must be 0, 1 or 2. In each ncahdr_keyindex block, it executes &amp;quot;if(ncahdr_x206&amp;gt;=3)&amp;lt;panic&amp;gt;&amp;quot;, but that won&#039;t trigger due to the earlier check. The end result is basically the same as pre-[[3.0.0]], except when ncahdr_x206 == 0x2, final_index is new_base_index+ncahdr_keyindex. Actual implementation loads index from u32_array[ncahdr_crypto_type], where the address of u32_array is different for each ncahdr_keyindex.&lt;br /&gt;
* [[3.0.1]]+: The dedicated range check for the &#039;&#039;&#039;Old Key Generation&#039;&#039;&#039; field (0x206) was removed, since the updated code no longer needs it. The output from a function masked with 0xFF is now used instead of ncahdr_x206. The range check for that field was changed from {ncahdr_x206 check with panic described above}, to &amp;quot;if(index&amp;gt;=4)final_index=10;&amp;quot;(skips accessing the array and uses 10 directly). The arrays were updated with an additional entry: final_index=v301_base_index+ncahdr_keyindex.&lt;br /&gt;
** The keydata for the above index10 is not(?) known to be initialized.&lt;br /&gt;
** The new function called by the code described above does:&lt;br /&gt;
** &amp;lt;code&amp;gt;if(ncahdr_x206 &amp;lt; ncahdr_x220){ret = ncahdr_x220; } else { ret = ncahdr_x206; } return ret;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Section Table Entry ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Media Start Offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Media End Offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Entry size is 0x10-bytes.&lt;br /&gt;
&lt;br /&gt;
Media offset is absoluteoffset/{mediasize}, where mediasize is 0x200 bytes.&lt;br /&gt;
&lt;br /&gt;
= Section Header Block =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x2&lt;br /&gt;
| Version (always 2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x1&lt;br /&gt;
| Filesystem Type (0 = RomFS, 1 = PFS0)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| Hash Type (2 = PFS0, 3 = RomFS)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x1&lt;br /&gt;
| Encryption Type (1 = None, 2 = AesCtrOld, 3 = AesCtr, 4 = AesCtrEx)&lt;br /&gt;
|-&lt;br /&gt;
| 0x5&lt;br /&gt;
| 0x1&lt;br /&gt;
| Padding&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0xF8&lt;br /&gt;
| FS-specific superblock&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| ?&lt;br /&gt;
| Optional BKTR header (can be used with any section, but only known to be used with game-updates RomFS)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Section Header Block for each section is at absoluteoffset+0x400+(sectionid*0x200), where sectionid corresponds to the index used with the entry/hash tables.&lt;br /&gt;
&lt;br /&gt;
The total size is 0x200-bytes.&lt;br /&gt;
&lt;br /&gt;
== PFS0 superblock ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x20&lt;br /&gt;
| SHA256 hash over the hash-table at section-start+0 with the below hash-table size&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x4&lt;br /&gt;
| Block size in bytes&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 0x4&lt;br /&gt;
| Must be 0x2&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x8&lt;br /&gt;
| Offset of hash-table (normally zero)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 0x8&lt;br /&gt;
| Size of hash-table&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8&lt;br /&gt;
| Offset relative to section-start where the PFS0 header is located&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x8&lt;br /&gt;
| Actual byte-size of the PFS0 filesystem relative to the PFS0 header&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0xB0&lt;br /&gt;
| Empty&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== RomFS superblock ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0xE0&lt;br /&gt;
| IVFC header (basically the same as [[Savegames]] IVFC except with 2 more levels and +0x0C is non-zero, see below)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This documents the structure of Section Header Block +0 for RomFS.&lt;br /&gt;
&lt;br /&gt;
=== IVFC ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Start&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x00&lt;br /&gt;
| 4&lt;br /&gt;
| Magicnum &amp;quot;IVFC&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x04&lt;br /&gt;
| 4&lt;br /&gt;
| Magic Number (0x20000)&lt;br /&gt;
|-&lt;br /&gt;
| 0x08&lt;br /&gt;
| 4&lt;br /&gt;
| Master hash size?&lt;br /&gt;
|-&lt;br /&gt;
| 0x0C&lt;br /&gt;
| 4&lt;br /&gt;
| Usually 7? Unknown, could be related to total number of levels maybe?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 8&lt;br /&gt;
| Level 1 offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 8&lt;br /&gt;
| Level 1 size&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 4&lt;br /&gt;
| Level 1 block size (in log2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x24&lt;br /&gt;
| 4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 8&lt;br /&gt;
| Level 2 offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x30&lt;br /&gt;
| 8&lt;br /&gt;
| Level 2 size&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 4&lt;br /&gt;
| Level 2 block size (in log2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x3C&lt;br /&gt;
| 4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 8&lt;br /&gt;
| Level 3 offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 8&lt;br /&gt;
| Level 3 size&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 4&lt;br /&gt;
| Level 3 block size (in log2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x54&lt;br /&gt;
| 4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x58&lt;br /&gt;
| 8&lt;br /&gt;
| Level 4 offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x60&lt;br /&gt;
| 8&lt;br /&gt;
| Level 4 size&lt;br /&gt;
|-&lt;br /&gt;
| 0x68&lt;br /&gt;
| 4&lt;br /&gt;
| Level 4 block size (in log2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x6C&lt;br /&gt;
| 4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 8&lt;br /&gt;
| Level 5 offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x78&lt;br /&gt;
| 8&lt;br /&gt;
| Level 5 size&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| 4&lt;br /&gt;
| Level 5 block size (in log2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x84&lt;br /&gt;
| 4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x88&lt;br /&gt;
| 8&lt;br /&gt;
| Level 6 offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x90&lt;br /&gt;
| 8&lt;br /&gt;
| Level 6 size&lt;br /&gt;
|-&lt;br /&gt;
| 0x98&lt;br /&gt;
| 4&lt;br /&gt;
| Level 6 block size (in log2)&lt;br /&gt;
|-&lt;br /&gt;
| 0x9C&lt;br /&gt;
| 4&lt;br /&gt;
| Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0xA0&lt;br /&gt;
| 32&lt;br /&gt;
| Unknown, reserved?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0&lt;br /&gt;
| 32&lt;br /&gt;
| Hash&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== BKTR ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Start&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x8&lt;br /&gt;
| Offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x8&lt;br /&gt;
| Size&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;BKTR&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| u32, must be &amp;lt;=1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| s32, must be &amp;gt;=1.&lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x20&lt;br /&gt;
| Same as the above 0x20-bytes except with different data.&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x4?&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x44&lt;br /&gt;
| 0x4?&lt;br /&gt;
| ?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Using this header is enabled when offset 0x8 in this header is non-zero.&lt;br /&gt;
&lt;br /&gt;
The above byte-offsets are relative to the start of the section-data.&lt;br /&gt;
&lt;br /&gt;
The two sections specified by the two BKTR entries are usually(?) at the very end of the section data(section_endoffset-{size of BKTR sections}).&lt;br /&gt;
&lt;br /&gt;
=== RomFS Patching ===&lt;br /&gt;
The BKTR section enables combining data from an update NCA with the RomFS from a base NCA to create a single patched RomFS image. &lt;br /&gt;
&lt;br /&gt;
The first BKTR entry describes how to map regions of the two RomFS images to create the patched RomFS. It has the following format:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Start&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x4 || Padding/Unused?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4 || 0x4 || Number of Buckets&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || 0x8 || Total Size of the Virtual RomFS Image&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 0x3FF0 || Base Virtual Offset for each Bucket (u64s, padded with 0s until end)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4000 || 0x4000*X || Relocation Buckets&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Where relocation buckets are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Start&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x4 || Padding/Unused?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4 || 0x4 || Number of Entries&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || 0x8 || End offset for this Bucket&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 0x3FF0 || Relocation Entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Where relocation entries are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Start&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x8 || Address in Patched RomFS&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || 0x8 || Address in Source RomFS&lt;br /&gt;
|-&lt;br /&gt;
| 0x10  || 0x4 || 1=Is from Patch RomFS, 0=Is from Base RomFS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The second BKTR entry describes the subsections within the Patch RomFS. It has the following format:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Start&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x4 || Padding/Unused?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4 || 0x4 || Number of Buckets&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || 0x8 || Total Size of the Physical Patch Image&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 0x3FF0 || Base Physical Offset for each Bucket (u64s, padded with 0s until end)&lt;br /&gt;
|-&lt;br /&gt;
| 0x4000 || 0x4000*X || Subsection Buckets&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Where subsection buckets are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Start&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x4 || Padding/Unused?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4 || 0x4 || Number of Entries&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || 0x8 || End offset for this Bucket&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || 0x3FF0 || Subsection Entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Where subsection entries are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Start&lt;br /&gt;
! Length&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 || 0x8 || Address in Patch RomFS&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 || 0x4 || Padding/Unused?&lt;br /&gt;
|-&lt;br /&gt;
| 0xC  || 0x4 || Value for subsection AES-CTR&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Official code assumes the relocation entries are sorted, and performs a binary search when determining where to read from. Each subsection in the Patch RomFS has its CTR calculated separately from the others based on the value in its entry (the BKTR entries use normal crypto). Thus decrypting a Patch RomFS requires decrypting and parsing the BKTR entries before anything else.&lt;br /&gt;
&lt;br /&gt;
= Logo section =&lt;br /&gt;
This is a PFS0.&lt;br /&gt;
&lt;br /&gt;
See [[NCA_Content_FS|here]] for the mounted-FS logo contents.&lt;br /&gt;
&lt;br /&gt;
= ExeFS section =&lt;br /&gt;
This is a PFS0.&lt;br /&gt;
&lt;br /&gt;
See [[ExeFS|here]] for mounted-FS ExeFS contents.&lt;br /&gt;
&lt;br /&gt;
= Game-updates =&lt;br /&gt;
The section-data for ncatype1 RomFS section(section1) uses section-crypto-type 0x4.&lt;br /&gt;
&lt;br /&gt;
Game-updates also contain multiple ncatype6 content, which contain &amp;quot;section0_pfs0/fragment&amp;quot;. Some of these are just NCAs, unknown for the rest(presumably NCAs with additional crypto?). The first ncatype6 content fragment file has a NDV0 header, with the NCA starting at offset 0x44.&lt;br /&gt;
&lt;br /&gt;
= PFS0 =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| {Hash-table offset from superblock}&lt;br /&gt;
| {Hash-table size from superblock}&lt;br /&gt;
| Table of SHA256 hashes.&lt;br /&gt;
|-&lt;br /&gt;
| {Hash-table &amp;lt;offset+size&amp;gt; from superblock}&lt;br /&gt;
| &lt;br /&gt;
| Zeros for alignment to {alignment size}.&lt;br /&gt;
|-&lt;br /&gt;
| {PFS0 offset from superblock}&lt;br /&gt;
| {PFS0 size from superblock}&lt;br /&gt;
| The actual PFS0.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is the FS which has magicnum &amp;quot;PFS0&amp;quot; at header+0. This is very similar to [[Gamecard_Format|HFS0]]. A tool for extracting this FS is available [https://gist.github.com/yellows8/1a96c2b846f4ebc4bb45d7f7fa1eb7db here].&lt;br /&gt;
&lt;br /&gt;
The hash table is hashes for every {Block size from superblock} starting at the PFS0 header. The size used for the last hash is {PFS0 filesystem size from superblock} - offset_relativeto_header.&lt;br /&gt;
&lt;br /&gt;
See also the PFS0 superblock above.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;PFS0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Number of files&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Size of the string table&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Zero/Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| X&lt;br /&gt;
| File Entry Table&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 + X&lt;br /&gt;
| Y&lt;br /&gt;
| String Table&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 + X + Y&lt;br /&gt;
| Z&lt;br /&gt;
| Raw File Data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Where File Entry Table consists of Number of Files FileEntries:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x8&lt;br /&gt;
| Offset of file in Data&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x8&lt;br /&gt;
| Size of file in Data&lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset of filename in String Table&lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| Normally zero?&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jakcron</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=User_talk:Jakcron&amp;diff=1714</id>
		<title>User talk:Jakcron</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=User_talk:Jakcron&amp;diff=1714"/>
		<updated>2017-07-20T02:43:43Z</updated>

		<summary type="html">&lt;p&gt;Jakcron: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jakcron</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=User_talk:Jakcron&amp;diff=1666</id>
		<title>User talk:Jakcron</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=User_talk:Jakcron&amp;diff=1666"/>
		<updated>2017-07-18T12:14:36Z</updated>

		<summary type="html">&lt;p&gt;Jakcron: Created page with &amp;quot;Just when something good was happening in my life.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Just when something good was happening in my life.&lt;/div&gt;</summary>
		<author><name>Jakcron</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=NPDM&amp;diff=1665</id>
		<title>NPDM</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=NPDM&amp;diff=1665"/>
		<updated>2017-07-18T11:58:52Z</updated>

		<summary type="html">&lt;p&gt;Jakcron: Document FS Access Control&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the Switch equivalent of 3DS exheader. This is the file with extension &amp;quot;.npdm&amp;quot; in {Switch ExeFS}. The size of this file varies.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x80&lt;br /&gt;
| META&lt;br /&gt;
|-&lt;br /&gt;
| 0x80&lt;br /&gt;
| &amp;lt;Varies&amp;gt;&lt;br /&gt;
| ACID&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;See META&amp;gt;&lt;br /&gt;
| &amp;lt;See META&amp;gt;&lt;br /&gt;
| ACI0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= META =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;META&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| 0xE&lt;br /&gt;
| 1&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0xF&lt;br /&gt;
| 1&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x1C&lt;br /&gt;
| 4&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| ?&lt;br /&gt;
| Title name&lt;br /&gt;
|-&lt;br /&gt;
| 0x70&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#ACI0]] offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x74&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#ACI0]] size&lt;br /&gt;
|-&lt;br /&gt;
| 0x78&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#ACID]] offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x7C&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#ACID]] size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= ACID =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 signature&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 public key&lt;br /&gt;
|-&lt;br /&gt;
| 0x200&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magic &amp;quot;ACID&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| 0x204&lt;br /&gt;
| 0x8&lt;br /&gt;
| Zeroes&lt;br /&gt;
|-&lt;br /&gt;
| 0x20C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Retail flag. Must be 1 on retail, on devunit 0 is also allowed.&lt;br /&gt;
|-&lt;br /&gt;
| 0x210&lt;br /&gt;
| 0x8&lt;br /&gt;
| Title id&lt;br /&gt;
|-&lt;br /&gt;
| 0x218&lt;br /&gt;
| 0x8&lt;br /&gt;
| Title id again&lt;br /&gt;
|-&lt;br /&gt;
| 0x220&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#FS Access Control]] offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x224&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#FS Access Control]] size&lt;br /&gt;
|-&lt;br /&gt;
| 0x228&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#Service Access Control]] offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x22C&lt;br /&gt;
| 0x4&lt;br /&gt;
| [[#Service Access Control]] size&lt;br /&gt;
|-&lt;br /&gt;
| 0x230&lt;br /&gt;
| 4&lt;br /&gt;
| [[#Kernel Access Control]] offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x234&lt;br /&gt;
| 4&lt;br /&gt;
| [[#Kernel Access Control]] size&lt;br /&gt;
|-&lt;br /&gt;
| 0x238&lt;br /&gt;
| 0x8&lt;br /&gt;
| Padding&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= ACI0 =&lt;br /&gt;
Looks like an old crappy version of ACID. It has the guessed version field 0 instead of 1.&lt;br /&gt;
&lt;br /&gt;
= FS Access Control =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Version (usually 1).&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x8&lt;br /&gt;
| FS Access Rights&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| ContentOwnerIds start offset &lt;br /&gt;
|-&lt;br /&gt;
| 0x10&lt;br /&gt;
| 0x4&lt;br /&gt;
| ContentOwnerIds end offset &lt;br /&gt;
|-&lt;br /&gt;
| 0x14&lt;br /&gt;
| 0x4&lt;br /&gt;
| SaveDataOwnerIds start offset &lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 0x4&lt;br /&gt;
| SavaDataOwnerIds end offset &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== FS Access Rights ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bit and bitmask&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;&lt;br /&gt;
| ApplicationInfo (MountContent* is accessible when set)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;&lt;br /&gt;
| BootModeControl&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;&lt;br /&gt;
| Calibration (Enables access to [[Filesystem_services|Bis]] partitionID 27 and 28)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;&lt;br /&gt;
| SystemSaveData&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;&lt;br /&gt;
| GameCard&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;&lt;br /&gt;
| SaveDataBackup&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;&lt;br /&gt;
| SaveDataManagement&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;&lt;br /&gt;
| BisAllRaw&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;&lt;br /&gt;
| GameCardRaw&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;9&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;&lt;br /&gt;
| GameCardPrivate&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;10&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;&lt;br /&gt;
| SetTime&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;11&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;&lt;br /&gt;
| ContentManager&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;12&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;&lt;br /&gt;
| ImageManager&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;13&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;&lt;br /&gt;
| CreateSaveData&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;14&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;&lt;br /&gt;
| SystemSaveDataManagement&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;15&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;&lt;br /&gt;
| BisFileSystem&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x10000&amp;lt;/code&amp;gt;&lt;br /&gt;
| SystemUpdate&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;17&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x20000&amp;lt;/code&amp;gt;&lt;br /&gt;
| SaveDataMeta&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;18&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x40000&amp;lt;/code&amp;gt;&lt;br /&gt;
| DeviceSaveControl&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;19&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x80000&amp;lt;/code&amp;gt;&lt;br /&gt;
| SettingsControl&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;62&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x4000000000000000&amp;lt;/code&amp;gt;&lt;br /&gt;
| Debug&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;63&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;0x8000000000000000&amp;lt;/code&amp;gt;&lt;br /&gt;
| FullPermission&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Web-applets access control:&lt;br /&gt;
* &amp;quot;LibAppletWeb&amp;quot; and &amp;quot;LibAppletOff&amp;quot; have same access control: word0 bit0 set, &#039;&#039;&#039;ApplicationInfo&#039;&#039;&#039; and &#039;&#039;&#039;SystemSaveData&#039;&#039;&#039; set, and &#039;&#039;&#039;Debug&#039;&#039;&#039; set.&lt;br /&gt;
* Rest of the web-applets: Same as above except &#039;&#039;&#039;ApplicationInfo&#039;&#039;&#039;  isn&#039;t set.&lt;br /&gt;
&lt;br /&gt;
= Service Access Control =&lt;br /&gt;
This is a list of [[Services_API|service]]-name strings which the title has access to, with the following structure:&lt;br /&gt;
  +0: control_byte&lt;br /&gt;
  +1: {service-name without nul-terminator}&lt;br /&gt;
&lt;br /&gt;
Bitmask 0x0F in control_byte is the {length of the service-name without nul-terminator} - 1.&lt;br /&gt;
&lt;br /&gt;
Bitmask 0x80 in control_byte means service is allowed to be registered.&lt;br /&gt;
&lt;br /&gt;
The service string can contain a wildcard &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt; character.&lt;br /&gt;
&lt;br /&gt;
= Kernel Access Control =&lt;br /&gt;
On Switch, descriptors are identified by pattern 01..11 in low bits.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Pattern of lower bits&lt;br /&gt;
! Type&lt;br /&gt;
! Fields&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxxxxxxxxx0111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Kernel flags&lt;br /&gt;
| Bit31-24: Highest allowed cpu id, bit23-16: Lowest allowed cpu id, bit15-10: Highest allowed thread prio, bit9-4: Lowest allowed thread prio&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxxxxxxxx01111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Syscall mask&lt;br /&gt;
| Bits 29-31: Syscall mask table index; Bits 5-28: Mask&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxxxxxx0111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Map IO page (RW)&lt;br /&gt;
| Bits 7-31: Page&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxxxxxx01111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Map IO range&lt;br /&gt;
| Bits 7-30: Alternating start page and number of pages, bit31: Alternating read-only flag then MemoryAttribute 0x2001/0x42002 selector flag&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0bxxxx011111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
| Interrupt pair&lt;br /&gt;
| Bits 12-21: Irq0, bits 20-31: Irq1, 0x3FF means empty.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0xxxx0111111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0xxx01111111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0xx011111111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;0x0111111111111111&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| All ones&lt;br /&gt;
| Ignored&lt;br /&gt;
|&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jakcron</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=NCA&amp;diff=1662</id>
		<title>NCA</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=NCA&amp;diff=1662"/>
		<updated>2017-07-18T11:41:17Z</updated>

		<summary type="html">&lt;p&gt;Jakcron: /* Header */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The entire raw NCAs are encrypted.&lt;br /&gt;
&lt;br /&gt;
The only known area which is not encrypted in the raw NCA is the logo section, when the NCA includes that section. Everything else documented on this page is for the plaintext version of that data.&lt;br /&gt;
&lt;br /&gt;
=Encryption=&lt;br /&gt;
The first {at least 0xC00 bytes} are encrypted with AES-XTS with sector size 0x200, at least 6 sectors in total. Everything in this region uses same keydata.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| NCA Header Signatures&lt;br /&gt;
|-&lt;br /&gt;
| 0x200&lt;br /&gt;
| NCA Header Data&lt;br /&gt;
|-&lt;br /&gt;
| 0x400&lt;br /&gt;
| NCA Section 0 Data&lt;br /&gt;
|-&lt;br /&gt;
| 0x600&lt;br /&gt;
| NCA Section 1 Data&lt;br /&gt;
|-&lt;br /&gt;
| 0x800&lt;br /&gt;
| NCA Section 2 Data&lt;br /&gt;
|-&lt;br /&gt;
| 0xA00&lt;br /&gt;
| NCA Section 3 Data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Header=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 signature over the 0x200-bytes starting at offset 0x200 using fixed key.&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 signature over the 0x200-bytes starting at offset 0x200 using key from [[NPDM]], or zeroes if not a program.&lt;br /&gt;
|-&lt;br /&gt;
| 0x200&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;NCA3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x204&lt;br /&gt;
| 0x1&lt;br /&gt;
| Distribution Type (0=Download, 1=GameCard)&lt;br /&gt;
|-&lt;br /&gt;
| 0x205&lt;br /&gt;
| 0x1&lt;br /&gt;
| Content Type (0=Program, 1=Meta, 2=Control, 3=Manual, 4=Data)&lt;br /&gt;
|-&lt;br /&gt;
| 0x206&lt;br /&gt;
| 0x1&lt;br /&gt;
| Crypto Type (0=Auto, 1=None, 2=Unknown added with With [[3.0.0]]+ ncatype1(not used for ncatype0, unknown for others), 3=AES-CTR)&lt;br /&gt;
|-&lt;br /&gt;
| 0x207&lt;br /&gt;
| 0x1&lt;br /&gt;
| Key index&lt;br /&gt;
|-&lt;br /&gt;
| 0x208&lt;br /&gt;
| 0x8&lt;br /&gt;
| Size of the entire NCA.&lt;br /&gt;
|-&lt;br /&gt;
| 0x210&lt;br /&gt;
| 0x8&lt;br /&gt;
| titleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x230&lt;br /&gt;
| 0x10&lt;br /&gt;
| Rights ID ([[Ticket]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x240&lt;br /&gt;
| 0x10*0x4(0x40)&lt;br /&gt;
| Table for each section, see below.&lt;br /&gt;
|-&lt;br /&gt;
| 0x280&lt;br /&gt;
| 0x20*0x4(0x80)&lt;br /&gt;
| Table of SHA256 hashes, over each 0x200-byte Section Header Block.&lt;br /&gt;
|-&lt;br /&gt;
| 0x300&lt;br /&gt;
| 0x10*0x4(0x40)&lt;br /&gt;
| Key area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The header is 0x400-bytes, at NCA+0.&lt;br /&gt;
&lt;br /&gt;
==Section Table Entry==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Media offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Media end-offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Entry size is 0x10-bytes.&lt;br /&gt;
&lt;br /&gt;
Media offset is absoluteoffset/{mediasize}, where mediasize is hard-coded to 0x200.&lt;br /&gt;
&lt;br /&gt;
=Section Header Block=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x1&lt;br /&gt;
| Crypto type. 0 and &amp;gt;4 are invalid. 1 = none(plaintext from raw NCA). 2 = other crypto. 3 = regular crypto. 4 = unknown.&lt;br /&gt;
|-&lt;br /&gt;
| 0x5&lt;br /&gt;
| 0x1&lt;br /&gt;
| Padding?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| &lt;br /&gt;
| FS-specific superblock.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Section Header Block for each section is at absoluteoffset+0x400+(sectionid*0x200), where sectionid corresponds to the index used with the entry/hash tables.&lt;br /&gt;
&lt;br /&gt;
The total size is 0x200-bytes.&lt;br /&gt;
&lt;br /&gt;
==PFS0 superblock==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x20&lt;br /&gt;
| SHA256 hash over the hash-table at section-start+0 with the below hash-table size.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Block size in bytes.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Size of hash-table.&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Offset relative to section-start where the PFS0 header is located.&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x8&lt;br /&gt;
| Actual byte-size of the PFS0 filesystem relative to the PFS0 header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0xF4&lt;br /&gt;
| Normally zeros.&lt;br /&gt;
|-&lt;br /&gt;
| 0x144&lt;br /&gt;
| ?&lt;br /&gt;
| 0x1?&lt;br /&gt;
|-&lt;br /&gt;
| 0x148&lt;br /&gt;
| 0xB8&lt;br /&gt;
| Normally zeros.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This documents the structure of Section Header Block +0 for PFS0.&lt;br /&gt;
&lt;br /&gt;
==RomFS superblock==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| &lt;br /&gt;
| IVFC header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This documents the structure of Section Header Block +0 for RomFS.&lt;br /&gt;
&lt;br /&gt;
=Logo section=&lt;br /&gt;
This is a PFS0. See [[NCA_Content_FS|here]] for the mounted-FS logo contents.&lt;br /&gt;
&lt;br /&gt;
=ExeFS section =&lt;br /&gt;
This is a PFS0.&lt;br /&gt;
&lt;br /&gt;
See [[ExeFS|here]] for mounted-FS ExeFS contents.&lt;br /&gt;
&lt;br /&gt;
=PFS0=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| X&lt;br /&gt;
| Table of SHA256 hashes.&lt;br /&gt;
|-&lt;br /&gt;
| X&lt;br /&gt;
| Y&lt;br /&gt;
| Zeros for alignment to {alignment size}.&lt;br /&gt;
|-&lt;br /&gt;
| X+Y&lt;br /&gt;
| &lt;br /&gt;
| Start of the PFS0 header.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is the FS which has magicnum &amp;quot;PFS0&amp;quot; at header+0.&lt;br /&gt;
&lt;br /&gt;
The hash table is hashes for every {Block size from superblock} starting at the PFS0 header. The size used for the last hash is {PFS0 filesystem size from superblock} - offset_relativeto_header.&lt;br /&gt;
&lt;br /&gt;
See also the PFS0 superblock above.&lt;/div&gt;</summary>
		<author><name>Jakcron</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=NCA&amp;diff=1658</id>
		<title>NCA</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=NCA&amp;diff=1658"/>
		<updated>2017-07-18T11:30:18Z</updated>

		<summary type="html">&lt;p&gt;Jakcron: Add information about encryption.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The entire raw NCAs are encrypted.&lt;br /&gt;
&lt;br /&gt;
The only known area which is not encrypted in the raw NCA is the logo section, when the NCA includes that section. Everything else documented on this page is for the plaintext version of that data.&lt;br /&gt;
&lt;br /&gt;
=Encryption=&lt;br /&gt;
The first 0xC00 bytes are encrypted with AES-XTS with sector size 0x200, 6 sectors in total.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! XTS Sector&lt;br /&gt;
! Key&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0&lt;br /&gt;
| NcaHeaderKey&lt;br /&gt;
| NCA Header Signatures&lt;br /&gt;
|-&lt;br /&gt;
| 0x200&lt;br /&gt;
| 1&lt;br /&gt;
| NcaHeaderKey&lt;br /&gt;
| NCA Header Data&lt;br /&gt;
|-&lt;br /&gt;
| 0x400&lt;br /&gt;
| 2&lt;br /&gt;
| ?&lt;br /&gt;
| NCA Section 0 Data&lt;br /&gt;
|-&lt;br /&gt;
| 0x600&lt;br /&gt;
| 3&lt;br /&gt;
| ?&lt;br /&gt;
| NCA Section 1 Data&lt;br /&gt;
|-&lt;br /&gt;
| 0x800&lt;br /&gt;
| 4&lt;br /&gt;
| ?&lt;br /&gt;
| NCA Section 2 Data&lt;br /&gt;
|-&lt;br /&gt;
| 0xA00&lt;br /&gt;
| 5&lt;br /&gt;
| ?&lt;br /&gt;
| NCA Section 3 Data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Header=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 signature over the 0x200-bytes starting at offset 0x200 using fixed key.&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x100&lt;br /&gt;
| RSA-2048 signature over the 0x200-bytes starting at offset 0x200 using key from [[NPDM]], or zeroes if not a program.&lt;br /&gt;
|-&lt;br /&gt;
| 0x200&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;NCA3&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x204&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x205&lt;br /&gt;
| 0x1&lt;br /&gt;
| Type value?&lt;br /&gt;
|-&lt;br /&gt;
| 0x206&lt;br /&gt;
| 0x1&lt;br /&gt;
| Crypto flags? Normally 0. With [[3.0.0]]+ ncatype1(not used for ncatype0, unknown for others) content this is 2: new keydata is used for this content, this field seems to control that.&lt;br /&gt;
|-&lt;br /&gt;
| 0x207&lt;br /&gt;
| 0x1&lt;br /&gt;
| Key index&lt;br /&gt;
|-&lt;br /&gt;
| 0x208&lt;br /&gt;
| 0x8&lt;br /&gt;
| Size of the entire NCA.&lt;br /&gt;
|-&lt;br /&gt;
| 0x210&lt;br /&gt;
| 0x8&lt;br /&gt;
| titleID&lt;br /&gt;
|-&lt;br /&gt;
| 0x230&lt;br /&gt;
| 0x10&lt;br /&gt;
| Rights ID ([[Ticket]])&lt;br /&gt;
|-&lt;br /&gt;
| 0x240&lt;br /&gt;
| 0x10*0x4(0x40)&lt;br /&gt;
| Table for each section, see below.&lt;br /&gt;
|-&lt;br /&gt;
| 0x280&lt;br /&gt;
| 0x20*0x4(0x80)&lt;br /&gt;
| Table of SHA256 hashes, over each 0x200-byte Section Header Block.&lt;br /&gt;
|-&lt;br /&gt;
| 0x300&lt;br /&gt;
| 0x10*0x4(0x40)&lt;br /&gt;
| Key area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The header is 0x400-bytes, at NCA+0.&lt;br /&gt;
&lt;br /&gt;
==Section Table Entry==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x4&lt;br /&gt;
| Media offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x4&lt;br /&gt;
| Media end-offset&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown&lt;br /&gt;
|-&lt;br /&gt;
| 0xC&lt;br /&gt;
| 0x4&lt;br /&gt;
| Unknown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Entry size is 0x10-bytes.&lt;br /&gt;
&lt;br /&gt;
Media offset is absoluteoffset/{mediasize}, where mediasize is hard-coded to 0x200.&lt;br /&gt;
&lt;br /&gt;
=Section Header Block=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 0x1&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x2&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x3&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0x1&lt;br /&gt;
| Crypto type. 0 and &amp;gt;4 are invalid. 1 = none(plaintext from raw NCA). 2 = other crypto. 3 = regular crypto. 4 = unknown.&lt;br /&gt;
|-&lt;br /&gt;
| 0x5&lt;br /&gt;
| 0x1&lt;br /&gt;
| Padding?&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| &lt;br /&gt;
| FS-specific superblock.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Section Header Block for each section is at absoluteoffset+0x400+(sectionid*0x200), where sectionid corresponds to the index used with the entry/hash tables.&lt;br /&gt;
&lt;br /&gt;
The total size is 0x200-bytes.&lt;br /&gt;
&lt;br /&gt;
==PFS0 superblock==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| 0x20&lt;br /&gt;
| SHA256 hash over the hash-table at section-start+0 with the below hash-table size.&lt;br /&gt;
|-&lt;br /&gt;
| 0x28&lt;br /&gt;
| 0x4&lt;br /&gt;
| Block size in bytes.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2C&lt;br /&gt;
| 0x4&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x38&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Size of hash-table.&lt;br /&gt;
|-&lt;br /&gt;
| 0x40&lt;br /&gt;
| 0x8?&lt;br /&gt;
| Offset relative to section-start where the PFS0 header is located.&lt;br /&gt;
|-&lt;br /&gt;
| 0x48&lt;br /&gt;
| 0x8&lt;br /&gt;
| Actual byte-size of the PFS0 filesystem relative to the PFS0 header.&lt;br /&gt;
|-&lt;br /&gt;
| 0x50&lt;br /&gt;
| 0xF4&lt;br /&gt;
| Normally zeros.&lt;br /&gt;
|-&lt;br /&gt;
| 0x144&lt;br /&gt;
| ?&lt;br /&gt;
| 0x1?&lt;br /&gt;
|-&lt;br /&gt;
| 0x148&lt;br /&gt;
| 0xB8&lt;br /&gt;
| Normally zeros.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This documents the structure of Section Header Block +0 for PFS0.&lt;br /&gt;
&lt;br /&gt;
==RomFS superblock==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x8&lt;br /&gt;
| &lt;br /&gt;
| IVFC header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This documents the structure of Section Header Block +0 for RomFS.&lt;br /&gt;
&lt;br /&gt;
=Logo section=&lt;br /&gt;
This is a PFS0. See [[NCA_Content_FS|here]] for the mounted-FS logo contents.&lt;br /&gt;
&lt;br /&gt;
=ExeFS section =&lt;br /&gt;
This is a PFS0.&lt;br /&gt;
&lt;br /&gt;
See [[ExeFS|here]] for mounted-FS ExeFS contents.&lt;br /&gt;
&lt;br /&gt;
=PFS0=&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0&lt;br /&gt;
| X&lt;br /&gt;
| Table of SHA256 hashes.&lt;br /&gt;
|-&lt;br /&gt;
| X&lt;br /&gt;
| Y&lt;br /&gt;
| Zeros for alignment to {alignment size}.&lt;br /&gt;
|-&lt;br /&gt;
| X+Y&lt;br /&gt;
| &lt;br /&gt;
| Start of the PFS0 header.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is the FS which has magicnum &amp;quot;PFS0&amp;quot; at header+0.&lt;br /&gt;
&lt;br /&gt;
The hash table is hashes for every {Block size from superblock} starting at the PFS0 header. The size used for the last hash is {PFS0 filesystem size from superblock} - offset_relativeto_header.&lt;br /&gt;
&lt;br /&gt;
See also the PFS0 superblock above.&lt;/div&gt;</summary>
		<author><name>Jakcron</name></author>
	</entry>
</feed>