A converter for Devil May Cry 1 model formats to Collada, vice versa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

daedevil1.py 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/python3
  2. import collada
  3. import ctypes
  4. import numpy
  5. import lib.lib3ddevil1.bindings.py3devil1
  6. if __name__ == "__main__":
  7. devil1 = lib.lib3ddevil1.bindings.py3devil1
  8. def pldtest(devil1pld, pldheader):
  9. with open("pl01.pld", "rb") as f:
  10. data = f.read()
  11. devil1pld.getheader(ctypes.byref(pldheader), data)
  12. devil1pld.printheader(ctypes.byref(pldheader))
  13. def textest(devil1tex, texheader):
  14. with open("pl01.pld_1.txp", "rb") as f:
  15. data = f.read()
  16. texheader = ctypes.cast(data, ctypes.POINTER(devil1.TexturePack))
  17. devil1tex.printheader(texheader)
  18. def geotest(devil1geo, geoheader):
  19. with open("pl01.pld_0", "rb") as f:
  20. data = f.read()
  21. geoheader = ctypes.cast(data, ctypes.POINTER(devil1.Header))
  22. devil1geo.printheader(geoheader)
  23. def main():
  24. sharedlib='./lib/lib3ddevil1/lib3ddevil1.so'
  25. libc = ctypes.cdll.LoadLibrary(sharedlib)
  26. if (not libc):
  27. print("Couldn't load %s" % sharedlib)
  28. return 1
  29. print("OK\n")
  30. DEVIL1PLD = devil1.Devil1PLD_FN.in_dll(libc, "DEVIL1PLD")
  31. pldh = devil1.PldHeader()
  32. pldtest(DEVIL1PLD, pldh)
  33. print()
  34. DEVIL1TEX = devil1.Devil1TEX_FN.in_dll(libc, "DEVIL1TEX")
  35. texh = devil1.TexturePack()
  36. textest(DEVIL1TEX, texh)
  37. print()
  38. DEVIL1GEO = devil1.Devil1GEO_FN.in_dll(libc, "DEVIL1GEO")
  39. geoh = devil1.Header()
  40. geotest(DEVIL1GEO, geoh)
  41. print()
  42. mesh = collada.Collada()
  43. with open("pl01.pld_0", "rb") as f:
  44. data = f.read()
  45. geoheader = ctypes.cast(data, ctypes.POINTER(devil1.Header))
  46. #for meshNo in range(0, geoh.contents.numMesh):
  47. #meshheader = ctypes.cast(data, ctypes.POINTER(devil1.
  48. #for batchNo in range(0,
  49. main()