@@ -197,7 +197,7 @@ def do_utime(targetname, atime, mtime):
197197 # Using utime() on directories is not allowed on Win32 according to
198198 # msdn.microsoft.com
199199 os .utime (targetname ,
200- (time .mktime (mstime (atime )), time .mktime (mstime (mtime ))))
200+ (time .mktime (mstime (atime )), time .mktime (mstime (mtime ))))
201201
202202###############################################################################
203203
@@ -246,7 +246,7 @@ def get_cluster(startclust, offset):
246246###############################################################################
247247
248248def fill_directory (infile , txtfile , contents , firstclust , makedir , start ,
249- offset ):
249+ offset ):
250250 """Fill the directory structure with the files contained in the archive.
251251
252252 @param infile pointer to the archive
@@ -262,9 +262,9 @@ def fill_directory(infile, txtfile, contents, firstclust, makedir, start,
262262
263263 # dictionary which holds the directory structure,
264264 # patch 0xFFFF is the 'root' directory.
265- paths = {0xFFFF :"" }
265+ paths = {0xFFFF : "" }
266266
267- oldpathind = 0xFFFF # initial path, speed up file/dir creation
267+ oldpathind = 0xFFFF # initial path, speed up file/dir creation
268268
269269 for i in xrange (0x1000 * firstclust // 64 ):
270270 cur = contents [i * 64 :(i + 1 ) * 64 ]
@@ -286,7 +286,7 @@ def fill_directory(infile, txtfile, contents, firstclust, makedir, start,
286286 if nlen < 1 or nlen > 40 :
287287 print "Filename length (%i) out of range, skipping file." % nlen
288288 continue
289- outname = outname [0 :nlen ] # strip trailing 0x00 from filename
289+ outname = outname [0 :nlen ] # strip trailing 0x00 from filename
290290
291291 if txtfile != None :
292292 if namelen & 0x80 == 0x80 :
@@ -312,7 +312,7 @@ def fill_directory(infile, txtfile, contents, firstclust, makedir, start,
312312 if pathind != oldpathind :
313313 # working directory changed
314314 for _ in xrange (paths [oldpathind ].count ("/" )):
315- os .chdir (".." ) # go back to root directory
315+ os .chdir (".." ) # go back to root directory
316316 os .chdir (paths [pathind ])
317317 oldpathind = pathind
318318 if namelen & 0x80 == 0x80 :
@@ -358,8 +358,9 @@ def write_common_part(infile, txtfile, png2stop, start):
358358 """
359359
360360 infile .seek (0x32C )
361- mhash = infile .read (20 ) # xbox180 : SHA1 hash of 0x0344-0xB000,
362- # CON : 0x0344 - 0xA000 (i.e. png2stop)
361+ # xbox180 : SHA1 hash of 0x0344-0xB000,
362+ # CON : 0x0344 - 0xA000 (i.e. png2stop)
363+ mhash = infile .read (20 )
363364 (mentry_id , content_type ) = struct .unpack (">LL" , infile .read (8 ))
364365
365366 if txtfile != None :
@@ -488,14 +489,14 @@ def handle_live_pirs(infile, fsize):
488489 print >> txtfile , hex (ord (i )),
489490 print >> txtfile
490491
491- ### BEGIN wxPirs ###
492- infile .seek (0xC032 ) # originally 4 bytes at 0xC030
492+ # BEGIN wxPirs
493+ infile .seek (0xC032 ) # originally 4 bytes at 0xC030
493494 (pathind , ) = struct .unpack (">H" , infile .read (2 ))
494495 if pathind == 0xFFFF :
495- start = 0xC000
496+ start = 0xC000
496497 else :
497- start = 0xD000
498- ### END wxPirs ###
498+ start = 0xD000
499+ # END wxPirs
499500 write_common_part (infile , txtfile , 0xB000 , start )
500501
501502###############################################################################
@@ -535,7 +536,7 @@ def extractPirsFromZip(systemupdate):
535536 print "Extracting $SystemUpdate/FFFE07DF00000001 from system update file..."
536537 updatefile = StringIO .StringIO (systemupdate )
537538 z = zipfile .ZipFile (updatefile )
538- #print z.namelist()
539+ # print z.namelist()
539540 pirs = z .open ("$SystemUpdate/FFFE07DF00000001" ).read ()
540541 print "done."
541542 return pirs
@@ -555,7 +556,7 @@ def extractPirsFromZip(systemupdate):
555556 basename = "FFFE07DF00000001"
556557 sio .name = basename
557558 pwd = os .getcwd ()
558- handle_live_pirs (sio , len (pirs )- 4 )
559+ handle_live_pirs (sio , len (pirs ) - 4 )
559560
560561 os .chdir (pwd )
561562 print "Moving audios.bin to current folder"
0 commit comments