def readCat(catDict, catPath): cat = dbo.unXor(catPath) cat.seek(0, 2) #get eof catSize = cat.tell() cat.seek(16) #skip nyan casDirectory = os.path.dirname(catPath) while cat.tell() != catSize: catEntry = CatEntry(cat, casDirectory) catDict[catEntry.sha1] = catEntry
def readCat3(catPath): #2017, added more unknown sections. cat = dbo.unXor(catPath) cat.seek(16) #skip nyan numEntries, unk, unk2, unk3 = unpack("<IIQQ", cat.read(24)) casDirectory = os.path.dirname(catPath) for i in range(numEntries): sha1 = cat.read(20) catDict[sha1] = CatEntry(cat, casDirectory, 3)
def readCat2(catPath): #2015, added the number of entries in the header, a new var (always 0?) to cat entry and a new section with unknown data (usually empty). cat = dbo.unXor(catPath) cat.seek(16) #skip nyan numEntries, unk = unpack("<II", cat.read(8)) casDirectory = os.path.dirname(catPath) for i in range(numEntries): sha1 = cat.read(20) catDict[sha1] = CatEntry(cat, casDirectory, 2)
def readCat3(catPath): #2015 (BF Final), added a a new var (always 0?) to cat entry. cat=dbo.unXor(catPath) cat.seek(16) #skip nyan numEntries, unk = unpack("<II",cat.read(8)) casDirectory=os.path.dirname(catPath) for i in range(numEntries): sha1=cat.read(20) catDict[sha1]=CatEntry(cat,casDirectory,3)
def readCat1(catPath): #2013, original version. cat = dbo.unXor(catPath) cat.seek(0, 2) #get eof catSize = cat.tell() cat.seek(16) #skip nyan casDirectory = os.path.dirname(catPath) while cat.tell() != catSize: sha1 = cat.read(20) catDict[sha1] = CatEntry(cat, casDirectory, 1)