Bundle 2/Burnout Paradise

From Burnout Wiki

Bundles are used for nearly every asset in Burnout Paradise, with the only exceptions being the JUNKYARDLIGHTING.DAT text file and STARDATA.DAT binary file (both in the ENVIRONMENTSETTINGS 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.

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 ResourceStringTable 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

Separate data chunks are used to define what memory type resources are loaded into. These chunks are platform specific (see ESmallResourceMemType). Keep these in mind when viewing the structures.

Resources always have data in Main Memory. If the resource is split, headers are loaded into Main Memory, while the other portion is typically loaded into Graphics Local on PS3, Physical on X360, and Disposable on PC and all Remastered variants. In resource documentation, these will be simplified to a "secondary" type. On PS3, some resources' secondary portion may be loaded into Graphics System; in that case, it will be listed separately.

Note that resources only ever have primary and secondary portions, never a tertiary one. Even in bundles where all three memory types are used, such as SHADERS.BUNDLE on PS3, resources only have two portions.

Structures

CgsResource::BundleV2

Offset Length Type Name Description Comments
0x0 0x4 char[4] macMagicNumber Bundle magic bnd2
0x4 0x4 uint32_t muVersion Bundle version 2
0x8 0x4 uint32_t muPlatform Platform the bundle was built for See 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 Per-memory type resource data offsets
0x24 0x4 uint32_t muFlags Bundle flags See flags

CgsResource::BundleV2::ResourceEntry

Entries are sorted sequentially by resource ID.

Offset Length Type Name Description Comments
0x0 0x8 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 Per-memory type resource sizes Has high nibble for alignment; changes between platforms
1 << [nibble] equals the memory alignment value
0x1C 0xC uint32_t[3] mauSizeAndAlignmentOnDisk Per-memory type compressed resource sizes
0x28 0xC uint32_t[3] mauDiskOffset Per-memory type resource offsets Relative to the start of the respective memory type's data offset
0x34 0x4 uint32_t muImportOffset Imports offset
0x38 0x4 uint32_t muResourceTypeId Resource type See Resource Types
0x3C 0x2 uint16_t muImportCount Number of imports
0x3E 0x1 uint8_t muFlags Resource flags Unused?
0x3F 0x1 uint8_t muStreamIndex Unused

CgsResource::BundleV2::ImportEntry

ImportEntries are appended to the end of resources.

Offset Length Type Name Description Comments
0x0 0x8 ID mResourceId Imported resource ID
0x8 0x4 uint32_t muOffset Offset of the pointer to be set at runtime
0xC 0x4 Padding

Enumerations

Platform

Three constants used by the platform field.

Name Value Comments
KU_BUNDLE_DX9? 1 PC. Reused for all platforms in Remastered
KU_BUNDLE_X360 2 Xbox 360
KU_BUNDLE_PS3 3 PlayStation 3

Flags

Name Value Comments
E_BUNDLEFLAG_COMPRESSED? 0x1 Resources are zlib compressed
? 0x2 Is main mem optimised. Always set same as is graphics mem optimised
? 0x4 Is graphics mem optimised. Always set same as is main mem optimised
E_BUNDLEFLAG_HAS_DEBUG_DATA? 0x8 Contains ResourceStringTable/Bundle Imports XML data

CgsResource::ESmallResourceMemType

PlayStation 3

Name Value Comments
E_MEMTYPE_MAINMEMORY 0
E_MEMTYPE_GRAPHICS_SYSTEM 1
E_MEMTYPE_GRAPHICS_LOCAL 2
E_MEMTYPE_NUMTYPES 3

Xbox 360

Name Value Comments
E_MEMTYPE_MAINMEMORY 0
? 1 PHYSICAL
? 2 DUMMY
E_MEMTYPE_NUMTYPES 3

PC, Remastered

Name Value Comments
E_MEMTYPE_MAINMEMORY 0
? 1 DISPOSABLE
? 2 DUMMY
E_MEMTYPE_NUMTYPES 3