Scout Trooper with Jetpack?

Started by Shazam, March 11, 2013, 11:39:28 AM

Previous topic - Next topic
Speaking of hexing a one of those on, how might you do that?
I noticed that when I tried to change TGA names, it crashed because I didn't keep the file length the same...
Is there a byte in the file somewhere that tells it what size it's suppost to be?
It would be cool to have ability to 'sow' things on to troopers :P

I think there are hex-editing tutorials on site. (I hope, because I'm awful at explaining things.)

But yes, there is a byte (4 of them) that has the size for the name lengths.

...

Every tag (TX0D, DATA, ATRB, ect..) has 4 bytes after it, it is a number encoded as a long integer (sometimes refered to as longint or just long) and is the size of the whole tag starting with the first byte after the size field.

For the TX0D field (as well as most the other string fields) the string has to be padded with nulls (at least one) so that it's length is equal to a multiple of 4. Nulls are simply zero values and will look like double zeros because of the way hex editors display things. (00)

So, for "A.tga" (5 bytes long) you need to add 3 nulls.   
A.tga (00)(00)(00)
And it's size will be 8.

Now for fun.

If you change the length of a TX0D string, you have to change it's size, makes sense, right?

Well, you also have to change the size of the container that holds the TX0D (MATD), and the container that holds MATD (MATL), and the container that holds MATL (MSH2), and the container that holds MSH2 (HEDR).

The container tags don't hold data in the same way as the other tags, they just hold other tags.  They just have the 4 letter tag and a size field. The size is the byte-lenghth of all the tags it contains. (except MATL, it's a container, and holds all the MATD tags, but also has the number of MATD's stored as a longint after it's size field.)

If you miss any one of them, the data wont line up and the msh is broken.

I have a msh assembly kit floating around somewhere with a size validation tool that will read and correct all the size fields in a msh.  I don't know where that kit landed on site.. I'll dig up the link and post it here.

I recommend using it if you plan on doing any kind of hex-editing as it automated the process of updating all the size fields at one time. It reduced the possibility for error (And saves a ton of time for those times where 1 edit  leads to 5 or more size field updates.)

The rest of the kit is a pain to use. (found it) Here is that kit: pre-alpha_msh_kit.zip

The program you want out of it is "TagSizeValidator.exe", just drop a msh file on it and it will save a copy of the msh with the sizes corrected. (It saves the copy as tst_inf_tst.msh cause I was mainly working on units at the time. It can be safely renamed.)... 

Hex-editing is basicly hacking. Taking what you want from here and putting it there, but you need to understand how a lot of the data you are moving works. The size fields are a big part of it, but there are tons of ways to fix or break a msh (or any file) my manipulating the data directly.  In the beginning, it's more art than science.

Hmm, very handy tool indeed!
I think it's funny that the files are so hard to 'hack', they (preverbial they) must have really not wanted us to modify that sort of thing without getting kicked in the hindquarters first :P

March 12, 2013, 12:03:32 PM #18 Last Edit: March 12, 2013, 12:08:02 PM by tirpider
I don't think Pandemic was really trying to protect thier property with the msh format. It's just an intermediate format between the modeler and the munger. Every (software) company developes their own way of storing data and Pandemic had already put a lot of effort into molding the msh format with previous titles.

After hunting around the web, and diggging through other file formats, I find it to be rather nice as it has a regular structure throughout and places for a lot of 3d feattures that othe file formats ignore. (that one reason it's so hard to do msh conversions.)

-edit
I wish I was a better programmer, I really enjoy working with the format.

Yes, old topic, I know...
But if someone could get me just the pauldron MSH file, I can put it on the scout trooper in XSI this after noon (I can do it whenever really), I recently figured out how edit jetpacks and packs on and export as a single MSH.
It shouldn't be much different to get pauldron on, expect for putting it on both bones.

Quote from: -RepublicCommando- on April 18, 2013, 12:47:52 PM
But if someone could get me just the pauldron MSH file

Seems, I can do that :):
http://speedy.sh/66Y5n/imp-pauldron.rar
Beauty is, the way to perfection.

Glory to Ukraine!  :mf:

April 18, 2013, 02:24:34 PM #21 Last Edit: May 26, 2013, 02:08:22 PM by -RepublicCommando-
Thanks Sereja! That was speedy :D
I'll get right to work on em.

EDIT: Its done! : http://www.swbfgamers.com/index.php?topic=6340.0