In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "Title metadata"

From WiiBrew
Jump to navigation Jump to search
m
(fixed content record)
Line 1: Line 1:
 
[[Category:Software]]
 
[[Category:Software]]
  
/**************************************************************/
+
== Nintendo Wii Title-Metadata (tmd) file structure ==
//
+
 
// Nintendo Wii Virtual Console 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.)
//
 
  //                  v.0.1
 
//
 
//      by Lockhool for #wiidev at efnet
 
  //                                                  14.12.2007
 
/**************************************************************/
 
 
   
 
   
 
  // Common labels used in this file:
 
  // Common labels used in this file:
Line 21: Line 15:
 
  // # in front of a comment signifies entires that are
 
  // # in front of a comment signifies entires that are
 
  // the same in each tmd-files the author checked
 
  // the same in each tmd-files the author checked
//
 
// ! Remember the Wii has a LITTLE-ENDIAN processor. When !
 
// ! working with ints or shorts on none-LE machines      !
 
// ! (e.g. PPC Mac) you need to swap the byteorder.      !
 
 
   
 
   
 
  typedef unsigned char  u8;
 
  typedef unsigned char  u8;
 
  typedef unsigned short u16;
 
  typedef unsigned short u16;
  typedef unsigned int  u32;   
+
  typedef unsigned int  u32;  
 +
  typedef unsigned long u64;
  
  typedef struct{
+
  typedef struct {
   u32 file [0x1]; // name of the file to download
+
   u32 cid; // content id
   u16 num [0x1]; // # number of the file
+
   u16 index; // # number of the file
   u8 undef0 [0x1]; // might be 0x00 or 0x80
+
   u16 type;
   u8  undef1 [0x1]; // # 0x01
+
   u64 size;
   u8  zeros0 [0x4]; // # 0
+
   u8  hash [20]; //  SHA1 hash content
  u32 length [0x1]; // non-padded filelength
+
  } content_record; // size: 0x30 bytes
  u8 hash [0x14]; // ? maybe SHA1-hash
 
  }VC_TMD_FILE; // size: 0x30 bytes
 
  
 
  typedef struct{
 
  typedef struct{

Revision as of 13:18, 16 January 2008


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