READ THE RULES: Click here

Follow us on Facebook: https://www.facebook.com/xentax/ :)

Star Wars: First Assault (XBOX360) .SW

Get your graphics formats figures out here! Got details for others? Post here!
Post Reply
User avatar
gwlogan
beginner
Posts: 21
Joined: Mon May 12, 2008 9:23 am
Location: Earth, well most of the time...
Has thanked: 3 times
Been thanked: 4 times

Star Wars: First Assault (XBOX360) .SW

Post by gwlogan » Mon Aug 19, 2019 11:49 am

Hello all,
I've extracted all the .sw textures from Star Wars: First Assault but I'm only able to successfully convert some of the textures, mainly the larger ones (1024x1024 and 2048x2048). It crashes when trying to read most of the smaller textures (512x512 and 256x256) and also fails to de-swizzle a lot of them. I was hoping someone could modify or fix the script to successfully read all of the textures. I don't know how to script with python or I would do it myself. I'm missing a lot of the needed textures for the higher poly game models since the script won't properly convert them. Any help would be appreciated, thanks!

Code: Select all

from inc_noesis import *

def registerNoesisTypes():
	handle = noesis.register("Xbox swizzled texture", ".sw")
	noesis.setHandlerTypeCheck(handle, noeCheckGeneric)
	noesis.setHandlerLoadRGBA(handle, MUA2LoadRGBA)
	#noesis.logPopup()
	return 1

def MUA2LoadRGBA(data, texList):
    datasize = len(data)
    bs = NoeBitStream(data)
    #bs.seek(0x1000, NOESEEK_ABS)
    data = bs.readBytes(datasize)

    if datasize == 4194304:
        imgWidth = 2048
        imgHeight = 2048
        texFmt = noesis.NOESISTEX_DXT5
        data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
    elif datasize == 2097152:
        imgWidth = 2048
        imgHeight = 2048
        texFmt = noesis.NOESISTEX_DXT1
        data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 8)
    elif datasize == 1048576:
        imgWidth = 1024
        imgHeight = 1024
        texFmt = noesis.NOESISTEX_DXT5
        data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
    elif datasize == 524288:
        imgWidth = 1024
        imgHeight = 1024
        texFmt = noesis.NOESISTEX_DXT1
        data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 8)
    elif datasize == 262144:
        imgWidth = 512
        imgHeight = 512
        texFmt = noesis.NOESISTEX_DXT5
        data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
    elif datasize == 131072:
        imgWidth = 512
        imgHeight = 512
        texFmt = noesis.NOESISTEX_DXT1
        data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 8)
    else:
        imgWidth = 256    # 45k
        imgHeight = 256
        texFmt = noesis.NOESISTEX_DXT1
        data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 8)
    #normal
    #imgHeight = 512
    #imgWidth = 512
    #data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
    #data = rapi.imageDecodeDXT(data, imgWidth, imgHeight, noesis.FOURCC_ATI2)
    #texFmt = noesis.NOESISTEX_RGBA32
    texList.append(NoeTexture(rapi.getInputName(), imgWidth, imgHeight, data, texFmt))
    return 1
I can provide the entire collection of textures if needed but here are just some of the textures I'm struggling with:
Texture samples: http://www.mediafire.com/file/ph6w6t34s ... s.zip/file

User avatar
Acewell
VIP member
VIP member
Posts: 1263
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2392 times
Been thanked: 730 times

Re: Star Wars: First Assault (XBOX360) .SW

Post by Acewell » Sat Aug 24, 2019 2:57 am

your samples are headerless, you must guess width, height and format
and set that in your script accordingly, or find a better way to extract the
textures along with their header info so no need to guess. :D

Post Reply