User Data PLG (RW Section)

From GTAMods Wiki
Revision as of 11:17, 7 September 2020 by Aschratt (talk | contribs) (User Data Types)
Jump to navigation Jump to search
{{{NAME}}}
RenderWare Stream Section
Vendor {{{VENDORNAME}}}
Module {{{MODULENAME}}}
Module ID 0x{{{MODULEID}}}
Identifier 0x{{{IDENTIFIER}}}
Chunk ID 0x{{{MODULEID}}}{{{IDENTIFIER}}}
Versions All
Hierarchy
Parents:
None
Children:
None
Extensions:
None
File Format

Custom data through the User Data extension (part of the Toolkit extensions) can be used to attach certain effects such as custom render states, morph data or other effects read by a function implemented into any of the GTA games. User data is organized as a dictionary, where a unique name maps to an array of objects.

Binary Layout

The first four bytes of the sections' content store the number of entries of the dictionary.

4b  - DWORD    - Number of dictionary entries

This value is then followed by a set of structures, where each one stores one entry of the dictionary.

Xb - TString   - Entry name (see below for a description of the binary string format)
4b - DWORD     - User data type
4b - DWORD     - Number of objects

This entry description is then followed by the actual array of elements stored under the entry name. Each array has a base data type.

User Data Types

The data type is identified by one of the following values:

0x01 - Integer (signed 32 bit integer)
0x02 - Float (32 bit single precision floating point value)
0x03 - String (see below)

String Layout

Strings are not (null-)terminated, but rather stored with a length value, followed by the actual string:

4b - DWORD     - String length (X)
Xb - CHAR[X]   - String character field

See also