-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathNUStool.py
executable file
·37 lines (32 loc) · 1.1 KB
/
NUStool.py
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
#----------------------------------------------------------------------
# NUS - a simple command line tool for NUS downloading.
# (c) 2009 |Omega| and #HACKERCHANNEL Productions.
#
# Wii.py (c) Xuzz, SquidMan, megazig, TheLemonMan, |Omega|, and Matt_P.
#----------------------------------------------------------------------
import Wii, sys, os, shutil
def downloadPack(titleid, version, outDir, pack):
print "downloadPack(0x%016x, %d, %s, %d)" % (titleid,version,outDir,pack)
if version != 0:
print "downloading....",
Wii.NUS.download(titleid, version).dumpDir(outDir)
else:
print "downloading....",
Wii.NUS.download(titleid).dumpDir(outDir)
print "done"
if pack == True:
print "packing........",
Wii.WAD.loadDir(outDir).dumpFile(str(outDir+".wad"))
shutil.rmtree(outDir)
print "done"
if len(sys.argv) % 3 == 2:
pack, x = False, 1
else:
pack, x = True, 0
for i in range(1 + x, len(sys.argv), 3):
titleid = int(sys.argv[i], 16)
print "TitleId: %016x" % titleid
version = int(sys.argv[i+1])
print "Version: %d" % version
outDir = sys.argv[i+2]
downloadPack(titleid, version, outDir, pack)