From 790afd9960a028eb46bd9b75346639d9bbdfe005 Mon Sep 17 00:00:00 2001 From: _ <_> Date: Tue, 24 Apr 2018 19:15:39 -0700 Subject: [PATCH] Added pack to packed structs --- bindings/py3devil1.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bindings/py3devil1.py b/bindings/py3devil1.py index 4e67102..d20cf1c 100755 --- a/bindings/py3devil1.py +++ b/bindings/py3devil1.py @@ -31,6 +31,7 @@ class Devil1PLD_FN(ctypes.Structure): #--------------------------------------+ class TexturePack(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("id", ctypes.c_char * 4), # fixed length 4, reverse order ("batchNumber", ctypes.c_int), @@ -39,6 +40,7 @@ class TexturePack(ctypes.Structure): ] class TextureBatchDescriptor(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("batchIdx", ctypes.c_int), ("hash", ctypes.c_int), @@ -49,11 +51,13 @@ class TextureBatchDescriptor(ctypes.Structure): ] class Texture(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("data", ctypes.c_ubyte) ] class TextureBatch(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("batch", ctypes.POINTER(Texture)) ] @@ -98,6 +102,7 @@ class Devil1TEX_FN(ctypes.Structure): #--------------------------------------+ class Header(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("numMesh", ctypes.c_ubyte), ("unknownNumberB", ctypes.c_ubyte), @@ -108,6 +113,7 @@ class Header(ctypes.Structure): ] class MeshHeader(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("numBatch", ctypes.c_short), ("numVertex", ctypes.c_short), @@ -117,6 +123,7 @@ class MeshHeader(ctypes.Structure): ] class Coordinate(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("x", ctypes.c_float), ("y", ctypes.c_float), @@ -124,23 +131,27 @@ class Coordinate(ctypes.Structure): ] class UVs(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("u", ctypes.c_short), ("v", ctypes.c_short) ] class BoneIndexes(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("indexes", ctypes.c_ubyte * 4), ] class BoneWeights(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("weights", ctypes.c_short) ] class BatchData(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("numVertex", ctypes.c_short), ("uB", ctypes.c_short), @@ -154,6 +165,7 @@ class BatchData(ctypes.Structure): ] class VertexData(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("positions", ctypes.POINTER(Coordinate)), ("normals", ctypes.POINTER(Coordinate)), @@ -163,12 +175,14 @@ class VertexData(ctypes.Structure): ] class Batch(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("bd", ctypes.POINTER(BatchData)), ("vd", VertexData) ] class Mesh(ctypes.Structure): + _pack_ = 1 _fields_ = [ ("b", ctypes.POINTER(Batch)) ] @@ -220,6 +234,7 @@ if __name__ == "__main__": devil1pld.printheader(ctypes.byref(pldheader)) print(pldheader) print(pldheader.numOffset) + print(pldheader.offsets) for i in range(0, pldheader.numOffset): print(hex(pldheader.offsets[i]))