Adding extra space to MSH files

Started by Giftheck, August 27, 2014, 03:01:13 PM

Previous topic - Next topic
So, you want to hex-edit an addon to your model. Say you have the "any_cape" model from Sereja's Nar Shaddaa assets and you want to hex-edit it onto the stock Anakin model. You've done the necesary. BUT! When you've gone to amend the PRNT part to point to where you want the mesh to be attached to, you've found that the name of the part won't fit because at current, it reads "null1" with three empty spaces after it! That won't fit the value "bone_pelvis", now, will it?

Fear not! There is a way round this! You will need XVI32 and its Data Inspector tool. This tutorial assumes you have already hex-edited the mesh to the model you want to.

First, inside the mesh part you want to edit, find the part that reads MODL. This is followed by a four-byte long integer value. Place the cursor on the byte directly after MODL and take note of the longint value. In this case, the value is 8744.

Find the line starting with PRNT. This is followed by a four-byte long integer value, followed by the name of the mesh/bone this mesh is attached to. Again, take note of this value. In this case, this is 8.

Now, move to the byte before TRAN. Make sure XVI32 is set to Insert mode at this point and add an additional six bytes in the hex window.

Now, you have to encode long integer values where you had previously taken note. Place XVI32 back into Overwrite mode. Resize the MODL chunk first as follows: MODL longint+additional bytes (in this case that would be 8744+6 = 8750). Now do the same with the PRNT longint (8+6 = 14).

You will also need to resize your HEDR and MSH2 values, though this is straighforward if you have previously modified them with new longint values to account for the new hex-edited meshes. As above, you're just adding the number of new bytes to each longint value.

Et voila! Resized mesh values will now allow you to place the addon mesh where you want it!

I haven't tried but I'm assuming this can also be done with other sections of the MSH file: for instance if you needed to rename collision for objects ported from SWBFII.
In Progress:
--Phantom Menace Celebration Maps
--SWBFEA Demakes

Completed:
--Star Wars: Battlefront - Anniversary Edition (formerly Star Wars: Battlefront - Legacy)

On Hold:
--Star Wars Battlefront: Elite Squadron For SWBF1

Could this be hypothetically done to add spaces to .lvl files ? Like to add files to be loaded by levels.
Also, check out my total conversion for BF1: Ferocious Battlefront
http://www.moddb.com/mods/ferocious-battlefront

RELEASE INCOMING

Quote from: 1ИC06И170 on July 26, 2018, 09:07:00 AM
Could this be hypothetically done to add spaces to .lvl files ? Like to add files to be loaded by levels.
You're on the right track, it is the same idea.

However even with my brief understanding of the format I've read from Riley pages,
its pretty intense to think that that could be easier than compiling from source.

I like the idea of trying this out just for the sake of learning things.
However I have no time to do such things, so you will need these:
http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=354
http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=455

Quote from: 1ИC06И170 on July 26, 2018, 09:07:00 AM
Could this be hypothetically done to add spaces to .lvl files ? Like to add files to be loaded by levels.
swbf-unmunge has a special mode for editing munged files and reassembling them back up.https://github.com/SleepKiller/swbf-unmunge/wiki/Explode-and-Assemble

So theoretically again, a script could be made to automatically add a readfile line to make a modmap's Lua file compatible with new files right ?
Also, check out my total conversion for BF1: Ferocious Battlefront
http://www.moddb.com/mods/ferocious-battlefront

RELEASE INCOMING

Unless you fancy editing Lua bytecode you'll have to outright replace the script, but yes should be doable. Though it may just be easier to completely recreate the mission.lvl from scratch.

Yeah, precisely what I thought... Means that I gotta start working back on my original project...
Also, check out my total conversion for BF1: Ferocious Battlefront
http://www.moddb.com/mods/ferocious-battlefront

RELEASE INCOMING