Line 332: |
Line 332: |
| ! Cmd || Name || Notes | | ! Cmd || Name || Notes |
| |- | | |- |
− | | 0 || Set || Takes a [[NCA#Meta_records|Meta Record]], a type-5 [[NCA#Content_records|Content Records]] buffer and a u64 size. | + | | 0 || Set || Takes a [[CNMT#Meta_records|Meta Record]], a type-5 [[CNMT#Content_records|Content Records]] buffer and a u64 size. |
| |- | | |- |
− | | 1 || Get || Takes a [[NCA#Meta_records|Meta Record]], a type-6 buffer to write [[NCA#Content_records|Content Records]] to and a u64 size. Returns the actual number of bytes read into the buffer. First 8 bytes of the data is header (u16 numExtraDataBytes, numContentRecords, numMetaRecords, padding). After the header is numExtraDataBytes of additional data, after which follow content records and meta records. Set takes this same data as input. | + | | 1 || Get || Takes a [[CNMT#Meta_records|Meta Record]], a type-6 buffer to write [[CNMT#Content_records|Content Records]] to and a u64 size. Returns the actual number of bytes read into the buffer. First 8 bytes of the data is header (u16 numExtraDataBytes, numContentRecords, numMetaRecords, padding). After the header is numExtraDataBytes of additional data, after which follow content records and meta records. Set takes this same data as input. |
| |- | | |- |
− | | 2 || Remove || Takes a [[NCA#Meta_records|Meta Record]], and removes the associated record. | + | | 2 || Remove || Takes a [[CNMT#Meta_records|Meta Record]], and removes the associated record. |
| |- | | |- |
− | | 3 || GetContentIdByType || Takes a [[NCA#Meta_records|Meta Record]] and a u8 [[#Title_Types|Title Type]]. Returns a [[#NcaID]]. | + | | 3 || GetContentIdByType || Takes a [[CNMT#Meta_records|Meta Record]] and a u8 [[#Title_Types|Title Type]]. Returns a [[#NcaID]]. |
| |- | | |- |
− | | 4 || ListContentInfo || Takes a type-6 buffer to write [[NCA#Content_records|Content Record]] entries to, a [[NCA#Meta_records|Meta Record]], and a u32 index into the Content Record entries to start copying from. Returns a u32 entries_read. | + | | 4 || ListContentInfo || Takes a type-6 buffer to write [[CNMT#Content_records|Content Record]] entries to, a [[CNMT#Meta_records|Meta Record]], and a u32 index into the Content Record entries to start copying from. Returns a u32 entries_read. |
| |- | | |- |
− | | 5 || List || Takes a type-6 buffer to write [[NCA#Meta_records|Meta Record]]s to, a u32 [[#Title_Types|Title Type]], a u64 TID, a u64 TID_LOW, and u64 TID_HIGH. Writes into the buffer all Meta Records with low <= record->title_id <= high, and record->type == type. Returns u32 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. | + | | 5 || List || Takes a type-6 buffer to write [[CNMT#Meta_records|Meta Record]]s to, a u32 [[#Title_Types|Title Type]], a u64 TID, a u64 TID_LOW, and u64 TID_HIGH. Writes into the buffer all Meta Records with low <= record->title_id <= high, and record->type == type. Returns u32 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, and returns the [[NCA#Meta_records|Meta Record]] with the highest version field for that title id. | + | | 6 || GetLatestContentMetaKey || Takes a u64 title id, and returns the [[CNMT#Meta_records|Meta Record]] with the highest version field for that title id. |
| |- | | |- |
| | 7 || [[#ListApplication]] || | | | 7 || [[#ListApplication]] || |
| |- | | |- |
− | | 8 || Has || Takes a [[NCA#Meta_records|Meta Record]] and returns whether that record is present in the database. | + | | 8 || Has || Takes a [[CNMT#Meta_records|Meta Record]] and returns whether that record is present in the database. |
| |- | | |- |
− | | 9 || HasAll || Takes a type-5 buffer containing [[NCA#Meta_records|Meta Records]] (code assumes there are size/sizeof(meta_record) records in the buffer), and returns whether all of those records are present in the database. | + | | 9 || HasAll || Takes a type-5 buffer containing [[CNMT#Meta_records|Meta Records]] (code assumes there are size/sizeof(meta_record) records in the buffer), and returns whether all of those records are present in the database. |
| |- | | |- |
− | | 10 || GetSize || Takes a [[NCA#Meta_records|Meta Record]], and returns the size of the associated [[NCA#Content_records|Content Records]]. | + | | 10 || GetSize || Takes a [[CNMT#Meta_records|Meta Record]], and returns the size of the associated [[CNMT#Content_records|Content Records]]. |
| |- | | |- |
− | | 11 || GetRequiredSystemVersion || Takes a [[NCA#Meta_records|Meta Record]], and returns u32 from ContentRecords + 16 (only if the Meta record has type Application or Patch). | + | | 11 || GetRequiredSystemVersion || Takes a [[CNMT#Meta_records|Meta Record]], and returns u32 from ContentRecords + 16 (only if the Meta record has type Application or Patch). |
| |- | | |- |
− | | 12 || GetPatchId || Takes a [[NCA#Meta_records|Meta Record]], and returns the update title id for that record. | + | | 12 || GetPatchId || Takes a [[CNMT#Meta_records|Meta Record]], and returns the update title id for that record. |
| |- | | |- |
| | 13 || DisableForcibly || Closes the meta database, and causes all future IPC commands to the current session to return error 0xDC05. | | | 13 || DisableForcibly || Closes the meta database, and causes all future IPC commands to the current session to return error 0xDC05. |
Line 364: |
Line 364: |
| | 15 || Commit || Flushes the in-memory database to savedata. | | | 15 || Commit || Flushes the in-memory database to savedata. |
| |- | | |- |
− | | 16 || HasContent || Takes a [[NCA#Meta_records|Meta Record]] and an [[#NcaID]]. Returns whether the content records for that meta record contain the NcaID. | + | | 16 || HasContent || Takes a [[CNMT#Meta_records|Meta Record]] and an [[#NcaID]]. Returns whether the content records for that meta record contain the NcaID. |
| |- | | |- |
− | | 17 || ListContentMetaInfo || Takes a type-6 [[NCA#Meta_records|Meta Record]] output buffer, a u32 eoffset into that buffer, and an input [[NCA#Meta_records|Meta Record]]. | + | | 17 || ListContentMetaInfo || Takes a type-6 [[CNMT#Meta_records|Meta Record]] output buffer, a u32 offset into that buffer, and an input [[CNMT#Meta_records|Meta Record]]. |
| |- | | |- |
− | | 18 || GetAttributes || Takes a [[NCA#Meta_records|Meta Record]], and returns u8 from ContentRecords + 6. | + | | 18 || GetAttributes || Takes a [[CNMT#Meta_records|Meta Record]], and returns u8 from ContentRecords + 6. |
| |- | | |- |
| | 19 || [2.0.0+] GetRequiredApplicationVersion || Does the same thing as GetEntryUnknownRecordSize, but for AddOnContents. | | | 19 || [2.0.0+] GetRequiredApplicationVersion || Does the same thing as GetEntryUnknownRecordSize, but for AddOnContents. |
Line 377: |
Line 377: |
| ==== ListApplication ==== | | ==== ListApplication ==== |
| Each 24-byte entry (officially "ApplicationContentMetaKey") is as follows: | | Each 24-byte entry (officially "ApplicationContentMetaKey") is as follows: |
− | [[NCA#Meta_records|meta_record]] meta_record; | + | [[CNMT#Meta_records|meta_record]] meta_record; |
| u64 base_title_id; | | u64 base_title_id; |
| | | |
Line 385: |
Line 385: |
| | | |
| ==== ReadEntryMetaRecords ==== | | ==== ReadEntryMetaRecords ==== |
− | Takes a type-6 [[NCA#Meta_records|Meta Record]] output buffer, a u32 eoffset into that buffer, and an input [[NCA#Meta_records|Meta Record]] entry. Returns a u32 for total_read_entries. | + | Takes a type-6 [[CNMT#Meta_records|Meta Record]] output buffer, a u32 offset into that buffer, and an input [[CNMT#Meta_records|Meta Record]] entry. Returns a u32 for total_read_entries. |
| | | |
| Reads the meta records stored in the entry's content records into the output buffer. | | Reads the meta records stored in the entry's content records into the output buffer. |