Changes

Jump to navigation Jump to search
2,365 bytes added ,  21:27, 15 October 2023
no edit summary
Line 1: Line 1:  
This is the metadata file that ends in <code>".cnmt{.nca}"</code> or <code>"meta0.ncd"</code>. This seems to replace the TMD format.
 
This is the metadata file that ends in <code>".cnmt{.nca}"</code> or <code>"meta0.ncd"</code>. This seems to replace the TMD format.
   −
There's at least 9 different filenames used for ".cnmt":
+
The official name for CNMT is "PackagedContentMeta".
* "Application_{lower-case hex titleID}.cnmt"
+
 
* "Patch_{lower-case hex titleID}.cnmt"
+
= PackagedContentMetaHeader =
* "AddOnContent_{lower-case hex titleID}.cnmt"
+
This is "nn::ncm::PackagedContentMetaHeader".
* "SystemUpdate_{hex titleID}.cnmt"
  −
* "SystemData_{lower-case hex titleID}.cnmt"
  −
* "SystemProgram_{lower-case hex titleID}.cnmt"
  −
* "BootImagePackage_{lower-case hex titleID}.cnmt"
  −
* "BootImagePackageSafe_{lower-case hex titleID}.cnmt"
  −
* "Delta_{lower-case hex titleID}.cnmt"
     −
== Header ==
   
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 21: Line 14:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Title ID
+
| Id
 
|-
 
|-
 
| 0x8
 
| 0x8
Line 29: Line 22:  
| 0xC
 
| 0xC
 
| 0x1
 
| 0x1
| [[NCM_services#Title_Types|Meta Type]]
+
| [[NCM_services#ContentMetaType|ContentMetaType]]
 
|-
 
|-
 
| 0xD
 
| 0xD
 
| 0x1
 
| 0x1
| Unused
+
| [17.0.0+] [[NCM_services#ContentMetaPlatform|ContentMetaPlatform]] ([1.0.0-16.1.0] Reserved)
 
|-
 
|-
 
| 0xE
 
| 0xE
 
| 0x2
 
| 0x2
| Extended Header Size
+
| ExtendedHeaderSize
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 0x2
 
| 0x2
| Content Count
+
| ContentCount
 
|-
 
|-
 
| 0x12
 
| 0x12
 
| 0x2
 
| 0x2
| Content Meta Count
+
| ContentMetaCount
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 0x1
 
| 0x1
| Attributes (0=None, 1=IncludesExFatDriver, 2=Rebootless)
+
| ContentMetaAttributes (0=None, 1=IncludesExFatDriver, 2=Rebootless, 4=Compacted)
 
|-
 
|-
 
| 0x15
 
| 0x15
 
| 0x3
 
| 0x3
| Unused
+
| Reserved
 
|-
 
|-
 
| 0x18
 
| 0x18
 
| 0x4
 
| 0x4
| Required Download System Version
+
| RequiredDownloadSystemVersion
 
|-
 
|-
 
| 0x1C
 
| 0x1C
 
| 0x4
 
| 0x4
| Unused
+
| Reserved
 
|}
 
|}
   −
== SystemUpdate Extended Header ==
+
= SystemUpdateMetaExtendedHeader =
 +
This is "nn::ncm::SystemUpdateMetaExtendedHeader".
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 73: Line 68:  
| 0x0
 
| 0x0
 
| 0x4
 
| 0x4
| Extended Data Size
+
| ExtendedDataSize
 
|}
 
|}
   −
== Application Extended Header ==
+
= ApplicationMetaExtendedHeader =
 +
This is "nn::ncm::ApplicationMetaExtendedHeader".
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 85: Line 82:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Patch ID
+
| PatchId
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 0x4
 
| 0x4
| Required System Version
+
| RequiredSystemVersion
 
|-
 
|-
 
| 0xC
 
| 0xC
 
| 0x4
 
| 0x4
| Unused
+
| RequiredApplicationVersion
 
|}
 
|}
   −
== Patch Extended Header ==
+
= PatchMetaExtendedHeader =
 +
This is "nn::ncm::PatchMetaExtendedHeader".
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 105: Line 104:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Application ID
+
| ApplicationId
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 0x4
 
| 0x4
| Required System Version
+
| RequiredSystemVersion
 
|-
 
|-
 
| 0xC
 
| 0xC
 
| 0x4
 
| 0x4
| Extended Data Size
+
| ExtendedDataSize
 +
|-
 +
| 0x10
 +
| 0x8
 +
| Reserved
 +
|}
 +
 
 +
= AddOnContentMetaExtendedHeader =
 +
This is "nn::ncm::AddOnContentMetaExtendedHeader".
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x8
 +
| ApplicationId
 +
|-
 +
| 0x8
 +
| 0x4
 +
| RequiredApplicationVersion
 +
|-
 +
| 0xC
 +
| 0x1
 +
| [15.0.0+] ContentAccessibilities ([1.0.0-14.1.2] Reserved)
 +
|-
 +
| 0xD
 +
| 0x3
 +
| Reserved
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 0x8
 
| 0x8
| Unused
+
| [15.0.0+] DataPatchId
 
|}
 
|}
   −
== AddOnContent Extended Header ==
+
= DeltaMetaExtendedHeader =
 +
This is "nn::ncm::DeltaMetaExtendedHeader".
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 129: Line 160:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Application ID
+
| ApplicationId
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 0x4
 
| 0x4
| Required Application Version
+
| ExtendedDataSize
 
|-
 
|-
 
| 0xC
 
| 0xC
 
| 0x4
 
| 0x4
| Unused
+
| Reserved
 
|}
 
|}
   −
== Delta Extended Header ==
+
= DataPatchMetaExtendedHeader =
 +
This is "nn::ncm::DataPatchMetaExtendedHeader".
 +
 
 +
This was added with [15.0.0+].
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 149: Line 184:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Application ID
+
| DataId
 
|-
 
|-
 
| 0x8
 
| 0x8
 +
| 0x8
 +
| ApplicationId
 +
|-
 +
| 0x10
 
| 0x4
 
| 0x4
| Extended Data Size
+
| RequiredApplicationVersion
 
|-
 
|-
| 0xC
+
| 0x14
 
| 0x4
 
| 0x4
| Unused
+
| ExtendedDataSize
 +
|-
 +
| 0x18
 +
| 0x8
 +
| Reserved
 
|}
 
|}
   −
== Content Records ==
+
= PackagedContentInfo =
 +
This is "nn::ncm::PackagedContentInfo".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 170: Line 214:  
| 0x0
 
| 0x0
 
| 0x20
 
| 0x20
| Hash
+
| Hash (SHA256 of the referenced content)
 
|-
 
|-
 
| 0x20
 
| 0x20
 
| 0x10
 
| 0x10
| Content ID
+
| ContentId
 
|-
 
|-
 
| 0x30
 
| 0x30
| 0x6
+
| [15.0.0+] 0x5 ([1.0.0-14.1.2] 0x6)
 
| Size
 
| Size
 +
|-
 +
| 0x35
 +
| 0x1
 +
| [15.0.0+] ContentAttributes
 
|-
 
|-
 
| 0x36
 
| 0x36
 
| 0x1
 
| 0x1
| Title Type (0=Meta, 1=Program, 2=Data, 3=Control, 4=[[Internet_Browser|HtmlDocument]], 5=[[Internet_Browser|LegalInformation]], 6=[[NCA_Format|DeltaFragment]])
+
| ContentType (0=Meta, 1=Program, 2=Data, 3=Control, 4=[[Internet_Browser|HtmlDocument]], 5=[[Internet_Browser|LegalInformation]], 6=[[NCA_Format|DeltaFragment]])
 
|-
 
|-
 
| 0x37
 
| 0x37
 
| 0x1
 
| 0x1
| Id Offset
+
| IdOffset
 
|}
 
|}
   −
== Content Meta Records ==
+
= ContentMetaInfo =
 +
This is "nn::ncm::ContentMetaInfo".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 199: Line 248:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Title ID
+
| Id
 
|-
 
|-
 
| 0x8
 
| 0x8
Line 207: Line 256:  
| 0xC
 
| 0xC
 
| 0x1
 
| 0x1
| [[NCM_services#Title_Types|Meta Type]]
+
| [[NCM_services#ContentMetaType|ContentMetaType]]
 
|-
 
|-
 
| 0xD
 
| 0xD
 
| 0x1
 
| 0x1
| Attributes (0=None, 1=IncludesExFatDriver, 2=Rebootless)
+
| ContentMetaAttributes (0=None, 1=IncludesExFatDriver, 2=Rebootless, 4=Compacted)
 
|-
 
|-
 
| 0xE
 
| 0xE
 
| 0x2
 
| 0x2
| Unused
+
| Reserved
 
|}
 
|}
    
This is used for SystemUpdate, see here: [[NCM_services#ReadEntryMetaRecords]].
 
This is used for SystemUpdate, see here: [[NCM_services#ReadEntryMetaRecords]].
   −
== SystemUpdate Extended Data ==
+
= SystemUpdateMetaExtendedData =
 +
This is "nn::ncm::SystemUpdateMetaExtendedData".
 +
 
 +
If the Version field is 1, the format is:
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| Version
 +
|-
 +
| 0x4
 +
| 0x4
 +
| VariationCount
 +
|-
 +
| 0x8
 +
| 0x20 * VariationCount
 +
| [[#FirmwareVariationInfo|FirmwareVariationInfo]] (Version 1)
 +
|}
    +
If the Version field is 2, the format is:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 234: Line 305:  
| 0x4
 
| 0x4
 
| 0x4
 
| 0x4
| Variation Count
+
| VariationCount
 
|-
 
|-
 
| 0x8
 
| 0x8
 +
| 0x4 * VariationCount
 +
| FirmwareVariationId
 +
|-
 +
| Variable
 +
| 0x20 * VariationCount
 +
| [[#FirmwareVariationInfo|FirmwareVariationInfo]] (Version 2)
 +
|-
 +
| Variable
 +
| 0x10 * MetaCount (from [[#FirmwareVariationInfo|FirmwareVariationInfo]] (Version 2))
 +
| [[#ContentMetaInfo|ContentMetaInfo]] (if ReferToBase is False)
 +
|}
 +
 +
== FirmwareVariationInfo ==
 +
This is "FirmwareVariationInfo ".
 +
 +
If the Version field is 1, the format is:
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| FirmwareVariationId
 +
|-
 +
| 0x4
 +
| 0x1C
 +
| Reserved
 +
|}
 +
 +
If the Version field is 2, the format is:
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x1
 +
| ReferToBase (0=False, 1=True)
 +
|-
 +
| 0x1
 +
| 0x3
 +
| Reserved
 +
|-
 +
| 0x4
 
| 0x4
 
| 0x4
| Firmware Variation
+
| MetaCount
|-  
+
|-
| 0xC
+
| 0x8
| 0x1C * Variation Count
+
| 0x18
| Unused
+
| Reserved
 
|}
 
|}
   −
== Patch Extended Data ==
+
= PatchMetaExtendedData =
 +
This is "nn::ncm::PatchMetaExtendedData".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 255: Line 374:  
| 0x0
 
| 0x0
 
| 0x4
 
| 0x4
| History Count
+
| PatchHistoryHeaderCount
 
|-
 
|-
 
| 0x4
 
| 0x4
 
| 0x4
 
| 0x4
| Delta History Count
+
| PatchDeltaHistoryCount
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 0x4
 
| 0x4
| Delta Count
+
| PatchDeltaHeaderCount
 
|-
 
|-
 
| 0xC
 
| 0xC
 
| 0x4
 
| 0x4
| Fragment Set Count
+
| FragmentSetCount
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 0x4
 
| 0x4
| History Content Count
+
| PatchHistoryContentInfoCount
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 0x4
 
| 0x4
| Delta Content Count
+
| PatchDeltaPackagedContentInfoCount
 
|-
 
|-
 
| 0x18
 
| 0x18
 
| 0x4
 
| 0x4
| Unused
+
| Reserved
 
|-
 
|-
 
| 0x1C
 
| 0x1C
| 0x38 * History Count
+
| 0x38 * PatchHistoryHeaderCount
| [[CNMT#History_Header|History Headers]]
+
| [[#PatchHistoryHeader|PatchHistoryHeader]]
 
|-
 
|-
|  
+
| Variable
| 0x28 * Delta History Count
+
| 0x28 * PatchDeltaHistoryCount
| [[CNMT#Delta_History|Delta Histories]]
+
| [[#PatchDeltaHistory|PatchDeltaHistory]]
 
|-
 
|-
|  
+
| Variable
| 0x28 * Delta Count
+
| 0x28 * PatchDeltaHeaderCount
| [[CNMT#Delta_Header|Delta Headers]]
+
| [[#PatchDeltaHeader|PatchDeltaHeader]]
 
|-
 
|-
|  
+
| Variable
| 0x34 * Fragment Set Count
+
| 0x34 * FragmentSetCount
| [[CNMT#Fragment_Set|Fragment Sets]]
+
| [[#FragmentSet|FragmentSet]]
 
|-
 
|-
|  
+
| Variable
| 0x18 * History Content Count
+
| 0x18 * PatchHistoryContentInfoCount
| [[CNMT#Content_Records|History Content Records (Content Records without the Hash entry)]]
+
| [[#PackagedContentInfo|PatchHistoryContentInfo]] ([[#PackagedContentInfo|PackagedContentInfo]] without the Hash entry)
 
|-
 
|-
|  
+
| Variable
| 0x38 * Delta Content Count
+
| 0x38 * PatchDeltaPackagedContentInfoCount
| [[CNMT#Content_Records|Delta Content Records]]
+
| [[#PackagedContentInfo|PatchDeltaPackagedContentInfo]]
 
|-
 
|-
|
+
| Variable
| 0x4 * Fragment Indicator Count (Fragment Set)
+
| 0x4 * FragmentIndicatorCount (from [[#FragmentSet|FragmentSet]])
| [[CNMT#Fragment_Indicator|Fragment Indicators]]
+
| [[#FragmentIndicator|FragmentIndicator]]
 
|}
 
|}
   −
=== History Header ===
+
== PatchHistoryHeader ==
 +
This is "nn::ncm::PatchHistoryHeader".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 320: Line 440:  
| 0x0
 
| 0x0
 
| 0x10
 
| 0x10
| [[CNMT#Content_Meta_Records|Content Meta Record]]
+
| ContentMetaKey
|-
  −
| 0xC
  −
| 0x1
  −
| [[NCM_services#Title_Types|Meta Type]]
  −
|-
  −
| 0xD
  −
| 0x1
  −
| Attributes (0=None, 1=IncludesExFatDriver, 2=Rebootless)
  −
|-
  −
| 0xE
  −
| 0x2
  −
| Unused
   
|-
 
|-
 
| 0x10
 
| 0x10
Line 340: Line 448:  
| 0x30
 
| 0x30
 
| 0x2
 
| 0x2
| Content Info Count
+
| ContentInfoCount
 
|-
 
|-
 
| 0x32
 
| 0x32
 
| 0x6
 
| 0x6
| Unused
+
| Reserved
 
|}
 
|}
   −
=== Delta History ===
+
== PatchDeltaHistory ==
 +
This is "nn::ncm::PatchDeltaHistory".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 357: Line 466:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Source Patch ID
+
| SourcePatchId
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 0x8
 
| 0x8
| Destination Patch ID
+
| DestinationPatchId
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 0x4
 
| 0x4
| Source Version
+
| SourceVersion
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 0x4
 
| 0x4
| Destination Version
+
| DestinationVersion
 
|-
 
|-
 
| 0x18
 
| 0x18
 
| 0x8
 
| 0x8
| Download Size
+
| DownloadSize
 
|-
 
|-
 
| 0x20
 
| 0x20
 
| 0x8
 
| 0x8
| Unused
+
| Reserved
 
|}
 
|}
   −
=== Delta Header ===
+
== PatchDeltaHeader ==
 +
This is "nn::ncm::PatchDeltaHeader".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 390: Line 500:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Source Patch ID
+
| SourcePatchId
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 8
 
| 8
| Destination Patch ID
+
| DestinationPatchId
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 0x4
 
| 0x4
| Source Version
+
| SourceVersion
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 0x4
 
| 0x4
| Destination Version
+
| DestinationVersion
 
|-
 
|-
 
| 0x18
 
| 0x18
 
| 0x2
 
| 0x2
| Fragment Set Count
+
| FragmentSetCount
 
|-
 
|-
 
| 0x1A
 
| 0x1A
 
| 0x6
 
| 0x6
| Unused
+
| Reserved
 
|-
 
|-
 
| 0x20
 
| 0x20
 
| 0x2
 
| 0x2
| Content Info Count
+
| ContentInfoCount
 
|-
 
|-
 
| 0x22
 
| 0x22
 
| 0x6
 
| 0x6
| Unused
+
| Reserved
 
|}
 
|}
   −
=== Fragment Set ===
+
== FragmentSet ==
 +
This is "nn::ncm::FragmentSet".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 431: Line 542:  
| 0x0
 
| 0x0
 
| 0x10
 
| 0x10
| Source Content ID
+
| SourceContentId
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 0x10
 
| 0x10
| Destination Content ID
+
| DestinationContentId
 
|-
 
|-
 
| 0x20
 
| 0x20
 
| 0x6
 
| 0x6
| Source Size
+
| SourceSize
 
|-
 
|-
 
| 0x26
 
| 0x26
 
| 0x6
 
| 0x6
| Destination Size
+
| DestinationSize
 
|-
 
|-
 
| 0x2C
 
| 0x2C
 
| 0x2
 
| 0x2
| Fragment Indicator Count
+
| FragmentIndicatorCount
 
|-
 
|-
 
| 0x2E
 
| 0x2E
 
| 0x1
 
| 0x1
| [[NCM_services#Title_Types|Meta Type]]
+
| FragmentTargetContentType (0=Meta, 1=Program, 2=Data, 3=Control, 4=[[Internet_Browser|HtmlDocument]], 5=[[Internet_Browser|LegalInformation]], 6=[[NCA_Format|DeltaFragment]])
 
|-
 
|-
 
| 0x2F
 
| 0x2F
 
| 0x1
 
| 0x1
| Update Type (0=ApplyAsDelta, 1=Overwrite, 2=Create)
+
| UpdateType (0=ApplyAsDelta, 1=Overwrite, 2=Create)
 
|-
 
|-
 
| 0x30
 
| 0x30
 
| 0x4
 
| 0x4
| Unused
+
| Reserved
 
|}
 
|}
   −
=== Fragment Indicator ===
+
== FragmentIndicator ==
 +
This is "nn::ncm::FragmentIndicator".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 472: Line 584:  
| 0x0
 
| 0x0
 
| 0x2
 
| 0x2
| Content Info Index
+
| ContentInfoIndex
 
|-
 
|-
 
| 0x2
 
| 0x2
 
| 0x2
 
| 0x2
| Fragment Index
+
| FragmentIndex
 
|}
 
|}
   −
== Delta Extended Data ==
+
= DeltaMetaExtendedData =
 +
This is "nn::ncm::DeltaMetaExtendedData".
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 489: Line 602:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| Source Patch ID
+
| SourcePatchId
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 0x8
 
| 0x8
| Destination Patch ID
+
| DestinationPatchId
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 0x4
 
| 0x4
| Source Version
+
| SourceVersion
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 0x4
 
| 0x4
| Destination Version
+
| DestinationVersion
 
|-
 
|-
 
| 0x18
 
| 0x18
 
| 0x2
 
| 0x2
| Fragment Set Count
+
| FragmentSetCount
 
|-
 
|-
 
| 0x1A
 
| 0x1A
 
| 0x6
 
| 0x6
| Unused
+
| Reserved
 
|-
 
|-
 
| 0x20
 
| 0x20
| 0x34 * Fragment Set Count
+
| 0x34 * FragmentSetCount
| [[CNMT#Fragment_Set|Fragment Sets]]
+
| [[#FragmentSet|FragmentSet]]
 
|-
 
|-
|
+
| Variable
| 0x4 * Fragment Indicator Count (Fragment Set)
+
| 0x4 * FragmentIndicatorCount (from [[#FragmentSet|FragmentSet]])
| [[CNMT#Fragment_Indicator|Fragment Indicators]]
+
| [[#FragmentIndicator|FragmentIndicator]]
 
|}
 
|}
   −
== Digest ==
+
= Digest =
 
  −
Always found at the end of the file.
  −
 
   
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 534: Line 644:  
| Digest
 
| Digest
 
|}
 
|}
 +
 +
This is a SHA-256 hash always found at the end of the file. The hash is calculated over the CNMT file's contents, but this is only done for the development version of the file which results in its production version counterpart sharing the same hash value.

Navigation menu