From 918e12544db75857aa6e7001620b3d080ff421de Mon Sep 17 00:00:00 2001 From: _ <_> Date: Tue, 24 Apr 2018 03:58:51 -0700 Subject: [PATCH 1/2] Fixed getmeshheader() --- bindings/py3devil1.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bindings/py3devil1.py b/bindings/py3devil1.py index ddccd4c..fea8911 100755 --- a/bindings/py3devil1.py +++ b/bindings/py3devil1.py @@ -189,7 +189,7 @@ class Devil1GEO_FN(ctypes.Structure): ctypes.c_char_p)), ("getmeshheader", ctypes.CFUNCTYPE( ctypes.c_bool, - ctypes.POINTER(MeshHeader), + ctypes.POINTER(ctypes.POINTER(MeshHeader)), ctypes.c_uint, ctypes.c_char_p)), ("getbatch", ctypes.CFUNCTYPE( @@ -224,8 +224,14 @@ if __name__ == "__main__": def geotest(devil1geo, geoheader): with open("pl00.pld_0", "rb") as f: data = f.read() - geoheader = ctypes.cast(data, ctypes.POINTER(Header)) +# geoheader = ctypes.cast(data, ctypes.POINTER(Header)) + gh = ctypes.pointer(geoheader) + devil1geo.getheader(ctypes.byref(gh), data) devil1geo.printheader(geoheader) + meshheader = MeshHeader() + mh = ctypes.pointer(meshheader) + devil1geo.getmeshheader(ctypes.byref(mh), 1, data) + devil1geo.printmeshheader(mh) def main(): sharedlib='./lib3ddevil1.so' From 16ece81bcff463612bcd6e717316037e7e5353dc Mon Sep 17 00:00:00 2001 From: _ <_> Date: Tue, 24 Apr 2018 04:08:52 -0700 Subject: [PATCH 2/2] Fixed getbatchdesc() --- bindings/py3devil1.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bindings/py3devil1.py b/bindings/py3devil1.py index fea8911..8abc301 100755 --- a/bindings/py3devil1.py +++ b/bindings/py3devil1.py @@ -67,17 +67,20 @@ class Devil1TEX_FN(ctypes.Structure): ctypes.POINTER(TextureBatchDescriptor))), ("getheader", ctypes.CFUNCTYPE( ctypes.c_bool, - ctypes.POINTER(ctypes.POINTER(TexturePack)), + ctypes.POINTER( + ctypes.POINTER(TexturePack)), ctypes.c_char_p)), ("getbatchdesc", ctypes.CFUNCTYPE( ctypes.c_bool, - ctypes.POINTER(TextureBatchDescriptor), + ctypes.POINTER( + ctypes.POINTER(TextureBatchDescriptor)), ctypes.c_uint, ctypes.c_char_p, ctypes.c_uint)), ("getbatch", ctypes.CFUNCTYPE( ctypes.c_bool, - ctypes.POINTER(TextureBatch), + ctypes.POINTER( + ctypes.POINTER(TextureBatch)), ctypes.c_uint, ctypes.c_char_p, ctypes.c_uint)), @@ -218,8 +221,14 @@ if __name__ == "__main__": def textest(devil1tex, texheader): with open("pl01.pld_1.txp", "rb") as f: data = f.read() - texheader = ctypes.cast(data, ctypes.POINTER(TexturePack)) - devil1tex.printheader(texheader) +# texheader = ctypes.cast(data, ctypes.POINTER(TexturePack)) + 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): with open("pl00.pld_0", "rb") as f: