You must be logged in to post messages.
Please login or register

Modding and Scripting
Moderated by Yeebaagooon, nottud

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: How to Change the Length of a Texture Name when Hex Editing Model Files
posted 15 August 2010 02:11 PM EDT (US)   
For those of you who use programmers notepad or another Hex editor to edit model files instead of using "ReplaceTexture", it can be annoying to have to keep the same number of characters in your new texture name as the original. This is especially annoying for files where "ReplaceTexture" does not work. I was messing around with some .prt files, and thankfully there is a way around this problem.

What you will need:
1). Programmers Notepad (or any other Hex editor)
2). This chart: http://www.asciitable.com/

For this tutorial, we will be editing the sfx a generic smoke small.prt file. I have only tested this method with single material .prt files, but it may work with .brg files as well.

1. Open sfx a generic smoke small.prt with Programmers notepad and use the Hex editor to view the name of the texture as you normally would. You should see the name is S.F.X. .E. .I.n.f.e.r.n.o. .C.l.o.u.d...t.g.a.

2. You now have to count the number of characters in the name (including the spaces and .tga, but not including the extra dot after each character). This is what you are counting:
"SFX E Inferno Cloud.tga"
and you should get 23.

3. With that number in mind, open up the ASCII table link.
Find "23" in the Dec column. Find the equivalent in the Hx column, which is 17. Forget 23, 17 is the actual number of characters according to the PRT file.

4. Go back to the file in Programmers Notepad. Position your cursor about 5 lines above the name of the texture. Search for "17". You should see the number 17 highlighted, followed by 00, and represented by a dot. It should a few characters before the texture name. This is the area that defines the number of characters in the texture file name.

5. We want to name the new texture "MySFX E Inferno Cloud.tga" so we want to add 2 characters, bringing the nubmer to 25. After looking at that chart, the number used to represent 25 in the Hex is 19. Change the 17 to 19.

6. In order to add more characters, we will have to paste the new name over the old, extra dots and all. Paste "M.Y.S.F.X. .E. .I.n.f.e.r.n.o. .C.l.o.u.d" over "S.F.X. .E. .I.n.f.e.r.n.o. .C.l.o.u.d".

7. There is one last thing to do. You will notice that the periods you pasted are represented as "2E" in the Hex rather than "00". This needs to be fixed. Replace all "2E" with "00", remembering only to replace those in the area that you pasted, NOT the entire file.

So basically, this is what you did:
Count the number of characters in the texture name, convert that number from Dec to Hx, search for that number in your model file, replace it with the equivalent Hx code representing the desired number of characters, paste your new texture name over the old one, and make sure all pasted periods are represented as "00".

And there you have it! It seems complicated at first, but it's easy once you get the hang of it. Just keep in mind that Hex codes can sometimes have letters instead of numbers, so make sure to reference the ASCII table.

Happy Modding!

Check out all of the mods I made here
Replies:
posted 16 August 2010 05:06 AM EDT (US)     1 / 2  
nice but i already made a tutorial, with pictures. so

http://aom.heavengames.com/cgi-bin/forums/display.cgi?action=ct&f=19,27310,,20

>> www.EmjeR.com <<

Mods - EmjeR's eyecandy pack :: Improved Greeks look :: Ghengis Khan - Mods
Programs - BCTool Attachpoint Editor :: BCTool :: Words - Programs
Games - 0 AD :: Stronhold 2 :: BfME 2 - Games
!! Proud member of WildFire Games !!
posted 16 August 2010 01:06 PM EDT (US)     2 / 2  
Oh haha well yours is definitely better than this one! I'm glad it works with BRG files too.

Check out all of the mods I made here
Age of Mythology Heaven » Forums » Modding and Scripting » How to Change the Length of a Texture Name when Hex Editing Model Files
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Mythology Heaven | HeavenGames