<?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=Pineapples61</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=Pineapples61"/>
	<link rel="alternate" type="text/html" href="https://switchbrew.org/wiki/Special:Contributions/Pineapples61"/>
	<updated>2026-05-08T03:31:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=XCI&amp;diff=4270</id>
		<title>XCI</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=XCI&amp;diff=4270"/>
		<updated>2018-03-24T21:06:56Z</updated>

		<summary type="html">&lt;p&gt;Pineapples61: /* Header */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Header=&lt;br /&gt;
The header is 0x200-bytes, at Gamecard+0.&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;
| 0x100&lt;br /&gt;
| RSA-2048 PKCS #1 signature over the data from 0x100 - 0x200.&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;HEAD&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x104&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset of Secure partition (Size of non-secure data?), in Media Units (0x200 bytes for switch gamecarts)&lt;br /&gt;
|-&lt;br /&gt;
| 0x108&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0xFFFFFFFF&lt;br /&gt;
|-&lt;br /&gt;
| 0x10C&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10D&lt;br /&gt;
| 0x1&lt;br /&gt;
| Cartridge Size. 0xF8 = 2 GB, 0xF0 = 4 GB, 0xE0 = 8 GB, 0xE1 = 16 GB, 0xE2 = 32 GB&lt;br /&gt;
|-&lt;br /&gt;
| 0x10E&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x10F&lt;br /&gt;
| 0x1&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x110&lt;br /&gt;
| 0x8&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x118&lt;br /&gt;
| 0x8&lt;br /&gt;
| Size of the Gamecart, in Media Units&lt;br /&gt;
|-&lt;br /&gt;
| 0x120&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x130&lt;br /&gt;
| 0x8&lt;br /&gt;
| Offset of HFS0 FS partition&lt;br /&gt;
|-&lt;br /&gt;
| 0x138&lt;br /&gt;
| 8&lt;br /&gt;
| HFS0 Header size&lt;br /&gt;
|-&lt;br /&gt;
| 0x140&lt;br /&gt;
| 0x20&lt;br /&gt;
| SHA256 hash of the HFS0 Header&lt;br /&gt;
|-&lt;br /&gt;
| 0x160&lt;br /&gt;
| 0x20&lt;br /&gt;
| SHA256 hash of the crypto header&lt;br /&gt;
|-&lt;br /&gt;
| 0x180&lt;br /&gt;
| 0x4&lt;br /&gt;
| 1?&lt;br /&gt;
|-&lt;br /&gt;
| 0x184&lt;br /&gt;
| 0x4&lt;br /&gt;
| 2?&lt;br /&gt;
|-&lt;br /&gt;
| 0x188&lt;br /&gt;
| 0x4&lt;br /&gt;
| 0?&lt;br /&gt;
|-&lt;br /&gt;
| 0x18C&lt;br /&gt;
| 0x4&lt;br /&gt;
| Offset of Secure partition (Size of non-secure data?), in Media Units, again.&lt;br /&gt;
|-&lt;br /&gt;
| 0x190&lt;br /&gt;
| 0x70&lt;br /&gt;
| Encrypted data/hashes of some kind&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Cert =&lt;br /&gt;
&lt;br /&gt;
This is for the CERT, located at Gamecard + 0x7000 (always?). This matches exactly the output from fsp-srv IDeviceOperator cmd 206 &amp;quot;GetGameCardDeviceCertificate&amp;quot;.&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;
| 0x100&lt;br /&gt;
| RSA-2048 PKCS #1 signature over the data from 0x100 - 0x200.&lt;br /&gt;
|-&lt;br /&gt;
| 0x100&lt;br /&gt;
| 0x4&lt;br /&gt;
| Magicnum &amp;quot;CERT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| 0x110&lt;br /&gt;
| 0x10&lt;br /&gt;
| ?&lt;br /&gt;
|-&lt;br /&gt;
| 0x12A&lt;br /&gt;
| 0xD6&lt;br /&gt;
| Encrypted data. Some kind of key?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The data between the CERT and the start of the HFS0 is all 0xFF.&lt;br /&gt;
&lt;br /&gt;
= HFS0 =&lt;br /&gt;
This is the FS which has magicnum &amp;quot;HFS0&amp;quot; at header+0.&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;
| HFS0 Magic&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;
| Size of Hashed region of file (for HFS0s, this is the size of the pre-filedata portion, for NCAs this is usually 0x200).&lt;br /&gt;
|-&lt;br /&gt;
| 0x18&lt;br /&gt;
| 8&lt;br /&gt;
| Zero/Reserved&lt;br /&gt;
|-&lt;br /&gt;
| 0x20&lt;br /&gt;
| 0x20&lt;br /&gt;
| SHA256 hash of the first (size of hashed region) bytes of filedata.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The string table is 00-padded to align the start of raw filedata with a sector/media unit boundary (usually?).&lt;br /&gt;
&lt;br /&gt;
=Typical Cartridge Layout=&lt;br /&gt;
Observed gamecarts contain three partitions: &amp;quot;update&amp;quot;, &amp;quot;normal&amp;quot;, and &amp;quot;secure&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The update partition (Gamecard partition 0 for fsp-srv cmd 31) contains .cnmt.nca + .nca files for the entire system update required to play the game. Launch day carts contain a full copy of 1.0 ncas, newer carts contain newer sysupdate NCAs etc.&lt;br /&gt;
&lt;br /&gt;
The normal partition contains the .cnmt.nca and the game icondata nca. This is presumably for future compatibility so that if a future update changes the cryptographic protocol for the secure partition, Game icon data can still be shown in the home menu on old firmwares.&lt;br /&gt;
&lt;br /&gt;
The secure partition contains an identical copy of the .cnmt.nca and game icondata nca, as well as all other ncas required for the game.&lt;br /&gt;
&lt;br /&gt;
The entire rest of the gamecard after the secure partition ends is all FF padding.&lt;/div&gt;</summary>
		<author><name>Pineapples61</name></author>
	</entry>
</feed>