Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.
Zero Tolerance for Disrespect

Need help decoding texture atlases from Trials Evolution

Featured Replies

  • Localization

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

Solved by DKDave

  • Solution
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.

 

 

  • Author
  • Localization
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 by jmancoder

  • Author
  • Localization

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 by jmancoder
Attached the Noesis script.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.