Bundle 2/Need for Speed Hot Pursuit

From Burnout Wiki
Revision as of 03:47, 3 April 2024 by Burninrubber0 (talk | contribs) (Verified ID::EIdType)

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

Hmmm...
Hmmm...
To do:
These may be named differently on other platforms. Only PS3 is listed here. (Requires investigation)

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.

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 Resource data offset
0x28 0x4 uint32_t muFlags Bundle flags See flags

CgsResource::BundleV2::ResourceEntry

Offset Length Type Name Description Comments
0x0 0x8 ID mResourceId Resource game changer ID 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 Number of imports
0x4A 0x1 uint8_t muFlags Resource flags Unused?
0x4B 0x1 uint8_t muPoolOffset Pool offset Used for having multiple assets with the same ID

CgsResource::BundleV2::ImportEntry

Offset Length Type Name Description Comments
0x0 0x8 ID mResourceId Resource game changer ID or name CRC32 Import entries are appended to the end of internal files
0x8 0x4 uint32_t muImportTypeAndOffset See import type
0xC 0x4 Padding

CgsResource::ID

Offset Length Type Name Description Comments
0x0 0x8 CHash mHash Resource ID Type at 0x0, ID at 0x4. See ID type for type info

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 Possibly IsGraphicsMemOptimised. Always used together
E_FLAGS_GRAPHICS_MEM_OPTIMISATION 0x4 Possibly IsMainMemOptimised. Always used together
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 Likely is multistream bundle
E_FLAGS_DELTA_BUNDLE 0x40 Is delta bundle - 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 UniqueId
E_ID_TYPE_RESOURCE_LIST 0x80
E_ID_TYPE_DELTA_BUNDLE 0xC0 Additions to a base bundle