Changes

1,869 bytes added ,  21:01, 19 April 2018
no edit summary
Line 15: Line 15:  
| 2 || CheckStorage || [[Filesystem_services#StorageId|StorageID]] ||
 
| 2 || CheckStorage || [[Filesystem_services#StorageId|StorageID]] ||
 
|-
 
|-
| 3 || GetAddOnContentLocationResolver || None  ||
+
| 3 || [2.0.0+] GetAddOnContentLocationResolver || None  ||
 
|}
 
|}
   Line 25: Line 25:  
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Cmd || Name || Arguments || Notes
+
! Cmd || Name
 +
|-
 +
| 0 || [[#GetProgramNcaPath]]
 +
|-
 +
| 1 || [[#SetProgramNcaPath]]
 +
|-
 +
| 2 || [[#GetUserControlNcaPath]]
 +
|-
 +
| 3 || [[#GetDocHtmlNcaPath]]
 +
|-
 +
| 4 || [[#GetControlNcaPath]]
 +
|-
 +
| 5 || [[#SetControlNcaPath]]
 
|-
 
|-
| 0 || GetProgramNcaPath || u64 TID + C descriptor || Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
+
| 6 || [[#SetDocHtmlNcaPath]]
 
|-
 
|-
| 1 || SetProgramNcaPath || u64 TID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] || Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
+
| 7 || [[#GetInfoHtmlNcaPath]]
 
|-
 
|-
| 2 || GetUserControlNcaPath || u64 TID + C descriptor || Used for [[NCA_Content_FS#NCA-type3|NCA-type3]] (gamecard only?).
+
| 8 || [[#SetInfoHtmlNcaPath]]
 
|-
 
|-
| 3 || GetDocHtmlNcaPath || u64 TID + C descriptor || Used for [[NCA_Content_FS#NCA-type4|NCA-type4]].
+
| 9 || [[#ClearLocationResolver]]
 
|-
 
|-
| 4 || GetControlNcaPath || u64 TID + C descriptor || Used for [[NCA_Content_FS#NCA-type3|NCA-type3]]. Stubbed, only returns error 0x608.
+
| 10 || [5.0.0+] [[#SetProgramNcaPath2]]
 
|-
 
|-
| 5 || SetControlNcaPath || u64 TID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] || Used for [[NCA_Content_FS#NCA-type3|NCA-type3]].
+
| 11 || [5.0.0+] [[#ClearLocationResolver2]]
 
|-
 
|-
| 6 || SetDocHtmlNcaPath || u64 TID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] || Used for [[NCA_Content_FS#NCA-type4|NCA-type4]].
+
| 12 || [5.0.0+]
 
|-
 
|-
| 7 || GetInfoHtmlNcaPath || u64 TID + C descriptor || Used for [[NCA_Content_FS#NCA-type5|NCA-type5]].
+
| 13 || [5.0.0+]
 
|-
 
|-
| 8 || SetInfoHtmlNcaPath || u64 TID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] || Used for [[NCA_Content_FS#NCA-type5|NCA-type5]].
+
| 14 || [5.0.0+]
 
|-
 
|-
| 9 || ClearLocationResolver || None || Clears all NCA paths set.
+
| 15 || [5.0.0+]
 
|}
 
|}
   −
These get-commands load the [[Filesystem_services|ContentPath]] from linked-lists in memory using the input titleID. The set-commands add a new entry to the list, if a matching entry is found it's removed first. ClearLocationResolver frees all entries in all of these linked-lists. The ContentPath is only used with memcpy() here with size=0x300, nothing more.
+
If the supplied [[Filesystem_services#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 set commands always return 0. When the get-commands fail to find an entry for the specified titleID, 0x408 is returned for GetProgramNcaPath, while the rest of the commands return 0xA08.
+
The Get* commands load the [[Filesystem_services|ContentPath]] from linked-lists' [[#Location_List_Entry|entries]] in memory using the input TitleID. When the command fails to find an entry for the specified TitleID, 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.
 +
 
 +
==== GetProgramNcaPath ====
 +
Takes an u64 '''TitleID''' and a C descriptor. Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
 +
 
 +
==== SetProgramNcaPath ====
 +
Takes an u64 '''TitleID''' 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.
 +
 
 +
==== GetUserControlNcaPath ====
 +
Takes an u64 '''TitleID''' and a C descriptor. Used for [[NCA_Content_FS#NCA-type3|NCA-type3]].
 +
 
 +
==== GetDocHtmlNcaPath ====
 +
Takes an u64 '''TitleID''' and a C descriptor. Used for [[NCA_Content_FS#NCA-type4|NCA-type4]].
 +
 
 +
==== GetControlNcaPath ====
 +
Takes an u64 '''TitleID''' and a C descriptor. Used for [[NCA_Content_FS#NCA-type3|NCA-type3]].
 +
 
 +
==== SetControlNcaPath ====
 +
Takes an u64 '''TitleID''' and a X descriptor with a [[Filesystem_services#ContentPath|ContentPath]]. Used for [[NCA_Content_FS#NCA-type3|NCA-type3]].
 +
 
 +
Inserts a new [[#Location_List_Entry|entry]] with '''flag''' set to 1.
 +
 
 +
==== SetDocHtmlNcaPath ====
 +
Takes an u64 '''TitleID''' and a X descriptor with a [[Filesystem_services#ContentPath|ContentPath]]. Used for [[NCA_Content_FS#NCA-type4|NCA-type4]].
 +
 
 +
Inserts a new [[#Location_List_Entry|entry]] with '''flag''' set to 1.
 +
 
 +
==== GetInfoHtmlNcaPath ====
 +
Takes an u64 '''TitleID''' and a C descriptor. Used for [[NCA_Content_FS#NCA-type5|NCA-type5]].
 +
 
 +
==== SetInfoHtmlNcaPath ====
 +
Takes an u64 '''TitleID''' and a X descriptor with a [[Filesystem_services#ContentPath|ContentPath]]. Used for [[NCA_Content_FS#NCA-type5|NCA-type5]].
 +
 
 +
Inserts a new [[#Location_List_Entry|entry]] with '''flag''' set to 1.
 +
 
 +
==== ClearLocationResolver ====
 +
Takes no input. Frees all linked-lists' entries that have '''flag''' set to 0.
 +
 
 +
==== SetProgramNcaPath2 ====
 +
Same as [[#SetProgramNcaPath|SetProgramNcaPath]], but inserts a new [[#Location_List_Entry|entry]] with '''flag''' set to 1.
 +
 
 +
==== ClearLocationResolver2 ====
 +
Takes no input. Frees all linked-lists' entries that have '''flag''' set to 1.
    
=== IRegisteredLocationResolver ===
 
=== IRegisteredLocationResolver ===
Line 61: Line 119:  
! Cmd || Name || Arguments || Notes
 
! Cmd || Name || Arguments || Notes
 
|-
 
|-
| 0 || GetPatchType0NcaPath || u64 TID + C descriptor || Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
+
| 0 || GetPatchType0NcaPath || u64 TitleID + C descriptor || Used for [[NCA_Content_FS#NCA-type1|NCA-type1]].
 
|-
 
|-
| 1 || RegisterPatchType0FallbackPath || u64 TID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] || Sets the Type 0 fallback TID and path to the provided arguments.
+
| 1 || RegisterPatchType0FallbackPath || u64 TitleID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] || Sets the Type 0 fallback TID and path to the provided arguments.
 
|-
 
|-
| 2 || UnregisterPatchType0FallbackPath || u64 TID || If the Type 0 fallback TID is == argument TID, unregisters the fallback path. Otherwise, noop.
+
| 2 || UnregisterPatchType0FallbackPath || u64 TitleID || If the Type 0 fallback TID is == argument TID, unregisters the fallback path. Otherwise, noop.
 
|-
 
|-
| 3 || SetPatchType0NcaPath || u64 TID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] ||
+
| 3 || SetPatchType0NcaPath || u64 TitleID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] ||
 
|-
 
|-
| ([[2.0.0]]+) 4 || GetPatchType1NcaPath || u64 TID + C descriptor ||
+
| 4 || [2.0.0+] GetPatchType1NcaPath || u64 TitleID + C descriptor ||
 
|-
 
|-
| ([[2.0.0]]+) 5 || RegisterPatchType1FallbackPath || u64 TID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] || Sets the Type 1 fallback TID and path to the provided arguments.
+
| 5 || [2.0.0+] RegisterPatchType1FallbackPath || u64 TitleID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] || Sets the Type 1 fallback TID and path to the provided arguments.
 
|-
 
|-
| ([[2.0.0]]+) 6 || UnregisterPatchType1FallbackPath || u64 TID || If the Type 1 fallback TID is == argument TID, unregisters the fallback path. Otherwise, noop.
+
| 6 || [2.0.0+] UnregisterPatchType1FallbackPath || u64 TitleID || If the Type 1 fallback TID is == argument TID, unregisters the fallback path. Otherwise, noop.
 
|-
 
|-
| ([[2.0.0]]+) 7 || SetPatchType1NcaPath || u64 TID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] ||
+
| 7 || [2.0.0+] SetPatchType1NcaPath || u64 TitleID + X descriptor [[Filesystem_services#ContentPath|ContentPath]] ||
 
|}
 
|}
   Line 85: Line 143:  
! Cmd || Name || Arguments || Notes
 
! Cmd || Name || Arguments || Notes
 
|-
 
|-
| 0 || GetAddOnContentNcaPath || u64 TID + C descriptor ||  
+
| 0 || GetAddOnContentNcaPath || u64 TitleID + C descriptor ||  
 
|-
 
|-
| 1 || RegisterAddOnContent || [[Filesystem_services#StorageId|StorageID]] + u64 TID ||  
+
| 1 || RegisterAddOnContent || [[Filesystem_services#StorageId|StorageID]] + u64 TitleID ||  
 
|-
 
|-
 
| 2 || ClearAddOnContentLocationResolver || None || Clears all registered titles here.
 
| 2 || ClearAddOnContentLocationResolver || None || Clears all registered titles here.
 +
|}
 +
 +
=== Location List Entry ===
 +
Total size is 0x320 bytes.
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Size || Description
 +
|-
 +
| 0x0 || 0x8|| Pointer to previous entry
 +
|-
 +
| 0x8 || 0x8|| Pointer to next entry
 +
|-
 +
| 0x10 || 0x8|| TitleID
 +
|-
 +
| 0x18 || 0x300 || [[Filesystem_services|ContentPath]]
 +
|-
 +
| 0x318 || 0x4 || Flag
 +
|-
 +
| 0x31C || 0x4 || Padding
 
|}
 
|}
   Line 108: Line 186:  
| 3 || GetExistsSaveDataDirectoryForMediaId || Takes a [[Filesystem_services#StorageId|StorageID]].
 
| 3 || GetExistsSaveDataDirectoryForMediaId || Takes a [[Filesystem_services#StorageId|StorageID]].
 
|-
 
|-
| 4 || GetIContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]], (2.0.0+) Only returns a storage if one has previously been opened globally via OpenIContentStorage.
+
| 4 || GetIContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]], [2.0.0+] Only returns a storage if one has previously been opened globally via OpenIContentStorage.
 
|-
 
|-
| 5 || GetIContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], (2.0.0+) Only returns a storage if one has previously been opened globally via OpenIContentStorage.
+
| 5 || GetIContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], [2.0.0+] Only returns a storage if one has previously been opened globally via OpenIContentStorage.
 
|-
 
|-
| ([[1.0.0]]) 6 || CloseContentStorageForcibly || Takes a [[Filesystem_services#StorageId|StorageID]]. Calls IContentStorage->CloseAndFlushStorage().
+
| 6 || [1.0.0] CloseContentStorageForcibly || Takes a [[Filesystem_services#StorageId|StorageID]]. Calls IContentStorage->CloseAndFlushStorage().
 
|-
 
|-
| ([[1.0.0]]) 7 || CloseContentMetaDatabaseForcibly || Takes a [[Filesystem_services#StorageId|StorageID]].  Calls IContentMetaDatabase->CloseMetaDatabase().
+
| 7 || [1.0.0] CloseContentMetaDatabaseForcibly || Takes a [[Filesystem_services#StorageId|StorageID]].  Calls IContentMetaDatabase->CloseMetaDatabase().
 
|-
 
|-
 
| 8 || DeleteSaveDataForMediaId || Takes a [[Filesystem_services#StorageId|StorageID]], and deletes the associated savedata.
 
| 8 || DeleteSaveDataForMediaId || Takes a [[Filesystem_services#StorageId|StorageID]], and deletes the associated savedata.
 
|-
 
|-
| (2.0.0+) 9 || OpenIContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]], and opens an IContentStorage for the StorageID to be gotten with GetIContentStorage.
+
| 9 || [2.0.0+] OpenIContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]], and opens an IContentStorage for the StorageID to be gotten with GetIContentStorage.
 
|-
 
|-
| (2.0.0+) 10 || CloseIContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]], and closes the associated IContentStorage.
+
| 10 || [2.0.0+] CloseIContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]], and closes the associated IContentStorage.
 
|-
 
|-
| (2.0.0+) 11 || OpenIContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], and opens an IContentMetaDatabase for the StorageID to be gotten with GetIContentMetaDatabase.
+
| 11 || [2.0.0+] OpenIContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], and opens an IContentMetaDatabase for the StorageID to be gotten with GetIContentMetaDatabase.
 
|-
 
|-
| (2.0.0+) 12 || CloseIContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], and closes the associated IContentMetaDatabase.
+
| 12 || [2.0.0+] CloseIContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], and closes the associated IContentMetaDatabase.
 
|}
 
|}
      
=== IContentStorage ===
 
=== IContentStorage ===
Line 167: Line 244:  
| 15 || CloseAndFlushStorage || Closes/Flushes all resources for the storage, and causes all future IPC commands to the current session to return error 0xC805.
 
| 15 || CloseAndFlushStorage || Closes/Flushes all resources for the storage, and causes all future IPC commands to the current session to return error 0xC805.
 
|-
 
|-
| 16 || CreatePlaceholderEntryRegisteredEntryAndRegisteredDirectoryEntry || Takes three 0x10-sized [[#NcaID]]s. Creates the registered directory NCA path, and renames the placeholder path to the registered NCA path.
+
| 16 || [2.0.0+] CreatePlaceholderEntryRegisteredEntryAndRegisteredDirectoryEntry || Takes three 0x10-sized [[#NcaID]]s. Creates the registered directory NCA path, and renames the placeholder path to the registered NCA path.
 +
|-
 +
| 17 || [2.0.0+] SetPlaceholderEntrySize || Takes a [[#NcaID]], and a u64 size
 +
|-
 +
| 18 || [2.0.0+] [[#ReadRegisteredEntryRaw]] ||
 
|-
 
|-
| 17 || SetPlaceholderEntrySize || Takes a [[#NcaID]], and a u64 size
+
| 19 || [2.0.0+] GetPlaceholderEntryRightsID || Gets the Rights ID for the [[#NcaID]]'s placeholder path.
 
|-
 
|-
| 18 || [[#ReadRegisteredEntryRaw]] ||
+
| 20 || [2.0.0+] GetRegisteredEntryRightsID || Gets the Rights ID for the [[#NcaID]]'s registered path
 
|-
 
|-
| 19 || GetPlaceholderEntryRightsID || Gets the Rights ID for the [[#NcaID]]'s placeholder path.
+
| 21 || [2.0.0+] WriteRegisteredPathForDebug || Takes a [[#NcaID]], a u64 offset, and a type 5 buffer. On debug units, writes the buffer to the NCA's registered path. On retail units, this just aborts.
 
|-
 
|-
| 20 || GetRegisteredEntryRightsID || Gets the Rights ID for the [[#NcaID]]'s registered path
+
| 22 || [2.0.0+] GetFreeSpace || Gets free space for the storage.
 
|-
 
|-
| 21 || WriteRegisteredPathForDebug || Takes a [[#NcaID]], a u64 offset, and a type 5 buffer. On debug units, writes the buffer to the NCA's registered path. On retail units, this just aborts.
+
| 23 || [2.0.0+] GetTotalSpace || Gets total space for the storage.
 
|-
 
|-
| 22 || GetFreeSpace || Gets free space for the storage.
+
| 24 || [3.0.0+] FlushStorage || Flushes resources for the storage without closing it.
 
|-
 
|-
| 23 || GetTotalSpace || Gets total space for the storage.
+
| 25 || [4.0.0+] ||  
 
|-
 
|-
| 24 || FlushStorage || Flushes resources for the storage without closing it.
+
| 26 || [4.0.0+] ||  
 
|}
 
|}
   Line 259: Line 340:  
| 18 || GetEntryUnknown6 || Takes a [[NCA#Meta_records|Meta Record]], and returns u8 from ContentRecords + 6.
 
| 18 || GetEntryUnknown6 || Takes a [[NCA#Meta_records|Meta Record]], and returns u8 from ContentRecords + 6.
 
|-
 
|-
| 19 || GetAddOnContentEntryUnknownRecordSize || Does the same thing as GetEntryUnknownRecordSize, but for AddOnContents.
+
| 19 || [2.0.0+] GetAddOnContentEntryUnknownRecordSize || Does the same thing as GetEntryUnknownRecordSize, but for AddOnContents.
 +
|-
 +
| 20 || [5.0.0+] ||
 
|}
 
|}
      
==== ListApplication ====
 
==== ListApplication ====
Line 271: Line 353:     
This func returns a u32 num_entries_written, and a u32 num_entries_total.
 
This func returns a u32 num_entries_written, and a u32 num_entries_total.
      
==== ReadEntryMetaRecords ====
 
==== ReadEntryMetaRecords ====
Line 279: Line 360:     
This is used, for example, with System Update title 0100000000000816, which contains Meta Records for all other systitles in its Content Records.
 
This is used, for example, with System Update title 0100000000000816, which contains Meta Records for all other systitles in its Content Records.
      
==== CheckEntryNcaIDsPresent ====
 
==== CheckEntryNcaIDsPresent ====
Line 296: Line 376:  
     if is_present_in_database(NcaID):
 
     if is_present_in_database(NcaID):
 
         out_buf[i] = 0
 
         out_buf[i] = 0
      
=== NcaID ===
 
=== NcaID ===
Line 337: Line 416:  
| 0x83
 
| 0x83
 
| Delta title
 
| Delta title
|-
   
|}
 
|}
    
== ncm:v ==
 
== ncm:v ==
   
This service doesn't normally exist on retail.
 
This service doesn't normally exist on retail.
    
[[Category:Services]]
 
[[Category:Services]]