diff --git a/ChangeLog b/ChangeLog index 3d15584..d24d3c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ -h / --help = show help -v / --version = show Qwad version and exit -d / --download = download IOS (see examples below) + -u / --unpack = unpack a wad file -g / --getversions = get available versions of given IOS -c / --convert = convert IOS name to hex (and vice versa) ====================================================================== @@ -19,6 +20,11 @@ qwad -d 000000010000003a 6176 $PWD/IOS58.wad True False >> Result: IOS58.wad + **Unpack** + qwad -u + qwad -u IOS58.wad IOS58-Unpacked + >> Result: IOS58-Unpacked/ + **GetVersions** qwad -g qwad -g IOS9 diff --git a/Qwad.pyw b/Qwad.pyw index 2d6618a..dd4cd61 100644 --- a/Qwad.pyw +++ b/Qwad.pyw @@ -5,7 +5,7 @@ from optparse import OptionParser from optparse import Option, OptionValueError from PyQt4.QtGui import QApplication from PyQt4.QtCore import QTranslator, QString, QLocale -from GUI.VenPri import MWQwad, nusDownloadingCLI +from GUI.VenPri import MWQwad, nusDownloadingCLI, PackingCLI, UnpackingCLI from TitleIDs import TitleDict, IOSdict, swap_dic class MultipleOption(Option): @@ -23,6 +23,7 @@ class MultipleOption(Option): VERSION = '0.6' def opts(): + os.chdir(sys.path[0]) description = """NUS-Downloader, WadManager and TMD-Viewer for Linux""" parser = OptionParser(option_class=MultipleOption, usage='usage: qwad [OPTIONS] ARGUMENT', @@ -31,11 +32,14 @@ def opts(): action="extend", type="string", dest='download', metavar='Arguments', - help='IOS ') + help="IOS Version Output Decrypt Pack") + parser.add_option('-u', "--unpack", dest="unpack", action="extend", + type="string", metavar='Arguments', help="unpack a WAD") + parser.add_option('-g', "--getversions", dest="getversions", action="store_true", default=False, help="get available versions for IOS") parser.add_option('-c', "--convert", dest="convert", - action="store_true", default=False, help="convert between IOSX and xxxxxxx-xxxxxxx") + action="store_true", default=False, help="convert between IOSxx and hex-value") parser.add_option("-v", "--version", dest="version", action="store_true", default=False, help="print version and exit") @@ -73,6 +77,24 @@ def opts(): 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): + folder = str(args[0]) + UnpackingCLI(wad, folder).start() + sys.exit(0) + else: + print "Output folder %s not writeable." % str(args[0]) + sys.exit(1) + def main(): # load our own translations translator = QTranslator() diff --git a/qwad b/qwad index 4406ee2..f833e3c 100755 --- a/qwad +++ b/qwad @@ -1,3 +1,3 @@ #!/bin/sh -cd /usr/share/Qwad -python Qwad.pyw $@ +PYTHONPATH="/usr/share/Qwad/" +python /usr/share/Qwad/Qwad.pyw $@