Difference between revisions of "RenderWare"

From GTAMods Wiki
Jump to navigation Jump to search
m (PS2 TXD)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{File-stub}}
 
{{File-stub}}
 
{{TocRight}}
 
{{TocRight}}
'''Renderware''' (RW for short) is the graphics engine used by GTA III, Vice City and San Andreas.
+
'''[[wikipedia:RenderWare|RenderWare]]''' (RW for short) is the graphics engine by ''Criterion Software'' that was licensed and used by ''Rockstar games'' for their titles Manhunt, Bully, [[GTA III]], [[GTA_VC|Vice City]] and [[GTA_SA|San Andreas]], just as for various [[wikipedia:List of RenderWare games|other games]]. GTA III's portable successors ''[[GTA_LCS|Liberty City Stories]]'' and ''[[GTA_VCS|Vice City Stories]]'' use the [[Leeds Engine|Rockstar Leeds engine]] that is almost a clone of the original RenderWare engine, which was already influenced by Rockstar Game's custom engine called [[RAGE]], which was used in the later titles [[GTA_IV|GTA IV]] and [[GTA V]].
For general information see [https://en.wikipedia.org/wiki/RenderWare] and for a list of games using it [https://en.wikipedia.org/wiki/List_of_RenderWare_games].
 
  
 +
==Versioning==
  
==Versions==
+
Each GTA game was linked against a certain version of the RenderWare engine. The following table gives an overview over the different versions that apply to GTA.
 
 
The versions of Renderware the games are linked against are the following:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 37: Line 35:
 
|}
 
|}
  
==Binary Streams==
+
Note: The japanese PC version of GTA3 uses RW 3.4.0.3 just like VC.
  
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.
+
On binary level, versions are used in different cases, most notably the ''library identifier stamp'' found in RenderWare's binary stream files. The stamp contains the version and build number of the RW library that wrote the file. It is a number that appears in 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 <code>0xFFFF</code> in all versions used by GTA.
The content depends on the type and parent chunks.
 
 
 
uint32 - type
 
uint32 - size, including child chunks and/or data
 
uint32 - library ID stamp
 
 
 
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):
 
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):
Line 63: Line 50:
 
These C example functions pack and unpack library ID stamps:
 
These C example functions pack and unpack library ID stamps:
  
<source lang="c">
+
<syntaxhighlight lang="c">
 
RwUInt32
 
RwUInt32
 
libraryIDPack(RwUInt32 version, RwUInt32 build)
 
libraryIDPack(RwUInt32 version, RwUInt32 build)
Line 89: Line 76:
 
return 0;
 
return 0;
 
}
 
}
</source>
+
</syntaxhighlight>
  
===Basic structure===
+
==Binary Streams==
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]]
 
** [[Struct (RW Section)#Clump|Struct]]
 
** [[Frame List (RW Section)|Frame List]]
 
*** [[Struct (RW Section)#Frame_List|Struct]]
 
*** [[Extension (RW Section)|Extension]] *
 
** [[Geometry List (RW Section)|Geometry List]]
 
*** [[Struct (RW Section)#Geometry_List|Struct]]
 
*** [[Geometry (RW Section)|Geometry]] *
 
**** [[Struct (RW Section)#Geometry|Struct]]
 
**** [[Material List (RW Section)|Material List]]
 
***** [[Struct (RW Section)#Material_List|Struct]]
 
***** [[Material (RW Section)|Material]] *
 
****** [[Struct (RW Section)#Material|Struct]]
 
****** [[Texture (RW Section)|Texture]] - optional
 
******* [[Struct (RW Section)#Texture|Struct]]
 
******* [[String (RW Section)|String]] - texture name
 
******* [[String (RW Section)|String]] - mask name
 
******* [[Extension (RW Section)|Extension]]
 
****** [[Extension (RW Section)|Extension]]
 
**** [[Extension (RW Section)|Extension]]
 
** [[Atomic (RW Section)|Atomic]] *
 
*** [[Struct (RW Section)#Atomic|Struct]]
 
*** [[Extension (RW Section)|Extension]]
 
** [[Struct (RW Section)|Struct]] *
 
** [[Light (RW Section)|Light]] *
 
*** [[Struct (RW Section)#Light|Struct]]
 
*** [[Extension (RW Section)|Extension]]
 
** [[Extension (RW Section)|Extension]]
 
 
 
====TXD====
 
* [[Texture Dictionary (RW Section)|Texture Dictionary]]
 
** [[Struct (RW Section)#Texture_Dictionary|Struct]]
 
** [[Texture Native (RW Section)|Texture Native]] *
 
*** [[Struct (RW Section)#Texture_Native|Struct]]
 
*** [[Extension (RW Section)|Extension]]
 
** [[Extension (RW Section)|Extension]]
 
  
====PS2/PSP TXD====
+
The most notable part of the engine when used in a modding context are the [[RenderWare binary stream file|binary stream files]], which contain either the games geometry ([[DFF]]) or it's textures ([[TXD]]).
* [[Texture Dictionary (RW Section)|Texture Dictionary]]
 
** [[Struct (RW Section)#Texture_Dictionary|Struct]]
 
** [[Texture Native (RW Section)|Texture Native]] *
 
*** [[Struct (RW Section)#Texture_Native|Struct]]
 
*** [[String (RW Section)|String]] - texture name
 
*** [[String (RW Section)|String]] - mask name
 
*** [[Struct (RW Section)|Struct]]
 
**** [[Struct (RW Section)|Struct]]
 
**** [[Struct (RW Section)|Struct]]
 
*** [[Extension (RW Section)|Extension]]
 
** [[Extension (RW Section)|Extension]]
 
  
''* These chunks can appear multiple times. The count is usually given in the parent's struct.
+
== External link ==
 +
* [https://github.com/electronicarts/Renderware3Docs RenderWare 3 documentation] ({{GTAF|882649|Discussion topic}})
  
See [[RenderWare binary stream file|RenderWare binary stream file]] for further information.
+
{{N|4|SA|VC|3}}

Latest revision as of 09:15, 24 January 2019

RenderWare (RW for short) is the graphics engine by Criterion Software that was licensed and used by Rockstar games for their titles Manhunt, Bully, GTA III, Vice City and San Andreas, just as for various other games. GTA III's portable successors Liberty City Stories and Vice City Stories use the Rockstar Leeds engine that is almost a clone of the original RenderWare engine, which was already influenced by Rockstar Game's custom engine called RAGE, which was used in the later titles GTA IV and GTA V.

Versioning

Each GTA game was linked against a certain version of the RenderWare engine. The following table gives an overview over the different versions that apply to GTA.

III Vice City San Andreas
PS2 3.1.0.0 3.3.0.2 3.6.0.3
PC 3.3.0.2 3.4.0.3 3.6.0.3
Xbox 3.5.0.0 3.5.0.0 3.6.0.3
Android 3.4.0.5 3.4.0.5 3.6.0.3

Note: The japanese PC version of GTA3 uses RW 3.4.0.3 just like VC.

On binary level, versions are used in different cases, most notably the library identifier stamp found in RenderWare's binary stream files. The stamp contains the version and build number of the RW library that wrote the file. It is a number that appears in 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.

Version 3.1.0.0 and before had no binary revision and build number and the library ID stamp was just 0x00000VJN (no 0x30000 subtracted). Version 3.1.0.0 for instance would be encoded as 0x00000310. Version 3.1.0.1 (used in some GTA III files, build FFFF) on the other hand is encoded as 0x0401FFFF. To find out what version a file has when reading, RW checks the upper 16 bits and assumes the old format when they're zero.

These C example functions pack and unpack library ID stamps:

RwUInt32
libraryIDPack(RwUInt32 version, RwUInt32 build)
{
	if(version <= 0x31000)
		return version>>8;
	return (version-0x30000 & 0x3FF00) << 14 | (version & 0x3F) << 16 |
	       (build & 0xFFFF);
}

RwUInt32
libraryIDUnpackVersion(RwUInt32 libid)
{
	if(libid & 0xFFFF0000)
		return (libid>>14 & 0x3FF00) + 0x30000 |
		       (libid>>16 & 0x3F);
	return libid<<8;
}

RwUInt32
libraryIDUnpackBuild(RwUInt32 libid)
{
	if(libid & 0xFFFF0000)
		return libid & 0xFFFF;
	return 0;
}

Binary Streams

The most notable part of the engine when used in a modding context are the binary stream files, which contain either the games geometry (DFF) or it's textures (TXD).

External link