mirror of
https://github.com/grp/Wii.py.git
synced 2025-06-18 14:55:35 -04:00
fixed some issues that broke tests
This commit is contained in:
parent
dd5e0542dc
commit
7039b63616
4
bns.py
4
bns.py
@ -76,6 +76,8 @@ class BNS_info(object):
|
||||
self.magic, self.size = struct.unpack('>4sI', buffer[offset+0:offset+8])
|
||||
self.codec, self.has_loop = struct.unpack('>BB', buffer[offset+8:offset+10])
|
||||
self.chan_cnt, self.zero = struct.unpack('>BB', buffer[offset+10:offset+12])
|
||||
assert self.chan_cnt > 0
|
||||
assert self.chan_cnt <=2
|
||||
self.samplerate, self.pad0 = struct.unpack('>HH', buffer[offset+12:offset+16])
|
||||
assert self.samplerate <= 48000
|
||||
assert self.samplerate > 32000
|
||||
@ -175,7 +177,7 @@ class BNS_info(object):
|
||||
print "Samplerate: %04x %d" % ( self.samplerate , self.samplerate )
|
||||
print "Padding: %04x" % self.pad0
|
||||
print "Loop Start: %08x" % self.loop_start
|
||||
print "Loop End: %08x" % self.loop_end
|
||||
print "Sample Count / Loop End: %08x" % self.loop_end
|
||||
print "Channels Starts Offsets: %08x" % self.offset_to_chan_starts
|
||||
print "Padding: %08x" % self.pad2
|
||||
print "Channel 1 Start Offset: %08x" % self.channel1_start_offset
|
||||
|
@ -231,7 +231,7 @@ def main():
|
||||
if len(sys.argv) == 1:
|
||||
print 'Usage: python bmg.py -r <filename.bmg> <filename.hog>'
|
||||
print ' == OR == '
|
||||
print 'Usage: python bmg.py -w> <filename.hog> <filename.bmg'
|
||||
print 'Usage: python bmg.py -w <filename.hog> <filename.bmg>'
|
||||
sys.exit(1)
|
||||
if sys.argv[1] == "-r":
|
||||
f = open(sys.argv[2], 'rb')
|
||||
|
2
nand.py
2
nand.py
@ -370,7 +370,7 @@ class NAND:
|
||||
self.ES.AddTicket(title.tik)
|
||||
contents = title.tmd.getContents()
|
||||
for i, content in enumerate(contents):
|
||||
self.ES.AddContentStart(title.tmd.titleid, content.cid)
|
||||
self.ES.AddContentStart(title.tmd.getTitleID(), content.cid)
|
||||
data = title[content.index]
|
||||
self.ES.AddContentData(content.cid, data)
|
||||
self.ES.AddContentFinish(content.cid)
|
||||
|
19
tests/createNAND.py
Normal file
19
tests/createNAND.py
Normal file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, Wii
|
||||
|
||||
nand = Wii.NAND('/home/megazig/Wii.py/nand')
|
||||
|
||||
# change for region
|
||||
sysV = 417
|
||||
iosV = 6174
|
||||
|
||||
#Wii.NUS.download(0x0000000100000002, sysV).dumpDir("0000000100000002")
|
||||
#Wii.NUS.download(0x000000010000003C, iosV).dumpDir("000000010000003C")
|
||||
#Wii.NUS.download(0x0001000848414C45).dumpDir("0001000848414C45")
|
||||
#Wii.NUS.download(0x0001000848414B45).dumpDir("0001000848414B45")
|
||||
|
||||
nand.importTitle(Wii.NUS.download(0x0000000100000002, sysV), False)
|
||||
nand.importTitle(Wii.NUS.download(0x000000010000003C, iosV), False)
|
||||
nand.importTitle(Wii.NUS.download(0x0001000848414C45), False)
|
||||
nand.importTitle(Wii.NUS.download(0x0001000848414B45), False)
|
@ -1,10 +1,20 @@
|
||||
import os
|
||||
#!/usr/bin/python
|
||||
|
||||
import os, sys
|
||||
from U8 import *
|
||||
from title import WAD
|
||||
|
||||
sysmenuWad = WAD('/home/giuseppe/Scrivania/RVL-WiiSystemmenu-v258.wad')
|
||||
sysmenuWad.unpack('/home/giuseppe/Scrivania/sysdump')
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
print 'Usage: python sysmenuUnpack.py <filename.wad> <output_folder>'
|
||||
sys.exit(1)
|
||||
|
||||
for file in os.listdir('/home/giuseppe/Scrivania/sysdump'):
|
||||
if open('/home/giuseppe/Scrivania/sysdump/' + file).read(4) == '\x55\xaa\x38\x2d':
|
||||
U8('/home/giuseppe/Scrivania/sysdump/' + file).unpack('/home/giuseppe/Scrivania/sysdump/' + file + '_decompressed/')
|
||||
sysmenuWad = WAD(sys.argv[1])
|
||||
sysmenuWad.unpack(sys.argv[2])
|
||||
|
||||
for file in os.listdir(sys.argv[2]):
|
||||
if open(sys.argv[2] + file).read(4) == '\x55\xaa\x38\x2d':
|
||||
U8(sys.argv[2] + file).unpack(sys.argv[2] + file + '_decompressed/')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -1,9 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
from formats import locDat
|
||||
|
||||
sdLoc = locDat('/home/giuseppe/Scrivania/sysmenu/loc.dat')
|
||||
def main():
|
||||
if len(sys.argv) == 1:
|
||||
print 'Usage: python testLOC.py <filename.dat>'
|
||||
sys.exit(1)
|
||||
|
||||
print '%s' % sdLoc
|
||||
sdLoc = locDat(sys.argv[1])
|
||||
|
||||
#concorsiMii = sdLoc.getTitle(0, 0, 0)
|
||||
sdLoc.delTitle(0, 0, 0)
|
||||
print '%s' % sdLoc
|
||||
|
||||
#concorsiMii = sdLoc.getTitle(0, 0, 0)
|
||||
sdLoc.delTitle(0, 0, 0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -1,9 +1,20 @@
|
||||
from savedata import *
|
||||
#!/usr/bin/python
|
||||
|
||||
save = Savegame('/home/giuseppe/Scrivania/data' + str(4) + '.bin')
|
||||
save.analyzeHeader()
|
||||
print '%s' % save
|
||||
save.getBanner()
|
||||
for i in range(save.getIconsCount()):
|
||||
save.getIcon(i)
|
||||
save.extractFiles()
|
||||
import sys, Wii
|
||||
|
||||
def main():
|
||||
if len(sys.argv) == 1:
|
||||
print 'Usage: python testSAVE.py <filename.bin>'
|
||||
sys.exit(1)
|
||||
|
||||
save = Savegame(sys.argv[1])
|
||||
save.analyzeHeader()
|
||||
print '%s' % save
|
||||
save.getBanner()
|
||||
for i in range(save.getIconsCount()):
|
||||
save.getIcon(i)
|
||||
save.extractFiles()
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
21
title.py
21
title.py
@ -408,18 +408,24 @@ class NUS:
|
||||
certs = ""
|
||||
tmd = TMD.load(urllib.urlopen("http://nus.cdn.shop.wii.com/ccs/download/0000000100000002/tmd.289").read())
|
||||
tik = Ticket.load(urllib.urlopen("http://nus.cdn.shop.wii.com/ccs/download/0000000100000002/cetk").read())
|
||||
|
||||
certs += tik.dump()[0x2A4:0x2A4 + 0x300] #XS
|
||||
certs += tik.dump()[0x2A4 + 0x300:] #CA (tik)
|
||||
certs += tmd.dump()[0x328:0x328 + 0x300] #CP
|
||||
|
||||
rawtmd = urllib.urlopen("http://nus.cdn.shop.wii.com/ccs/download/0000000100000002/tmd.289").read()
|
||||
rawtik = urllib.urlopen("http://nus.cdn.shop.wii.com/ccs/download/0000000100000002/cetk").read()
|
||||
certs += rawtik[0x2A4:0x2A4 + 0x300] #XS
|
||||
certs += rawtik[0x2A4 + 0x300:] #CA (tik)
|
||||
certs += rawtmd[0x328:0x328 + 0x300] #CP
|
||||
|
||||
#certs += tik.dump()[0x2A4:0x2A4 + 0x300] #XS
|
||||
#certs += tik.dump()[0x2A4 + 0x300:] #CA (tik)
|
||||
#certs += tmd.dump()[0x328:0x328 + 0x300] #CP
|
||||
|
||||
if(Crypto.createMD5HashHex(certs) != "7ff50e2733f7a6be1677b6f6c9b625dd"):
|
||||
raise ValueError("Failed to create certs! MD5 mistatch.")
|
||||
|
||||
if(self.version == None):
|
||||
if(version == None):
|
||||
versionstring = ""
|
||||
else:
|
||||
versionstring = ".%u" % self.version
|
||||
versionstring = ".%u" % version
|
||||
|
||||
titleurl = self.url + "%08x%08x/" % (titleid >> 32, titleid & 0xFFFFFFFF)
|
||||
|
||||
@ -434,8 +440,9 @@ class NUS:
|
||||
contents = tmd.getContents()
|
||||
for content in contents:
|
||||
encdata = urllib.urlopen(titleurl + ("%08x" % content.cid)).read(content.size)
|
||||
decdata = Crypto.decryptContent(titlekey, content.index, encdata)
|
||||
decdata = Crypto.decryptContent(tik.titlekey, content.index, encdata)
|
||||
if(Crypto.validateSHAHash(decdata, content.hash) == 0):
|
||||
raise ValueError("Decryption failed! SHA1 mismatch.")
|
||||
title.contents.append(decdata)
|
||||
return title
|
||||
download = classmethod(download)
|
||||
|
Loading…
Reference in New Issue
Block a user