Title metadata


Nintendo Wii Title-Metadata (tmd) file structure

A "title" is a standalone entity -- a game, a channel, etc. Titles can be made up of multiple "contents". (Don't ask me I just work here.)

// Common labels used in this file:
// magicnum - control ints or shorts found in all tmds
// zeros    - bytes all filled with zeros
// undef    - non-zero data of unknown purpose
// sign     - zero-terminated string padded to 64 bytes
//            probably used in the signing process
// hash     - probably 20, 512 or 1024 byte hashes
//
// # in front of a comment signifies entires that are
// the same in each tmd-files the author checked

typedef unsigned char  u8;
typedef unsigned short u16;
typedef unsigned int   u32; 
typedef unsigned long u64; 
typedef struct {
  u32 cid;		// content id
  u16 index;		// # number of the file
  u16  type;
  u64 size;
  u8  hash [20]; 		//  SHA1 hash content
} content_record; 			// size: 0x30 bytes
typedef struct{
  u32 magicnum0 [0x1];		// # 0x00010001
  u8  hash0 [0x100];		// ?
  u8  zeros0 [0x3C]; 		// # 0
  u8  sign0 [0x40];		// # Root-CA-CP
  u8  undef0 [0x10];		// # ?
  u8  code [0x4];		// game code in ascii
  u32 magicnum1 [0x1];		// # 0x00000001
  u8  publ [0x2];		// publisher id
  u8  zeros1 [0x2];		// # 0
  u8  undef1 [0x4];		// ?
  u8  undef2 [0xE];		// ? 0x80
  u8  zeros2 [0x2E];		// # 0
  u8  undef3 [0x8];		// ?
  VC_TMD_FILE files[7];	// 7 file entries
  u32 magicnum2 [0x1];		// # 0x00010001
  u8  hash1 [0x100];		// # ?
  u8  zeros3 [0x3C];		// # 0
  u8  sign1 [0x40];		// # Root-CA
  u32 magicnum3 [0x1];		// # 0x00000001
  u8  sign2 [0x40];		// # CP
  u8  hash2 [0x104];		// # ?
  u32 magicnum4 [0x1];		// # 0x00010001
  u8  zeros4 [0x34];		// # 0
  u32 magicnum5 [0x1];		// # 0x00100000
  u8  hash3 [0x200];		// # ?
  u8  zeros5 [0x3C];		// # 0
  u8  sign3 [0x40];		// # Root
  u32 magicnum6 [0x1];		// # 0x00000001
  u8  sign4 [0x40];		// # CA
  u8  hash4 [0x104];		// # ?
  u32 magicnum7 [0x1];		// # 0x00010001
  u8 zeros6 [0x34];		// # 0
}VC_TMD;			// size: 09E0 bytes