From GTAModding
Jump to: navigation, search

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.


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

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 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):


Version 0x36003 build 0xFFFF for instance is encoded as 0x1803FFFF.

Version and before had no binary revision and build number and the library ID stamp was just 0x00000VJN (no 0x30000 subtracted). Version for instance would be encoded as 0x00000310. Version (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:

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

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

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).