Advertisement
Shadowth117

Armored Core 4 TPF script

Dec 13th, 2022
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. from inc_noesis import *
  2.  
  3. def registerNoesisTypes():
  4. handle = noesis.register("Armored Core 4 PS3", ".tpf")
  5. noesis.setHandlerTypeCheck(handle, noepyCheckType)
  6. noesis.setHandlerLoadRGBA(handle, noepyLoadRGBA)
  7. #noesis.logPopup()
  8. return 1
  9.  
  10. def noepyCheckType(data):
  11. bs = NoeBitStream(data)
  12. Magic = bs.readBytes(4)
  13. if Magic != b'\x54\x50\x46\x00':
  14. return 0
  15. return 1
  16.  
  17. def noepyLoadRGBA(data, texList):
  18. bs = NoeBitStream(data, NOE_BIGENDIAN)
  19. bs.seek(0x18, NOESEEK_ABS)
  20. imgFmt = bs.readUByte()
  21. bs.seek(0x3, NOESEEK_REL)
  22. imgWidth = bs.readUShort()
  23. imgHeight = bs.readUShort()
  24. datasize = len(data) - 0x80
  25. bs.seek(0x80, NOESEEK_ABS)
  26. data = bs.readBytes(datasize)
  27. #DXT1
  28. if imgFmt == 0:
  29. texFmt = noesis.NOESISTEX_DXT1
  30. #DXT5
  31. elif imgFmt == 5:
  32. texFmt = noesis.NOESISTEX_DXT5
  33. #unknown, not handled
  34. else:
  35. print("WARNING: Unhandled image format " + repr(imgFmt) + " - " + repr(imgWidth) + "x" + repr(imgHeight) + " - " + repr(len(data)))
  36. return None
  37. texList.append(NoeTexture(rapi.getInputName(), imgWidth, imgHeight, data, texFmt))
  38. return 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement