It's cool if you feel the need to release another tutorial on hex editing MODL chunks, but I don't see a need to release it as a download when you could just paste it into your reply. Download links tend to break and using proprietary text formats like docx makes it difficult for some to see what it is, although you can upload it to
Google Docs and view it there.
Similar tutorials linked from the FAQ:
MshEdit by biohazard supposedly does this stuff without the need for hex editing.
SWBF_MSH_INFO by tirpider can open a msh and export out a MODL chunk without you having to touch a hex editor.
I think more often than not, folks get confused about the use of terms like 'longint' and 'encoding' in existing tutorials, this makes things sound more complex than it actually is. You can use any hex editor to insert MODL chunks, when you change a chunk header length you're just adding bytes to keep from corrupting the msh file. You have an existing msh with a certain number of bytes and you have a MODL chunk with a certain number of bytes, you insert the MODL chunk bytes then modify any chunk headers affected by the additional bytes, it's simple.
Msh chunk headers are always 8 bytes consisting of the name(4 bytes) and length(4 bytes) in the SWBF msh format, but length values are read right to left. The headers work like this, for example cor1_bldg_garden.msh:
48 45 44 52
28 3B 00 00 4D 53 48 32
18 3B 00 00 = HEDR
(;..MSH2
.;..
HEDR
(;..
(;.. =
28 3B 00 00
read as:
3B 28 (not 28 3B)
3B28 in decimal is 15144, therefore 15144 bytes
If you start at the 'M' of the MSH2 header and goto 3B28 in the file it would take you to the end of the file which is the length HEDR covers.
Total file size is 3B30, in decimal it is 15152, therefore 15152 bytes
15152 - 15144 = 8
8 is the remainder that represents
HEDR(;.. which occupies the first 8 bytes of the file.
The same is true for MSH2:
MSH2
.;..
.;.. =
18 3B 00 00
read as:
3B 18 (not 18 3B)
3B18 in decimal is 15128, therefore 15128 bytes
If you start at the 'S' at SINF and goto 3B18, it will take you to the byte before the 'C' at CL1L.... at the end of the file, that is the length MSH2 covers.
total size minus MSH2 size equals 24 bytes which is the exact size of HEDR and MSH2 occupying the first 16 bytes of the file and CL1L occupying the last 8 bytes of the file.
15152 - 15128 = 24
Any hex editor in combination with Windows calculator set to Scientific can get this done easily.