Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Star Wars Kinect (XBOX360) .TEX

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

Star Wars Kinect (XBOX360) .TEX

Post by gwlogan »

Hello,
I've been using a Noesis python script to extract the game's textures but I'm having an issue with the displayed image dimensions when viewing the .tex files. I've mostly been using the game's .tga texture files with no problems but I've noticed the .tex files seem to include some higher resolution textures and it would be nice to properly extract these! This might be due to the .tex files being containers rather than just textures but I don't really know for sure. Here is an example of what is displayed in Noesis when viewing the .tga and .tex files respectively:
Image
Here are the .tex file samples:
http://www.mediafire.com/file/4lqbkmr3g ... s.zip/file
Noesis python script:

Code: Select all

from inc_noesis import *

def registerNoesisTypes():
	handle = noesis.register("Star Wars Kinect TEX", ".tex")
	noesis.setHandlerTypeCheck(handle, StarWarsKinectCheckType)
	noesis.setHandlerLoadRGBA(handle, StarWarsKinectLoadRGBA)
	return 1

def StarWarsKinectCheckType(data):
	bs = NoeBitStream(data)
	Magic = bs.readInt()
	if Magic != 8:
		return 0
	return 1   

def StarWarsKinectLoadRGBA(data, texList):
	datasize = len(data) - 0x34
	bs = NoeBitStream(data)
	bs.seek(0x18, NOESEEK_ABS)
	imgFmt = bs.readInt()
	imgWidth = bs.readInt() // 2
	imgHeight = bs.readInt() // 2
	if imgHeight == 2:
		imgHeight = 4
	data01 = bs.readInt()
	data02 = bs.readInt()
	bs.seek(0x34, NOESEEK_ABS)
	data = bs.readBytes(datasize)
	#DXT1
	if imgFmt == 0x28:
		data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 8)
		texFmt = noesis.NOESISTEX_DXT1
	#DXT5
	elif imgFmt == 0x33:
		data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
		texFmt = noesis.NOESISTEX_DXT5
	#DXT5 packed normal map
	elif imgFmt == 0x1C:
		data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
		data = rapi.imageDecodeDXT(data, imgWidth, imgHeight, noesis.FOURCC_ATI2)
		texFmt = noesis.NOESISTEX_RGBA32
	#DXT5 packed normal map2
	elif imgFmt == 0x36:
		data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 16)
		data = rapi.imageDecodeDXT(data, imgWidth, imgHeight, noesis.FOURCC_ATI1)
		texFmt = noesis.NOESISTEX_RGBA32
	#DXT1 packed normal map
	elif imgFmt == 0x16:
		data = rapi.imageUntile360DXT(rapi.swapEndianArray(data, 2), imgWidth, imgHeight, 8)
		data = rapi.imageDecodeDXT(data, imgWidth, imgHeight, noesis.FOURCC_DXT1NORMAL)
		texFmt = noesis.NOESISTEX_RGBA32
	#raw
	elif imgFmt == 0x1B:
		data = rapi.imageUntile360Raw(rapi.swapEndianArray(data, 4), imgWidth, imgHeight, 4)
		texFmt = noesis.NOESISTEX_RGBA32
	#unknown, not handled
	else:
		print("WARNING: Unhandled image format " + repr(imgFmt) + " - " + repr(imgWidth) + "x" + repr(imgHeight) + " - " + repr(len(data)))
		return None
	texList.append(NoeTexture(rapi.getInputName(), imgWidth, imgHeight, data, texFmt))
	return 1
Acewell
VIP member
VIP member
Posts: 1330
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2710 times
Been thanked: 884 times

Re: Star Wars Kinect (XBOX360) .TEX

Post by Acewell »

try this :D
tex_SWKinect_X360_tga_tex.zip
You do not have the required permissions to view the files attached to this post.
User avatar
gwlogan
beginner
Posts: 26
Joined: Mon May 12, 2008 9:23 am
Location: Earth, well most of the time...
Has thanked: 11 times
Been thanked: 5 times

Re: Star Wars Kinect (XBOX360) .TEX

Post by gwlogan »

Thank you Acewell, your script works great!
Post Reply