Bundle 2/Need for Speed Most Wanted: Difference between revisions

From Burnout Wiki
Content added Content deleted
(Add Vita and Wii U platforms)
(Updated descriptions, added game changer info, and corrected memory types (added per-platform types))
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:


= Memory types =
= 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:
Separate data chunks are used to define what memory type resources are loaded into. These chunks are platform specific (see [[#EMemoryType|EMemoryType]]). Keep these in mind when viewing the structures.
# Main Memory
# Graphics System
# Graphics Local
# Disposable

Keep these in mind when viewing the specs below.


= Structures =
= Structures =
Line 15: Line 9:
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x4 || char[4] || macMagicNumber || Magic || bnd2
| 0x0 || 0x4 || char[4] || macMagicNumber || Bundle magic || bnd2
|-
|-
| 0x4 || 0x2 || uint16_t || muVersion || Format version || 5
| 0x4 || 0x2 || uint16_t || muVersion || Bundle version || 5
|-
|-
| 0x6 || 0x2 || uint16_t || muPlatform || Platform the bundle is built for || See [[#Platform|Platform]]
| 0x6 || 0x2 || uint16_t || muPlatform || Platform the bundle is built for || See [[#Platform|Platform]]
|-
|-
| 0x8 || 0x4 || uint32_t || muDebugDataOffset || ResourceStringTable offset ||
| 0x8 || 0x4 || uint32_t || muDebugDataOffset || Bundle debug data offset || ResourceStringTable XML
|-
|-
| 0xC || 0x4 || uint32_t || muResourceEntriesCount || Number of entries ||
| 0xC || 0x4 || uint32_t || muResourceEntriesCount || Number of resources in the bundle ||
|-
|-
| 0x10 || 0x4 || uint32_t || muResourceEntriesOffset || Resource entries || Sorted by stream index first, resource ID second.
| 0x10 || 0x4 || uint32_t || muResourceEntriesOffset || Resource entries offset ||
|-
|-
| 0x14 || 0x10 || uint32_t[4] || mauResourceDataOffset || Offsets for chunks 1-4 ||
| 0x14 || 0x10 || uint32_t[4] || mauResourceDataOffset || Per-memory type resource data offsets ||
|-
|-
| 0x24 || 0x4 || uint32_t || muFlags || Bundle flags || See [[#CgsResource::BundleV2::eBundleFlags|eBundleFlags]]
| 0x24 || 0x4 || uint32_t || muFlags || Bundle flags || See [[#CgsResource::BundleV2::eBundleFlags|eBundleFlags]]
Line 39: Line 33:


=== CgsResource::BundleV2::ResourceEntry ===
=== CgsResource::BundleV2::ResourceEntry ===
Entries are sorted sequentially by, from highest to lowest level:
# Stream offset
# Index from ID (if Game Changer)
# Resource type from ID (if Game Changer)
# ID type
# Resource ID (lower 32 bits)

{| class="wikitable"
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x8 || [[#CgsResource::ID|ID]] || mResourceId || UniqueId or name CRC32 || If UniqueId, starts with 01. Hashed names are all lowercase.
| 0x0 || 0x8 || [[#CgsResource::ID|ID]] || mResourceId || Resource ID ||
|-
|-
| 0x8 || 0x10 || uint32_t[4] || mauUncompressedSizeAndAlignment || File sizes (uncompressed) for chunks 1-4 || Has high nibble for alignment; changes between platforms<br>1 << [nibble] equals the memory alignment value"
| 0x8 || 0x10 || uint32_t[4] || mauUncompressedSizeAndAlignment || Per-memory type resource sizes || Has high nibble for alignment; changes between platforms<br>1 << [nibble] equals the memory alignment value
|-
|-
| 0x18 || 0x10 || uint32_t[4] || mauSizeAndAlignmentOnDisk || File sizes (compressed) for chunks 1-4 ||
| 0x18 || 0x10 || uint32_t[4] || mauSizeAndAlignmentOnDisk || Per-memory type compressed resource sizes ||
|-
|-
| 0x28 || 0x10 || uint32_t[4] || mauDiskOffset || File offsets for chunks 1-4 ||
| 0x28 || 0x10 || uint32_t[4] || mauDiskOffset || Per-memory type resource offsets || Relative to the start of the respective memory type's data offset
|-
|-
| 0x38 || 0x4 || uint32_t || muImportOffset || Imports offset ||
| 0x38 || 0x4 || uint32_t || muImportOffset || Imports offset ||
|-
|-
| 0x3C || 0x4 || uint32_t || muResourceTypeId || File type || See [[Resource Types (Need for Speed)|resource types]]
| 0x3C || 0x4 || uint32_t || muResourceTypeId || Resource type || See [[Resource Types (Need for Speed)|resource types]]
|-
|-
| 0x40 || 0x2 || uint16_t || muImportCount || Number of imports ||
| 0x40 || 0x2 || uint16_t || muImportCount || Number of imports ||
|-
|-
| 0x42 || 0x1 || uint8_t || muFlags || Flags || Unused?
| 0x42 || 0x1 || uint8_t || muFlags || Resource flags || Unused?
|-
|-
| 0x43 || 0x1 || uint8_t || muStreamOffset || Stream index || Per-file. Refer to macStreamName
| 0x43 || 0x1 || uint8_t || muStreamOffset || Stream index || Per-bundle. Refer to macStreamName
|-
|-
| 0x44 || 0x4 || || || padding ||
| 0x44 || 0x4 || || || Padding ||
|}
|}


=== CgsResource::BundleV2::ImportEntry ===
=== CgsResource::BundleV2::ImportEntry ===
Import entries are appended to the resource data.

{| class="wikitable"
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x8 || [[#CgsResource::ID|ID]] || mResourceId || UniqueId or name CRC32 || ImportEntries are appended to the end of internal files.
| 0x0 || 0x8 || [[#CgsResource::ID|ID]] || mResourceId || Imported resource ID ||
|-
|-
| 0x8 || 0x4 || uint32_t || muImportTypeAndOffset || ||
| 0x8 || 0x4 || uint32_t || muImportTypeAndOffset || Offset of the pointer to be set at runtime || See [[#CgsResource::BundleV2::eImportType|import type]]
|-
|-
| 0xC || 0x4 || || || padding ||
| 0xC || 0x4 || || || Padding ||
|}
|}


Line 78: Line 81:
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x8 || [[#CgsResource::ID::CHash|CHash]] || mHash || Resource ID || Type at 0x0, ID at 0x4. See [[#CgsResource::ID::EIdType|ID type]] for type info
| 0x0 || 0x8 || [[#CgsResource::ID::CHash|CHash]] || mHash || Resource ID || ID type stored in highest 8 bits, ID in lowest 32 bits. See [[#CgsResource::ID::EIdType|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.

{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x1 || [[#CgsResource::ID::EIdType|EIdType]] || || ID type || See [[#CgsResource::ID::EIdType|ID type]]
|-
| 0x1 || 0x1 || uint8_t || || Index ||
|-
| 0x2 || 0x2 || uint16_t || || Resource type ID || See [[Resource Types (Need for Speed)|resource types]]<br>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]]
|}
|}


Line 94: Line 112:
! Name !! Value !! Comments
! Name !! Value !! Comments
|-
|-
| ? || 1 || PC
| KU_BUNDLE_PLATFORM_PC || 1 || PC
|-
|-
| ? || 2 || PlayStation 3
| KU_BUNDLE_PLATFORM_PS3 || 2 || PlayStation 3
|-
|-
| ? || 3 || Xbox 360
| KU_BUNDLE_PLATFORM_X360 || 3 || Xbox 360
|-
|-
| ? || 4 || PlayStation Vita
| ? || 4 || PlayStation Vita
Line 117: Line 135:
| E_FLAGS_NON_ASYNCH_FIXUP_REQUIRED || 0x4 ||
| E_FLAGS_NON_ASYNCH_FIXUP_REQUIRED || 0x4 ||
|-
|-
| E_FLAGS_MULTISTREAM_BUNDLE || 0x8 || More than one stream is used (graphics, sound, etc)
| E_FLAGS_MULTISTREAM_BUNDLE || 0x8 || More than one stream is used
|-
|-
| E_FLAGS_DELTA_BUNDLE || 0x10 || Contains additions to a base bundle
| E_FLAGS_DELTA_BUNDLE || 0x10 || Contains additions to a base bundle
Line 134: Line 152:


=== CgsResource::ID::EIdType ===
=== CgsResource::ID::EIdType ===
{{todo|These are from Most Wanted's symbols and need to be verified in Hot Pursuit.}}
{| class="wikitable"
{| class="wikitable"
! Name !! Value !! Comments
! Name !! Value !! Comments
Line 140: Line 157:
| E_ID_TYPE_NORMAL || 0x0 || Lowercase resource name CRC32 hash
| E_ID_TYPE_NORMAL || 0x0 || Lowercase resource name CRC32 hash
|-
|-
| E_ID_TYPE_GAMECHANGER || 0x1 || See [[UniqueId]]
| E_ID_TYPE_GAMECHANGER || 0x1 || See [[#Game Changer ID|Game Changer ID]]
|-
|-
| E_ID_TYPE_RESOURCE_LIST || 0x80 ||
| E_ID_TYPE_RESOURCE_LIST || 0x80 ||
|-
|-
| E_ID_TYPE_DELTA_BUNDLE || 0xC0 || Additions to a base bundle
| E_ID_TYPE_DELTA_BUNDLE || 0xC0 || Additions to a base resource
|}

=== EMemoryType ===
==== PlayStation 3, PlayStation Vita ====
{| class="wikitable"
! 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 ====
{| class="wikitable"
! Name !! Value !! Comments
|-
| E_MEMTYPE_MAIN || 0 ||
|-
| E_MEMTYPE_PHYSICAL? || 1 || PHYSICAL
|-
| E_MEMTYPE_DISPOSABLE || 2 ||
|-
| ? || 3 || DUMMY
|-
| E_MEMTYPE_NUMTYPES || 4 ||
|}

==== PC ====
{| class="wikitable"
! Name !! Value !! Comments
|-
| E_MEMTYPE_MAIN || 0 ||
|-
| E_MEMTYPE_DISPOSABLE || 1 ||
|-
| ? || 2 || DUMMY
|-
| ? || 3 || DUMMY
|-
| E_MEMTYPE_NUMTYPES || 4 ||
|}

==== Wii U ====
{| class="wikitable"
! Name !! Value !! Comments
|-
| E_MEMTYPE_MAIN || 0 ||
|-
| ? || 1 || MEM1
|-
| ? || 2 || GRAPHICS_MEM2
|-
| E_MEMTYPE_DISPOSABLE || 3 ||
|-
| E_MEMTYPE_NUMTYPES || 4 ||
|}
|}

Revision as of 01:41, 4 April 2024

Need for Speed Most Wanted uses version 5 of the Bundle format, adding support for streams and updating certain fields and enumerations.

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 0x2 uint16_t muVersion Bundle version 5
0x6 0x2 uint16_t muPlatform Platform the bundle is built for See Platform
0x8 0x4 uint32_t muDebugDataOffset Bundle debug data offset ResourceStringTable XML
0xC 0x4 uint32_t muResourceEntriesCount Number of resources in the bundle
0x10 0x4 uint32_t muResourceEntriesOffset Resource entries offset
0x14 0x10 uint32_t[4] mauResourceDataOffset Per-memory type resource data offsets
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

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

  1. Stream 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 0x10 uint32_t[4] mauUncompressedSizeAndAlignment Per-memory type resource sizes Has high nibble for alignment; changes between platforms
1 << [nibble] equals the memory alignment value
0x18 0x10 uint32_t[4] mauSizeAndAlignmentOnDisk Per-memory type compressed resource sizes
0x28 0x10 uint32_t[4] mauDiskOffset Per-memory type resource offsets Relative to the start of the respective memory type's data offset
0x38 0x4 uint32_t muImportOffset Imports offset
0x3C 0x4 uint32_t muResourceTypeId Resource type See resource types
0x40 0x2 uint16_t muImportCount Number of imports
0x42 0x1 uint8_t muFlags Resource flags Unused?
0x43 0x1 uint8_t muStreamOffset Stream index Per-bundle. Refer to macStreamName
0x44 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
KU_BUNDLE_PLATFORM_PS3 2 PlayStation 3
KU_BUNDLE_PLATFORM_X360 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
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

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, PlayStation Vita

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

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

Wii U

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