forked from zurgeg/pywii
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextractwad.py
More file actions
35 lines (26 loc) · 804 Bytes
/
extractwad.py
File metadata and controls
35 lines (26 loc) · 804 Bytes
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
import sys, os, os.path
import pywii.Common.pywii as wii
def extractwad(wad, outdir):
wii.loadkeys("../keys")
wad = wii.WiiWad(wad)
if not os.path.isdir(outdir):
os.mkdir(outdir)
for ct in wad.tmd.get_content_records():
data = wad.getcontent(ct.index)
f = open(os.path.join(outdir, "%08X" % ct.cid),"wb")
f.write(data)
f.close()
f = open(os.path.join(outdir, "cetk"),"wb")
f.write(wad.tik.data)
f.close()
f = open(os.path.join(outdir, "tmd"),"wb")
f.write(wad.tmd.data)
f.close()
f = open(os.path.join(outdir, "certs"),"wb")
for cert in wad.certlist:
f.write(cert.data)
wii.falign(f,0x40)
f.close()
f = open(os.path.join(outdir, "footer"),"wb")
f.write(wad.footer)
f.close()