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

How to edit .TEX files from 50 Cent Bulletproof PS2

Get your graphics formats figures out here! Got details for others? Post here!
Post Reply
TjVatio
n00b
Posts: 10
Joined: Wed Dec 13, 2017 5:50 am
Has thanked: 7 times

How to edit .TEX files from 50 Cent Bulletproof PS2

Post by TjVatio »

So, basically i want to convert this format to any image to modify and re convert to .TEX

tried some tools around the web and only texture finder give me some result.

TextureFinder preview.
Image

TEX file samples
http://www.mediafire.com/file/cb86158u7 ... GAL_EN.TEX
http://www.mediafire.com/file/nro1nafpt ... GRBRDR.TEX
http://www.mediafire.com/file/q6lbrgofajblh4f/FAIL.TEX

Thankies!! :] :]
The life without music and games is a truly mistake.
Acewell
VIP member
VIP member
Posts: 1330
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2710 times
Been thanked: 884 times

Re: How to edit .TEX files from 50 Cent Bulletproof PS2

Post by Acewell »

LEGAL_EN.png
all 3 samples use the same settings
i've never done a Noesis python script for ps2 images but i may give it a try later. :D
You do not have the required permissions to view the files attached to this post.
TjVatio
n00b
Posts: 10
Joined: Wed Dec 13, 2017 5:50 am
Has thanked: 7 times

Re: How to edit .TEX files from 50 Cent Bulletproof PS2

Post by TjVatio »

AceWell wrote:
LEGAL_EN.png
all 3 samples use the same settings
i've never done a Noesis python script for ps2 images but i may give it a try later. :D
OMG!!! thank you so much, that program works like a charm :D, actually ive downloaded noesis and loaded some scripts from forum but none of them working in this .TEX, maybe was only for a specific game that already posted :P

edit: i got lost to convert back my edited image to .TEX, i have to use the same program?

once again thank you for helping me!!!
Last edited by TjVatio on Sun Jan 21, 2018 3:02 am, edited 1 time in total.
The life without music and games is a truly mistake.
Acewell
VIP member
VIP member
Posts: 1330
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2710 times
Been thanked: 884 times

Re: How to edit .TEX files from 50 Cent Bulletproof PS2

Post by Acewell »

TjVatio wrote:so, i got lost to convert back my edited image to .TEX, i have to use the same program?
no, you have to break it back down to paletted data and retwiddle to rebuild it, i can't help with this.
i tried making a Noesis python script to open the TEX files but i can't get the result like the one in "Console Texture Explorer". :(
episoder
mega-veteran
mega-veteran
Posts: 162
Joined: Fri Oct 16, 2015 8:05 pm
Has thanked: 6 times
Been thanked: 78 times

Re: How to edit .TEX files from 50 Cent Bulletproof PS2

Post by episoder »

AceWell wrote:
TjVatio wrote:so, i got lost to convert back my edited image to .TEX, i have to use the same program?
no, you have to break it back down to paletted data and retwiddle to rebuild it, i can't help with this.
i tried making a Noesis python script to open the TEX files but i can't get the result like the one in "Console Texture Explorer". :(
i don't like sad pals. you forgot something. ;) i borrowed some code from there and unshuffled this bitch, ps2 style. :] you gotta do the pointer dance. :D

Code: Select all

from inc_noesis import *
import noesis
import rapi

def registerNoesisTypes():
	handle = noesis.register("50cent Bulletproof TEX Textures", ".tex")
	noesis.setHandlerTypeCheck(handle, TEXCheckType)
	noesis.setHandlerLoadRGBA(handle, TEXLoadRGBA)
	#noesis.logPopup()
	return 1

def TEXCheckType(data):
	return 1

def TEXLoadRGBA(data, texList):
	bs = NoeBitStream(data)
	filename = bs.read("32B")
	hash = bs.readInt()
	width = bs.readUShort()
	height = bs.readUShort()
	#dummy1 = bs.readUByte()
	size_bmapdata = width * height #bs.readUInt()
	#print(str(size_bmapdata))
	#dummy2 = bs.readUByte()
	#ofs_palette = bs.readUInt()
	bs.seek(0x40, NOESEEK_ABS)
	texData = bs.readBytes(size_bmapdata)
	#bs.seek(ofs_palette + 0x40, NOESEEK_ABS)
	palData = []
	for x in range(8):
		for p in range(32):
			read = bs.readUByte()
			palData.append(read)
		bs.seek(32, NOESEEK_REL)
		for p in range(32):
			read = bs.readUByte()
			palData.append(read)
		bs.seek(-64, NOESEEK_REL)
		for p in range(32):
			read = bs.readUByte()
			palData.append(read)
		bs.seek(32, NOESEEK_REL)
		for p in range(32):
			read = bs.readUByte()
			palData.append(read)

	palData = bytearray(palData)
	pic = rapi.imageUntwiddlePS2(texData, width, height, 8)
	pic = rapi.imageDecodeRawPal(pic, palData, width, height, 8, "r8g8b8a8")
	texList.append(NoeTexture(str(filename), width, height, pic, noesis.NOESISTEX_RGBA32))

	return 1
butchered and commented out are data pointer safeguards. assuming the layout is always aligning the image followed by the pallette without padding.

reversing is not possible like that. you'd need to explicit export a indexed bitmap with a palette. tga does that. and you gotta reshuffle the palette the same way. the twiddlePS2 should work as it is tho.
Acewell
VIP member
VIP member
Posts: 1330
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2710 times
Been thanked: 884 times

Re: How to edit .TEX files from 50 Cent Bulletproof PS2

Post by Acewell »

episoder wrote: and unshuffled this bitch, ps2 style. :] you gotta do the pointer dance.
ah yes that works great! thanks :D
it seems i didn't do that palette unshuffle thing and was getting some pixelated areas,
is that a standard procedure in parsing PS2 textures? :)
episoder
mega-veteran
mega-veteran
Posts: 162
Joined: Fri Oct 16, 2015 8:05 pm
Has thanked: 6 times
Been thanked: 78 times

Re: How to edit .TEX files from 50 Cent Bulletproof PS2

Post by episoder »

AceWell wrote:
episoder wrote: and unshuffled this bitch, ps2 style. :] you gotta do the pointer dance.
ah yes that works great! thanks :D
it seems i didn't do that palette unshuffle thing and was getting some pixelated areas,
is that a standard procedure in parsing PS2 textures? :)
i assume yes. and it's only on 8-bit textures. the texture finder seems to always do it. those i scripted, needed it. gits, resident evil dead aim, onimusha3. all of them shuffled. i could check dmc too, but this got more block size fuckery in some of it's files. later maybe. :)
TjVatio
n00b
Posts: 10
Joined: Wed Dec 13, 2017 5:50 am
Has thanked: 7 times

Re: How to edit .TEX files from 50 Cent Bulletproof PS2

Post by TjVatio »

episoder wrote:
AceWell wrote:
episoder wrote: and unshuffled this bitch, ps2 style. :] you gotta do the pointer dance.
ah yes that works great! thanks :D
it seems i didn't do that palette unshuffle thing and was getting some pixelated areas,
is that a standard procedure in parsing PS2 textures? :)
i assume yes. and it's only on 8-bit textures. the texture finder seems to always do it. those i scripted, needed it. gits, resident evil dead aim, onimusha3. all of them shuffled. i could check dmc too, but this got more block size fuckery in some of it's files. later maybe. :)
Wow!!! you guys rock!!!! 8) 8) now noesis work fine loading this .TEX file
also when i export from preview and i choose tga or png, it save with transparency by default, there's a way to change this?

and with ConsoleTextureExplorer i followed your advices AceWell and the only way that program import the edited texture succesfully into the .TEX, is doing with .TM2 format image, this gives an almost none support, the only Proprietary software that let me save it in that format is one calling OPTPiX iMageStudio. :shame:

Edit: digging more, i found one program calls Rainbow that support saving .tm2 and does the trick :] the against on this. is too much work around to get this working, AceWell will you plain to do some changes in noesis to fully support this? saving maybe into tm2? or back to .TEX? im being too much greedy? :D :D

many many thanks @AceWell and @episoder!!!!!
The life without music and games is a truly mistake.
Post Reply