add channel support to -c, -g and -d cmd-opts,

handle bc/mios correctly in -d opt
added  CLI and CLI.Channels doc files
support for downloading latest version by passing 0 as requested version
This commit is contained in:
Christopher Roy Bratusek 2012-11-25 19:31:25 +01:00
parent b09dd4fd16
commit 61846976f4
5 changed files with 206 additions and 99 deletions

68
CLI Normal file
View File

@ -0,0 +1,68 @@
NOTE: all paths must be absolute
NOTE: in order to download the latest version, pass 0 for version
NOTE: for channels you need to change to non-space lowercase . region,
example: System Menu = systemmenu.pal -- see file CLI.Channels
-h / --help = show help
-v / --version = show Qwad version and exit
-d / --download = download IOS (see examples below)
-u / --unpack = unpack a wad file
-p / --pack = pack a folder as wad
-g / --getversions = get available versions of given IOS
-c / --convert = convert IOS name to hex (and vice versa)
======================================================================
Examples (no batch-support¹):
**Download**
qwad -d <IOS/Channel> <VERSION> <OUTPUT> <DECRYPT> <PACK>
qwad -d IOS58 6176 $PWD/IOS58.wad False True
qwad -d 000000010000003a 6176 $PWD/IOS58.wad True False
qwad -d systemmenu.pal 450 $PWD/SM41p.wad False True
>> Result: IOS58.wad
**Unpack**
qwad -u <WAD> <FOLDER>
qwad -u $PWD/IOS58.wad $PWD/IOS58-Unpacked
>> Result: IOS58-Unpacked/
**Pack**
qwad -p <FOLDER> <WAD>
qwad -p $PWD/IOS58-Unpacked/ $PWD/IOS58.wad
>> Result: IOS58.wad
**GetVersions**
qwad -g <IOS>
qwad -g IOS9
qwad -g 0000000100000009
qwad -q mii.pal
>> Result: Available Versions for IOS9: 520, 521, 778, 1034
>> Result: Available Versions for Mii Channel: 2, 3, 4, 5, 6
**Convert**
qwad -c <IOS>
qwad -c IOS36
qwad -c 0000000100000024
qwad -c wiispeak.pal
>> Result: IOS36 == 0000000100000024
>> Result: Wii Speak == 0001000148434650
**TMD-Info**
qwad -t <TMDFILE>
qwad -t $PWD/0001000154484246.tmd
>> Result:
Title ID (HEX) : 0001000154484246
Title ID (ASCII) : THBF
Title Version : 41
Title Boot Index : 2
Title Contents : 3
Title IOS : IOS58
Title Access Rights: 3
Title Type : 1
Title Group ID : 21065
Title Reserved : _
¹on a capable shell you can do something like:
#!/bin/sh
for item in arg1 arg2 arg3 arg4;
do qwad <whatever>;
done
to still achieve batch-mode

25
CLI.Channels Normal file
View File

@ -0,0 +1,25 @@
Channel names for CLI downloader:
boot => BOOT2,
bbciplayer => BBC iPlayer,
systemmenu => System Menu,
checkmiiout => Check Mii Out,
digicamprint => Digicam Print,
eula => EULA,
everyonevotes => Everyone Votes,
jamwiththeband => Jam With The Band,
japanfoodservice => Japan Food Service,
mii => Mii Channel,
news => News,
nintendo => Nintendo,
opera => Opera,
photo => Photo,
photo11 => Photo 1.1,
regionselect => Region Select,
shashin => Shashin Channel,
shop => Shop,
todaytomorrow => Today & Tomorrow,
tvfriend => TV Friend / G-Guide,
weather => Weather,
wiinoma => Wii No Ma,
wiispeak => Wii Speak

View File

@ -5,59 +5,7 @@
* only install qm-files for translation, not ts-files aswell * only install qm-files for translation, not ts-files aswell
* changed default directory to $HOME (so that file-selectors * changed default directory to $HOME (so that file-selectors
don't start at Qwads source or installation directory) don't start at Qwads source or installation directory)
* add command line options (NOTE: all paths must be absolute!): * added command line options (see CLI file)
-h / --help = show help
-v / --version = show Qwad version and exit
-d / --download = download IOS (see examples below)
-u / --unpack = unpack a wad file
-p / --pack = pack a folder as wad
-g / --getversions = get available versions of given IOS
-c / --convert = convert IOS name to hex (and vice versa)
======================================================================
Examples (no batch-support):
**Download**
qwad -d <IOS> <VERSION> <OUTPUT> <DECRYPT> <PACK>
qwad -d IOS58 6176 $PWD/IOS58.wad False True
qwad -d 000000010000003a 6176 $PWD/IOS58.wad True False
>> Result: IOS58.wad
**Unpack**
qwad -u <WAD> <FOLDER>
qwad -u $PWD/IOS58.wad $PWD/IOS58-Unpacked
>> Result: IOS58-Unpacked/
**Pack**
qwad -p <FOLDER> <WAD>
qwad -p $PWD/IOS58-Unpacked/ $PWD/IOS58.wad
>> Result: IOS58.wad
**GetVersions**
qwad -g <IOS>
qwad -g IOS9
qwad -g 0000000100000009
>> Result: Available Versions for IOS9: 520, 521, 778, 1034
**Convert**
qwad -c <IOS>
qwad -c IOS36
qwad -c 0000000100000024
>> Result: IOS36 == 0000000100000024
**TMD-Info**
qwad -t <TMDFILE>
qwad -t $PWD/0001000154484246.tmd
>> Result:
Title ID (HEX) : 0001000154484246
Title ID (ASCII) : THBF
Title Version : 41
Title Boot Index : 2
Title Contents : 3
Title IOS : IOS58
Title Access Rights: 3
Title Type : 1
Title Group ID : 21065
Title Reserved : _
-- 0.5a -- -- 0.5a --
* correctly show version of IOS62 * correctly show version of IOS62

132
Qwad.pyw
View File

@ -6,7 +6,7 @@ from optparse import Option, OptionValueError
from PyQt4.QtGui import QApplication from PyQt4.QtGui import QApplication
from PyQt4.QtCore import QTranslator, QString, QLocale from PyQt4.QtCore import QTranslator, QString, QLocale
from GUI.VenPri import MWQwad, nusDownloadingCLI, PackingCLI, UnpackingCLI, ShowTMD from GUI.VenPri import MWQwad, nusDownloadingCLI, PackingCLI, UnpackingCLI, ShowTMD
from TitleIDs import TitleDict, IOSdict, swap_dic from TitleIDs import TitleDict, IOSdict, swap_dic, ChannelCLIDict, ChannelJAPDict, ChannelPALDict, ChannelUSADict, ChannelJAPVerDict, ChannelPALVerDict, ChannelUSAVerDict
class MultipleOption(Option): class MultipleOption(Option):
ACTIONS = Option.ACTIONS + ("extend",) ACTIONS = Option.ACTIONS + ("extend",)
@ -53,62 +53,102 @@ def opts():
sys.exit(0) sys.exit(0)
if options.download: if options.download:
if "IOS" in str(options.download[0]): if args[0] is "0":
xarg = TitleDict[str(options.download[0])] args[0] = None
nusdow = nusDownloadingCLI(int(str(xarg).lower(),16), args[0], args[1], args[2], args[3]) if "." in str(options.download[0]):
else: dld = ChannelCLIDict[str(options.download[0][:-4])]
reg = str(options.download[0][-3:])
if "pal" in reg or "PAL" in reg:
xarg = ChannelPALDict[str(dld)]
elif "usa" in reg or "USA" in reg:
xarg = ChannelUSADict[str(dld)]
elif "jap" in reg or "JAP" in reg:
xarg = ChannelJAPDict[str(dld)]
else:
print "specified region %s is invalid" % reg
sys.exit(1)
nusdow = nusDownloadingCLI(int(str(xarg).lower(),16), args[0], args[1], args[2], args[3])
elif "IOS" in str(options.download[0]) or "BC" in str(options.download[0]) or "MIOS" in str(options.download[0]):
xarg = TitleDict[str(options.download[0])]
nusdow = nusDownloadingCLI(int(str(xarg).lower(),16), args[0], args[1], args[2], args[3])
else:
nusdow = nusDownloadingCLI(int(str(options.download[0]).lower(),16), args[0], args[1], args[2], args[3]) nusdow = nusDownloadingCLI(int(str(options.download[0]).lower(),16), args[0], args[1], args[2], args[3])
nusdow.start() nusdow.start()
sys.exit(0) sys.exit(0)
if options.getversions: if options.getversions:
if "IOS" in str(args[0]): if "." in str(args[0]):
print "Available Versions for %s: %s" % (str(args[0]), IOSdict[str(args[0])]) dld = ChannelCLIDict[str(args[0][:-4])]
else: reg = str(args[0][-3:])
NewDict = swap_dic(TitleDict) if "pal" in reg or "PAL" in reg:
xarg = NewDict[str(args[0])] xarg = ChannelPALVerDict[str(dld)]
print "Available Versions for %s: %s" % (str(args[0]), IOSdict[str(xarg)]) elif "usa" in reg or "USA" in reg:
sys.exit(0) xarg = ChannelUSAVerDict[str(dld)]
elif "jap" in reg or "JAP" in reg:
xarg = ChannelJAPVerDict[str(dld)]
else:
print "specified region %s is invalid" % reg
sys.exit(1)
print "Available Versions for %s: %s" % (dld, xarg)
elif "IOS" in str(args[0]) or "BC" in str(args[0]) or "MIOS" in str(args[0]):
print "Available Versions for %s: %s" % (str(args[0]), IOSdict[str(args[0])])
else:
NewDict = swap_dic(TitleDict)
xarg = NewDict[str(args[0])]
print "Available Versions for %s: %s" % (str(args[0]), IOSdict[str(xarg)])
sys.exit(0)
if options.convert: if options.convert:
if "IOS" in str(args[0]): if "." in str(args[0]):
print "%s == %s" % (str(args[0]), TitleDict[str(args[0])]) dld = ChannelCLIDict[str(args[0][:-4])]
else: reg = str(args[0][-3:])
NewDict = swap_dic(TitleDict) if "pal" in reg or "PAL" in reg:
xarg = NewDict[str(args[0])] xarg = ChannelPALDict[str(dld)]
print "%s == %s" % (str(args[0]), xarg) elif "usa" in reg or "USA" in reg:
sys.exit(0) xarg = ChannelUSADict[str(dld)]
elif "jap" in reg or "JAP" in reg:
xarg = ChannelJAPDict[str(dld)]
else:
print "specified region %s is invalid" % reg
sys.exit(1)
print "%s == %s" % (dld, xarg)
elif "IOS" in str(args[0]) or "BC" in str(args[0]) or "MIOS" in str(args[0]):
print "%s == %s" % (str(args[0]), TitleDict[str(args[0])])
else:
NewDict = swap_dic(TitleDict)
xarg = NewDict[str(args[0])]
print "%s == %s" % (str(args[0]), xarg)
sys.exit(0)
if options.unpack: if options.unpack:
if os.access(str(options.unpack[0]), os.R_OK): if os.access(str(options.unpack[0]), os.R_OK):
wad = str(options.unpack[0]) wad = str(options.unpack[0])
else: else:
print "WAD file %s does not exist." % str(options.unpack[0]) print "WAD file %s does not exist." % str(options.unpack[0])
sys.exit(1) sys.exit(1)
if os.access(str(args[0]), os.W_OK): if os.access(str(args[0]), os.W_OK):
folder = str(args[0]) folder = str(args[0])
else: else:
os.mkdir(str(args[0]), 0755) os.mkdir(str(args[0]), 0755)
if os.access(str(args[0]), os.W_OK): if os.access(str(args[0]), os.W_OK):
UnpackingCLI(wad, str(args[0])).start() UnpackingCLI(wad, str(args[0])).start()
sys.exit(0) sys.exit(0)
else: else:
print "Output folder %s not writeable." % str(args[0]) print "Output folder %s not writeable." % str(args[0])
sys.exit(1) sys.exit(1)
if options.pack: if options.pack:
if os.access(str(options.pack[0]), os.R_OK): if os.access(str(options.pack[0]), os.R_OK):
folder = str(options.pack[0]) folder = str(options.pack[0])
else: else:
print "Input folder %s not readable." % str(options.pack[0]) print "Input folder %s not readable." % str(options.pack[0])
sys.exit(1) sys.exit(1)
if os.access(os.path.dirname(str(args[0])), os.W_OK): if os.access(os.path.dirname(str(args[0])), os.W_OK):
PackingCLI(folder, str(args[0])).start() PackingCLI(folder, str(args[0])).start()
sys.exit(0) sys.exit(0)
else: else:
print "Output file %s can't be created." % str(args[0]) print "Output file %s can't be created." % str(args[0])
sys.exit(1) sys.exit(1)
if options.tmdinfo: if options.tmdinfo:
if os.access(str(args[0]), os.R_OK): if os.access(str(args[0]), os.R_OK):

View File

@ -96,6 +96,32 @@ TitleDict = {
TitleSwapDict = swap_dic(TitleDict) TitleSwapDict = swap_dic(TitleDict)
ChannelCLIDict = {
"boot":"BOOT2",
"bbciplayer":"BBC iPlayer",
"systemmenu":"System Menu",
"checkmiiout":"Check Mii Out",
"digicamprint":"Digicam Print",
"eula":"EULA",
"everyonevotes":"Everyone Votes",
"jamwiththeband":"Jam With The Band",
"japanfoodservice":"Japan Food Service",
"mii":"Mii Channel",
"news":"News",
"nintendo":"Nintendo",
"opera":"Opera",
"photo":"Photo",
"photo11":"Photo 1.1",
"regionselect":"Region Select",
"shashin":"Shashin Channel",
"shop":"Shop",
"todaytomorrow":"Today & Tomorrow",
"tvfriend":"TV Friend / G-Guide",
"weather":"Weather",
"wiinoma":"Wii No Ma",
"wiispeak":"Wii Speak"
}
ChannelJAPDict = { ChannelJAPDict = {
"BOOT2":"0000000100000001", "BOOT2":"0000000100000001",
"System Menu":"0000000100000002", "System Menu":"0000000100000002",