emoose / MBINCompiler

Now maintained by monkeyman192: https://github.com/monkeyman192/MBINCompiler
Other
43 stars 69 forks source link

Discrepancies between NMS_REALITY_GCTECHNOLOGYTABLE.MBIN original and recompiled #69

Open locastan opened 8 years ago

locastan commented 8 years ago

https://i.gyazo.com/9c7280ff760078671c80a5e564f081c5.png

Several changes are present between the original game file and a recompiled unchanged MBIN after its been put through MBINCompiler. The one at/near Jetpack data prominently results in ingame loss of Jetpack Descriptions. I don't know what else might be affected.

This is FYI as you probably will find this upon re-eval of all templates currently going on.

emoose commented 8 years ago

I've known of a few cases where MBINCompiler would compile files differently (such as missing padding between generic list entries), but I didn't think those would cause an issue since there's usually a way for the game to find the actual offset without needing to align for it (eg by using the offset field in generic list name entries), and when I was testing those recompiled files ingame they seemed to work fine.

I guess there might be more problems than that though based on the crash described in #73, I'll have to go over it later, it could possibly just be an issue with the template structures not matching the exe exactly, but I got a feeling it's related to this issue of MBINCompiler not compiling it exactly the same.

locastan commented 8 years ago

PM'd you another example over discord with the INVENTORY.MBIN. That one has whole sections put in different order than original. o.O

In the comparison I linked in my OP, the yellow highlight has some interesting changes too. B9 -> B8 and the EF -> F0 changes happen often throughout the file. Could it be some kind of messed up manual XML indent like HG using a mix of tabs and spaces to indent their xml code? (Just thinking...)

monkeyman192 commented 8 years ago

I have the same problem with the REWARDTABLE.mbin file. hex_diff (This is a side by side comparison of the files, left is original, right is recompiled) I also have a problem with the language mbins (maybe not all of them, but both english ones at least). When they recompile they are smaller than before, and a lot of the text in the game no longer works properly.

Further information: When using this recompiled mbin instead of the old one, any time you attempt to interact with something that would give you a reward (even things like observatories that would find you a ruin) the game tells you that the inventory is full (even when it isn't or you aren't actually receiving anything.) I have attached the recompiled mbin. REWARDTABLE.zip

emoose commented 8 years ago

In the comparison I linked in my OP, the yellow highlight has some interesting changes too. B9 -> B8 and the EF -> F0 changes happen often throughout the file. Could it be some kind of messed up manual XML indent like HG using a mix of tabs and spaces to indent their xml code? (Just thinking...)

Hmm, that sounds to me like offsets to templates might be messing up, could be because we aren't padding between templates, or maybe we haven't got the template structure mapped properly and it's missing a byte..

Scratch that, should have looked at the pic you linked more closely first :laughing:

That's pretty weird, I'm guessing it's a float being serialized differently to the original (like the problem we have with the half-floats inside TkGeometryData), but I'm not certain about that, I'll have to look into it properly later.

I also have a problem with the language mbins (maybe not all of them, but both english ones at least). When they recompile they are smaller than before, and a lot of the text in the game no longer works properly.

Strange, in the unit tests we actually decompile and recompile each MBIN and test its contents against the original, but for the language files they're disabled in the tests as they take a long time to process, but when I last tried them they seemed to recompile fine.

I guess the game must read it differently to MBINC though, working on getting those language files to compile exactly like the originals would probably be the easiest since it's a fairly simple template, the fixes from doing that might fix the other MBINs having problems too.

jvarnes commented 8 years ago

Unsurprisingly NMS_REALITY_GCSUBSTANCETABLE.MBIN also exhibits this behavior. Modifying and recompiling causes text errors in some of the substances (most notably Heridium at least on my saves). Seems like this is a wide reaching bug atm :(

Hope it can be sorted out.

emoose commented 8 years ago

Latest commits should fix some issues with strings being written, and should make the recompiled MBINs a lot closer to the originals too, I tested with NMS_REALITY_GCTECHNOLOGYTABLE.MBIN and it seems to almost 100% match the original - the only differences being in float values being encoded a bit differently, which hopefully shouldn't matter much (if it does though please let me know!)

Can you try testing with the latest commit and see if the problems still appear for you?

monkeyman192 commented 8 years ago

I am still having problems with the REWARDTABLE mbin. Doing a simple re-decompile still gives me the 'inventory full' message whenever I interact with something :/

emoose commented 8 years ago

@monkeyman192 I might have identified the issue, small bug with NMSTemplate fields not serializing template names properly, can you try again with the latest commit?

monkeyman192 commented 8 years ago

Thank you very much! The latest version fixes the problem!

locastan commented 8 years ago

The latest commit is included in the compiled eye from the repo? If yes, then for inventory.mbin it made things worse in terms of shuffling the entire structure around.

locastan commented 8 years ago

eye » exe. *phone.

emoose commented 8 years ago

The latest commit is included in the compiled eye from the repo? If yes, then for inventory.mbin it made things worse in terms of shuffling the entire structure around.

Does it work ingame though? The structure won't be exact for most files, since we still aren't padding stuff exactly the same way the games compiler does, but for those differences they shouldn't really make a difference as the game doesn't rely on that padding.

If it's still having issues with the latest commit the only real thing I can think of is that the structures might be slightly wrong.

Spar10Tech commented 8 years ago

I just decompiled and recompiled the updated NMS_REALITY_GCTECHNOLOGYTABLE.MBIN with the MBINCompiler.exe 1.0.146 build from appveyor.com and it appears to NOT have the missing descriptions problem. I then added some of my multi-tool changes and it still looks good. I'll have to make a save with all the tech installed and verify.

locastan commented 8 years ago

That sounds good then. I didn't have the time to test beyond a quick hex compare. If it doesn't matter in what order the items are stored in the mbin then this is most likely resolved. :-)