Bundle 2/NFS Hot Pursuit

From Burnout Wiki

Need for Speed Hot Pursuit uses version 3 of the Bundle format, adding support for an additional memory type, game changer IDs, and delta bundles.

Memory types

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

Structures

CgsResource::BundleV2

Offset Length 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 0x10 uint32_t[4] mauResourceDataOffset Per-memory type resource data offsets
0x28 0x4 uint32_t muFlags Bundle flags See flags

CgsResource::BundleV2::ResourceEntry

Entries are sorted sequentially by, from highest to lowest level:

  1. Pool offset
  2. Index from ID (if Game Changer)
  3. Resource type from ID (if Game Changer)
  4. ID type
  5. Resource ID (lower 32 bits)
Offset Length Type Name Description Comments
0x0 0x8 ID mResourceId Resource ID
0x8 0x8 uint64_t muImportHash Dependency name(s) CRC32(s) Multiple are combined with a bitwise OR
0x10 0x10 uint32_t[4] mauUncompressedSizeAndAlignment Per-memory type resource sizes Has high nibble for alignment which changes between platforms
1 << [nibble] equals the memory alignment value
0x20 0x10 uint32_t[4] mauSizeAndAlignmentOnDisk Per-memory type compressed resource sizes
0x30 0x10 uint32_t[4] mauDiskOffset Per-memory type resource offsets Relative to the start of the respective memory type's data offset
0x40 0x4 uint32_t muImportOffset Imports offset
0x44 0x4 uint32_t muResourceTypeId Resource type See resource types
0x48 0x2 uint16_t muImportCount Number of imports
0x4A 0x1 uint8_t muFlags Resource flags Unused?
0x4B 0x1 uint8_t muPoolOffset Pool index
0x4C 0x4 Padding

CgsResource::BundleV2::ImportEntry

Import entries are appended to the resource data.

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

CgsResource::ID

Offset Length Type Name Description Comments
0x0 0x8 CHash mHash Resource ID ID type stored in highest 8 bits, ID in lowest 32 bits. See ID type

Game Changer ID

This is a specific type of ID which is not an explicitly defined structure, but stores extra information in the high bits of the ID.

Offset Length Type Name Description Comments
0x0 0x1 EIdType ID type See ID type
0x1 0x1 uint8_t Index
0x2 0x2 uint16_t Resource type ID See resource types
Does not always match the entry's muResourceTypeId field
0x4 0x4 uint32_t Resource ID/Game changer ID ID tracked by the game database. See UniqueId

Typedefs

CgsResource::ID::CHash

Name Type Length Comments
CHash uint64_t 0x8

Enumerations

Platform

Name Value Comments
KU_BUNDLE_PLATFORM_PC 1 PC. Reused for all Hot Pursuit Remastered platforms
KU_BUNDLE_PLATFORM_X360 2 Xbox 360
KU_BUNDLE_PLATFORM_PS3 3 PlayStation 3

CgsResource::BundleV2::eBundleFlags

Name Value Comments
E_FLAGS_DEFAULT 0x0
E_FLAGS_ZLIB_COMPRESSION 0x1 Resources are compressed using zlib
E_FLAGS_MAIN_MEM_OPTIMISATION 0x2
E_FLAGS_GRAPHICS_MEM_OPTIMISATION 0x4
E_FLAGS_CONTAINS_DEBUG_DATA 0x8 Resource string table XML data is present
E_FLAGS_NON_ASYNCH_FIXUP_REQUIRED 0x10
E_FLAGS_MULTISTREAM_BUNDLE 0x20 More than one stream is used
E_FLAGS_DELTA_BUNDLE 0x40 Contains additions to a base bundle

CgsResource::BundleV2::eImportType

Name Value Comments
E_IMPORT_TYPE_POINTER 0
E_IMPORT_TYPE_RESOURCE_HANDLE 1

CgsResource::ID::EIdType

Name Value Comments
E_ID_TYPE_NORMAL 0x0 Lowercase resource name CRC32 hash
E_ID_TYPE_GAMECHANGER 0x1 See Game Changer ID
E_ID_TYPE_RESOURCE_LIST 0x80
E_ID_TYPE_DELTA_BUNDLE 0xC0 Additions to a base resource

EMemoryType

PlayStation 3

Name Value Comments
E_MEMTYPE_MAIN 0
E_MEMTYPE_GRAPHICS_SYSTEM 1
E_MEMTYPE_GRAPHICS_LOCAL 2
E_MEMTYPE_DISPOSABLE 3
E_MEMTYPE_NUMTYPES 4

Xbox 360

Name Value Comments
E_MEMTYPE_MAIN 0
E_MEMTYPE_PHYSICAL? 1 PHYSICAL
E_MEMTYPE_DISPOSABLE 2
? 3 DUMMY
E_MEMTYPE_NUMTYPES 4

PC, Remastered

Name Value Comments
E_MEMTYPE_MAIN 0
E_MEMTYPE_DISPOSABLE 1
? 2 DUMMY
? 3 DUMMY
E_MEMTYPE_NUMTYPES 4