Skip to main content

depload.dat — Dependency Chunk

Verified via reverse engineering, corrects an earlier community write-up

Originally documented community-side (Discord, Far Cry Modding Community — a from-scratch black-box exchange between fdx4061 and ArmanIII; not supported by FCBConverter, hence the from-scratch approach: "fcb converter doesn't support fc2 depload.dat"). Independently confirmed and extended by disassembly, traced live via GhidraMCP against the same more heavily-symbolized FarCry2_server binary used for the DLC entity-library merge. See intro for how RE-verified and community-reported claims are distinguished on this site.

depload.dat records, per world, which resources a resource depends on (its "parents"/"children") — a prefetch manifest, used by the engine to warm what a resource will need. It is also, for animation, the membership list of every CAnimationPackageResource: a .mab the engine will play has to be listed under the package that plays it, so for clips this file is not a hint but a requirement.

It does not gate loading — for a texture

A texture absent from every depload still resolves and renders when something asks for it — verified with one staged into patch.dat at a path present in no shipped archive, no hashlist and no depload list, reached through a material that is listed. For that case, absence costs streaming warmth, not availability.

This does not generalise. See Animations are not like textures below — an animation clip in the same situation did not load.

Sound banks are a second such case, and the mechanism there is explicit: a sound is requested by id against a registry with no load-on-miss path, never by path, so an unlisted bank can only resolve to null. See what loads the child bank.

How it's loaded​

CXGame::LoadDepLoad (0x08888d50) is the entry point:

  1. Calls CWorldDescriptorImpl::LoadDep() (0x09c2b0c0), which loads the current world's own <world>/generated/<world>_depload.dat (format string "%s%s_depload.dat"), and its sibling "%s%s_deploadnewparticles.rml" — a second, RML-format dependency file for particle effects. RML is a separate container: jackall-cli rml decode / rml encode round-trip oasisstrings.rml byte-identically at 946 KB. If the binary .dat isn't found, it falls back to a same-named _depload.xml (a plain XmlParser::parse path). Besides the small common/ui/localized/*/ui/ ones, nearly every world ships that XML twin beside its binary — 25 of them, up to 5.3 MB — and they carry the same parents the binary does, with names restored; see The type table. Whether the loader's fallback actually consumes that exact shape is untested, since the binary is always present.
  2. Then walks every installed DLC via CDlcService::GetDepLoads() and loads each one's own depload.dat the same way, with isPrimary = false.

The particle library​

On the PC client, LoadParticleDepLoad (GOG 0x1064D890) loads the world's <world>_deploadnewparticles.rml as the world's particle library, then each DLC's own (RE-verified on GOG):

  • Overridable. It goes through the ordinary XML loader and the archive resolver, so a copy in patch.dat replaces the shipped one.
  • Layout. The root must be NewPartLib. Each PartSys child is one particle system, keyed by its Name attribute, and each PartEmit under it one emitter.
  • Resource id. A system's resource id is the CPathID of its Name: the path rule, lowercased and CRC32'd. An effect therefore names a particle system the way a file names a path.

mp_02_s_shanty's library, for scale, holds 236 systems and 641 emitters.

An emitter sets its texture, its particle count (NbInitPart at once, then EmitRateKF per second for EmitDuration) and its aim (RotOffset and the EmitDir… cone) as attributes. Each Init…KF child is a starting value with a random VariantKF spread, and each Part…KF child a curve of knots over a particle's life, 0 to 1. The colour a particle shows is InitColorKF times PartColorKF (inferred): the bullet blood's smoke puff, (0.33, 0.18, 0.18) times (0.58, 0, 0), draws as a near-black red. jackall-cli rml decode and rml encode round-trip the shipped libraries byte for byte, and JackAll merges a library system by system, so a mod ships only the systems it changes or adds, as fragments numbered by their resource id; Combat Overhaul's data\particles.py writes its bullet blood that way.

Both paths bottom out in CResourceManager::LoadDep(IFile*, bool isPrimary) (0x09c07f50) → CResourceDataBase::LoadBinaryFile(IFile*, bool isPrimary) (0x09c594c0), the actual binary reader — its IFile::Read call sequence is the ground truth for the layout below. isPrimary only changes how loaded records merge into the in-memory resource database; it has no effect on the file's own byte layout.

Structure​

A file-level header, then a parents array:

offset size field
0 4 parent count N (u32)
4 8*N N × parent entries

Each parent entry — confirmed field-for-field against the three separate IFile::Read calls (2, 2, then 4 bytes) LoadBinaryFile issues per entry:

offset size field
0 2 childIndex — index (not byte offset) into the flattened child arrays below
2 2 childCount — how many consecutive entries starting at childIndex belong to this parent
4 4 parent CRC32 (CPathID hash of the parent resource's path)

Entries are sorted ascending by CRC32, treated as unsigned 32-bit. Confirmed both empirically (community finding) and directly in the disassembly, which binary-searches this array by CRC32 on load — a binary search only works if the array is actually kept sorted, so the engine itself depends on this invariant, not just tooling built to read the file.

The children chunk​

Immediately after the parents array, three more length-prefixed arrays follow, each with its own independent u32 count:

u32 childHashCount (M_A)
M_A × u32 childHash[] — CPathID hash (CRC32) of the child (dependency) resource's path

u32 childTypeIndexCount (M_B, == M_A)
M_B × u8 childTypeIndex[] — one byte per child: an index into the type table below

u32 typeTableCount (M_C, independent — much smaller than M_A/M_B in practice)
M_C × u32 typeHash[] — a small deduplicated table of distinct type CRC32s

A parent's children are childHash[childIndex .. childIndex+childCount) (and the parallel slice of childTypeIndex) — childIndex is a slice start into the two per-child arrays, confirmed directly from the load loop. Each child's actual type hash is typeHash[childTypeIndex[i]].

Two real shipped files (entitylibrary_depload.dat: 433 parents, 1,314 children; worlds/tmpla/generated/tmpla_depload.dat: 9,134 parents, 25,838 children) bear this out: the third array's count-prefix is nowhere near the child count in either file, and every childTypeIndex byte falls inside [0, typeTableCount). The third array is a small deduplicated type-hash table indexed by the second, not a third per-child field. (LoadBinaryFile also does its own runtime interning of type hashes into an in-memory table with a per-child byte index after the file is read — a second, unrelated dedup pass over already-parsed data, structurally similar to the file's own table.)

Animations are not like textures​

A .mab is reachable only through its animation package

Measured in game. An animation clip at a path present in no shipped archive loads and plays normally, provided it is listed as a CAnimationResource child of the CAnimationPackageResource that the weapon's sPartName names. Registering a clip in a depload is adding it to an animation package — they are the same act.

Three configurations, one variable each time:

Clip at an invented pathResult
listed in no deploadreload never plays; the MOVE state machine enters the reload state and never leaves
listed under the wrong package (dart_rifle)identical failure
listed under the package sPartName names (dragunov)plays normally

The middle row is the control that matters: it rules out "any depload edit, or the rebuild itself, fixed it" and pins the cause to package membership.

The trap is which package. It is named by the archetype's sPartName, not by the weapon whose slot a mod occupies. The VSS Vintorez replaces the Dart Rifle but sets sPartName = dragunov, so its clips belong to the dragunov package; a registration under dart_rifle is accepted, changes nothing, and fails silently.

Edit it with jackall-cli depload add rather than by hand.

A clip can also be listed under the MOVE state that plays it. The map's arm clips belong to no animation package: every world lists each one under the states that play it, which are CMovementResources keyed by the state's name (Pawn_Generic_Aim, Pawn_Generic_Wait, Pawn_Generic_Draw…). Copies of them at new paths, listed under the same states, play in game. Whether listing them was needed there is untested.

An unlisted clip does not load

Measured in game, on the VSS Vintorez's clips (see MOVE):

  • A .mab staged into patch.dat at an invented path — present in the archive, referenced by movemgr.bin, listed in no depload — never plays. The MOVE state machine enters the reload state and never leaves it: no reload, no fire, and the weapon stays dead until the player switches away and the state is re-entered from scratch. Switching back leaves it dead again.
  • The same bytes at a real shipped path play immediately.

The correlation is exact. The working clip's CPathID (70AEAAE4, …\pneu_dart_model_389\1stge_uppb_reload_+000fw_sp389_i1.mab) appears in 26 of the 27 shipped depload files, including both campaign worlds. The invented path's (11641D75) appears in none.

The one community report of a corrupted depload describes animations misbehaving specifically (see Hand-editing gotcha), which is the same mechanism seen from the other side — a parents array the engine can no longer binary-search loses the package lookup.

Reusing a real path the mod already owns needs no depload edit, so it stays the simpler option when a free slot exists: jackall-cli move clips --weapon N --shared-only lists which of a replaced weapon's own clip slots no other weapon plays. Registering a new path is what scales past that, and what a mod adding genuinely new content has to do.

The type table​

typeHash is the CRC32 of the resource's class name, hashed exact-case — not lowercased, unlike CPathID. Confirmed against world1_depload.dat's 16-entry table; the lowercased form matches nothing.

The _depload.xml form is what gives the names away, twice over: it spells the class out as the element name, and on many entries it also carries the hash outright as a crc_Type attribute.

<CSoundResource Type="CSoundResource" crc_Type="1676955864" ID="soundbinary\00456a3c.spk"
crc_ID="1746764574" IsFilename="1" Size="0" nbChildren="2">
<CMagmaConfigUIResource ID="ui\localized\pc\eng\ui\360.mgb.desc" crc_ID="3891716022" version="2">
<CMagmaUIResource ID="ui\localized\pc\eng\ui\360.mgb" crc_ID="2823636668" />
<CTextureResource ID="ui\textures\360\360_b.xbt" crc_ID="123948764" />

So the XML is the binary's own shape with names restored: a parent element per parent entry, its children nested inside, crc_ID being the CPathID the binary stores.

All sixteen distinct type hashes across every shipped depload are identified. Each name below hashes to the value observed in a real type table, with none left over:

typeHashClasstypeHashClass
BC825377CMaterialResourceB0604725CAnimationResource
6BD55AFCCTextureResource44601C12CParticlesSystemParamResource
6BE083B6CParticlesEmitterParamResource4CDDA42CCSkeletonResource
86E8E8BECGeometryResourceAB064BA6CFaceAnimResource
63F450D8CSoundResource59EB7FEFCDominoBoxResource
1131FDDCCStateMachineResource1543407DCResourceContainer
06EA6087CFrankensteinPoseResource84A30AF0CAnimationPackageResource
221AD401CMovementResource3AE88EFDCPhysResource

The names are in the shipped data. Six are stated outright by the world twins' crc_Type attributes, and the rest fall out of matching child hashes against the same twins.

CRealtreeResource, CStateMachineBlobResource and CResource appear in the twins as parents but never as anyone's child, so they never enter a type table.

Hand-editing gotcha​

fdx4061 reported breaking in-game animations by getting the sort order wrong while merging two depload.dat files by hand. Anyone inserting or removing entries must re-sort the whole parents array by CRC32 afterward (and keep childIndex/childCount consistent with wherever the corresponding slice ends up in the children arrays), or the file loads but animations misbehave — not a hard crash, so the corruption is easy to miss until playtesting.

Editing​

jackall-cli depload reads, writes and edits the format. Encode re-derives the parents' sort order, every child slice and the whole type table from the decoded model, so an edit says only what belongs where and never maintains an index by hand — which is exactly the class of mistake the gotcha describes.

jackall-cli depload decode world1_depload.dat # to XML, paths resolved from the hashlist
jackall-cli depload encode world1_depload.xml
jackall-cli depload validate world1_depload.dat # sort order, index ceilings, round trip
jackall-cli depload add world1_depload.dat \
--parent dragunov --child "graphics\...\clip.mab" --type CAnimationResource

--parent takes an animation package name, a game path, or an eight-digit hex CRC: package names hash exactly as paths do, so dragunov resolves to E765D26D on its own.

For a mod, add --fragment and stage the result in a layer, which merges into the retail file at build time instead of shipping a 220 KB binary:

mods\worlds\world1\generated\
entitylibrary.fcb\weapons\Special\Dart_Rifle.xml an archetype
world1_depload.dat\dragunov.3882209901.xml an animation package

One fragment is one resource and its whole dependency list — about 2 KB.

The number is the resource's CPathID and is what binds; the label in front of it is decoration. 3882209901.xml, dragunov.3882209901.xml and anything.3882209901.xml are the same fragment. That matters because the two sides of this rarely know the same names: JackAll resolves resources through the hashlist, which covers 7,543 of world1's 9,718 and includes no animation packages at all, while a mod author writing dragunov does know. Binding on the number lets each label the entry however it can and still land on one entry — otherwise a row lists under one spelling, a mod stages under another, and the same resource appears twice.

This is the scheme a world-sector entity's fragment already uses (Guard_12.2058514756624450165.xml), so FcbFragments.IdComparer collapses the label with no special case. Decimal rather than hex precisely because that rule keys on a numeric tail. The label must be a flat leaf — spelled with directories it would canonicalize with the directory kept and stop matching. depload add --fragment writes the filename from whatever you passed to --parent.

JackAll browses the file the same way: a _depload.dat expands in the file tree into exactly these entries, one row per resource under the id a mod stages it at, so a row can be read, diffed against vanilla and mirrored into the workspace as a fragment override without leaving the file list — the same treatment a splitting .fcb gets.

A fragment deliberately carries no childIndex: that is a whole-file layout detail which shifts whenever anything earlier in the file changes, so including it would make every fragment churn.

Two mods registering clips under different packages compose without either noticing, and so do two under the same package: a package's dependencies are matched by hash, so both mods' additions land after the shipped ones, in load order, and the shipped order is kept.

Three properties of all 27 shipped files are what let the encoder rebuild from the model alone, and JackAll's tests pin each one:

  • the child slices are a gapless, non-overlapping cover of the child arrays;
  • the type table is in first-use order, with no unused slot;
  • childIndex is not monotonic in parent order, so block order has to be carried separately.

The format's own ceilings are childIndex/childCount being u16 (65,535 children per file; world1 uses 29,723) and childTypeIndex being u8 (256 distinct types; 16 are used).

UI dependency lists​

The UI has lists of its own, plain XML at ui\localized\<aspect>\<lang>\ui\_depload.xml, one per language and screen shape. Each holds 53 top-level resources: a package's .mgb.desc for each of 50 packages, and 3 sound banks. A package's children are its .mgb, the packages it uses, and the textures, fonts and sounds it draws and plays:

<CMagmaConfigUIResource ID="ui\localized\pc\eng\ui\fonts.mgb.desc" crc_ID="615711406" version="2">
<CMagmaUIResource ID="ui\localized\pc\eng\ui\fonts.mgb" crc_ID="2178248305" />
<CMagmaUIResource ID="ui\fonts\farcry2_25.mft" crc_ID="2187389144" />
<CTextureResource ID="ui\fonts\farcry2_25_0.xbt" crc_ID="4044182890" />
…
</CMagmaConfigUIResource>

crc_ID is the path's archive hash. The game loads the list at startup (CFCXUiService::PreloadUiDependencies, Steam 0x101d0cb0) (RE-verified):

  • It is what the game reads, not the .desc. A package's .mgb.desc carries the same dependencies, but CMagmaConfigUIResource::ClientProcessRawData (Steam 0x10554c60) reads them only when the request manager's depload flag (+0x2F5) is off. It is on: the constructor sets it, and animation clips need their world depload.dat entries, which only that mode enforces.
  • A UI file opens only once it is loaded. Magma opens a file through CFileReaderNomad::Open (FarCry2_server 0x096f7510), which takes the resource if it is already loaded and otherwise creates an empty one that fails to open. A new font named in fonts.mgb but missing from this list draws nothing; listed under fonts.mgb.desc, it draws (seen in game). A texture is not held to this: a HUD material on a texture no list names still draws (engine interop).

JackAll splits each list per top-level resource, staged as <file name>.<crc_ID>.xml, such as ui\localized\pc\eng\ui\_depload.xml\fonts.mgb.desc.615711406.xml, and merges a resource's dependencies as a list, so mods adding to one package all land.

Unknowns​

  • Whether registration is needed for asset types other than animations and UI files. A texture at an unlisted path renders fine, and an animation does not load at all; nothing else has been tested.
  • The _depload.xml twins are not a byte-exact source for the binary. In world1 they agree on all 9,718 parents, but 381 parents recur through the nesting and 2,032 localized soundbinary\loc\*.spk children disagree with the .dat, so the XML is a readable sibling rather than the file the binary is built from.