Changes

Jump to navigation Jump to search
141 bytes added ,  17:37, 16 November 2019
no edit summary
If the supplied [[#StorageId|StorageID]] is 1 (Host), a different set of internal functions is used to handle these commands. In this more restricted set of functions, GetControlNcaPath is stubbed and only returns error 0x608.
The Get* commands load the [[Filesystem_services|ContentPath]] from linked-lists' [[#Location_List_Entry|entries]] in memory using the input TitleID[[#ProgramId]]. When the command fails to find an entry for the specified TitleID[[#ProgramId]], 0x408 is returned for GetProgramNcaPath and 0xA08 is returned for the rest.
The Set* commands always return 0 and add a new entry to the list. If a matching entry is found, it's removed first.
==== ResolveProgramPath ====
Takes an u64 '''TitleID''' [[#ProgramId]] and a C descriptor. Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
==== RedirectProgramPath ====
Takes an u64 '''TitleID''' [[#ProgramId]] and a X descriptor with a [[Filesystem_services#ContentPath|ContentPath]]. Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
Inserts a new [[#Location_List_Entry|entry]] with '''flag''' set to 0.
==== ResolveApplicationControlPath ====
Takes an u64 '''TitleID''' [[#ApplicationId]] and a C descriptor. Used for [[NCA_Content_FS#NCA-type3|NCA-type3]].
==== ResolveApplicationHtmlDocumentPath====
Takes an u64 '''TitleID''' [[#ApplicationId]] and a C descriptor. Used for [[NCA_Content_FS#NCA-type4|NCA-type4]].
==== ResolveDataPath ====
Takes an u64 '''TitleID''' [[#ApplicationId]] and a C descriptor. Used for [[NCA_Content_FS#NCA-type3|NCA-type3]].
==== RedirectApplicationControlPath ====
Takes an u64 '''TitleID''' [[#ApplicationId]] and a X descriptor with a [[Filesystem_services#ContentPath|ContentPath]]. Used for [[NCA_Content_FS#NCA-type3|NCA-type3]].
[9.0.0+] Now takes an additional 8-bytes of input.
==== RedirectApplicationHtmlDocumentPath ====
Takes an u64 '''TitleID''' [[#ApplicationId]] and a X descriptor with a [[Filesystem_services#ContentPath|ContentPath]]. Used for [[NCA_Content_FS#NCA-type4|NCA-type4]].
[9.0.0+] Now takes an additional 8-bytes of input.
==== ResolveApplicationLegalInformationPath ====
Takes an u64 '''TitleID''' [[#ApplicationId]] and a C descriptor. Used for [[NCA_Content_FS#NCA-type5|NCA-type5]].
==== RedirectApplicationLegalInformationPath ====
Takes an u64 '''TitleID''' [[#ApplicationId]] and a X descriptor with a [[Filesystem_services#ContentPath|ContentPath]]. Used for [[NCA_Content_FS#NCA-type5|NCA-type5]].
[9.0.0+] Now takes an additional 8-bytes of input.
==== EraseProgramRedirection ====
Takes an u64 '''TitleID'''[[#ProgramnId]]. Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
Removes the [[#Location_List_Entry|entry]] that matches the input TitleIDProgramId.
==== EraseApplicationControlRedirection ====
Takes an u64 '''TitleID'''[[#ApplicationId]]. Used for [[NCA_Content_FS#NCA-type3|NCA-type3]].
Removes the [[#Location_List_Entry|entry]] that matches the input TitleIDApplicationId.
==== EraseApplicationHtmlDocumentRedirection ====
Takes an u64 '''TitleID'''[[#ApplicationId]]. Used for [[NCA_Content_FS#NCA-type4|NCA-type4]].
Removes the [[#Location_List_Entry|entry]] that matches the input TitleIDApplicationId.
==== EraseApplicationLegalInformationRedirection ====
Takes an u64 '''TitleID'''[[#ApplicationId]]. Used for [[NCA_Content_FS#NCA-type5|NCA-type5]].
Removes the [[#Location_List_Entry|entry]] that matches the input TitleIDApplicationId.
==== ResolveProgramPathForDebug ====
This is "nn::lr::IRegisteredLocationResolver".
This works like [[#ILocationResolver]], but only two types of NCA paths can be gotten/set. In addition, each type has a fallback path that can be set for a single title ID [[#ProgramId]] at a time.
{| class="wikitable" border="1"
! Cmd || Name || Arguments || Notes
|-
| 0 || ResolveProgramPath || u64 TitleID [[#ProgramId]] + C descriptor || Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
|-
| 1 || RegisterProgramPath || u64 TitleID [[#ProgramId]] + X descriptor [[Filesystem_services#ContentPath|ContentPath]] [9.0.0+] Now takes an additional 8-bytes of input. || Sets the Type 0 fallback TID and path to the provided arguments.
|-
| 2 || UnregisterProgramPath || u64 TitleID [[#ProgramId]] || If the Type 0 fallback TID is == argument TID, unregisters the fallback path. Otherwise, noop.
|-
| 3 || RedirectProgramPath || u64 TitleID [[#ProgramId]] + X descriptor [[Filesystem_services#ContentPath|ContentPath]] [9.0.0+] Now takes an additional 8-bytes of input. ||
|-
| 4 || [2.0.0+] ResolveHtmlDocumentPath || u64 TitleID [[#ProgramId]] + C descriptor ||
|-
| 5 || [2.0.0+] RegisterHtmlDocumentPath || u64 TitleID [[#ProgramId]] + X descriptor [[Filesystem_services#ContentPath|ContentPath]] [9.0.0+] Now takes an additional 8-bytes of input. || Sets the Type 1 fallback TID and path to the provided arguments.
|-
| 6 || [2.0.0+] UnregisterHtmlDocumentPath || u64 TitleID [[#ProgramId]] || If the Type 1 fallback TID is == argument TID, unregisters the fallback path. Otherwise, noop.
|-
| 7 || [2.0.0+] RedirectHtmlDocumentPath || u64 TitleID [[#ProgramId]] + X descriptor [[Filesystem_services#ContentPath|ContentPath]] [9.0.0+] Now takes an additional 8-bytes of input. ||
|-
| 8 || [7.0.0+] Refresh || No input/output. ||
|-
| 9 || [9.0.0+] RefreshExcluding || Type-5 buffer || Unofficial name. Refreshes entries excluding those with application title ids ProgramIds contained in the buffer.
|}
! Cmd || Name || Arguments || Notes
|-
| 0 || ResolveAddOnContentPath || u64 TitleID [[#ProgramId]] + C descriptor ||
|-
| 1 || RegisterAddOnContentStorage || [[#StorageId|StorageID]] + u64 TitleID [[#ProgramId]] [9.0.0+] Now takes an additional u64 TitleID [[#ApplicationId]] for the owner application. ||
|-
| 2 || UnregisterAllAddOnContentPath || None || Clears all registered titles here.
| 3 || [9.0.0+] [[#RefreshApplicationAddOnContent]] || Type-5 buffer || Unofficial name
|-
| 4 || [9.0.0+] [[#UnregisterApplicationAddOnContent]] || u64 TitleID [[#ProgramId]] || Unofficial name
|}
==== RefreshApplicationAddOnContent ====
Takes an type-5 buffer containing application title idsan array of [[#ApplicationId]]. Unregisters entries with application ids IDs absent from the input buffer.
==== UnregisterApplicationAddOnContent====
Takes an u64 '''TitleID''' [[#ApplicationId]] for the application to unregister add on content entries for.
=== Location List Entry ===
| 0x8 || 0x8|| Pointer to next entry
|-
| 0x10 || 0x8|| TitleID[[#ProgramId]]
|-
| 0x18 || 0x300 || [[Filesystem_services|ContentPath#Path]]
|-
| 0x318 || 0x4 || Flag
| 5 || List || Takes a type-6 buffer to write [[#ContentMetaKey|Content Meta Key]]s to, a u32 [[#ContentMetaType|Content Meta Type]], a u64 TID, a u64 TID_LOW, and u64 TID_HIGH. Writes into the buffer all Content Meta Keys with low <= record->title_id <= high, and record->type == type. Returns s32 numEntriesTotal, numEntriesWritten. Additionally requires record->title_id == TID, if record->type is Application, Patch, Add-On, or Delta, otherwise, you can pass 0 for type to ignore the type and list them all in the range.
|-
| 6 || GetLatestContentMetaKey || Takes a u64 title id[[#ProgramId]], and returns the [[#ContentMetaKey|Content Meta Key]] with the highest version field for that title idProgramId.
|-
| 7 || [[#ListApplication]] ||
| 11 || GetRequiredSystemVersion || Takes a [[#ContentMetaKey|Content Meta Key]], and returns u32 from ContentRecords + 16 (only if the content meta key has type Application or Patch).
|-
| 12 || GetPatchId || Takes a [[#ContentMetaKey|Content Meta Key]], and returns the update title id [[#ProgramId]] for that record.
|-
| 13 || DisableForcibly || Closes the meta database, and causes all future IPC commands to the current session to return error 0xDC05.
out_buf[i] = 0
=== ContentId ===This is "nn::ncm::ContentId". This is a 0x10-byte entry. This is originally from the hex portion of "<hex>.nca" directory-names from this storage FS(like [[SD_Filesystem|SD]]). The ContentId is the same as the first 0x10-bytes from the calculated SHA256 hash, from hashing the entire output from [[#ReadContentIdFile]]. === PlaceHolderId ===This is "nn::ncm::PlaceHolderId". This is the same as [[#ContentId]], except this is for placeholder content and originates from [[#GeneratePlaceHolderId]]. == ProgramId ==This is "nn::ncm::ProgramId" or "nn::ncm::SystemProgramId". This is an u64 ID bound to a [[Title_list#System_Modules|program]]. == DataId ==This is "nn::ncm::DataId" or "nn::ncm::SystemDataId". This is an u64 ID bound to a [[Title_list#System_Data_Archives|data archive]]. == ApplicationId ==This is "nn::ncm::ApplicationId". This is an u64 ID bound to an [[Title_list#System_Applications|application]]. == StorageId ===
This is "nn::ncm::StorageId". Enum, sizeof() == sizeof(u8).
nn::ncm::IsUniqueStorage returns true for != None && != Any.
=== ContentId =RightsId ==This is "nn::ncm::ContentIdRightsId".This is a 0x10-byte struct. [3.0.0+] This is a 0x18-byte struct. {| class="wikitable" border="1"|-! Offset! Size! Description|-| 0x0 || 0x10 || FS Rights ID|-| 0x10 || 0x1 || [3.0.0+] key_generation|-| 0x11 || 0x7 || [3.0.0+] Padding|}
== ProgramLocation ==This is a 0x10-byte entry. This is originally from the hex portion of "<hex>.ncann::ncm::ProgramLocation" directory-names from this storage FS(like [[SD_Filesystem|SD]]).
The ContentId is the same as the first 0x10{| class="wikitable" border="1"|-bytes from the calculated SHA256 hash, from hashing the entire output from ! Offset! Size! Description|-| 0x0 || 0x8 || [[#ProgramId]]|-| 0x8 || 0x1 || [[#ReadContentIdFileStorageId]].|-| 0x9 || 0x7 || Padding|}
=== PlaceHolderId =Path ==This is "nn::ncm::PlaceHolderIdPath".
This is the same as [[#ContentId]]a 0x300-byte structure, except this is for placeholder content and originates from which contains a [[Filesystem_services#GeneratePlaceHolderIdContentPath|Content Path]].
== ContentInstallType ==
| 0x0
| 0x8
| Title id[[#ProgramId]]
|-
| 0x8
| 0xC
| 0x1
| [[#ContentMetaType|Content Meta Type]]
|-
| 0xD
| 0x1
| [[#ContentInstallType|Content Install Type]]
|-
| 0xE
| 0x2
| Padding
|}
 
== ProgramId ==
This is "nn::ncm::ProgramId" or "nn::ncm::SystemProgramId".
 
This is an u64 ID bound to a [[Title_list#System_Modules|program]].
 
== DataId ==
This is "nn::ncm::DataId" or "nn::ncm::SystemDataId".
 
This is an u64 ID bound to a [[Title_list#System_Data_Archives|data archive]].
 
== ApplicationId ==
This is "nn::ncm::ApplicationId".
 
This is an u64 ID bound to an [[Title_list#System_Applications|application]].
 
== ProgramLocation ==
This is "nn::ncm::ProgramLocation".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || titleID
|-
| 0x8 || 0x1 || [[#StorageId|storageID]]
|-
| 0x9 || 0x7 || Padding
|}
 
== Path ==
This is "nn::ncm::Path".
 
This is a 0x300-byte structure, which contains a [[Filesystem_services#ContentPath|Content Path]].
 
== RightsId ==
This is "nn::ncm::RightsId". This is a 0x10-byte struct. [3.0.0+] This is a 0x18-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x10 || FS Rights ID
|-
| 0x10 || 0x1 || [3.0.0+] key_generation
|-
| 0x11 || 0x7 || [3.0.0+] Padding
|}

Navigation menu