NoMansSky:Creating Mods From MBINs

From Step Mods | Change The Game
Nomanssky flare.png

Hex Editing MBINs

The purpose of Hex Editing

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 and particularly 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

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 FROM A VERY CLOSE 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. Save the .MBIN 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 (ideally), or close to the game version used for the modded files. If AMUMSS can search and find the MBINCompiler version used for a mod, and thus hint on the used game version, you still have to find the original files for this version. 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 files. There's some chance though that the file structure hasn't change so much, so you can always 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 values have moved in the new file 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

There's quite a lot of hexadecimal tools around.
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 File Format

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.

You can see here for or a litlle more details on the original header of MBINfiles and the MBINCompiler custom ones.

You usually will never touch the header though because all you want to edit are the data included in the rest of the file.
Data themselves are arranged in a different way for almost each .MBIN file so this can't be detailed here but this won't be an issue as most of the time, we don't need the structure to make the needed changes, only the offsets and values we need to change to reproduce a mod in the latest .MBIN file.