NoMansSky:Creating Mods From MBINs

From Step Mods | Change The Game
Revision as of 08:54, August 15, 2020 by Lo2k (talk | contribs)

Template:TOC right

The purpose of Hex Editing[edit | edit source]

Hex Editing is the way to edit any computer file, whatever its format as long as it is not compressed. So once NMS files are unpacked, any of them can be edited with an hexadecimal editor. But do not expect to create mods this way, because files are structured and apart if you already studied the structure yourself (comparing .MBIN files with decompiled .EXML files for example), there's little chance you could know exactly what you have to change to create a mod.

So what's the point of hex editing ? The point is to be able to update some mods in the following cases :

  • A new big update has been released and you temporarily can't decompile .MBIN files anymore as MBINCompiler hasn't been updated yet.
  • You found a very old mod and have a strong will to update it for current game version

Updating mods by comparison[edit | edit source]

In both cases, in theory, the way to update a mod is simple :

  1. Proceed a binary comparison between the modded .MBIN files you want to update and an original .MBIN files IDEALLY FROM THE SAME GAME VERSION.
  2. Note all the changes. Usually you might note the position in the file (the offset) and the new value for each change.
  3. APPLY THE SAME CHANGES' to the .MBIN files of the latest NMS version.
  4. Recompile and repack the mod


That's for the theory. In practice, you probably noticed the two bold sentences above.
Indeed these could be some very difficult points:

  • Game version : To be able to compare apples with apples, you need to have an original .mBIN file of the same game version, or close to this game version, than the modded files. If you are modding NMS since a long time, you probably made backups of older game versions, but if you're new on the scene, there's few chances you could find these original gems. There's some chance though that the file structure hasn't change so much, so you can also attempt at comparing the modded .MBIN file with your latest original .MBIN one, but it's all about luck.
  • Applying changes : Even if the changes are simple, sometimes new values have been added into the files and a lot of values have shifted. Meaning you can't apply changes just based on offset/values but you need to recognize where your desired value has moved before applying the change.

So all in all, if you get a close enough original file that permit a clean comparison of files resulting in a very few changes, it will be trivial to update a mod. If the comparison results in hundreds of changes, added and removed parts, there's few luck you will be able to update this mod.

Hexadecimal Editors[edit | edit source]

To edit .MBIN binary files, you will need an hexadecimal editor and there's quite a lot of them.
Here is a list of some of them worth mentioning:

  • 010 (paid, with 30 day trial)
  • HxD (freeware, proprietary)
  • Hex Editor Neo (free, has paid versions)
  • Hex Workshop (paid)
  • HexEdit (mac only?)
  • XVI32 (freeware, very small (~1Mb) and portable)

For information, .MBIN Files are all using little indian byte order.
So before anything, it's better to set your Hexadecimal editor to read values in little indian order.

.MBIN Header[edit | edit source]

As most file formats, .MBIN files start with a header.
The .MBIN header is 96 (0x60) bytes and is composed as follow :

  • Magic Data which is 4 bytes long. It is 0xCCCCCCCC for MBIN files and is 0xDDDDDDDD for MBIN.PC files.
  • Format ID, a 4 bytes long integer
  • Time stamp, an 8 bytes long integer. If the file was compiled with MBINCompiler, stamp is replaced by the MBINCompiler Tag "MBINCver".
  • Template GUID, an 8 bytes long integer. If the file was compiled with MBINCompiler, this is replaced by the MBINCompiler version in the form of xx.yy.zz matching the MBINCOmpiler version used to compile the file.
  • Template Name, a 72 (0x48) bytes string reserved for the internal file name.

For a litlle more details on the original header of MBINfiles and MBINCompiler ones, see here.

The rest of the file contains the data. This can't be detailed here as each MBIN file has a different data structure but this won't be an issue as most of the time, we don't need the structure to make the needed changes.

Template:NMSPageClose