diff options
author | Martin Szulecki | 2009-03-18 20:52:11 +0100 |
---|---|---|
committer | Martin Szulecki | 2009-03-18 20:52:11 +0100 |
commit | 9c1ded3b0ae8e540177ee0c0baa1f9c8fcf91989 (patch) | |
tree | 38aa36327c9e3c0fef1ef7ee77c707d987aff9d0 /wii_tmd.h | |
download | wiiwadtools-9c1ded3b0ae8e540177ee0c0baa1f9c8fcf91989.tar.gz wiiwadtools-9c1ded3b0ae8e540177ee0c0baa1f9c8fcf91989.tar.bz2 |
Initial commit of sources
Diffstat (limited to 'wii_tmd.h')
-rw-r--r-- | wii_tmd.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/wii_tmd.h b/wii_tmd.h new file mode 100644 index 0000000..4bd77af --- /dev/null +++ b/wii_tmd.h @@ -0,0 +1,64 @@ +/** + * wii_tmd.h + */ + +#ifndef __WII_TMD_H__ +#define __WII_TMD_H__ + +#include <stdio.h> +#include <stdlib.h> +#include "types.h" + +#define OFFSET_TMD (0xd00) +#define OFFSET_TITLE_ID (0x18c) +#define OFFSET_REGION (0x19d) +#define OFFSET_BF (0x1c1) + +extern const char *region_names[]; + +typedef struct { + u32 cid; /* content id */ + u16 index; /* # number of the file */ + u16 type; + u64 size; + u8 hash[20]; /* SHA1 hash content */ +} tmd_content_record; /* size: 0x24 bytes */ + +typedef struct { + u32 sig_type; + u8 sig[256]; + u8 fill1[60]; + char issuer[64]; /* Root-CA%08x-CP%08x */ + u8 version; + u8 ca_crl_version; + u8 signer_crl_version; + u8 fill2; + u64 sys_version; + u32 title_category; + u32 title_id; + u32 title_type; + u16 group_id; /* Publisher ID */ + u16 fill4; + u16 region_code; + u8 reserved[58]; + u32 access_rights; + u16 title_version; + u16 num_contents; + u16 boot_index; + u16 fill6; +} tmd_header; + +void dump_tmd_raw(u8 *tmd); +void print_tmd(tmd_header *tmd); +void print_tmd_content_records(tmd_header *tmd, tmd_content_record *tmd_content); + +void tmd_read(FILE *f, tmd_header *tmd); +void tmd_read_content_records(FILE *f, tmd_header *tmd, tmd_content_record *tmd_content); + u32 tmd_get_block_size(tmd_header *tmd, tmd_content_record *tmd_content); + +char*tmd_lookup_group_name(u16 group_id); +char*tmd_lookup_title_category_name(u32 category); +char*tmd_lookup_system_code_name(u32 title_id); + int tmd_get_system_title_name(u32 title_id, char *name); + +#endif |