NoMansSky:Creating Mods From MBINs: Difference between revisions

From Step Mods | Change The Game
Line 21: Line 21:


== .MBIN Header ==
== .MBIN Header ==
All MBIN files start with a 24 (0x18) bytes header composed as follow :
As most of file format, .MBIN files start with a header.<br>
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.<br>
* Magic Data which is 4 bytes long. It is 0xCCCCCCCC for MBIN files and is 0xDDDDDDDD for MBIN.PC files.<br>
* Format ID, a 4 bytes long integer
* Format ID, a 4 bytes long integer
* Time stamp, an 8 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
* 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.
Then there's a 72 (0x48) bytes string reserved for the internal file name.<br>
* Template Name, a 72 (0x48) bytes string reserved for the internal file name.<br>
So in total the header of an MBINfile is 96 (0x60) bytes.<br>


For details on the header format of MBINfiles see [https://github.com/monkeyman192/MBINCompiler/wiki/MBIN-Header-Format-v0 here].<br>
For a litlle more details on the original header of MBINfiles and MBINCompiler ones, see [https://github.com/monkeyman192/MBINCompiler/wiki/MBIN-Format here].<br>
There are also associated pages which contain the header format for MBIN files produced by MBINCompiler as extra info is added to indicate the version of MBINCompiler used to compile the file.<br>


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.
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.

Revision as of 20:23, August 11, 2020

Template:TOC right

The purpose of Hex Editing[edit | edit source]

If the MBIN you want to edit is not yet supported by MBINCompiler after a game update, you can still edit it with an hexadecimal editor.

The way to o it :

  1. Use a binary comparison between the original MBIN files and modded MBIN files (both from previous NMS version).
  2. Note the changes and apply them to the new MBIN files from latest NMS version.
  3. Done

Template:Notice Small

Hexadecimal Editors[edit | edit source]

there are a lot of Hexadecimal editor available. Here is a list of some of them:

  • 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)

.MBIN Header[edit | edit source]

As most of file format, .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.

Editing MBIN files[edit | edit source]

First, you need to know that MBIN Files are all using little indian byte order. So before anything, set your Hexadecimal editor to read values in little indian order.

Template:NMSPageClose