Changes

1,748 bytes added ,  21:25, 31 October 2022
m
Line 1: Line 1: βˆ’
'''Title metadata''' is a format used to store information about a title (a single standalone game, channel, etc.) and all its installed contents, including which contents they consist of and their SHA1 hashes.
+
'''Title metadata''' (aka '''TMD''') is a format used to store information about a [[title]] and all its installed contents, including which contents they consist of and their SHA1 hashes.
βˆ’
+
 
βˆ’
Many operations are done in terms of 64-byte blocks, which means you will often see padding out to the nearest 64-byte boundary at the end of a field.
+
TMDs seem to have been originally intended to all be stored in [[:/title/00000001/00000002/data/tmds.sys]], much like ticket.sys on the iQue Player; on release consoles, most TMDs are still stored there, but the TMD files actually used are stored in separate title.tmd files.
    
== Structure ==
 
== Structure ==
βˆ’
=== Header ===
+
=== Signed blob header ===
 
{| class="wikitable"
 
{| class="wikitable"
 
|- style="background-color: #ddd;"
 
|- style="background-color: #ddd;"
βˆ’
! Start
+
! Absolute offset
 
! Length
 
! Length
 
! Description
 
! Description
Line 13: Line 13:  
| 0x000
 
| 0x000
 
| 4
 
| 4
βˆ’
| Signature type
+
| Signature type (always 0x10001 for RSA-2048 w/ SHA-1)
 
|-
 
|-
 
| 0x004
 
| 0x004
 
| 256
 
| 256
βˆ’
| Signature
+
| Signature covering the main header as well as all CMDs
 
|-
 
|-
 
| 0x104
 
| 0x104
 
| 60
 
| 60
βˆ’
| Padding modulo 64
+
| Padding for 64-byte alignment
 +
|}
 +
 
 +
=== Main header ===
 +
{| class="wikitable"
 +
|- style="background-color: #ddd;"
 +
! Absolute offset
 +
! Length
 +
! Description
 
|-
 
|-
 
| 0x140
 
| 0x140
 
| 64
 
| 64
βˆ’
| Issuer
+
| Certificate issuer
 
|-
 
|-
 
| 0x180
 
| 0x180
Line 41: Line 49:  
| 0x183
 
| 0x183
 
| 1
 
| 1
βˆ’
| Padding modulo 64
+
| Is vWii (1 for vWii titles, 0 for normal titles)
 
|-
 
|-
 
| 0x184
 
| 0x184
 
| 8
 
| 8
βˆ’
| System Version (the ios that the title need)
+
| System Version (the IOS that the title needs, Set to 0 for IOS itself. For the boot2, this is identical to the boot2 version.)
 
|-
 
|-
 
| 0x18C
 
| 0x18C
Line 60: Line 68:  
|-
 
|-
 
| 0x19A
 
| 0x19A
βˆ’
| 62
+
| 2
βˆ’
| reserved
+
| Zero
 +
|-
 +
| 0x19C
 +
| 2
 +
| Region (0: Japan, 1: USA, 2: Europe, 3: Region Free, 4: Korea)
 +
|-
 +
| 0x19E
 +
| 16
 +
| Ratings
 +
|-
 +
| 0x1AE
 +
| 12
 +
| Reserved
 +
|-
 +
| 0x1BA
 +
| 12
 +
| IPC Mask
 +
|-
 +
| 0x1C6
 +
| 18
 +
| Reserved
 
|-
 
|-
 
| 0x1D8
 
| 0x1D8
 
| 4
 
| 4
βˆ’
| Access rights
+
| Access rights (flags for [[DVDX|DVD-video access]] and [http://hackmii.com/2009/08/of-tmds-and-hardware/ full PPC hardware access])
 
|-
 
|-
 
| 0x1DC
 
| 0x1DC
Line 77: Line 105:  
| 0x1E0
 
| 0x1E0
 
| 2
 
| 2
βˆ’
| boot index
+
| boot index (content index for boot file. For [[Broadway]] titles, this is typically the [[NAND Boot Program]]. For [[Starlet]] titles, this is the main binary with the kernel/ES/FS, or the single binary for monolithic IOSes)
 
|-
 
|-
 
| 0x1E2
 
| 0x1E2
 
| 2
 
| 2
βˆ’
| Padding modulo 64
+
| Minor version (unused - the term typically refers to the lower half of the main version instead)
βˆ’
|-
  βˆ’
| 0x1E4
  βˆ’
| 36*nbr_cont
  βˆ’
| Contents
   
|}
 
|}
   βˆ’
=== Content ===
+
=== Content metadata (CMD) ===
 +
Following the main header (starting at offset 0x1E4) is a list of CMDs (one per content).
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
βˆ’
! Start
+
! Offset
 
! Length
 
! Length
 
! Description
 
! Description
Line 105: Line 131:  
| 0x06
 
| 0x06
 
| 2
 
| 2
βˆ’
| Type
+
| Type (0x0001: Normal, 0x4001: DLC, 0x8001: [[:/shared1|Shared]])
 
|-
 
|-
 
| 0x08
 
| 0x08
Line 119: Line 145:  
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
βˆ’
! Start
+
! Offset
 
! Length
 
! Length
 
! Description
 
! Description
Line 132: Line 158:  
|-
 
|-
 
| 0x104
 
| 0x104
βˆ’
| 32
+
| 64
 
| Issuer
 
| Issuer
 
|-
 
|-
 
| 0x124
 
| 0x124
 
| 4
 
| 4
βˆ’
| Tag
+
| Public Key Type
 
|-
 
|-
 
| 0x128
 
| 0x128
Line 143: Line 169:  
| Name
 
| Name
 
|-
 
|-
βˆ’
| 0x168
+
| 0x12C
 +
| 4
 +
| Date
 +
|-
 +
| 0x16C
 
|  
 
|  
βˆ’
| Key
+
| Public Key
 
|}
 
|}
   Line 160: Line 190:  
   u32 cid; // content id
 
   u32 cid; // content id
 
   u16 index; // # number of the file
 
   u16 index; // # number of the file
βˆ’
   u16  type; // normal: 0x0001; shared: 0x8001
+
   u16  type; // normal: 0x0001; dlc: 0x4001; shared: 0x8001
 
   u64 size;
 
   u64 size;
 
   u8  hash [20]; //  SHA1 hash content
 
   u8  hash [20]; //  SHA1 hash content
Line 166: Line 196:  
</source>
 
</source>
 
<source lang="c">
 
<source lang="c">
βˆ’
enum sig_type {
+
enum sig_type {
βˆ’
      RSA_2048 = 0x00010001,
+
  RSA_2048 = 0x00010001,
βˆ’
      RSA_4096 = 0x00010000
+
  RSA_4096 = 0x00010000
βˆ’
};
+
};
 +
 
 +
// High 32 bits of the title ID
 +
enum title_type : u32 {
 +
  System = 0x00000001,
 +
  Game = 0x00010000,
 +
  Channel = 0x00010001,
 +
  SystemChannel = 0x00010002,
 +
  GameWithChannel = 0x00010004,
 +
  DLC = 0x00010005,
 +
  HiddenChannel = 0x00010008,
 +
};
 +
 
 +
// title_type (offset 0x194)
 +
enum title_flags {
 +
  // All official titles have this flag set.
 +
  Default = 0x1,
 +
  Unknown_0x4 = 0x4,
 +
  // Used for DLC titles.
 +
  Data = 0x8,
 +
  Unknown_0x10 = 0x10,
 +
  // Seems to be used for WFS titles.
 +
  Maybe_WFS = 0x20,
 +
  Unknown_CT = 0x40,
 +
};
 
</source>
 
</source>
 
<source lang="c">
 
<source lang="c">
Line 180: Line 234:  
         u8 ca_crl_version;
 
         u8 ca_crl_version;
 
         u8 signer_crl_version;
 
         u8 signer_crl_version;
βˆ’
         u8 fill2;
+
         u8 vwii;
 
         u64 sys_version;
 
         u64 sys_version;
 
         u64 title_id;
 
         u64 title_id;
Line 190: Line 244:  
         u16 num_contents;
 
         u16 num_contents;
 
         u16 boot_index;
 
         u16 boot_index;
βˆ’
         u16 fill3;
+
         u16 fill2;
 
         content_record contents[num_contents];
 
         content_record contents[num_contents];
 
  } tmd;
 
  } tmd;
Line 199: Line 253:  
   u8 sig[256];  // 256 for RSA_2048, 512 for RSA_4096
 
   u8 sig[256];  // 256 for RSA_2048, 512 for RSA_4096
 
   u8 issuer[32];
 
   u8 issuer[32];
βˆ’
   u32 tag;  // identifies what is being signed
+
   u32 key_type;  // the type of public key
 
   u8 name[64]; // name of thing being signed
 
   u8 name[64]; // name of thing being signed
 
   u8 key[...];
 
   u8 key[...];
Line 228: Line 282:  
};
 
};
 
</source>
 
</source>
 +
 
[[Category:File formats]]
 
[[Category:File formats]]