Created
May 9, 2016 14:19
-
-
Save dantarion/c84e7ae618c18cb735342156e6bc8849 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import zlib | |
from struct import pack,unpack | |
def extractFile(filename): | |
f = open(filename,"rb") | |
f.seek(0x14) | |
unknown, filecount = unpack(">HH",f.read(4)) | |
f.seek(0x60) | |
dirpath = filename.replace(".drp","") | |
if not os.path.isdir(dirpath): | |
os.makedirs(dirpath) | |
for i in range(0, filecount): | |
try: | |
fname = f.read(0x40).split("\x00")[0] | |
if os.path.isfile(os.path.join(dirpath,fname+".bin")): | |
continue | |
#print "\t",fname, | |
f.seek(0x10,1) | |
fsize, fsize2, fsize3, fsize4,uncompressedSize = unpack(">5I",f.read(4*5)) | |
#print fsize, fsize2, fsize3, fsize4,hex(uncompressedSize) | |
data = f.read(fsize2-4) | |
if fsize > 80: | |
data = zlib.decompress(data) | |
out = open(os.path.join(dirpath,fname+".bin"),"wb") | |
out.write(data) | |
out.close() | |
except: | |
print "\tError with ",filename,fname | |
return | |
for root,dirs,files in os.walk("disc\\WiiU-Decrypted\\"): | |
for filename in files: | |
if ".drp" not in filename: | |
continue | |
extractFile(os.path.join(root,filename)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment