.fcb — Binary Object-Tree Format
Traced live via GhidraMCP against the Steam v1.03 build, to independently confirm (and in one case
correct) the .fcb format as reverse-engineered by the community (Gibbed's BinaryResourceFile) and
ported to first-party C# at tools/JackAll/src/JackAll.Core/Format/Fcb/FcbDocument.cs. For where this
format's data lives and how it's used practically, see Getting
Started and Data Recipes.
.fcb is the engine's generic serialized-object-tree format: a header, a flat pool of objects, and a
recursive tree of typed values. It's used for entity libraries, weapon/vehicle definitions, world-sector
placement data, and — as documented on the savegame page — the entire embedded
PersistenceDB dump inside a .sav file.
Confirmed call chain
World_LoadEntityLibraryWithOverride (0x1065b130, see archives) → resolver
vtable+0x4c → Resource_LoadViaResolver (0x102340f0) → vtable+0x48 → FUN_102353b0 (reads the whole
file into a malloc'd buffer) → Fcb_ReadHeader (0x10235080) → Fcb_AllocateTree
(0x10234fc0) → Fcb_ParseObject (0x10234d60, recursive) → Fcb_ReadTypeHash
(0x10234260, once per object).
Header
offset size field
0 4 magic (u32) — must equal 0x4643626E ("FCbn" LE)
4 2 version (u16) — must equal 2, no other value accepted
6 2 flags (u16) — only bit 0 is read; everything else ignored
8 4 objectCount (u32) — every distinct object, the root included
12 4 childSlotCount (u32) — every child-list entry, backreferences included
16 — root object tree starts here
Fcb_ReadHeader rejects the file (returns failure) if magic or version don't match, or if both counts
are zero — an all-zero tree is explicitly invalid, not "empty but valid."
Fcb_ParseObject — the recursive tree walker
One object is: childCount-varint, TypeHash, valueCount-varint, that many value entries, then
childCount child objects.
- Varints (
childCountandvalueCount, this object's own counts): a marker byte< 0xFEis the literal value;0xFEor0xFFboth mean "read the next 4 bytes (LE) as the literal value instead." Neither marker carries backreference meaning at this position — this differs materially from how Gibbed's tooling treats it. No real fixture uses0xFEhere; JackAll pins the behavior with a synthetic regression test (FcbDocumentTests.cs,An_objects_own_value_count_never_means_backreference_even_with_marker_0xFE). - Object registration: right after TypeHash is read, the object's pool address is appended to a growing array. Index = its ordinal among everything parsed so far, in file order.
- Value entries: nameHash (u32), then a size-varint:
< 0xFE→ that many payload bytes follow;== 0xFF→ an explicit 4-byte size, then that many bytes;== 0xFE→ skip exactly 5 bytes total and never dereference — the trailing 4 bytes are a backward byte offset to an earlier value's own size-varint ("my bytes are the same as that one's"). JackAll's port, needing a self-contained in-memory tree, eagerly resolves and copies the shared bytes at parse time instead — a different but behaviorally equivalent strategy. - Child list: for each of
childCountslots, peek the next byte. If exactly0xFE: a backreference — read a 4-byte index into the object-pointer array, resolve it, store the pointer, advance 5 bytes, no recursion. Any other byte recurses intoFcb_ParseObject, which consumes that same leading byte as its ownchildCountfield. This is the one place0xFEgenuinely means backreference, and it's a distinct code position from the object's ownchildCount/valueCountreads above. - Each object struct in the pre-allocated pool: 6 dwords (24 bytes) — vtable, a zeroed flag, file
position,
childCount, two zeroed trailer fields — followed bychildCountmore dwords holding the (possibly backreferenced) child pointers.
Fcb_ReadTypeHash — the flags-gated alternate encoding
If the header's flags bit 0 is 0 (every real sample seen): TypeHash is the raw u32 at the cursor, 4
bytes consumed. If set: the leading u32 becomes a fallback raw hash (used only if the string is too
long), a second u32 gives a string length, and if under 512, that many raw bytes follow as a class-name
string, NUL-terminated and hashed via GetNameHash → CRC32_Hash to produce the real TypeHash (12
bytes + string length consumed instead of 4). No known shipped .fcb uses this path — all 5 real
fixtures checked have flags == 0 — so FcbDocument.Deserialize deliberately throws rather than
mishandling a file that needs it.
Fcb_AllocateTree — pool sizing
Allocates (objectCount * 6 + childSlotCount) * 4 bytes up front. The *6 term is the 24-byte
fixed object struct; the childSlotCount term is consumed only as each object's trailing
child-pointer-slot array (childCount dwords per object) — never as storage for primitive value bytes
(values are read from the retained raw file buffer, not copied into this pool).
The two counts are exactly the distinct objects, the root included, and the sum of every object's
childCount, backreference slots included — in all 12 shipped files checked (entity libraries,
omnis, mapsdata, managers, world sectors and a landmark) (seen in data). So for a file with no
backreferences, childSlotCount is objectCount − 1.
A writer must get both right: the pool is sized from them, and a count too small leaves the parser writing past it.
Member names and their text_ twins
A value's nameHash is the CRC32 of the member's name as raw, case-sensitive ASCII: no lowercasing,
no path normalization.
Beside a member that stores a hash, the original editor also wrote the plain text it hashed, under the
same name prefixed with text_:
| Member | Type | Example value |
|---|---|---|
text_fileName | string | graphics\vehicles\land\quad\quad_single.xml |
fileName | hash | 9E468864, the path hash of the line above |
text_matimpSmallCollisionImpact | string | Vehicle.sparks_col_small |
matimpSmallCollisionImpact | hash | B09DB7A8, the CRC32 of the line above |
The engine reads only the hash. Neither Dunia.dll nor the Linux server contains a single text_
string, so no code can look the twin up, and the engine's property registry never lists one. Editing a
text_ value changes nothing in game; edit its hashed member instead.
This is established from the data, not traced in the engine. In world1's entitylibrary_full.fcb,
194 of the 195 distinct unnamed string members hold text whose CRC32 is the value of a sibling member,
and the text_ rule names every one of them. Applied to the 225 member hashes binary_classes.xml
left unnamed, it names 218 with no ambiguous candidate. The one string it does not name, 9816A342 on
Malfunction, holds values like 0x00456C42.
Unknowns
- A real
.fcbsample with flags bit 0 set (the string-hashed TypeHash path) — none is known, soFcb_ReadTypeHash's alternate branch is understood from static analysis only.