Fixed getbatchdesc()

This commit is contained in:
_ 2018-04-24 04:08:52 -07:00
parent 918e12544d
commit 16ece81bcf

View File

@ -67,17 +67,20 @@ class Devil1TEX_FN(ctypes.Structure):
ctypes.POINTER(TextureBatchDescriptor))), ctypes.POINTER(TextureBatchDescriptor))),
("getheader", ctypes.CFUNCTYPE( ("getheader", ctypes.CFUNCTYPE(
ctypes.c_bool, ctypes.c_bool,
ctypes.POINTER(ctypes.POINTER(TexturePack)), ctypes.POINTER(
ctypes.POINTER(TexturePack)),
ctypes.c_char_p)), ctypes.c_char_p)),
("getbatchdesc", ctypes.CFUNCTYPE( ("getbatchdesc", ctypes.CFUNCTYPE(
ctypes.c_bool, ctypes.c_bool,
ctypes.POINTER(TextureBatchDescriptor), ctypes.POINTER(
ctypes.POINTER(TextureBatchDescriptor)),
ctypes.c_uint, ctypes.c_uint,
ctypes.c_char_p, ctypes.c_char_p,
ctypes.c_uint)), ctypes.c_uint)),
("getbatch", ctypes.CFUNCTYPE( ("getbatch", ctypes.CFUNCTYPE(
ctypes.c_bool, ctypes.c_bool,
ctypes.POINTER(TextureBatch), ctypes.POINTER(
ctypes.POINTER(TextureBatch)),
ctypes.c_uint, ctypes.c_uint,
ctypes.c_char_p, ctypes.c_char_p,
ctypes.c_uint)), ctypes.c_uint)),
@ -218,8 +221,14 @@ if __name__ == "__main__":
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:
data = f.read() data = f.read()
texheader = ctypes.cast(data, ctypes.POINTER(TexturePack)) # texheader = ctypes.cast(data, ctypes.POINTER(TexturePack))
devil1tex.printheader(texheader) th = ctypes.pointer(texheader)
devil1tex.getheader(ctypes.byref(th), data)
devil1tex.printheader(th)
batchdesc = TextureBatchDescriptor()
bd = ctypes.pointer(batchdesc)
print("\nbatch descriptor:")
devil1tex.getbatchdesc(ctypes.byref(bd), 1, data, len(data))
def geotest(devil1geo, geoheader): def geotest(devil1geo, geoheader):
with open("pl00.pld_0", "rb") as f: with open("pl00.pld_0", "rb") as f: