jmancoder Posted October 11 Posted October 11 I've extracted the Xbox 360 version of Trials Evolution, and it seems to contain both normal textures with a T5X header and atlas textures with a T8X header. The T5X textures were simple enough to convert: I just read the 4-byte magic number and two int16s for the dimensions, then skipped to offset 0x1D and read the rest of the file as DXT5-compressed data. However, I haven't had any luck with the T8X textures yet. I've attached six of them for reference, though I have more if needed. T8X Textures.zip
Solution DKDave Posted October 11 Solution Posted October 11 1 hour ago, jmancoder said: I've extracted the Xbox 360 version of Trials Evolution, and it seems to contain both normal textures with a T5X header and atlas textures with a T8X header. The T5X textures were simple enough to convert: I just read the 4-byte magic number and two int16s for the dimensions, then skipped to offset 0x1D and read the rest of the file as DXT5-compressed data. However, I haven't had any luck with the T8X textures yet. I've attached six of them for reference, though I have more if needed. T8X Textures.zip 191.83 kB · 1 download From a quick look, the files have a variable-sized header, depending on how many parts there seem to be (for example, the "cube" one has 6 parts). This header is followed by decompressed size, then compressed size, and then the compressed data using XMEMLZX compression. Haven't delved into it much more than that, but that should be enough to investigate further. 1
jmancoder Posted October 11 Author Posted October 11 (edited) 3 hours ago, DKDave said: From a quick look, the files have a variable-sized header, depending on how many parts there seem to be (for example, the "cube" one has 6 parts). This header is followed by decompressed size, then compressed size, and then the compressed data using XMEMLZX compression. Haven't delved into it much more than that, but that should be enough to investigate further. I managed to read the headers and decompress the XMEMLZX data with the following Noesis function (I'll adjust it later so it can read cubemaps). However, I still can't read heightmap textures. Based on the results in ImageHeat, they use BC4_UNORM, and I'm not sure how you read that pixel format in Noesis. def decodeT8X(bs, flag): if flag != 2: print("Unknown T8X flag: " + str(flag)) return None width1 = bs.readShort() height1 = bs.readShort() textureCompFlag = bs.readShort() sectionCountA = bs.readShort() bs.seek(bs.tell() + 8) width2 = bs.readShort() height2 = bs.readShort() bs.seek(bs.tell() + 6) sectionCountB = bs.readByte() decompLen = bs.readInt() compLen = bs.readInt() compBuffer = bs.getBuffer(bs.tell(), compLen) print(str(compLen) + " expanded to " + str(decompLen)) decompBuffer = rapi.decompXMemLZX(compBuffer, decompLen) imageName = rapi.getExtensionlessName(rapi.getLocalFileName(rapi.getInputName())) if textureCompFlag == 1294: texture = NoeTexture(imageName, width1, height1, decompBuffer, noesis.NOESISTEX_DXT5) elif textureCompFlag == 1313: #BC4 UNORM? texture = NoeTexture(imageName, width1, height1, decompBuffer, noesis.NOESISTEX_UNKNOWN) else: print("Unknown image compression flag: " + str(textureCompFlag)) return None return texture Edited October 11 by jmancoder
jmancoder Posted October 12 Author Posted October 12 (edited) Never mind, I just had to use imageDecodeDXT in FOURCC_BC4 mode first. I'll attach the full Noesis script here once it's done for future reference. fmt_tex.py Edited October 12 by jmancoder Attached the Noesis script.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now