summaryrefslogtreecommitdiffstats
path: root/TODO
blob: 35441e73bf5b8ac57ae16c86b02ea8172ef0bcd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
- Improve error checking and be strict on parsing errors
OK - Do not show extended information on WADs we can not parse like system IOS WADs
- Rewrite patcher to use Wii related structures to change data
- Allow unpacking and packing WAD files
- New API:

---

wad_header
cert_chain
tik_header
tmd_header
tmd_content_records
content0
build_info
imet
u8
content1
content2
...
footer

---

typedef struct {
	build_info bi;
	imet imet;
	u8_archive *u8_archive;
} app_file;

typedef struct {
	tmd_header header;
	tmd_content_record *content_record[];
} tmd_file;

typdef struct {
	wad_header header;
	char cert_chain;
	tik tik;
	tmd_file tmd_file;
	char *content;
	char *footer;
} wad_file;

void wad_header_read(FILE *f, wad_header *header);
void wad_header_write(FILE *f, wad_header *header);
 u32 wad_header_get_section_offset(wad_header *header, u8 section);
void wad_seek_to_section(FILE *f, u8 section);

void cert_chain_read(FILE *f, char *cert_chain, u32 size);
void cert_chain_write(FILE *f, char *cert_chain, u32 size);

void ticket_read(FILE *f, wii_tik *ticket);
void ticket_write(FILE *f, wii_tik *ticket);

void tmd_read(FILE *f, char *tmd, u32 size);
void tmd_write(FILE *f, char *tmd, u32 size);
void tmd_free(char *tmd);
 u32 tmd_content_records_calculate_content_block_size(tmd_content_record *records, u16 num_records);

void content_read(FILE *f, char *content, u32 size);
void content_write(FILE *f, char *content, u32 size);
void content_free(char *content);

void content_decrypt(char *content, tmd_content_record *record, tik *tik);
void content_encrypt(char *content, tmd_content_record *record, tik *tik);

void footer_read(FILE *f, char *footer, u32 size);
void footer_write(FILE *f, char *footer, u32 size);
void footer_free(char *footer);

void build_info_read(FILE *f, build_info *bi);
void build_info_write(FILE *f, build_info *bi);

void imet_read(FILE *f, imet *imet);
void imet_write(FILE *f, imet *imet);