Ok, so Noesis can now load the .tex files (Tamschi's source was a great help!), but I do need some help on Noesis functions on how to load them more efficiently.
After loading the file into memory and correcting the data I don't know what to do with the raw ( DXT5 compressed) pixel data, so I basically write everything back into NoeBitStream, get the buffer from this load that bitstream asif it was a dds file.
Code: Select all
def WriteFixedDDS(self):
file=NoeBitStream()
file.writeBytes(b"\x44\x44\x53\x20")
file.writeBytes(noePack("<1i",self.header.DefaultSize))
file.writeBytes(noePack("<1i",self.header.Flags))
file.writeBytes(noePack("<1i",self.header.Height))
file.writeBytes(noePack("<1i",self.header.Width))
file.writeBytes(noePack("<1i",self.header.LinearSize))
file.writeBytes(noePack("<1i",self.header.Depth))
file.writeBytes(noePack("<1i",self.header.MipmapCount))
file.writeBytes(noePack("<11i",*self.header.Reserved1))
file.writeBytes(noePack("<1i",self.header.PixelFormat.DefaultSize))
file.writeBytes(noePack("<1i",self.header.PixelFormat.Flags))
file.writeBytes(b"\x44\x58\x54\x35")
file.writeBytes(noePack("<1i",self.header.PixelFormat.RGBBitCount))
file.writeBytes(noePack("<1i",self.header.PixelFormat.RBitMask))
file.writeBytes(noePack("<1i",self.header.PixelFormat.GBitMask))
file.writeBytes(noePack("<1i",self.header.PixelFormat.BBitMask))
file.writeBytes(noePack("<1i",self.header.PixelFormat.ABitMask))
file.writeBytes(noePack("<1i",self.header.Caps))
file.writeBytes(noePack("<1i",self.header.Caps2))
file.writeBytes(noePack("<1i",self.header.Caps3))
file.writeBytes(noePack("<1i",self.header.Caps4))
file.writeBytes(noePack("<1i",self.header.Reserved2))
self.header.Images[0].reverse()
for l in range(self.header.Layers):
for m in range(self.header.MipmapCount):
file.writeBytes(self.header.Images[l][m])
return file
Code: Select all
buffer=dds.WriteFixedDDS()
tex = rapi.loadTexByHandler(buffer, '.dds')
if tex: texList.append(tex)
Code: Select all
texList.append(NoeTexture("TQTex",dds.header.Width,dds.header.Height,dds.header.Images[0][10],noesis.NOESISTEX_RGBA32))