Need for Speed Most Wanted uses version 5 of the Bundle format, adding support for streams and updating certain fields and enumerations.
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
Disposable
Keep these in mind when viewing the specs below.
Structures
CgsResource::BundleV2
Offset
Length
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
Number of 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
CgsResource::BundleV2::ResourceEntry
Offset
Length
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
Number of imports
0x42
0x1
uint8_t
muFlags
Flags
Unused?
0x43
0x1
uint8_t
muStreamOffset
Stream index
Per-file. Refer to macStreamName
0x44
0x4
padding
CgsResource::BundleV2::ImportEntry
Offset
Length
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
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
?
1
PC
?
2
PlayStation 3
?
3
Xbox 360
?
4
PlayStation Vita
?
5
Wii U
CgsResource::BundleV2::eBundleFlags
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
Name
Value
Comments
E_IMPORT_TYPE_POINTER
0
E_IMPORT_TYPE_RESOURCE_HANDLE
1
CgsResource::ID::EIdType
Hmmm... To do: These are from Most Wanted's symbols and need to be verified in Hot Pursuit.
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