Filesystem services: Difference between revisions

TimmSkiller (talk | contribs)
TimmSkiller (talk | contribs)
Line 1,296: Line 1,296:
|-
|-
| 2 || Raw content (low-level NCCH/SRL) access
| 2 || Raw content (low-level NCCH/SRL) access
|-
| 3 || Banner save data access (for DSiWare titles)
|-
|-
| 5 || Save data access (low-level, encrypted)
| 5 || Save data access (low-level, encrypted)
Line 1,323: Line 1,325:
! Value !! Description
! Value !! Description
|-
|-
| 0 || [[NCCH/Extended_Header|Extheader]] without AccessDesc (0x0-0x400)
| 0 || [[NCCH/Extended_Header|Extheader]] (0x0-0x400)
|-
|-
| 1 || [[NCCH/Extended_Header|Extheader]] with AccessDesc (0x0-0x800)
| 1 || [[NCCH/Extended_Header|Extheader]] AccessDesc (0x400-0x800)
|-
|-
| 2 || Raw [[NCCH#NCCH_Header|NCCH Header]]
| 2 || Raw [[NCCH#NCCH_Header|NCCH Header]]
Line 1,334: Line 1,336:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Index word
! Offset !! Size !! Description
! Description
|-
|-
| 0
| 0x0 || 0x8 || Program ID (Title ID)
| Lower word programID
|-
|-
| 1
| 0x8 || 0x1 || [[Mediatypes|Media Type]]
| Upper word programID
|-
|-
| 2
| 0x9 || 0x7 || padding
| [[Mediatypes|Media Type]]
|}
 
==== File Path ====
 
{| class="wikitable" border="1"
|-
! Offset !! Size !! Description
|-
| 0x0 || 0x4 || [[Filesystem_services#Title_Access_Type|Title Access Type]]
|-
|-
| 3
| 0x4 || 0x10 || Dynamic data depending on [[Filesystem_services#Title_Access_Type|Title Access Type]]:
| unused
 
{| class="wikitable" border="1"
|-
! High Level NCCH Access !! Save Data Access (high level) !! Raw Content
|-
|
{| class="wikitable" border="1"
|-
! Offset !! Size !! Description
|-
| 0x0 || 0x4 || Content index from TMD for NAND/SD titles
NCSD partition index for gamecards
|-
| 0x4 || 0x4 || [[Filesystem_services#NCCH_Access_Type|NCCH Access Type]]
|-
| 0x8 || 0x8 || Dynamic data depending on [[Filesystem_services#NCCH_Access_Type|NCCH Access Type]]:
For ExeFS, (System Menu Data / <code>exefs:/.code</code>),
 
{| class="wikitable" border="1"
| 8-byte ExeFS file name
|}
 
For Header Access,
 
{| class="wikitable" border="1"
| [[Filesystem_services#NCCH_Header_Access_Type|u64, NCCH Header Access Type]]
|}
|}


==== File Path ====
For RomFS,


{| class="wikitable" border="1"
{| class="wikitable" border="1"
| [[NCCH#NCCH_Flags|u64, Allowed content types flag]]
|}
|}
|
{| class="wikitable" border="1"
|-
! Offset !! Size !! Description
|-
|-
!  Index word
| 0x0 || 0x10 || 16-byte IV for save data decryption
!  Description
|}
|
{| class="wikitable" border="1"
|-
|-
| 0
! Offset !! Size !! Description
| [[Filesystem_services#Title_Access_Type|Title Access Type]]
|-
|-
| 1
| 0x0 || 0x4 || Content index from TMD for NAND/SD titles
| TMD content index / NCSD partition index.
NCSD partition index for gamecards
|-
|-
| 2
| 0x4 || 0xC || padding
| Type: 0=romfs(0 for non-NCCH as well), 1=exefs ".code"(?), 2=exefs "icon"/"banner"/"logo", 3=unknown, 4=unknown, 5=unknown.
|}
|}
|-
|-
| 3-4
| 0x14 || 0x10 || 16-byte seed for titles that require one, or for validating a seed against the check value in the [[NCCH#NCCH_Header|NCCH Header]]'s check value.
| Filename for ExeFS.
If the title does not use a seed, this should not be included and size 0x14 should be used instead of 0x24.
|}
|}


The 0x14-byte lowpath is all-zero for accessing the title's main RomFS.
For encrypted save data access and banner save data access, the entire 0x10 portion of the dynamic data is left blank.
 
The "is seeded check" NCCH access type opens a virtual 1-byte file that reads either 0 or 1; this value is generated on-the-fly and will be 1 if ncchflags[7] has bit5 set (content uses seed), and 0 otherwise.
 
For NCCH sections that require a seed (e.g. <code>.code</code>, RomFS, etc.), the additional seed portion of the low path must be populated with the correct seed.
 
The "Seed Verify/Validate" NCCH access type also requires the seed portion of the lowpath. The target NCCH content is opened (with the opened file interface being stubbed, meaning no real reads/writes can be performed on it), and the given seed is used to calculate the seed check hash, and part of it is compared to the check value in the NCCH header. If it matches, opening the "file" succeeds, otherwise 0xD900458C is returned. If attempt is made to use the seed validation type on a content that does not use a seed, error 0xC92044E6 is returned.


=== [[RomFS]] ===
=== [[RomFS]] ===