Common Data Types (Burnout Paradise): Difference between revisions

From Burnout Wiki
Content added Content deleted
(Created page.)
 
(Vectors and matrices.)
Line 2: Line 2:


= Set/Array =
= Set/Array =
A <code>Set</code> or <code>Array</code> is a contiguous series of elements of a specified data type, followed by the number of elements. Though technically separate, <code>Set</code> and <code>Array</code> have the same structure.
A <code>Set</code> or <code>Array</code>, sometimes called <code>CgsSet</code> and <code>CgsArray</code>, 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, <code>Set</code> and <code>Array</code> have the same structure.
Typically, the element count is succeeded by 4 bytes of padding; however, as seen in Profile 1.9, it may have no padding.


As an example, the below is the structure of <code>Set<uint16_t, 8></code>.
As an example, the below is the structure of <code>Set<uint16_t, 8></code>.
Line 13: Line 13:
| 0x0 || 0x10 || uint16_t[8] || maElements || The elements in the array
| 0x0 || 0x10 || uint16_t[8] || maElements || The elements in the array
|-
|-
| 0x10 || 0x4 || uint32_t || muLength || The number of elements in the array
| 0x10 || 0x4 || uint32_t || muLength || The number of elements in use
|-
|-
| 0x14 || 0x4 || || || padding
| 0x14 || 0x4 || || || padding
Line 19: Line 19:


= BitArray =
= BitArray =
As the name would suggest, a <code>BitArray</code> is an array of bits. Unlike an <code>Array</code>, the element count is not part of the structure, making it hardcoded.
As the name would suggest, a <code>BitArray</code>, sometimes called <code>CgsBitArray</code>, is an array of bits. Unlike an <code>Array</code>, the element count is not part of the structure, making it hardcoded.


Note that a <code>BitArray</code> is stored as a series of <code>uint64_t</code>. This can be confusing if the data is in little endian byte order. Due to this, every <code>BitArray</code>, even when below 64 bits in length, is padded to 64 bits.
Note that a <code>BitArray</code> is stored as a series of <code>uint64_t</code>. This can be confusing if the data is in little endian byte order. Due to this, every <code>BitArray</code>, even when below 64 bits in length, is padded to 64 bits.
Line 32: Line 32:


= CgsID =
= CgsID =
A <code>CgsID</code>, though technically just a typedef of <code>uint64_t</code>, 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 <code>CgsID</code>, commonly being a normal <code>uint64_t</code> or <code>uint32_t</code> instead.
A <code>CgsID</code> is a typedef of <code>uint64_t</code> 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 <code>CgsID</code>, commonly being a normal <code>uint64_t</code> or <code>uint32_t</code> instead.
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 40: Line 40:
|}
|}


= Vectors =
= Vector =
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.
Criterion used several vector formats, including <code>Vector3</code>, <code>Vector3Plus</code>, and <code>Vector4</code>. Todo.


The below structures represent the data held, but many vectors use the <code>VectorIntrinsic</code> type, causing them to be 0x10 long regardless of their structure.
= Matrices =
=== VectorIntrinsic ===
Criterion used several matrix formats, including <code>Matrix33</code>, <code>Matrix44</code>, and <code>Matrix44Affine</code>. Todo.
{| class="wikitable"
|-
! Name !! Type !! Size
|-
| VectorIntrinsic || float[4] || 0x10
|}
=== Vector2 ===
{| class="wikitable"
|-
! Offset !! Size !! Type !! Name !! Description
|-
| 0x0 || 0x4 || float || x || X value
|-
| 0x4 || 0x4 || float || y || Y value
|}
=== Vector3 ===
{| class="wikitable"
|-
! Offset !! Size !! Type !! Name !! Description
|-
| 0x0 || 0x4 || float || x || X value
|-
| 0x4 || 0x4 || float || y || Y value
|-
| 0x8 || 0x4 || float || z || Z value
|}
=== Vector3Plus/Vector4 ===
{| class="wikitable"
|-
! Offset !! Size !! Type !! Name !! Description
|-
| 0x0 || 0x4 || float || x || X value
|-
| 0x4 || 0x4 || float || y || Y value
|-
| 0x8 || 0x4 || float || z || Z value
|-
| 0xC || 0x4 || float || w || W value
|}
= Matrix =
Matrices are structures made up of vectors. They see similar use to vectors but are three-dimensional rather than planar.
=== Matrix33 ===
{| class="wikitable"
|-
! Offset !! Size !! Type !! Name !! Description
|-
| 0x0 || 0x10 || Vector3 || xAxis || X axis
|-
| 0x10 || 0x10 || Vector3 || yAxis || Y axis
|-
| 0x20 || 0x10 || Vector3 || zAxis || Z axis
|}
=== Matrix44 ===
{| class="wikitable"
|-
! Offset !! Size !! Type !! Name !! Description
|-
| 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 ===
{| class="wikitable"
|-
! Offset !! Size !! Type !! Name !! Description
|-
| 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 ===
{| class="wikitable"
|-
! Offset !! Size !! Type !! Name !! Description
|-
| 0x0 || 0x10 || Vector4 || xAxis || X axis
|-
| 0x10 || 0x10 || Vector4 || yAxis || Y axis
|-
| 0x20 || 0x10 || Vector4 || zAxis || Z axis
|}


= Hashes =
= Hashes =

Revision as of 22:10, 2 November 2021

Some of the more commonly seen data types in Burnout Paradise. This list is WIP.

Set/Array

A Set or Array, sometimes called CgsSet and CgsArray, 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>.

Offset Size Type Name Description
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

BitArray

As the name would suggest, a BitArray, sometimes called CgsBitArray, is an 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, even when below 64 bits in length, is padded to 64 bits.

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

Offset Size Type Name Description
0x0 0x20 uint64_t[4] maxBits The elements in the array

CgsID

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.

Name Type Size
CgsID uint64_t 0x8

Vector

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.

The below structures represent the data held, but many vectors use the VectorIntrinsic type, causing them to be 0x10 long regardless of their structure.

VectorIntrinsic

Name Type Size
VectorIntrinsic float[4] 0x10

Vector2

Offset Size Type Name Description
0x0 0x4 float x X value
0x4 0x4 float y Y value

Vector3

Offset Size Type Name Description
0x0 0x4 float x X value
0x4 0x4 float y Y value
0x8 0x4 float z Z value

Vector3Plus/Vector4

Offset Size Type Name Description
0x0 0x4 float x X value
0x4 0x4 float y Y value
0x8 0x4 float z Z value
0xC 0x4 float w W value

Matrix

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

Matrix33

Offset Size Type Name Description
0x0 0x10 Vector3 xAxis X axis
0x10 0x10 Vector3 yAxis Y axis
0x20 0x10 Vector3 zAxis Z axis

Matrix44

Offset Size Type Name Description
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

Offset Size Type Name Description
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

Offset Size Type Name Description
0x0 0x10 Vector4 xAxis X axis
0x10 0x10 Vector4 yAxis Y axis
0x20 0x10 Vector4 zAxis Z axis

Hashes

Criterion used several hash formats, including HashInt/TypeID (AttribSys), ID (Bundle), and CgsSound::PlayBack::Hash (Registry). Todo.