[tool]SWBF_MSH_INFO v0.05 alpha

Started by tirpider, January 18, 2012, 11:41:43 PM

Previous topic - Next topic
January 18, 2012, 11:41:43 PM Last Edit: June 10, 2012, 01:25:01 PM by tirpider
SWBF_MSH_INFO
v0.05 alpha

This will eventually become a tool for tweaking and modifying MSH files outside of a model editor.

Currently it is simply a viewer of raw data with no editing capabilities.
If you want to 'see' how the tags fit together in a msh, this will do it.

The plan is to make it into a full-on, MSH file tweak and edit tool. With advanced chunk swapping, attribute managment and vertex/polygon manipulation features.

It doesn't do any of that right now.
Currently, it displays raw and translated information contained in a MSH.
Once this program can display the information correctly, I'll start making things editable. (very alpha right now.)

I have been on this for several months and it is now stable enough to get it into the hands of the curious.

FEATURES:

    -32 and 64 bit versions (I can't test 64 bit on my end)
    -Open SWBF1 and 2 MSH files
    -Tag and Tag Chunk export
    -Displays MSH Tag information in readable format (for known tags)
    -Displays MSH Tag information in hex format (for unknown tags)

KNOWN PROBLEMS:

    -The GUI is not displaying properly on Win7 64 bit. (this one may cause me to change languages)
    -It is written in AutoIT, so the initial loading of the file is a bit slow (several min for the AT-AT.)
    -Size validation is broken. Don't use it.
    -Fix Sizes is broken. Don't use it.
    -A lot of the descriptions are messy, missing and/or inaccurate. These will be fixed.

PLANNED FEATURES
in no particular order

    -Better display of tag data
    -Import Tag and Chunk files
    -Import/Export txt or xml of all data
    -Possibly save as Obj or other 3d formats (don't count on this one)
    -Validate Skeleton Names and Heirarchy
    -More Translated tags
    -Move Tags or Chunks, up or down the heirarchy
    -Tag specific controls for editing data
    -Overall Scalling of geometry
    -Insert/Delete Vertexes and associated normals, uv's, ect
    -Switch between HEX and translated data display
    -Display the bone heirarchy
    -Move MODLs around the bone heirarchy
    -Merge Geometries (for shadow volumes)
    -A help file and or proper documentation.
    -MSH Summery/Report (Poly counts, Textures used)
    -.option and basic ODF generation
    -Very Basic projection of Geometry (for visualizing vertex placement)
    -User Notes and calculator(s) for planning edits to achieve certain goals

WISHLIST FEATURES:
these will probably never happen.

    -Rendering a MSH
    -Convert MSH to XSI source
    -Munge / Un-Munge a MSH

For an idea of what this program is showing you, my MSH Notes are here: [info].msh structure notes
And Ande's MSH research here: Star Wars: Battlefront MSH File Information

DOWNLOAD HERE: SWBF_MSH_INFO_v0_05_alpha.zip

There are 2 versions in the archive. The 32 bit version is marked with 'x86' and the 64 bit version is marked 'x64'.
There may still be issues with the 64 bit version. If the issues can't be nailed out, I will port over to another language that doesn't have issues.

Any questions, suggestions, corrections, ideas, flames, or comments are welcome.  I'm not a programmer, but I will try.

This post can be found at the following forums:
www.swbfgamers.com
gametoast.com

History:[spoiler]
01/31/2012 v0.05 alpha
          -Moving forward on this release as I am seeing a dentist soon and that
           may interfere with the programs progress.

          -[new bug]something in the way I'm decoding FWGT is breaking the
           'validate tag size' function so I'm disabling it for now. Also
           disabling the 'save msh' till I am confident with the size issues.

          -Customizing the data display for each tag is getting annoying from my
           end. I'm switching to a generic [line number] [data] format till I
           get past the translation hurdles.

          -Started implementing tag definitions again. Got a bunch showing, and
           they look correct. (so far) Time to catch up on the known MSH tag
           translations.

          -Started working on a 'Move Tag UP/DOWN' feature. Initially it works,
           but hoses up the parent structure. I'll probably make it a
           'Move Chunk'feature and limit movements to valid positions. Maybe
           only allowing MODL chunks to be moved since that's all it would be
           good for anyway.

          -[resolved bug] - The loading slowdown is caused by resizing the arrays
           on every entry. So I just need to resize the arrays before my loops
           begin. (initial tests show a 1600% increase in tag conversion speed)
           'THE' fix so far is to split up how I save data during conversion
           into 3 functions, instead of one.

          -the upshot of the following 3 is that the determiniation of sizes for
           each tag are now correct, that chunk exporting is reliable, and the
           summery display of tags within a chunk no longer bleeds into the next
           chunk or to the end of the parent chunk.

          -[resolved bug] - It's truncating 4 bytes off of some tags during
           load. This one trumps everything. I was guessing at the chunk size,
           now I'm actualy measuring. Doesn't slow it down much. (+/- .001 sec)

          -[resolved bug] - CLTH's size in dummy.msh, was including SWCI (16 bytes)
           Corrected size. It was probaby caused by the last child error below.

          -[resolved bug] - The last child tag is not being calculated
           correctly for (a lot of tags). This affects is what summery info is
           displayed for it. And it IS affecting how chunks are saved. Just
           re-wrote the hole function to explicitly define end tags.

01/25/2012 v0.04 alpha
          -[note] - The difference in this version is subtle on the outside, but I
           promise you, a lot of code got moved around.

          -Some 3rd party MSHs have MTYP misspelled as MYTP. For now, I am
           silently correcting but not saving. It's only 3 or 4 models, so I
           think it was a typo on the modder's part and not a tool issue. In
           the future the program will offer to save if this change is made.

          -Adding some column labels.(this will continue until all tags have
           sensible labels)

          -re-organizing line labels.(this will continue until all tags have
           sensible labels)

          -[unresolved bug] - When opening a MSH while one is already loaded, the
           program 'remembers' the selected tag and selects the same tag # on
           the tree.
          -[unresolved bug] - Some of the tags have an extra blank line in the
           display. This doesn't affect saved files, but still needs to go away.

          -[fixed bug] - The order I was assigning variables in the MSH parser was
           causing incorrect offsets to be read in some fixed length, multiline
           Tags. (like BBOX, DATA)

          -The reason some tags take so long to convert is not the way I'm
           converting them, It's the way I'm juggling variables and arrays. The
           'fix' is to get everything passed as pointers instead of copying
           values in memory. A rewrite of the parser is happening, but won't be
           implemented until it is 100% working.

01/21/2012 v0.03 alpha
          -Cleaned up debug menu. Added array descriptions

          -increased the selected tag box height. It might be to big, but thats
           better than to small.

          -started organizing column descriptions (not yet complete)

01/20/2012 v0.02 alpha
          -Greyed out disabled menu options.

          -Disabled chunk export when a chunk is not selected.

          -Validate Tag Size now asks if you want to repair an invalid size
           field or not.

          -Fix_AllTagSizes removed. It was redundant.

          -still experimenting with different tag data displays

          -added 64-bit build

01/20/2012 v0.01 alpha - released as is.
[/spoiler]

January 19, 2012, 12:54:04 AM #1 Last Edit: January 19, 2012, 12:57:07 AM by Phobos Developer
Nice work Tirpider, I have not tested this new tool yet but it sounds promising.

I have archived all the threads and tools into a "Tirpider Mesh Tools Kit v1", which includes updated material from the original blackfoot repair kit. I hope you are okay with this, here is the link
http://www.mediafire.com/?iukcfs19u6cmz5r

Since these tools are still works in progress I will update the tools kit archive every month or so.

Thats groovy,  Phobos Developer.

This is very early in it's development, so it might go through rapid changes.
Every month or so sounds like a good update timeline.

It isn't quite usefull yet, but randomly posting screens at the bottom of the notes thread wasn't helping me track it's progress.

I don't know if anyone has thanked you for keeping track of and updating your Encyclopedia.
Thats no small task, and really helps, having all that info in one place.

yea v5 has been under construction for about a year, i have a larger project in mind with that.

Fresh version in first post.

I bump this because more tags are translated (confirming a lot of Ande's work.)
And it's loading a bit faster.
Still gets hung up on NDXL/XT but big models are no longer taking 15-20 min to load. 1 or 2 at the  most.

Other than that, not much new.

January 31, 2012, 03:27:57 PM #5 Last Edit: January 31, 2012, 03:53:12 PM by SleepKiller
Okay, let me get this straight if I were to HEX edit a TGA name to be longer. And then run it through this It would automatic fix the file size headers for me?

EDIT:
Also would the same apply for renaming a bone for instance?

Quote from: SleepKiller on January 31, 2012, 03:27:57 PM
Okay, let me get this straight if I were to HEX edit a TGA name to be longer. And then run it through this It would automatic fix the file size headers for me?

EDIT:
Also would the same apply for renaming a bone for instance?

Short answer:
(for both) Yes and no.

Ok, a bit more descriptive:
Once editing and saving is enabled.  yes.
There will be an option to manually fix the sizes or to have it do it automagicaly.

Until editing and saving is enabled.  no.
There are numerous bugs in the code. I'm not willing to open up the ability to completely hose a model just yet.

The Long answer:
In order to speed up load times, I read the size fields and use that to guess where the next tag is.

The good side is a speed up on load, the bad side is that if the size fields are incorrect on load, then that tag would be incorrectly read, and worse, there is a good chance the tags after the corrupt size field would never be found or loaded (and couldn't be saved).

What I'm going to do about it:
I'm re-writing the msh loading routines in a side file with the intent of porting to a more robust language. But the current development line is stuck with my AutoIT limitations.
Look for editing capabilities once the version number gets to 0.5. By then I'll have the display and loading bugs gone.
(seems far off, but it's just a planned jump)

I'm gonna revisit my old tools and see if I can make a size fixer, because going back through a msh to make several edits for the sake of one string change is just silly.
It may be slow to identify the tags at first, but the rest should run really quick.

Renaming a bone:
Same rules apply. If you change it's size, then you have to change its parent and it's parent's parent all the way back to HEDR.

Note: All the MODL tags are children of MSH2. The PRNT bone is technicaly the MODL's parent, but only in the bone heirarchy. The Bone heirarchy interacts with the msh in special ways, but is seperate from sizes.

Wow, for what I had in mind that does sound like a very complex job to do by hand. Thanks for explaining it.