Jump to content

Crimson Skies: High Road to Revenge (*.tga)


Go to solution Solved by h3x3r,

Recommended Posts

  • Solution

Well this should do...

from inc_noesis import *
import noesis
import rapi
import os

def registerNoesisTypes():
   handle = noesis.register("Crimson Skies: High Road to Revenge Env tex(*.dds)", "dds")
   noesis.setHandlerTypeCheck(handle, noepyCheckType)
   noesis.setHandlerLoadRGBA(handle, noepyLoadRGBA)
   noesis.logPopup()
   return 1
        
def noepyCheckType(data):
   bs = NoeBitStream(data)
   if len(data) < 20:
      return 0
   return 1
   
def noepyLoadRGBA(data, texList):
    bs = NoeBitStream(data)
    baseName = rapi.getExtensionlessName(rapi.getLocalFileName(rapi.getInputName()))
    print(baseName)
    ImgWidth = bs.readUInt()
    ImgHeight = bs.readUInt()
    PixelFormat = bs.readUInt()
    MipMap = bs.readUInt()
    for i in range(6):
        ImgSize = bs.readUInt()
        data = bs.readBytes(ImgSize)
        MipCount = MipMap - 1
        for j in range(MipCount):
            DataSize = bs.readUInt()
            MipData = bs.readBytes(DataSize)
            
        if PixelFormat == 1:
            texFmt = noesis.NOESISTEX_DXT1
        elif PixelFormat == 3:
            texFmt = noesis.NOESISTEX_DXT3
        elif PixelFormat == 5:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "r8 g8 b8 a8", noesis.NTEXFLAG_CUBEMAP)
            texFmt = noesis.NOESISTEX_DXT5
        elif PixelFormat == 6:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "b0 g0 r0 a16")
            #data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 14:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "b5 g6 r5 a0")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 15:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "r8 g8 b8 a8")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 16:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "b8 g8 r8 a8")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 19:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "r0 g0 b0 a8")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 20:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "r8 g8 b8 a8")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        texList.append(NoeTexture(rapi.getInputName(), ImgWidth, ImgHeight, data, texFmt))
    return 1

 

  • Like 1
Link to comment
Share on other sites

Posted (edited)
19 hours ago, h3x3r said:

Well this should do...

from inc_noesis import *
import noesis
import rapi
import os

def registerNoesisTypes():
   handle = noesis.register("Crimson Skies: High Road to Revenge Env tex(*.dds)", "dds")
   noesis.setHandlerTypeCheck(handle, noepyCheckType)
   noesis.setHandlerLoadRGBA(handle, noepyLoadRGBA)
   noesis.logPopup()
   return 1
        
def noepyCheckType(data):
   bs = NoeBitStream(data)
   if len(data) < 20:
      return 0
   return 1
   
def noepyLoadRGBA(data, texList):
    bs = NoeBitStream(data)
    baseName = rapi.getExtensionlessName(rapi.getLocalFileName(rapi.getInputName()))
    print(baseName)
    ImgWidth = bs.readUInt()
    ImgHeight = bs.readUInt()
    PixelFormat = bs.readUInt()
    MipMap = bs.readUInt()
    for i in range(6):
        ImgSize = bs.readUInt()
        data = bs.readBytes(ImgSize)
        MipCount = MipMap - 1
        for j in range(MipCount):
            DataSize = bs.readUInt()
            MipData = bs.readBytes(DataSize)
            
        if PixelFormat == 1:
            texFmt = noesis.NOESISTEX_DXT1
        elif PixelFormat == 3:
            texFmt = noesis.NOESISTEX_DXT3
        elif PixelFormat == 5:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "r8 g8 b8 a8", noesis.NTEXFLAG_CUBEMAP)
            texFmt = noesis.NOESISTEX_DXT5
        elif PixelFormat == 6:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "b0 g0 r0 a16")
            #data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 14:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "b5 g6 r5 a0")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 15:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "r8 g8 b8 a8")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 16:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "b8 g8 r8 a8")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 19:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "r0 g0 b0 a8")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        elif PixelFormat == 20:
            data = rapi.imageDecodeRaw(data, ImgWidth, ImgHeight, "r8 g8 b8 a8")
            data = rapi.imageFromMortonOrder(data, ImgWidth, ImgHeight, 4)
            texFmt = noesis.NOESISTEX_RGBA32
        texList.append(NoeTexture(rapi.getInputName(), ImgWidth, ImgHeight, data, texFmt))
    return 1

 

did some testing, looks like this works fine! with the exception of the random ~a in some textures, looks like all of the CS:HRTR textures can now be extracted!

cheers and thanks a ton, really appreciate the help you guys ❤️ 

Edited by notameowcelot
Link to comment
Share on other sites

...found an odd .tga that just won't extract, actually! Can't zip it due to my max total size being at 80kb for some reason, but let me know if there's a way to send it through mega perhaps

On 4/22/2024 at 6:10 PM, notameowcelot said:

did some testing, looks like this works fine! with the exception of the random ~a in some textures, looks like all of the CS:HRTR textures can now be extracted!

cheers and thanks a ton, really appreciate the help you guys ❤️ 

 

Link to comment
Share on other sites

Posted (edited)
16 hours ago, h3x3r said:

Tell me a path and name of a file. I have game files.

Should be PF_Gangster.bin (found in airplanes.zip if you're using retail or August 2003 prototype builds), GangsterPF.tga.

Edited by notameowcelot
Link to comment
Share on other sites

Well i checked it but don't know what's goin on. Texture format is DXT1 but noesis strugle to open it. Not sure why. There's no error at all.

When i tried it in Raw Texture Cooker it show it properly.

Link to comment
Share on other sites

Posted (edited)
On 4/24/2024 at 4:11 AM, notameowcelot said:

cheers and thanks a ton, really appreciate the help you guys

@notameowcelot Barring some smaller loose ends, would you consider this topic solved via h3x3r's original post (or the April 21st one)? "..." / "Mark as solution" Cheers.

Edited by piken
Link to comment
Share on other sites

13 hours ago, piken said:

@notameowcelot Barring some smaller loose ends, would you consider this topic solved via h3x3r's original post (or the April 21st one)? "..." / "Mark as solution" Cheers.

Aye, will consider it solved! Just gotta figure out the ~a and this weird issue with PF_Gangster but that should be it.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...