Difference between revisions of "RenderWare binary stream file"
m |
m |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{File-stub}} | {{File-stub}} | ||
{{TocRight}} | {{TocRight}} | ||
− | '''RenderWare binary stream files''' are hierarchically structured binary data files used by the [[ | + | '''RenderWare binary stream files''' are hierarchically structured binary data files used by the [[RenderWare]] 3.x graphics engine utilized by [[Wikipedia:Rockstar North|Rockstar North]] for their GTA III trilogy (only on PC, [[Wikipedia:PS2|PS2]] and [[Wikipedia:XBOX|XBOX]], not [[Wikipedia:PSP|PSP]]!) and related games (Manhunt, Bully). |
− | GTA's [[model file]]s use the [[Wikipedia:file extension|file extension]] <code>.dff</code> and [[texture archive]]s use <code>.txd</code>. Other possible extensions, not used by the GTA games, are <code>.rws</code>, <code>.bsp</code> and <code>.dma</code>. GTA3 does use <code>.anm</code> for some of its cutscene animations, but it is the only GTA to do so. | + | GTA's [[model file]]s use the [[Wikipedia:file extension|file extension]] <code>.dff</code> ('''D'''ive '''F'''ile '''F'''ormat) and [[texture archive]]s use <code>.txd</code>. Other possible extensions, not used by the GTA games, are <code>.rws</code>, <code>.bsp</code> and <code>.dma</code>. GTA3 does use <code>.anm</code> for some of its cutscene animations, but it is the only GTA to do so. |
==File Format== | ==File Format== | ||
− | |||
− | + | RW streams are split up into chunks. Each section has a 12 byte header and can either be empty, contain data or more child chunks. | |
+ | The content depends on the type and parent chunks. | ||
− | + | uint32 - type | |
− | + | uint32 - size, including child chunks and/or data | |
− | + | uint32 - library ID stamp | |
− | The RW version | + | ===Versioning=== |
+ | |||
+ | The library ID stamp contains the version and build number of the RW library that wrote the file. | ||
+ | |||
+ | The library version is a hexadecimal number and has the form <code>0xVJNBB</code> where V (3 bits) is the Renderware version, J (4 bits) is the major revision, N (4 bits) is the minor revision and B (6 bits) is the binary revision. Version 3.6.0.3 for instance would be encoded as <code>0x36003</code>. | ||
+ | |||
+ | The library build is 0xFFFF in all versions used by GTA. | ||
+ | |||
+ | To make the library ID stamp, <code>0x30000</code> is subtracted from the version first and then packed as follows (where D is the 16 bit build number): | ||
+ | VVJJ JJNN NNBB BBBB DDDD DDDD DDDD DDDD | ||
+ | Version <code>0x36003</code> build <code>0xFFFF</code> for instance is encoded as <code>0x1803FFFF</code>. | ||
+ | |||
+ | For more information on how the version number can be calculated, see [[RenderWare]]. | ||
===Valid RW Section IDs=== | ===Valid RW Section IDs=== | ||
Line 33: | Line 45: | ||
* [[Breakable (RW Section)|Breakable]] ''(0x0253F2FD)'' | * [[Breakable (RW Section)|Breakable]] ''(0x0253F2FD)'' | ||
* [[Frame (RW Section)|Frame]] ''(0x0253F2FE)'' | * [[Frame (RW Section)|Frame]] ''(0x0253F2FE)'' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Common File Structures== | ==Common File Structures== | ||
− | === | + | ===Basic structure=== |
+ | The basic structure of DFF and TXD files is given below. | ||
+ | The Extensions are given as empty, their contents depend on the plugins and plugin data of the object they belong to. | ||
+ | These are described elsewhere. | ||
+ | ====DFF==== | ||
* [[Clump (RW Section)|Clump]] | * [[Clump (RW Section)|Clump]] | ||
** [[Struct (RW Section)#Clump|Struct]] | ** [[Struct (RW Section)#Clump|Struct]] | ||
Line 59: | Line 59: | ||
*** [[Struct (RW Section)#Frame_List|Struct]] | *** [[Struct (RW Section)#Frame_List|Struct]] | ||
*** [[Extension (RW Section)|Extension]] * | *** [[Extension (RW Section)|Extension]] * | ||
− | |||
− | |||
** [[Geometry List (RW Section)|Geometry List]] | ** [[Geometry List (RW Section)|Geometry List]] | ||
*** [[Struct (RW Section)#Geometry_List|Struct]] | *** [[Struct (RW Section)#Geometry_List|Struct]] | ||
Line 71: | Line 69: | ||
****** [[Texture (RW Section)|Texture]] - optional | ****** [[Texture (RW Section)|Texture]] - optional | ||
******* [[Struct (RW Section)#Texture|Struct]] | ******* [[Struct (RW Section)#Texture|Struct]] | ||
− | ******* [[String (RW Section)|String]] - | + | ******* [[String (RW Section)|String]] - texture name |
− | ******* [[String (RW Section)|String]] - | + | ******* [[String (RW Section)|String]] - mask name |
******* [[Extension (RW Section)|Extension]] | ******* [[Extension (RW Section)|Extension]] | ||
− | |||
****** [[Extension (RW Section)|Extension]] | ****** [[Extension (RW Section)|Extension]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
**** [[Extension (RW Section)|Extension]] | **** [[Extension (RW Section)|Extension]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
** [[Atomic (RW Section)|Atomic]] * | ** [[Atomic (RW Section)|Atomic]] * | ||
*** [[Struct (RW Section)#Atomic|Struct]] | *** [[Struct (RW Section)#Atomic|Struct]] | ||
*** [[Extension (RW Section)|Extension]] | *** [[Extension (RW Section)|Extension]] | ||
− | **** [[ | + | ** [[Struct (RW Section)|Struct]] * |
− | **** [[ | + | ** [[Light (RW Section)|Light]] * |
− | **** [[ | + | *** [[Struct (RW Section)#Light|Struct]] |
− | **** [[ | + | *** [[Extension (RW Section)|Extension]] |
+ | ** [[Struct (RW Section)|Struct]] * | ||
+ | ** [[Camera (RW Section)|Camera]] * | ||
+ | *** [[Struct (RW Section)#Camera|Struct]] | ||
+ | *** [[Extension (RW Section)|Extension]] | ||
** [[Extension (RW Section)|Extension]] | ** [[Extension (RW Section)|Extension]] | ||
− | |||
− | |||
− | |||
+ | ====TXD==== | ||
* [[Texture Dictionary (RW Section)|Texture Dictionary]] | * [[Texture Dictionary (RW Section)|Texture Dictionary]] | ||
− | ** [[Struct (RW Section)#Texture_Dictionary|Struct]] | + | ** [[Struct (RW Section)#Texture_Dictionary|Struct]] |
− | ** [[ | + | ** [[Raster (RW Section)|Raster]] * |
− | *** [[Struct (RW Section) | + | *** [[Struct (RW Section)|Struct]] |
− | *** [[Extension (RW Section)|Extension]] | + | *** [[Extension (RW Section)|Extension]] |
− | ** [[Extension (RW Section)|Extension]] | + | ** [[Extension (RW Section)|Extension]] |
− | === | + | ====PS2 TXD==== |
* [[Texture Dictionary (RW Section)|Texture Dictionary]] | * [[Texture Dictionary (RW Section)|Texture Dictionary]] | ||
− | ** [[Struct (RW Section)#Texture_Dictionary|Struct]] | + | ** [[Struct (RW Section)#Texture_Dictionary|Struct]] |
− | ** [[ | + | ** [[Raster (RW Section)|Raster]] * |
− | *** [[Struct (RW Section) | + | *** [[Struct (RW Section)|Struct]] |
− | *** [[String (RW Section)|String]] - | + | *** [[String (RW Section)|String]] - texture name |
− | *** [[String (RW Section)|String]] - | + | *** [[String (RW Section)|String]] - mask name |
*** [[Struct (RW Section)|Struct]] | *** [[Struct (RW Section)|Struct]] | ||
− | **** [[Struct (RW Section)|Struct]] | + | **** [[Struct (RW Section)|Struct]] |
− | **** [[Struct (RW Section)|Struct]] | + | **** [[Struct (RW Section)|Struct]] |
*** [[Extension (RW Section)|Extension]] | *** [[Extension (RW Section)|Extension]] | ||
− | + | ** [[Extension (RW Section)|Extension]] | |
− | ** [[Extension (RW Section)|Extension]] | ||
− | ''* These | + | ''* These chunks can appear multiple times. The count is usually given in the parent's struct. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | The | ||
− | |||
− | |||
==Tools & Scripts== | ==Tools & Scripts== | ||
Line 146: | Line 114: | ||
* [http://www.steve-m.com/downloads/tools/rwanalyze/ RW Analyze] – by {{U|steve-m}} | * [http://www.steve-m.com/downloads/tools/rwanalyze/ RW Analyze] – by {{U|steve-m}} | ||
* various [[model file]] and [[texture archive]] related tools | * various [[model file]] and [[texture archive]] related tools | ||
+ | |||
+ | ==Official Sources== | ||
+ | |||
+ | * [https://web.archive.org/web/20070127023600/http://www.renderware.com/ Official RenderWare Site (archived)] | ||
+ | * {{Github|electronicarts/RenderWare3Docs|Official documentation repository}} | ||
+ | * {{Github|GTAmodding/rw37|RenderWare 3.7 source code (for demo-purposes only)}} | ||
==See also== | ==See also== | ||
+ | * [http://www.chronetal.co.uk/gta/index.php?page=dff Original DFF format description] by KCow | ||
* {{GTAF|128451|RW Analyze discussion thread}} | * {{GTAF|128451|RW Analyze discussion thread}} | ||
− | * [ | + | * [https://github.com/aap/librw librw] - a reimplementation of the original RenderWare graphics API by {{U|The hero}} |
− | |||
* [http://wiki.multimedia.cx/index.php?title=TXD MultimediaWiki TXD] | * [http://wiki.multimedia.cx/index.php?title=TXD MultimediaWiki TXD] | ||
− | {{SA | + | {{N|SA|VC|3}} |
[[Category:3D File Formats]] | [[Category:3D File Formats]] |
Latest revision as of 10:54, 14 September 2020
RenderWare binary stream files are hierarchically structured binary data files used by the RenderWare 3.x graphics engine utilized by Rockstar North for their GTA III trilogy (only on PC, PS2 and XBOX, not PSP!) and related games (Manhunt, Bully).
GTA's model files use the file extension .dff
(Dive File Format) and texture archives use .txd
. Other possible extensions, not used by the GTA games, are .rws
, .bsp
and .dma
. GTA3 does use .anm
for some of its cutscene animations, but it is the only GTA to do so.
File Format
RW streams are split up into chunks. Each section has a 12 byte header and can either be empty, contain data or more child chunks. The content depends on the type and parent chunks.
uint32 - type uint32 - size, including child chunks and/or data uint32 - library ID stamp
Versioning
The library ID stamp contains the version and build number of the RW library that wrote the file.
The library version is a hexadecimal number and has the form 0xVJNBB
where V (3 bits) is the Renderware version, J (4 bits) is the major revision, N (4 bits) is the minor revision and B (6 bits) is the binary revision. Version 3.6.0.3 for instance would be encoded as 0x36003
.
The library build is 0xFFFF in all versions used by GTA.
To make the library ID stamp, 0x30000
is subtracted from the version first and then packed as follows (where D is the 16 bit build number):
VVJJ JJNN NNBB BBBB DDDD DDDD DDDD DDDD
Version 0x36003
build 0xFFFF
for instance is encoded as 0x1803FFFF
.
For more information on how the version number can be calculated, see RenderWare.
Valid RW Section IDs
See the list of RW section IDs.
Rockstar's Custom Section IDs
Rockstar added several vendor specific RW plugins, which have their own ID range (0x0253F2F*).
- Pipeline Set (0x0253F2F3)
- Specular Material (0x0253F2F6)
- 2d Effect (0x0253F2F8)
- Extra Vert Colour (0x0253F2F9)
- Collision Model (0x0253F2FA)
- Reflection Material (0x0253F2FC)
- Breakable (0x0253F2FD)
- Frame (0x0253F2FE)
Common File Structures
Basic structure
The basic structure of DFF and TXD files is given below. The Extensions are given as empty, their contents depend on the plugins and plugin data of the object they belong to. These are described elsewhere.
DFF
- Clump
- Struct
- Frame List
- Geometry List
- Atomic *
- Struct *
- Light *
- Struct *
- Camera *
- Extension
TXD
PS2 TXD
* These chunks can appear multiple times. The count is usually given in the parent's struct.
Tools & Scripts
- RW Analyze – by steve-m
- various model file and texture archive related tools
Official Sources
- Official RenderWare Site (archived)
- Official documentation repository on GitHub
- RenderWare 3.7 source code (for demo-purposes only) on GitHub
See also
- Original DFF format description by KCow
- GTAForums: RW Analyze discussion thread
- librw - a reimplementation of the original RenderWare graphics API by The hero
- MultimediaWiki TXD