saxbophone/libsxbp

File Format changes

Closed this issue · 2 comments

These will be needed for #128, #138 and for #107

These should be done in tandem, or at least #128 should be done in a way that allows for #138 to be done without further changing the file format (add a 32/64 bit mode flag to the file format).

#107 can be done at any time really as it won't break the file format (a space is reserved for it currently).
However, it may be nice to make all the file format changes at the same time.

#107 is now a breaking change and should be done at the same time for simplicity's sake (or at least, extra space should be reserved for it).

Ignore this - it's overly complex

SXBP File format (version 3)

  • Control codes are written in square brackets (e.g. [SOH] = Start of Heading)
  • Variable chunks are written in angle brackets (e.g. )

Format:

sxbp<version number as 3 big endian uint16s>
[SOH]<number of lines as 1 big-endian uint32>
[US]<number of lines solved, 1 big-endian uint32>
[US]<number of seconds spent solving as 1 big-endian uint32>
[US]<number of seconds to which the previous field is accurate, (same type)>
[STX]
... 0 or more of the following:
    <2 bits for line direction><30 bits for line length>
...
[ETX]

SXBP File format (version 3):

  • ASCII chars 'sxbp'
  • major version uint16
  • minor version uint16
  • patch version uint16
  • number of lines uint32
  • number of lines solved uint32
  • number of seconds spent solving uint32
  • number of seconds to which previous field is accurate uint32
  • 0 or more of the following (should be as many as number of lines):
    • 2 bits for line direction (unsigned, converted to enum)
    • 30 bits for line length (unsigned, converted to uint32)

This gives a file header of 26 bytes in total.