Fixed access of offset attribute in PldHeader

This commit is contained in:
_ 2018-04-24 18:46:10 -07:00
parent 7736a50e7f
commit 8585702471

View File

@ -6,6 +6,7 @@ import ctypes
#--------------------------------------+ #--------------------------------------+
class PldHeader(ctypes.Structure): class PldHeader(ctypes.Structure):
_pack_ = 1
_fields_ = [ _fields_ = [
("numOffset", ctypes.c_int), ("numOffset", ctypes.c_int),
("offsets", ctypes.POINTER(ctypes.c_int)) ("offsets", ctypes.POINTER(ctypes.c_int))
@ -217,6 +218,10 @@ if __name__ == "__main__":
data = f.read() data = f.read()
devil1pld.getheader(ctypes.byref(pldheader), data) devil1pld.getheader(ctypes.byref(pldheader), data)
devil1pld.printheader(ctypes.byref(pldheader)) devil1pld.printheader(ctypes.byref(pldheader))
print(pldheader)
print(pldheader.numOffset)
for i in range(0, pldheader.numOffset):
print(hex(pldheader.offsets[i]))
def textest(devil1tex, texheader): def textest(devil1tex, texheader):
with open("pl01.pld_1.txp", "rb") as f: with open("pl01.pld_1.txp", "rb") as f: