diff --git a/CLI b/CLI new file mode 100644 index 0000000..87a0909 --- /dev/null +++ b/CLI @@ -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 +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 +qwad -u $PWD/IOS58.wad $PWD/IOS58-Unpacked +>> Result: IOS58-Unpacked/ + +**Pack** +qwad -p +qwad -p $PWD/IOS58-Unpacked/ $PWD/IOS58.wad +>> Result: IOS58.wad + +**GetVersions** +qwad -g +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 +qwad -c IOS36 +qwad -c 0000000100000024 +qwad -c wiispeak.pal +>> Result: IOS36 == 0000000100000024 +>> Result: Wii Speak == 0001000148434650 + +**TMD-Info** +qwad -t +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 ; + done +to still achieve batch-mode \ No newline at end of file diff --git a/CLI.Channels b/CLI.Channels new file mode 100644 index 0000000..79a3e42 --- /dev/null +++ b/CLI.Channels @@ -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 \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index d41499c..0869670 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,59 +5,7 @@ * only install qm-files for translation, not ts-files aswell * changed default directory to $HOME (so that file-selectors don't start at Qwads source or installation directory) -* add command line options (NOTE: all paths must be absolute!): - -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 - qwad -d IOS58 6176 $PWD/IOS58.wad False True - qwad -d 000000010000003a 6176 $PWD/IOS58.wad True False - >> Result: IOS58.wad - - **Unpack** - qwad -u - qwad -u $PWD/IOS58.wad $PWD/IOS58-Unpacked - >> Result: IOS58-Unpacked/ - - **Pack** - qwad -p - qwad -p $PWD/IOS58-Unpacked/ $PWD/IOS58.wad - >> Result: IOS58.wad - - **GetVersions** - qwad -g - qwad -g IOS9 - qwad -g 0000000100000009 - >> Result: Available Versions for IOS9: 520, 521, 778, 1034 - - **Convert** - qwad -c - qwad -c IOS36 - qwad -c 0000000100000024 - >> Result: IOS36 == 0000000100000024 - - **TMD-Info** - qwad -t - 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 : _ +* added command line options (see CLI file) -- 0.5a -- * correctly show version of IOS62 diff --git a/Qwad.pyw b/Qwad.pyw index 0fdad11..e046fef 100644 --- a/Qwad.pyw +++ b/Qwad.pyw @@ -6,7 +6,7 @@ from optparse import Option, OptionValueError from PyQt4.QtGui import QApplication from PyQt4.QtCore import QTranslator, QString, QLocale 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): ACTIONS = Option.ACTIONS + ("extend",) @@ -53,62 +53,102 @@ def opts(): sys.exit(0) if options.download: - if "IOS" 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: - + if args[0] is "0": + args[0] = None + if "." in str(options.download[0]): + 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.start() - sys.exit(0) + nusdow.start() + sys.exit(0) if options.getversions: - if "IOS" 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 "." in str(args[0]): + dld = ChannelCLIDict[str(args[0][:-4])] + reg = str(args[0][-3:]) + if "pal" in reg or "PAL" in reg: + xarg = ChannelPALVerDict[str(dld)] + elif "usa" in reg or "USA" in reg: + 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 "IOS" 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 "." in str(args[0]): + dld = ChannelCLIDict[str(args[0][:-4])] + reg = str(args[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) + 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 os.access(str(options.unpack[0]), os.R_OK): - wad = str(options.unpack[0]) - else: - print "WAD file %s does not exist." % str(options.unpack[0]) - sys.exit(1) - if os.access(str(args[0]), os.W_OK): - folder = str(args[0]) - else: - os.mkdir(str(args[0]), 0755) - if os.access(str(args[0]), os.W_OK): - UnpackingCLI(wad, str(args[0])).start() - sys.exit(0) - else: - print "Output folder %s not writeable." % str(args[0]) - sys.exit(1) + if os.access(str(options.unpack[0]), os.R_OK): + wad = str(options.unpack[0]) + else: + print "WAD file %s does not exist." % str(options.unpack[0]) + sys.exit(1) + if os.access(str(args[0]), os.W_OK): + folder = str(args[0]) + else: + os.mkdir(str(args[0]), 0755) + if os.access(str(args[0]), os.W_OK): + UnpackingCLI(wad, str(args[0])).start() + sys.exit(0) + else: + print "Output folder %s not writeable." % str(args[0]) + sys.exit(1) if options.pack: - if os.access(str(options.pack[0]), os.R_OK): - folder = str(options.pack[0]) - else: - print "Input folder %s not readable." % str(options.pack[0]) - sys.exit(1) - if os.access(os.path.dirname(str(args[0])), os.W_OK): + if os.access(str(options.pack[0]), os.R_OK): + folder = str(options.pack[0]) + else: + print "Input folder %s not readable." % str(options.pack[0]) + sys.exit(1) + if os.access(os.path.dirname(str(args[0])), os.W_OK): PackingCLI(folder, str(args[0])).start() sys.exit(0) - else: - print "Output file %s can't be created." % str(args[0]) - sys.exit(1) + else: + print "Output file %s can't be created." % str(args[0]) + sys.exit(1) if options.tmdinfo: if os.access(str(args[0]), os.R_OK): diff --git a/TitleIDs.py b/TitleIDs.py index 697aa57..f374dc3 100644 --- a/TitleIDs.py +++ b/TitleIDs.py @@ -96,6 +96,32 @@ 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 = { "BOOT2":"0000000100000001", "System Menu":"0000000100000002",