Bundle

From Need For Speed Wiki

The Bundle container is the core file format of Criterion's 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 format has two major versions: the original, using the bndl magic, and Bundle 2, using the bnd2 magic. The first Bundle format underwent at least five iterations during its use from early 2006 to early-mid 2007, but it was never used in a retail game and can only be found in development builds of games such as Burnout Paradise. It was succeeded by Bundle 2, which ultimately saw use in the retail versions of Burnout Paradise (version 2), Need for Speed Hot Pursuit (version 3), and Need for Speed Most Wanted (version 5).

Bundle 2 versions 3 and 5 are described below. For information on earlier versions, see the page on the Burnout Wiki.

Layout[edit]

Memory types[edit]

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:

  1. Main Memory
  2. Graphics System
  3. Graphics Local
  4. Disposable

Keep these in mind when viewing the specs below.

Bundle 2 Version 3[edit]

BundleV2[edit]

Offset Size Type Name Description Comments
0x0 0x4 char[4] macMagicNumber Bundle magic bnd2
0x4 0x4 uint32_t muVersion Bundle version 3
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 0x4 uint32_t muResourceDataOffset Resource data offset
0x24 0x4 uint32_t muFlags Bundle flags See Flags

ResourceEntry[edit]

Offset Size Type Name Description Comments
0x0 0x8 ID mResourceId UniqueId or name CRC32 Hashed names are all lowercase. Starts with 1 if UniqueId
0x8 0x8 uint64_t muImportHash Dependency name(s) CRC32(s) Multiple are combined with a bitwise OR
0x10 0x10 uint32_t[4] mauUncompressedSizeAndAlignment File sizes (uncompressed) for chunks 1-4 Has high nibble for alignment which changes between platforms
1 << [nibble] equals the memory alignment value
0x20 0x10 uint32_t[4] mauSizeAndAlignmentOnDisk File sizes (compressed) for chunks 1-4
0x30 0x10 uint32_t[4] mauDiskOffset File offsets for chunks 1-4
0x40 0x4 uint32_t muImportOffset Imports offset
0x44 0x4 uint32_t muResourceTypeId Asset type See Resource Types
0x48 0x2 uint16_t muImportCount Num imports
0x4A 0x1 uint8_t muFlags Resource flags Unused?
0x4B 0x1 uint8_t muStreamIndex Stream index Used for having multiple assets with the same ID

ImportEntry[edit]

Offset Size Type Name Description Comments
0x0 0x8 ID mResourceId UniqueId or name CRC32 ImportEntries are appended to the end of internal files.
0x8 0x4 uint32_t muOffset
0xC 0x4 padding

Bundle 2 Version 5[edit]

BundleV2[edit]

Offset Size Type Name Description Comments
0x0 0x4 char[4] macMagicNumber Magic "bnd2"
0x4 0x2 uint16_t muVersion Format version 5
0x6 0x2 uint16_t muPlatform Platform the bundle is built for See Platform
0x8 0x4 uint32_t muDebugDataOffset ResourceStringTable offset
0xC 0x4 uint32_t muResourceEntriesCount Num entries
0x10 0x4 uint32_t muResourceEntriesOffset Resource entries Sorted by stream index first, resource ID second.
0x14 0x10 uint32_t[4] mauResourceDataOffset Offsets for chunks 1-4
0x24 0x4 uint32_t muFlags Bundle flags See eBundleFlags
0x28 0x8 ID mDefaultResourceId Default resource to access
0x30 0x4 int32_t miDefaultResourceStreamIndex Stream index of the default resource
0x34 0x3C char[4][15] macStreamName Names of the streams contained in the bundle

ResourceEntry[edit]

Offset Size Type Name Description Comments
0x0 0x8 ID mResourceId UniqueId or name CRC32 If UniqueId, starts with 01. Hashed names are all lowercase.
0x8 0x10 uint32_t[4] mauUncompressedSizeAndAlignment File sizes (uncompressed) for chunks 1-4 Has high nibble for alignment; changes between platforms
1 << [nibble] equals the memory alignment value"
0x18 0x10 uint32_t[4] mauSizeAndAlignmentOnDisk File sizes (compressed) for chunks 1-4
0x28 0x10 uint32_t[4] mauDiskOffset File offsets for chunks 1-4
0x38 0x4 uint32_t muImportOffset Imports offset
0x3C 0x4 uint32_t muResourceTypeId File type See Resource Types
0x40 0x2 uint16_t muImportCount Num imports
0x42 0x1 uint8_t muFlags Flags Unused?
0x43 0x1 uint8_t muStreamOffset Stream index Per-file. Refer to macStreamName
0x44 0x4 padding

ImportEntry[edit]

Offset Size Type Name Description Comments
0x0 0x8 ID mResourceId UniqueId or name CRC32 ImportEntries are appended to the end of internal files.
0x8 0x4 uint32_t muImportTypeAndOffset
0xC 0x4 padding

Enumerations[edit]

Bundle 2 Version 3[edit]

Platform[edit]

Not enum type.

Name Value Comments
PC 1 Reused for all Hot Pursuit Remastered platforms
X360 2
PS3 3

Flags[edit]

Not enum type.

Name Value Comments
IsCompressed 0x1 Resources are compressed using zlib
IsMainMemOptimised 0x2 Possibly IsGraphicsMemOptimised. Always used together
IsGraphicsMemOptimised 0x4 Possibly IsMainMemOptimised. Always used together
ContainsDebugData 0x8 Resource string table XML data is present
? 0x10
? 0x20 Likely is multistream bundle
? 0x40 Is delta bundle - contains additions to a base bundle

Bundle 2 Version 5[edit]

Platform[edit]

Not enum type.

Name Value Comments
PC 1
PS3 2
X360 3

CgsResource::BundleV2::eBundleFlags[edit]

Name Value Comments
E_FLAGS_DEFAULT 0x0
E_FLAGS_ZLIB_COMPRESSION 0x1 Resources are compressed using zlib
E_FLAGS_CONTAINS_DEBUG_DATA 0x2 Resource string table XML data is present
E_FLAGS_NON_ASYNCH_FIXUP_REQUIRED 0x4
E_FLAGS_MULTISTREAM_BUNDLE 0x8 More than one stream is used (graphics, sound, etc)
E_FLAGS_DELTA_BUNDLE 0x10 Contains additions to a base bundle
E_FLAGS_CONTAINS_DEFAULT_RESOURCE 0x20 A default resource ID is specified in mDefaultResourceId

CgsResource::BundleV2::eImportType[edit]

Name Value Comments
E_IMPORT_TYPE_POINTER 0
E_IMPORT_TYPE_RESOURCE_HANDLE 1