def __init__(self, data): self.data = data stream = StreamParser(data) self.dependecies = [] # for now, this will do for gathering the dependencies stream.burn(8) header_size = stream.readInt(4) stream.burn(4) self.name = stream.readString() stream.seek(header_size) stream.burn(15) dependency_count = stream.readInt(4) stream.burn(6) for i in range(dependency_count): self.dependecies.append(stream.readString()) stream.burn(6)
def load(self, stream: StreamParser): self.size = stream.readInt(4) self.flags = stream.readInt(4) self.fourCC = stream.readString(length=4) self.RGBBitCount = stream.readInt(4) self.RBitMask = stream.readInt(4) self.GBitMask = stream.readInt(4) self.BBitMask = stream.readInt(4) self.ABitMask = stream.readInt(4)
def load(self, path): if type(path) != StreamParser: stream = StreamParser(open(path, "rb").read()) else: stream = path self.magic = stream.readString(length=4) self.size = stream.readInt(4) self.flags = stream.readInt(4) self.height = stream.readInt(4) self.width = stream.readInt(4) self.pitchOrLinearSize = stream.readInt(4) self.depth = stream.readInt(4) self.mipmap_count = stream.readInt(4) for item in self.reserved: stream.readInt(4) self.ddspf.load(stream) self.caps = stream.readInt(4) self.caps2 = stream.readInt(4) self.caps3 = stream.readInt(4) self.caps4 = stream.readInt(4) self.reserved2 = stream.readInt(4)