Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:RenderWare binary stream (DFF, TXD)

From ReverseEngineering.wiki
Format
Developer Criterion Software
Versions RenderWare 3.0 to 3.7 (library stamps 0x30000-0x37002)
Magic none; first chunk header, e.g. type 0x10 (Clump) for .dff and 0x16 (Texture Dictionary) for .txd
Extensions .dff, .txd, .bsp, .anm
Endianness little
On this wiki Facts · Code · Notes · Topics

Chunk-based container of Criterion's RenderWare Graphics (3.x) used by .dff models, .txd texture dictionaries, .bsp worlds and .anm animations: every chunk has a 12-byte header (type, size, library version stamp) and nests children, with a Struct child first.

Chunk header

Every chunk starts with 12 bytes: uint32 type, uint32 size (bytes after the header, including children) and uint32 libraryID (the version stamp). Chunks nest; a container's payload is a sequence of child chunks. Most objects begin with a Struct (type 0x01) child holding their fixed data, then optionally an Extension (0x03) child holding plugin chunks. Readers skip unknown chunks by size.

Version stamp

Old files (library version <= 0x31000) store version >> 8 as a small value (high 16 bits zero). Newer files pack it. From librw libraryIDPack:

libid = ((version - 0x30000) & 0x3FF00) << 14 | (version & 0x3F) << 16 | (build & 0xFFFF)

where version is 0x3MMmm-style (for example 0x36003 = 3.6.0.3, which librw writes by default with build 0xFFFF, giving stamp 0x1803FFFF). Unpacking: if the high 16 bits are non-zero, version = ((libid >> 14 & 0x3FF00) + 0x30000) | (libid >> 16 & 0x3F) and build = libid & 0xFFFF. The version table in the source: stamps 0x04000000 = 3.1, 0x08000000 = 3.2, 0x0C000000 = 3.3, 0x10000000 = 3.4, 0x14000000 = 3.5, 0x18000000 = 3.6, 0x1C000000 = 3.7. The stamp identifies the SDK a game's art pipeline used, and is also a quick way to tell a file's source game.

Core chunk types

See Fact:RenderWare binary stream (DFF, TXD)/enum/Chunk ids for the table. Main structure of a .dff: Clump (0x10) -> Struct (object count), FrameList (0x0E), GeometryList (0x1A) with Geometry (0x0F) children, one Atomic (0x14) per mesh, Extension. Geometry holds a Struct (flags, triangle/vertex counts, morph targets with positions and normals), a MaterialList (0x08) with Material (0x07) children that reference a Texture (0x06) by name, and an Extension with Bin Mesh PLG (0x50E, triangles grouped by material) and Skin PLG (0x116) for skinned models. A .txd is a Texture Dictionary (0x16): Struct (u16 texture count, u16 device id), then that many Texture Native (0x15) chunks, then an Extension.

Native texture (D3D8, as read by librw)

Inside Texture Native: Struct whose payload is u32 platform (8 = D3D8, 9 = D3D9, 5 = Xbox, 'PS2\0' = 0x00325350 for PS2), u32 filterAddressing, char name[32], char mask[32], i32 rasterFormat, i32 hasAlpha (D3D9 packs this as a D3D format), u16 width, u16 height, u8 depth, u8 numLevels, u8 rasterType, u8 compression (DXT type), then a palette (32 or 256 BGRA entries) for paletted formats and, per mip level, a u32 size followed by pixel data. DXT fourccs 'DXT1'..'DXT5' (0x31545844...) are recognised for D3D9. Texture names are looked up case-insensitively by the games; the same name keys DFF materials to TXD textures.

Platform ids and vendor ids

Platform: 2 OpenGL, 4 PS2, 5 Xbox, 8 D3D8, 9 D3D9, 11 WDGL, 12 GL3 (librw). Plugin ids pack a vendor in the upper bits: vendor 0 core, 1 Criterion toolkit (skin 0x116, HAnim 0x11E, user data 0x11F, MatFX 0x120, anisotropy 0x127), 4 internal modules, 5 world (0x50E bin mesh, 0x510 native data, 0x511 vertex format).

Tools

librw (aap/librw, MIT) reads and writes DFF and TXD for PS2, D3D8, D3D9 and Xbox and re-implements the engine; BSP world files are not supported there.

Code & repositories

  • https://github.com/aap/librw @ 18532c2e13efbc1aa43f0b00b4459831f9414de0 · license: MIT
    Re-implementation of the RenderWare Graphics engine with DFF and TXD readers and writers for PS2, D3D8, D3D9 and Xbox; rwbase.h lists chunk ids, platform ids and the library version stamp functions.
    Tested on: source read, not run: source read, not built: rwbase.h, base.cpp, texture.cpp, d3d/d3d8.cpp at commit 18532c2 · checked 2026-10-18; last activity 2026-08-26

Evidence & references

aap/librw at commit 18532c2: src/rwbase.h (plugin ids, platform ids, libraryIDPack/Unpack*, version table), src/base.cpp line 26 (version = 0x36003, build = 0xFFFF) and readChunkHeaderInfo (line 1095), src/texture.cpp (streamReadNative), src/d3d/d3d8.cpp (readNativeTexture, writeNativeTexture). Unverified: the claim that 0x1803FFFF is the stamp for 3.6.0.3 is derived from the formula above, not read from a file.