Plants VS. Zombies (Android TV China) *.TEX (SEXYAppFramework TEXture)

Textures, recreate headers, conversions, algorithms and parsing of image files
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Plants VS. Zombies (Android TV China) *.TEX (SEXYAppFramework TEXture)

Post by LolHacksRule »

The textures are zlib-compressed, the format is super easy but ripping textures is going to be a little tedious as they use XML files to locate textures on the atlas. I tried to create a Noesis script on my own, it gets the textures, but doesn't properly adjust the texture formats to ARGB, making textures look improperly colored. Any advice on fixing my script?

Code: Select all

//------------------------------------------------
//--- 010 Editor v10.0.2 Binary Template
//
//      File: PopCap (SexyApp/Sexy App) Framework *.TEX (SEXY Texture)
//      Authors: LolHacksRule
//      Version: 1
//      Purpose: Gets data out of the binary.
//      Category: Metadata
//      File Mask: SEXYTEX
//      ID Bytes:
//      History:
//------------------------------------------------

LittleEndian();

struct Header {
    char    sexyTexHeader[7]<bgcolor=cGreen>; //Should be SEXYTEX
    char    padding[5]<bgcolor=cRed>; //should be 00
} header;


struct TexMetaData {
    uint    texWidth<bgcolor=cBlue>; //Width
    uint    texHeight<bgcolor=cLtBlue>;
    uint    texFmt<bgcolor=cPurple>; //03 = ARGB4444, 02 = ARGB8888
    uint    unknown2<bgcolor=cRed>;
    uint    unknown3<bgcolor=cRed>;
    uint    zLibCompressedTexSize<bgcolor=cRed>;
    char    morePadding[12]<bgcolor=cRed>;
} texMetaDataTable;


Code: Select all

    #RGBA8888 texture
    if texFmt == 0x2:
        print("RGBA8888: format detected")
        texData = rapi.imageDecodeRaw(decompTex, texWidth, texHeight, "r8 g8 b8 a8")
        texFmt = noesis.NOESISTEX_RGBA32
    #RGBA4444 texture
    elif texFmt == 0x3:
        print("RGBA4444: format detected")
        texData = rapi.imageDecodeRaw(decompTex, texWidth, texHeight, "r4 g4 b4 a4")
        texFmt = noesis.NOESISTEX_RGBA32
    else:
        print("UNKNOWN TEXTURE FORMAT DETECTED!")
        return None
    texList.append(NoeTexture(rapi.getInputName(), texWidth, texHeight, texData, texFmt))
    return 1
z4ruz
Posts: 75
Joined: Sun Jan 10, 2021 2:23 pm

Re: Plants VS. Zombies (Android TV China) *.TEX (SEXYAppFramework TEXture)

Post by z4ruz »

next time please also provide full script (attach as file)
tex_PvZ_tex.py.txt
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Plants VS. Zombies (Android TV China) *.TEX (SEXYAppFramework TEXture)

Post by LolHacksRule »

Sorry, but thanks anyway.