NCM services: Difference between revisions
lr |
ContentStorage + ContentManager |
||
Line 198: | Line 198: | ||
! Cmd || Name || Notes | ! Cmd || Name || Notes | ||
|- | |- | ||
| 0 || | | 0 || CreateContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]]. | ||
|- | |- | ||
| 1 || | | 1 || CreateContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]]. | ||
|- | |- | ||
| 2 || | | 2 || VerifyContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]]. | ||
|- | |- | ||
| 3 || | | 3 || VerifyContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]]. | ||
|- | |- | ||
| 4 || | | 4 || OpenContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]], [2.0.0+] Only returns a storage if one has previously been opened globally via OpenIContentStorage. | ||
|- | |- | ||
| 5 || | | 5 || OpenContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], [2.0.0+] Only returns a storage if one has previously been opened globally via OpenIContentStorage. | ||
|- | |- | ||
| 6 || [1.0.0] CloseContentStorageForcibly || Takes a [[Filesystem_services#StorageId|StorageID]]. Calls IContentStorage->CloseAndFlushStorage(). | | 6 || [1.0.0] CloseContentStorageForcibly || Takes a [[Filesystem_services#StorageId|StorageID]]. Calls IContentStorage->CloseAndFlushStorage(). | ||
Line 214: | Line 214: | ||
| 7 || [1.0.0] 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 || | | 8 || CleanupContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], and deletes the associated savedata. | ||
|- | |- | ||
| 9 || [2.0.0+] | | 9 || [2.0.0+] OpenContentStorage2 || Takes a [[Filesystem_services#StorageId|StorageID]], and opens an IContentStorage for the StorageID to be gotten with GetIContentStorage. Note: Name is not official. | ||
|- | |- | ||
| 10 || [2.0.0+] | | 10 || [2.0.0+] CloseContentStorage || Takes a [[Filesystem_services#StorageId|StorageID]], and closes the associated IContentStorage. Note: Name is not official. | ||
|- | |- | ||
| 11 || [2.0.0+] | | 11 || [2.0.0+] OpenContentMetaDatabase2 || Takes a [[Filesystem_services#StorageId|StorageID]], and opens an IContentMetaDatabase for the StorageID to be gotten with GetIContentMetaDatabase. Note: Name is not official. | ||
|- | |- | ||
| 12 || [2.0.0+] | | 12 || [2.0.0+] CloseContentMetaDatabase || Takes a [[Filesystem_services#StorageId|StorageID]], and closes the associated IContentMetaDatabase. Note: Name is not official. | ||
|} | |} | ||
Line 234: | Line 234: | ||
| 0 || [[#GeneratePlaceHolderId]] || Returns a random UUID for the Content Storage. | | 0 || [[#GeneratePlaceHolderId]] || Returns a random UUID for the Content Storage. | ||
|- | |- | ||
| 1 || | | 1 || CreatePlaceHolder || Takes two [[#NcaID]]s, and a u64 filesize. | ||
|- | |- | ||
| 2 || | | 2 || DeletePlaceHolder || Takes a [[#NcaID]]. | ||
|- | |- | ||
| 3 || | | 3 || HasPlaceHolder || Takes a [[#NcaID]]. | ||
|- | |- | ||
| 4 || | | 4 || WritePlaceHolder || Takes a [[#NcaID]], a u64-offset, and type 5 buffer. Writes the buffer to the file for the NcaID's placeholder path at the specified offset. | ||
|- | |- | ||
| 5 || | | 5 || Register || Takes two [[#NcaID]]s, moves the Placeholder NCA content to the registered NCA path. | ||
|- | |- | ||
| 6 || | | 6 || Delete || Takes a [[#NcaID]]. | ||
|- | |- | ||
| 7 || | | 7 || Has || Takes a [[#NcaID]]. | ||
|- | |- | ||
| 8 || GetPath || Takes a [[#NcaID]]. Returns a [[Filesystem_services#ContentPath|Content Path]]. | | 8 || GetPath || Takes a [[#NcaID]]. Returns a [[Filesystem_services#ContentPath|Content Path]]. | ||
|- | |- | ||
| 9 || | | 9 || GetPlaceHolderPath || Takes a [[#NcaID]]. Returns a [[Filesystem_services#ContentPath|Content Path]]. | ||
|- | |- | ||
| 10 || | | 10 || CleanupAllPlaceHolder || Deletes and re-creates the Placeholder directory. | ||
|- | |- | ||
| 11 || | | 11 || ListPlaceHolder || This is like [[#GetNumberOfRegisteredEntries]], but for the Placeholder directory. | ||
|- | |- | ||
| 12 || [[# | | 12 || [[#GetContentCount]] || | ||
|- | |- | ||
| 13 || [[# | | 13 || [[#ListContentId]] || | ||
|- | |- | ||
| 14 || [[# | | 14 || [[#GetSize]] || | ||
|- | |- | ||
| 15 || | | 15 || DisableForcibly || Closes/Flushes all resources for the storage, and causes all future IPC commands to the current session to return error 0xC805. | ||
|- | |- | ||
| 16 || [2.0.0+] | | 16 || [2.0.0+] RevertToPlaceHolder || 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+] | | 17 || [2.0.0+] SetPlaceHolderSize || Takes a [[#NcaID]], and a u64 size | ||
|- | |- | ||
| 18 || [2.0.0+] [[# | | 18 || [2.0.0+] [[#ReadContentIdFile]] || | ||
|- | |- | ||
| 19 || [2.0.0+] | | 19 || [2.0.0+] GetRightsIdFromPlaceHolderId || Gets the Rights ID for the [[#NcaID]]'s placeholder path. | ||
|- | |- | ||
| 20 || [2.0.0+] | | 20 || [2.0.0+] GetRightsIdFromContentId || Gets the Rights ID for the [[#NcaID]]'s registered path | ||
|- | |- | ||
| 21 || [2.0.0+] | | 21 || [2.0.0+] WriteContentForDebug || 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. | ||
|- | |- | ||
| 22 || [2.0.0+] | | 22 || [2.0.0+] GetFreeSpaceSize || Gets free space for the storage. | ||
|- | |- | ||
| 23 || [2.0.0+] | | 23 || [2.0.0+] GetTotalSpaceSize || Gets total space for the storage. | ||
|- | |- | ||
| 24 || [3.0.0+] FlushStorage || Flushes resources for the storage without closing it. | | 24 || [3.0.0+] FlushStorage || Flushes resources for the storage without closing it. | ||
Line 292: | Line 292: | ||
Calls nn::util::GenerateUuid(), which internally calls nn::os::GenerateRandomBytes(16); | Calls nn::util::GenerateUuid(), which internally calls nn::os::GenerateRandomBytes(16); | ||
==== | ==== GetContentCount ==== | ||
Writes the total number of entries which can be read by GetEntries, to cmdreply <SFCO_offset>+0x10. | Writes the total number of entries which can be read by GetEntries, to cmdreply <SFCO_offset>+0x10. | ||
==== | ==== ListContentId==== | ||
Takes an output buffer, u32 offset and gets all entries starting at that offset. | Takes an output buffer, u32 offset and gets all entries starting at that offset. | ||
Returns number of entries read. | Returns number of entries read. | ||
Line 303: | Line 303: | ||
The total read entries is exactly the same as the number of "<hex>.nca" directories in the storage FS(or at least under the "registered" directory?). | The total read entries is exactly the same as the number of "<hex>.nca" directories in the storage FS(or at least under the "registered" directory?). | ||
==== | ==== GetSize ==== | ||
Takes a [[#NcaID]] as input. | Takes a [[#NcaID]] as input. | ||
Returns the total size readable by ReadEntryRaw. This is the same as the size-field in the [[NAX0]] "<NcaID>.nca/00" file. | Returns the total size readable by ReadEntryRaw. This is the same as the size-field in the [[NAX0]] "<NcaID>.nca/00" file. | ||
==== | ==== ReadContentIdFile ==== | ||
Takes an output buffer, a [[#NcaID]] as input, and a u64 file offset. | Takes an output buffer, a [[#NcaID]] as input, and a u64 file offset. | ||