I can live with that, as long as it’s relatively simple.
Just throwing some ideas out there…
What about something like this:
// Basic header
// Section index entry
// Section header
// Section data
And then we designate the section ids to special kinds of sections.
- “CODE” (
0x434F4445) for code section
- “LICN” (
0x4C49434E) for licence section
- “TITL” (
0x5449544C) for the game name
- “DESC” (
0x44455343) for the game’s description
By having the ‘contents page’, it makes it easier to seek to specific bits of information.
You can load the whole contents page into memory and then just seek as and when you want a specific section.
And code would look something like:
enum class SectionID : std::uint32_t =
Unknown = 0x00000000,
Code = 0x434F4445,
// or Code = makeSectionId('C', 'O', 'D', 'E')
// or even Code = "CODE"_section
Licence = 0x4C49434E,
Title = 0x5449544C,
Description = 0x44455343,
char * buffer;
Or, how about Minecraft’s NBT tags?
Basically they’re like a binary equivalent of JSON.
Or we can mix both.
Use the earlier thing for the main structure and NBT tags for encoding information in specific sections.