summaryrefslogtreecommitdiffstats
path: root/wii_wad.h
blob: 0985f7ada252baf7679672bba8246db45620c9d5 (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
/**
 * wii_wad.h
 */

#ifndef __WII_WAD_H__
#define __WII_WAD_H__

#include <stdio.h>
#include "types.h"
#include "wii_tmd.h"
#include "wii_tik.h"
#include "wii_imet.h"

enum wad_section {
	SECTION_WAD_HEADER = 0,
	SECTION_CERT_CHAIN = 1,
	SECTION_TICKET = 2,
	SECTION_TMD = 3,
	SECTION_DATA = 4,
	SECTION_FOOTER = 5
};

typedef struct {
	u32 size;		/* header size, always 0x20 */
	u16 type;
	u16 unk0;
	u32 cert_chain_size;
	u32 crl_size;
	u32 ticket_size;
	u32 tmd_size;
	u32 data_size;
	u32 footer_size;
} ATTRIBUTE_PACKED wad_header;

void print_wad(wad_header *wad);

int wad_read(FILE *f, wad_header *wad);
void wad_read_tmd(FILE *f, wad_header *wad, tmd_header *tmd);
void wad_read_tik(FILE *f, wad_header *wad, tmd_header *tmd, wii_tik *tik);
void wad_read_app_info(FILE *f, wad_header *wad, tmd_content_record *tmd_content, wii_tik *tik, wii_build_info *bi, wii_imet *imet);
u32 wad_get_section_offset(wad_header *wad, u8 section);

#endif