All numbers are little-endian unsigned ints.
The file is constructed by concatenating each of the following sections in sequence.
Offset | Size | Value |
---|---|---|
0 | 16 | "PinEightGBFS\r\n\x1a\n" |
16 | 4 | Total GBFS file size |
20 | 2 | Offset to start of directory (always 32) |
22 | 2 | Number of objects in GBFS file |
24 | 8 | Reserved |
Repeats once for each object in the GBFS file.
Offset | Size | Value |
---|---|---|
0 | 24 | Object name (may not be null-terminated) |
24 | 4 | Size of object |
28 | 4 | File offset to start of object |
Extra padding may be observed at the end of the directory, but before the objects start. This may be the "wasted space" referred to in the original gbfs tool.
Objects are concatenated directly to the GBFS file, one after another.
The original GBFS tool pads each file to a 16-byte boundary. It does not seem this is necessary for libgbfs to function correctly.
- The header needs to know the total GBFS file size.
- The header needs to know the number of objects in the GBFS file.
- The number of objects should be determinable up front.
- Each directory entry needs to know the size of its object.
- The size of each object should be determinable up front.
- Each directory entry needs to know the offset to the start of its object.
- The header knows the size of the directory entries section. Objects start at 32 (the fixed size of the header) plus this.
- The size of any previous object is added to get the starting offset for the current entry's object.