fixed showing ascii title id in tmd viewer, add -t cmd-opt

This commit is contained in:
Christopher Roy Bratusek 2012-11-25 13:44:20 +01:00
parent 7f38e480be
commit 7c1f3e061f
4 changed files with 52 additions and 4 deletions

View File

@ -1,6 +1,7 @@
-- 0.6 --
* fixed a string in german translation
* fixed selecting file in TMD-Viewer
* fixed show ascii id of title in TMD-Viewer
* 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)
@ -43,6 +44,21 @@
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 : 4294967354
Title Access Rights: 3
Title Type : 1
Title Group ID : 21065
Title Reserved : _
-- 0.5a --
* correctly show version of IOS62
* fix downloading shop channel

View File

@ -66,7 +66,7 @@ class Ui_Qwad(object):
self.label_9 = QtGui.QLabel(self.widget)
self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_9.setObjectName("label_9")
self.gridLayout.addWidget(self.label_9, 0, 2, 1, 2)
self.gridLayout.addWidget(self.label_9, 0, 3, 1, 1)
self.idASCII = QtGui.QLabel(self.widget)
self.idASCII.setObjectName("idASCII")
self.gridLayout.addWidget(self.idASCII, 0, 4, 1, 1)

View File

@ -61,7 +61,10 @@ class MWQwad(QMainWindow, Ui_Qwad):
"""
tmd = TMD().loadFile(tmdpath)
self.TitleID.setText("%016x" % tmd.tmd.titleid)
self.idASCII.setText("%s" % binascii.unhexlify(str(tmd.tmd.titleid)[7:]))
tid = "%016x" % tmd.tmd.titleid
tid = tid[8:]
asc = ''.join([chr(int(''.join(c), 16)) for c in zip(tid[0::2],tid[1::2])])
self.idASCII.setText("%s" % asc)
self.IOSversion.setText(TitleIDs.TitleSwapDict["%s" % ("%016x" % tmd.tmd.iosversion)])
self.TitleType.setText(str(tmd.tmd.title_type))
self.GroupID.setText(str(tmd.tmd.group_id))
@ -430,6 +433,25 @@ class nusDownloadingCLI(UnpackingCLI):
except Exception, e:
print e
def ShowTMD(tmdpath):
"""
Displays _TMD information in the CLI
"""
tmd = TMD().loadFile(tmdpath)
print "Title ID (HEX) : %016x" % tmd.tmd.titleid
tid = "%016x" % tmd.tmd.titleid
tid = tid[8:]
asc = ''.join([chr(int(''.join(c), 16)) for c in zip(tid[0::2],tid[1::2])])
print "Title ID (ASCII) : %s" % asc
print "Title Version : %s" % tmd.tmd.title_version
print "Title Boot Index : %s" % tmd.tmd.boot_index
print "Title Contents : %s" % tmd.tmd.numcontents
print "Title IOS : %s" % tmd.tmd.iosversion
print "Title Access Rights: %s" % tmd.tmd.access_rights
print "Title Type : %s" % tmd.tmd.title_type
print "Title Group ID : %s" % tmd.tmd.group_id
print "Title Reserved : %s" % ''.join(str(tmd.tmd.reserved))
#Statusbar messages
#FIXME: Why don't they get translated? It's frustrating
DOWNLOADING = QT_TR_NOOP("Downloading files from NUS... This may take a while, please, be patient.")

View File

@ -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, PackingCLI, UnpackingCLI
from GUI.VenPri import MWQwad, nusDownloadingCLI, PackingCLI, UnpackingCLI, ShowTMD
from TitleIDs import TitleDict, IOSdict, swap_dic
class MultipleOption(Option):
@ -40,7 +40,9 @@ def opts():
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 IOSxx and hex-value")
action="store_true", default=False, help="convert between IOSxx and hex-value")
parser.add_option('-t', "--tmdinfo", default=False, dest="tmdinfo", action="store_true",
help="Show infos provided by TMD file")
parser.add_option("-v", "--version", dest="version",
action="store_true", default=False, help="print version and exit")
@ -108,6 +110,14 @@ def opts():
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):
ShowTMD(str(args[0]))
sys.exit(0)
else:
print "Can't access %s." % str(args[0])
sys.exit(1)
def main():
# load our own translations
translator = QTranslator()