Common Data Types (Burnout Paradise)

From Burnout Wiki
(Redirected from Vector3)

Some of the more commonly seen data types in Burnout Paradise.

CgsID

CgsID Functions
C++ functions for encoding and decoding CgsIDs.

A CgsID is a typedef of uint64_t which is heavily used across the game. Its original intent appears to be as a new moniker for GtID, Criterion's in-house compressed string type, and it sees extensive use in this role. However, at times, it is also used to store the IDs colloquially referred to as GameDB IDs. Conversely, GameDB IDs are not always stored as a CgsID, commonly being a normal uint64_t or uint32_t instead.

Utilities to compress/uncompress GtIDs/CgsIDs can be found below.

Compress

Uncompress

CgsID
Name Type Length Comments
CgsID uint64_t 0x8

CgsSet/CgsArray

A CgsSet, or Set, and CgsArray, or Array, is a contiguous series of elements of a specified data type, followed by the number of elements in use. If the elements are 64 bits long, the element count will usually (but not always) be succeeded by 4 bytes of padding; otherwise, it will have no padding.

Though technically separate, Set and Array have the same structure.

As an example, the below is the structure of Set<uint16_t, 8>.

CgsContainers::Set<uint16_t, 8>
Offset Length Type Name Description Comments
0x0 0x10 uint16_t[8] maElements The elements in the array
0x10 0x4 uint32_t muLength The number of elements in use
0x14 0x4 padding

CgsBitArray/CgsFastBitArray

A CgsBitArray, or BitArray, and CgsFastBitArray, or FastBitArray, is a contiguous array of bits. Unlike an Array, the element count is not part of the structure, making it hardcoded.

Note that a BitArray is stored as a series of uint64_t. This can be confusing if the data is in little endian byte order. Due to this, every BitArray has a length which is a multiple of 8 bytes.

The below is the structure of BitArray<200>. Notice how even though the bits only take up 0x19 bytes, 0x20 bytes are allocated.

CgsContainers::BitArray<200>
Offset Length Type Name Description Comments
0x0 0x20 uint64_t[4] maxBits The elements in the array

Vectors

Vectors in Burnout Paradise are structures made up of floats. They are primarily used for positional values but have been used in other cases, such as colors and gear ratios. Though a number of types besides floats are technically supported, they are seemingly never used under the vector name.

The below structures represent the data held. Some use the FPU model, where the vectors are represented by a series of float fields. Others use the VPU model where a 128-bit space is used (the VectorIntrinsic type), causing them to be 0x10 long regardless of their structure.

VectorIntrinsic

rw::math::vpu::detail::VectorIntrinsicUnion::VectorIntrinsic
Name Type Length Comments
VectorIntrinsic float[4] 0x10 Note that this will actually be implemented as a low level vector instrinsic type, such as SSE2's __m128 on x86.

VecFloat

FPU VecFloat
Name Type Length Comments
VecFloat float 0x4
rw::math::vpu::VecFloat
Offset Length Type Name Description Comments
0x0 0x10 VectorIntrinsic mV Components:
value (float)
unused
unused
unused

Vector2

rw::math::fpu::Vector2Template<float>
Offset Length Type Name Description Comments
0x0 0x4 float x X value
0x4 0x4 float y Y value
rw::math::vpu::Vector2
Offset Length Type Name Description Comments
0x0 0x10 VectorIntrinsic mV Components:
X (float)
Y (float)
unused
unused

Vector3

rw::math::fpu::Vector3Template<float>
Offset Length Type Name Description Comments
0x0 0x4 float x X value
0x4 0x4 float y Y value
0x8 0x4 float z Z value
rw::math::vpu::Vector3
Offset Length Type Name Description Comments
0x0 0x10 VectorIntrinsic mV Components:
X (float)
Y (float)
Z (float)
unused

Vector3Plus

The FPU version of Vector3Plus does not appear to exist, or is never used.

rw::math::vpu::Vector3Plus
Offset Length Type Name Description Comments
0x0 0x10 VectorIntrinsic mV Components:
X (float)
Y (float)
Z (float)
Plus (float)

Vector4

rw::math::fpu::Vector4Template<float>
Offset Length Type Name Description Comments
0x0 0x4 float x X value
0x4 0x4 float y Y value
0x8 0x4 float z Z value
0xC 0x4 float w W value
rw::math::vpu::Vector4
Offset Length Type Name Description Comments
0x0 0x10 VectorIntrinsic mV Components:
X (float)
Y (float)
Z (float)
W (float)

Mask4

Mask4 is like a Vector4, but using unsigned integers or bools instead of floats.

No FPU version is known to exist.

rw::math::vpu::Mask4
Offset Length Type Name Description Comments
0x0 0x10 VectorIntrinsic mV Components:
X (uint32_t or bool)
Y (uint32_t or bool)
Z (uint32_t or bool)
W (uint32_t or bool)


Matrices

Matrices are structures made up of vectors. They see similar use to vectors but are three-dimensional rather than planar.

Matrix33

rw::math::vpu::Matrix33
Offset Length Type Name Description Comments
0x0 0x10 Vector3 xAxis X axis
0x10 0x10 Vector3 yAxis Y axis
0x20 0x10 Vector3 zAxis Z axis

Matrix44

rw::math::vpu::Matrix44
Offset Length Type Name Description Comments
0x0 0x10 Vector4 xAxis X axis
0x10 0x10 Vector4 yAxis Y axis
0x20 0x10 Vector4 zAxis Z axis
0x30 0x10 Vector4 wAxis W axis

Matrix44Affine

rw::math::vpu::Matrix44Affine
Offset Length Type Name Description Comments
0x0 0x10 Vector3 xAxis X axis
0x10 0x10 Vector3 yAxis Y axis
0x20 0x10 Vector3 zAxis Z axis
0x30 0x10 Vector3 wAxis W axis

Matrix44AffinePacked

rw::math::vpu::Matrix44AffinePacked
Offset Length Type Name Description Comments
0x0 0x10 Vector4 xAxis X axis
0x10 0x10 Vector4 yAxis Y axis
0x20 0x10 Vector4 zAxis Z axis

Hashes

Burnout Paradise uses several different forms of hash. This section is meant to give a brief synopsis of them; their parent pages contain more information and context.

This list is incomplete and will be added to as time goes on.

Resource ID

A CgsResourceID is a 64-bit field storing a CRC32 hash of a given Bundle resource name converted to lowercase. The 4 bytes preceding the hash are unused in Bundle 2 V2 and older, though later versions add fields which make extensive use of them. Most IDs' resource names can be determined by viewing the Bundle debug data, if present. Hashes can be generated using any of a variety of online or local calculators, such as crccalc.com.

CgsResource::ID
Offset Length Type Name Description Comments
0x0 0x8 uint64_t mHash CRC32 hash

Attribute hash

HashInt is a typedef of uint64_t. It is used in AttribSys Vault resources to refer to GameDB IDs which have been lookup8 encoded. This type has several aliases, including ExportID, Key, AssetID, Type, and TypeID.

Attrib::Attribute::HashInt
Name Type Length Comments
HashInt uint64_t 0x8

Sound hash

This type is used in Registry resources and anything accessing streams through a Registry resource. It is a custom hash which was either developed in-house or at EA. This was originally uintptr_t, however it was changed to a fixed 32-bit type (likely uint32_t) by the time the first 64-bit build was available in the remaster.

The same hash is used by the Voice Hierarchy resource type in the VoiceId and QueueElement types.

CgsSound::Playback::Name
Offset Length Type Name Description Comments
0x0 0x4 uintptr_t (original)
uint32_t (remaster)
mHash Custom hash

Language hash

A Language hash, though not explicitly defined as a type, is a JAMCRC CRC32 hash of the name of an entry in a Language resource. This name can usually be determined via the game's executable. You can encode to JAMCRC using a website such as Sunshine's CRC Calculator or crccalc.com, or you can calculate the CRC locally while either performing a bitwise NOT on the result or using an output XOR of 0.

CgsRandom

Generates a random value.

CgsNumeric::Random
Offset Length Type Name Description Comments
0x0 0x20 anon_union_0 field_0
0x20 0x8 uint64_t muSeed
0x28 0x4 uint32_t muOldestBufferIndex
0x2C 0x4 padding
Anonymous union in CgsNumeric::Random
Length Type Name Description Comments
0x20 float32_t[8] mafFloatBuffer
0x20 uint32_t[8] mauIntegerBuffer
0x20 VectorIntrinsic[2] mvVector

CgsUtf8

Used for some strings, such as those in Language resources.

CgsUnicode::UnicodeBuffer::CgsUtf8
Name Type Length Comments
CgsUtf8 uint8_t 0x1