Bundle 2: Difference between revisions

From Burnout Wiki
Content added Content deleted
m (Conform to format documentation guidelines.)
mNo edit summary
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The Bundle 2 container is the core file format of Burnout Paradise and Criterion's other 7th-gen titles, with the exception of Burnout Revenge (X360). Each Bundle holds one or more resources (assets) and contains information about each resource, such as its size, type, compression, alignment, and so on.
The Bundle 2 container is the core file format of ''Burnout Paradise'' and Criterion's other 7th-gen titles, with the exception of ''Burnout Revenge'' (X360). Each Bundle holds one or more resources (assets) and contains information about each resource, such as its size, type, compression, alignment, and so on.


Bundle 2 is used in the retail versions of Burnout Paradise, Need for Speed Hot Pursuit, and Need for Speed Most Wanted. It was preceded by the [[Bundle | original Bundle format]]. For information on the later versions used in Need for Speed, see the [https://needforspeed.miraheze.org/wiki/Bundle Need for Speed Wiki].
Bundle 2 is used in the retail versions of ''Burnout Paradise'', ''Need for Speed Hot Pursuit'', and ''Need for Speed Most Wanted''. It was preceded by the [[Bundle (original)|original Bundle format]].


=Versions=
= Overview =
{{subpage|Burnout Paradise|text=Information on Bundle 2 version 2, the format used in ''Burnout Paradise.}}
Bundles are used for nearly every asset in Burnout Paradise, with the only exceptions being the <code>JUNKYARDLIGHTING.DAT</code> text file and <code>STARDATA.DAT</code> binary file (both in the <code>ENVIRONMENTSETTINGS</code> folder), the non-RAM portion of sound assets, and video files. This makes it one of the most important formats to understand when attempting to parse assets.
{{subpage|NFS Hot Pursuit|text=Information on Bundle 2 version 3, the format used in ''Need for Speed Hot Pursuit (2010)''.}}

{{subpage|NFS Most Wanted|text=Information on Bundle 2 version 5, the format used in ''Need for Speed Most Wanted (2012)''.}}
While the header contains some valuable data, such as the flags and chunk offsets, the majority of relevant information is in resource entries, which store the ID, uncompressed and compressed size, alignment, relative offset, and type of each resource in each chunk. These also store the import offsets, which enable importing specific data from other resources.

Bundle debug data is also important to understand. Sometimes called Bundle imports, this was originally only available in development builds but shipped with every Bundle in the game in Remastered. Consisting of XML data headed by the <code>ResourceStringTable</code> element, it contains the ID, name, and type name of every resource in a respective bundle. This means that effectively every resource name in the game is known. Despite this, the resource names given by the debug data sometimes do not match the hash when encoded. In some cases, such as with Registry resources, this means the name is hardcoded.

= Memory types =
Across all Bundle versions, a common theme is the use of separate data chunks to define what memory type resources are loaded into. These chunks are as follows:

# Main Memory
# Graphics System
# Graphics Local

Keep these in mind when viewing the structures.

= Structures =
=== CgsResource::BundleV2 ===
{| class="wikitable"
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || char[4] || macMagicNumber || Bundle magic || bnd2
|-
| 0x4 || 0x4 || uint32_t || muVersion || Bundle version ||
|-
| 0x8 || 0x4 || uint32_t || muPlatform || Platform the bundle was built for || See [[#Platform | Platform]]
|-
| 0xC || 0x4 || uint32_t || muDebugDataOffset || Bundle debug data offset || ResourceStringTable XML
|-
| 0x10 || 0x4 || uint32_t || muResourceEntriesCount || Number of resources in the bundle ||
|-
| 0x14 || 0x4 || uint32_t || muResourceEntriesOffset || Resource entries offset ||
|-
| 0x18 || 0xC || uint32_t[3] || mauResourceDataOffset || Resource data offset ||
|-
| 0x24 || 0x4 || uint32_t || muFlags || Bundle flags || See [[#Flags | Flags]]
|}

=== CgsResource::BundleV2::ResourceEntry ===
{| class="wikitable"
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x8 || [[Common Data Types (Burnout Paradise)#CgsResourceID | ID]] || mResourceId || Resource name CRC32 ||
|-
| 0x8 || 0x8 || uint64_t || muImportHash || Dependency name(s) CRC32(s) || Multiple are combined with a bitwise OR
|-
| 0x10 || 0xC || uint32_t[3] || mauUncompressedSizeAndAlignment || Resource sizes (uncompressed) for each chunk || Has high nibble for alignment; changes between platforms<br>1 << [nibble] equals the memory alignment value
|-
| 0x1C || 0xC || uint32_t[3] || mauSizeAndAlignmentOnDisk || Resource sizes (compressed) for each chunk || Has high nibble for alignment; changes between platforms<br>1 << [nibble] equals the memory alignment value
|-
| 0x28 || 0xC || uint32_t[3] || mauDiskOffset || Resource offsets for each chunk || Relative to the start of the respective chunk
|-
| 0x34 || 0x4 || uint32_t || muImportOffset || Bundle imports offset ||
|-
| 0x38 || 0x4 || uint32_t || muResourceTypeId || Resource type || See [[#ResourceType | ResourceType]]
|-
| 0x3C || 0x2 || uint16_t || muImportCount || Number of imports ||
|-
| 0x3E || 0x1 || uint8_t || muFlags || ||
|-
| 0x3F || 0x1 || uint8_t || muStreamIndex || ||
|}

=== CgsResource::BundleV2::ImportEntry ===
ImportEntries are appended to the end of resources.
{| class="wikitable"
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x8 || [[Common Data Types (Burnout Paradise)#Resource ID | ID]] || mResourceId || Resource name CRC32 ||
|-
| 0x8 || 0x4 || uint32_t || muOffset || ||
|-
| 0xC || 0x4 || || || padding ||
|}

= Enumerations =
=== Platform ===
{| class="wikitable"
|-
! Name !! Value !! Comments
|-
| ? || 1 || PC. Reused for all platforms in Remastered
|-
| ? || 2 || Xbox 360
|-
| ? || 3 || PlayStation 3
|}

=== Flags ===
{| class="wikitable"
|-
! Name !! Value !! Comments
|-
| IsCompressed || 0x1 || Resources are zlib compressed
|-
| IsMainMemOptimised || 0x2 || Possibly IsGraphicsMemOptimised - always used together
|-
| IsGraphicsMemOptimised || 0x4 || Possibly IsMainMemOptimised - always used together
|-
| ContainsDebugData || 0x8 || Contains ResourceStringTable/Bundle Imports XML data
|}

=== ResourceType ===
See [[Resource Types (Burnout Paradise) | Resource Types]].

Revision as of 18:26, 21 March 2023

The Bundle 2 container is the core file format of Burnout Paradise and Criterion's other 7th-gen titles, with the exception of Burnout Revenge (X360). Each Bundle holds one or more resources (assets) and contains information about each resource, such as its size, type, compression, alignment, and so on.

Bundle 2 is used in the retail versions of Burnout Paradise, Need for Speed Hot Pursuit, and Need for Speed Most Wanted. It was preceded by the original Bundle format.

Versions

Burnout Paradise
Information on Bundle 2 version 2, the format used in Burnout Paradise.
NFS Hot Pursuit
Information on Bundle 2 version 3, the format used in Need for Speed Hot Pursuit (2010).
NFS Most Wanted
Information on Bundle 2 version 5, the format used in Need for Speed Most Wanted (2012).