Fixed TEXturePack struct

This commit is contained in:
_ 2018-04-27 04:44:55 -07:00
parent be691baffb
commit 62841adcb9

View File

@ -275,21 +275,18 @@ class PLDHeader:
class TEXturePack: class TEXturePack:
def __init__(self, filedata): def __init__(self, filedata):
self.cstruct = TexturePack() self.cstruct = ctypes.pointer(TexturePack())
self.th = ctypes.pointer(self.cstruct) devil1tex.getheader(ctypes.byref(self.cstruct), filedata)
devil1tex.getheader(ctypes.byref(self.th), filedata)
devil1tex.printheader(self.th)
return return
def show(self): def show(self):
devil1tex.printheader(ctypes.byref(self.cstruct)) devil1tex.printheader(self.cstruct)
devil1tex.printheader(self.th)
def getbatchno(self): def getbatchno(self):
return self.cstruct.batchNumber return self.cstruct.contents.batchNumber
def getfirstbatchoffset(self): def getfirstbatchoffset(self):
return self.cstruct.firstBatchOffset return self.cstruct.contents.firstBatchOffset
class TEXtureBatchDescriptor: class TEXtureBatchDescriptor:
def __init__(self, i, filedata): def __init__(self, i, filedata):
@ -390,6 +387,8 @@ if __name__ == "__main__":
data = f.read() data = f.read()
txp = TEXturePack(data) txp = TEXturePack(data)
txp.show() txp.show()
print(txp.getbatchno())
print(txp.getfirstbatchoffset())
#---------------------------------------+ #---------------------------------------+
# main() # main()
mainx() mainx()