The G2D Binary File format is the basic structure that all NNS G2D binary files follow. One of the main features are the ability to contain multiple binary blocks of variable size. 

!!Header

The header of all NNS G2D binary files takes on the same structure. That is as follows:

||Offset||Type||Meaning
| 0x00   | u32 | File signature. This is a 32-bit tag that identifies the file type in little-endian byte order. 
| 0x04   | u16 | Byte order mark. This is {{0xFEFF}} in the endianness used. In practice only little endian byte order is used. For old format files this will be 0.
| 0x06   | u16 | File version. The most significant 8 bits are the major version, and least significant 8 bits are the minor version. For most G2D files this will be {{1.0}}. Old format files use version {{0.1}}.
| 0x08   | u32 | File size. For most G2D files, this will be the size of the entire file. For old type files, this will be the size of the file minus the size of all block headers ({{8 * numBlocks}}).
| 0x0C   | u16 | Header size. This is usually {{0x10}}. 
| 0x0E   | u16 | Number of blocks.

!!Block Structure

G2D files are composed of multiple binary blocks. They are structured in such a way that a decoder only needs to be aware of the structure of blocks relevant to it and can skip over other blocks. These are structured as follows:

||Offset||Type||Meaning
| 0x00   | u32 | Block signature. This is a 32-bit tag identifying the block in little-endian byte order.
| 0x04   | u32 | Block size. For most G2D files this is the size of the whole block, including this header. For old type files, this is the size of the block excluding the header.