Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from inc_noesis import *
- def registerNoesisTypes():
- handle = noesis.register("Armored Core 4 PS3", ".tpf")
- noesis.setHandlerTypeCheck(handle, noepyCheckType)
- noesis.setHandlerLoadRGBA(handle, noepyLoadRGBA)
- #noesis.logPopup()
- return 1
- def noepyCheckType(data):
- bs = NoeBitStream(data)
- Magic = bs.readBytes(4)
- if Magic != b'\x54\x50\x46\x00':
- return 0
- return 1
- def noepyLoadRGBA(data, texList):
- bs = NoeBitStream(data, NOE_BIGENDIAN)
- bs.seek(0x18, NOESEEK_ABS)
- imgFmt = bs.readUByte()
- bs.seek(0x3, NOESEEK_REL)
- imgWidth = bs.readUShort()
- imgHeight = bs.readUShort()
- datasize = len(data) - 0x80
- bs.seek(0x80, NOESEEK_ABS)
- data = bs.readBytes(datasize)
- #DXT1
- if imgFmt == 0:
- texFmt = noesis.NOESISTEX_DXT1
- #DXT5
- elif imgFmt == 5:
- texFmt = noesis.NOESISTEX_DXT5
- #unknown, not handled
- else:
- print("WARNING: Unhandled image format " + repr(imgFmt) + " - " + repr(imgWidth) + "x" + repr(imgHeight) + " - " + repr(len(data)))
- return None
- texList.append(NoeTexture(rapi.getInputName(), imgWidth, imgHeight, data, texFmt))
- return 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement