All data is stored in big endian format.
The overall structure of the file is as follows:
Name | Type | Description |
---|---|---|
construction header |
Construction Header | |
section data table |
Section data table | |
metadata |
TAG_Compound | Metadata |
metadata start offset |
uint32 | offset from the start of the file to the start of the metadata entry |
magic number |
"constrct" (8 bytes) UTF-8 char array |
(Verifies that the file was saved correctly) |
- Read the construction header to cofirm that it is a construction file with specification version 0
- Skip to the end of the file and read the final
magic number
. If the value does not equalconstrct
the file is invalid (most likely only half saved) - Read the
metadata start offset
which will give you the offset to the start ofmetadata
- Skip to the byte offset and read the metadata entry. This contains the offsets to each of the section data entries in the section data table
- Write the construction header
- Write each section data entry - keeping track of the locations where each exists in the file
- Write the metadata
- Write the offset to the start of the metadata
- Write the magic number