Difference between revisions of "NCSD"

From 3dbrew
Jump to navigation Jump to search
Line 77: Line 77:
 
|-
 
|-
 
| 1
 
| 1
| Starting with [[6.0.0-11]] NATIVE_FIRM will use this flag to determine the gamecard [[Savegames|savegame]] keyY method, when flag[3] is set. 1 = hashed keyY, 2 = new keyY method implemented with [[6.0.0-11]].
+
| Starting with [[6.0.0-11]] NATIVE_FIRM will use this flag to determine the gamecard [[Savegames|savegame]] keyY method, when flag[3] is set. 2 = hashed keyY, 3 = [[Savegames|new]] keyY method implemented with [[6.0.0-11]].
 
|-
 
|-
 
| 3
 
| 3

Revision as of 08:09, 28 June 2013

This page documents the format of NCSD.

Overview

There are two known specialisations of the NCSD container format. The CTR Cart Image (CCI) format and the CTR System Update (CSU). CCI is the format of retail game ROM dumps. CSU is used with developer system updates and tools

NCSD images start with a NCSD header, followed by up to a maximum of 8 NCCH partitions. The first partition(NCCH 0) usually starts at 0x4000, this is generally the main NCCH (Executable). The following info on partitions 1, 2, and 7 are only valid for .CCI. The second partition(NCCH 1) contains the game's Electronic Manual(The partitionID-high for the Instruction Manual .CFA is always 0x00050000). The third partition(NCCH 2) contains the download play "Child"(The partitionID-high for the .CFA containing the DLP Child is always 0x00060000). The eighth block(NCCH 7) contains "Update Data"(The partitionID-high for the .CFA containing the Update Data is always 0x80000000). The format of partitions can be determined from the partition FS flags, while the contents can be determined from the partitions flags.

NCSD header

Offset Size Description
0x000 0x100 RSA-2048 SHA-256 signature of the NCSD header
0x100 4 Magic Number 'NCSD'
0x104 4 Size of the NCSD image, in media units (1 media unit = 0x200 bytes)
0x108 8 Media ID
0x110 8 Partitions FS type
0x118 8 Partitions crypt type
0x120 0x40=(4+4)*8 Offset & Length partition table
0x160 0x20 Exheader SHA-256 hash
0x180 0x4 Additional header size
0x184 0x4 Sector zero offset
0x188 8 Partition Flags: byte[5]-byte[7] indicate content type ( system update, application, manual, ... ) size of media units ( 512*2^byte[6] ) and encryption.
0x190 0x40=8*8 Partition ID table
0x1D0 0x30 Reserved

Partition Flags

Byte Index Description
0 Unknown, NATIVE_FIRM loads this flag from the gamecard NCSD header starting with 6.0.0-11.
1 Starting with 6.0.0-11 NATIVE_FIRM will use this flag to determine the gamecard savegame keyY method, when flag[3] is set. 2 = hashed keyY, 3 = new keyY method implemented with 6.0.0-11.
3 When this flag is set the hashed gamecard savegame keyY method is used. With 6.0.0-11 the system will determine the gamecard savegame keyY method via flag[1], instead of just using the hashed keyY via this flag
7 This flag enables using the hashed gamecard savegame keyY method, support for this flag was implemented with 2.2.0-4. All games with the NCSD image finalized since 2.2.0-4(and contains 2.2.0-4+ in the system update partition) have this flag set, this flag likely also enables the new CTR method as well.

Card Info Header

OFFSET SIZE DESCRIPTION
0x200 8 Card Info
0x208 0xDF8 Reserved1
0x1000 8 Media ID (same as first NCCH partitionId)
0x1008 8 Reserved2
0x1010 0x30 Initial Data
0x1040 0xC0 Reserved
0x1100 0x100 Copy of first NCCH header (excluding RSA signature)

Development Card Info Header Extension

OFFSET SIZE DESCRIPTION
0x1200 0x200 CardDeviceReserved1
0x1400 0x10 TitleKey
0x1410 0xF0 CardDeviceReserved2

Tools

ctrtool - (CMD)(Windows/Linux) Parsing NCSD files

3DSExplorer - (GUI)(Windows Only) Parsing NCSD files