Bundle (original): Difference between revisions

m
Memory address comments
m (Updated common data type link.)
m (Memory address comments)
 
(8 intermediate revisions by 2 users not shown)
Line 5:
The Bundle format underwent at least five iterations during its use from early 2006 to early-mid 2007. At present, only files using Bundle version 3, 4, and 5 have been discovered. It was succeeded by the [[Bundle 2]] container.
 
= OverviewMemory types =
Separate data chunks are used to define what memory type resources are loaded into. These chunks are platform specific (see [[#Base resource types|base resource types]]). Keep these in mind when viewing the structures.
Bundles are used for nearly every asset in Burnout Paradise. This makes it one of the most important formats to understand when attempting to parse assets.
 
Resources always have data in Main Memory. If the resource is split, headers are loaded into Main Memory, while the other portion is typically loaded into into Graphics Local on PS3 and Physical on Xbox 360. '''In resource documentation, these will be simplified to a "secondary" type.''' Resources only ever have primary and secondary portions. On PS3, some resources' secondary portion may be loaded into Graphics System; in that case, it will be listed separately.
While the header contains some valuable data, such as the flags and chunk offsets, the majority of relevant information is in resource entries, which store the size, alignment, offset, and type of each resource in each chunk. These also store the import offsets, which enable importing specific data from other resources.
 
= Structures =
Bundle debug data is also important to understand. Sometimes called Bundle imports, it consists of XML data headed by the <code>ResourceStringTable</code> element and contains the ID, name, and type name of every resource in a respective bundle. This means that where debug data is present, every resource name is known. Despite this, the resource names given by the debug data sometimes do not match the hash when encoded. In some cases, such as with Registry resources, this means the name is hardcoded.
=== CgsResource::Bundle ===
==== PlayStation 3 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || uint32_t || muMagicNumber || Bundle magic || bndl
|-
| 0x4 || 0x4 || uint32_t || muVersion || Bundle version || 3 in base, 4 in V4, 5 in V5
|-
| 0x8 || 0x4 || uint32_t || muNumResources || Number of resources in the bundle ||
|-
| 0xC || 0x30 || [[#rw::ResourceDescriptor|ResourceDescriptor]][6] || mBundleResourceDescriptor || Size and alignment of each chunk ||
|-
| 0x3C || 0x18 || [[#rw::Resource|Resource]][6] || mAllocatedResource || Memory address of each chunk || Set at runtime
|-
| 0x54 || 0x4 || uint32_t || mHashTableOffset || Resource IDs offset || List of [[Resource ID|resource IDs]]
|-
| 0x58 || 0x4 || uint32_t || mResourceEntriesOffset || Resource entries offset || See [[#CgsResource::Bundle::ResourceEntry|ResourceEntry]]
|-
| 0x5C || 0x4 || uint32_t || mImportTablesOffset || Imports offset || See [[#CgsResource::Bundle::ImportTable|ImportTable]]
|-
| 0x60 || 0x4 || uint32_t || mResourceDataOffset || Resource data offset ||
|-
| 0x64 || 0x4 || uint32_t || muPlatform || Platform the bundle was built for || See [[#Platform|Platform]]
|}
 
==== MemoryXbox types360 ====
{| class="wikitable"
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:
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || uint32_t || muMagicNumber || Bundle magic || bndl
|-
| 0x4 || 0x4 || uint32_t || muVersion || Bundle version || 3 in base, 4 in V4, 5 in V5
|-
| 0x8 || 0x4 || uint32_t || muNumResources || Number of resources in the bundle ||
|-
| 0xC || 0x28 || [[#rw::ResourceDescriptor|ResourceDescriptor]][5] || mBundleResourceDescriptor || Size and alignment of each chunk ||
|-
| 0x34 || 0x14 || [[#rw::Resource|Resource]][5] || mAllocatedResource || Memory address of each chunk || Set at runtime
|-
| 0x48 || 0x4 || uint32_t || mHashTableOffset || Resource IDs offset || List of [[Resource ID|resource IDs]]
|-
| 0x4C || 0x4 || uint32_t || mResourceEntriesOffset || Resource entries offset || See [[#CgsResource::Bundle::ResourceEntry|ResourceEntry]]
|-
| 0x50 || 0x4 || uint32_t || mImportTablesOffset || Imports offset || See [[#CgsResource::Bundle::ImportTable|ImportTable]]
|-
| 0x54 || 0x4 || uint32_t || mResourceDataOffset || Resource data offset ||
|-
| 0x58 || 0x4 || uint32_t || muPlatform || Platform the bundle was built for || See [[#Platform|Platform]]
|}
 
==== PC ====
# Main Memory
{| class="wikitable"
# Disposable
! Offset !! Length !! Type !! Name !! Description !! Comments
# Physical
|-
# Uninitialized
| 0x0 || 0x4 || uint32_t || muMagicNumber || Bundle magic || bndl
# Disposable uninitialized
|-
| 0x4 || 0x4 || uint32_t || muVersion || Bundle version || 3 in base, 4 in V4, 5 in V5
|-
| 0x8 || 0x4 || uint32_t || muNumResources || Number of resources in the bundle ||
|-
| 0xC || 0x20 || [[#rw::ResourceDescriptor|ResourceDescriptor]][4] || mBundleResourceDescriptor || Size and alignment of each chunk ||
|-
| 0x2C || 0x10 || [[#rw::Resource|Resource]][4] || mAllocatedResource || Memory address of each chunk || Set at runtime
|-
| 0x3C || 0x4 || uint32_t || mHashTableOffset || Resource IDs offset || List of [[Resource ID|resource IDs]]
|-
| 0x40 || 0x4 || uint32_t || mResourceEntriesOffset || Resource entries offset || See [[#CgsResource::Bundle::ResourceEntry|ResourceEntry]]
|-
| 0x44 || 0x4 || uint32_t || mImportTablesOffset || Imports offset || See [[#CgsResource::Bundle::ImportTable|ImportTable]]
|-
| 0x48 || 0x4 || uint32_t || mResourceDataOffset || Resource data offset ||
|-
| 0x4C || 0x4 || uint32_t || muPlatform || Platform the bundle was built for || See [[#Platform|Platform]]
|}
 
=== CgsResource::BundleV4ExtendedData ===
Keep these in mind when viewing the structures.
==== PlayStation 3 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x68 || CgsResource::BaseBundleExtendedData || Base class || || See [[#CgsResource::Bundle|Bundle]]
|-
| 0x68 || 0x4 || uint32_t || muFlags || Bundle flags || See [[#CgsResource::EFlags|Flags]]
|-
| 0x6C || 0x4 || uint32_t || muUncompressedDescriptorCount || Number of compressed resources ||
|-
| 0x70 || 0x4 || [[#rw::ResourceDescriptor|ResourceDescriptor]]* || mpUncompressedResourceDescriptors || Compression information offset ||
|}
 
==== Xbox 360 ====
= Structures =
{| class="wikitable"
The original Bundle format's versions were treated more like additions to the previous version. Thus, rather than a full structure for each, only their additions are described here.
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x5C || CgsResource::BaseBundleExtendedData || Base class || || See [[#CgsResource::Bundle|Bundle]]
|-
| 0x5C || 0x4 || uint32_t || muFlags || Bundle flags || See [[#CgsResource::EFlags|Flags]]
|-
| 0x60 || 0x4 || uint32_t || muUncompressedDescriptorCount || Number of compressed resources ||
|-
| 0x64 || 0x4 || [[#rw::ResourceDescriptor|ResourceDescriptor]]* || mpUncompressedResourceDescriptors || Compression information offset ||
|}
 
==== PC ====
== CgsResource::BundleHeaderBase ==
=== Bundle ===
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x50 || CgsResource::BaseBundleExtendedData || Base class || || See [[#CgsResource::Bundle|Bundle]]
|-
| 0x50 || 0x4 || uint32_t || muFlags || Bundle flags || See [[#CgsResource::EFlags|Flags]]
|-
| 0x5C || 0x4 || uint32_t || muUncompressedDescriptorCount || Number of compressed resources ||
|-
| 0x60 || 0x4 || [[#rw::ResourceDescriptor|ResourceDescriptor]]* || mpUncompressedResourceDescriptors || Compression information offset ||
|}
 
=== CgsResource::BundleV5ExtendedData ===
==== PlayStation 3 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x40x74 || char[4[#CgsResource::BundleV4ExtendedData|BundleV4ExtendedData]] || macMagicNumber || BundleBase magicclass || bndl
|-
| 0x40x74 || 0x4 || uint32_tint32_t || muVersionmiMainMemAlignment || Bundle version || 3 in base, 4 in V4, 5 in V5
|-
| 0x80x78 || 0x4 || uint32_tint32_t || muResourceEntriesCountmiGraphicsMemAlignment || Number of resources in the bundle ||
|}
 
==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0xC0x0 || 0x280x68 || [[#Size and alignment CgsResource::BundleV4ExtendedData| Size and alignmentBundleV4ExtendedData]][5] || || Size and alignment of eachBase chunkclass ||
|-
| 0x340x68 || 0x140x4 || uint32_t[5]int32_t || miMainMemAlignment || Memory address of each chunk ||
|-
| 0x480x6C || 0x4 || uint32_tint32_t || miGraphicsMemAlignment || Resource IDs offset ||
|}
 
==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x5C || [[#CgsResource::BundleV4ExtendedData|BundleV4ExtendedData]] || || Base class ||
| 0x4C || 0x4 || uint32_t || muResourceEntriesOffset || Resource entries offset ||
|-
| 0x500x5C || 0x4 || uint32_tint32_t || miMainMemAlignment || Imports offset ||
|-
| 0x540x60 || 0x4 || uint32_tint32_t || muResourceDataOffsetmiGraphicsMemAlignment || Resource data offset ||
|}
 
=== CgsResource::Bundle::ResourceEntry ===
==== PlayStation 3 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x580x0 || 0x4 || uint32_tvoid* || muPlatformmpResource || PlatformResource thedata bundlememory was built foraddress || SeeSet [[#Platform |at Platform]]runtime
|-
| 0x4 || 0x4 || [[#CgsResource::Bundle::ImportTable|ImportTable]]* || mpImportTable || Bundle imports offset ||
|-
| 0x8 || 0x4 || CgsResource::Type* || mpType || Resource type || Type ID replaced by pointer at runtime. See [[Resource Types]]
|-
| 0xC || 0x30 || [[#rw::ResourceDescriptor|ResourceDescriptor]][6] || mSerialisedResourceDescriptor || Resource sizes in bundle<br />Compressed size if compression used ||
|-
| 0x3C || 0x30 || [[#rw::ResourceDescriptor|ResourceDescriptor]][6] || mSerialisedOffsetResourceDescriptor || Offsets in bundle || Alignment is unused (always 1)
|-
| 0x6C || 0x18 || [[#rw::Resource|Resource]][6] || mSerialisedResource || Memory addresses || Set at runtime
|}
 
==== ResourceEntryXbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || void* || mpResource || Resource data memory address || Set at runtime
|-
| 0x4 || 0x4 || [[#CgsResource::Bundle::ImportTable|ImportTable]]* || mpImportTable || Bundle imports offset ||
|-
| 0x8 || 0x4 || CgsResource::Type* || mpType || Resource type || Type ID replaced by pointer at runtime. See [[Resource Types]]
|-
| 0xC || 0x28 || [[#rw::ResourceDescriptor|ResourceDescriptor]][5] || mSerialisedResourceDescriptor || Resource sizes in bundle<br />Compressed size if compression used ||
|-
| 0x34 || 0x28 || [[#rw::ResourceDescriptor|ResourceDescriptor]][5] || mSerialisedOffsetResourceDescriptor || Offsets in bundle || Alignment is unused (always 1)
|-
| 0x5C || 0x14 || [[#rw::Resource|Resource]][5] || mSerialisedResource || Memory addresses || Set at runtime
|}
 
==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || uint32_tvoid* || mpResource || Resource data memory address || Set at runtime
|-
| 0x4 || 0x4 || uint32_t[[#CgsResource::Bundle::ImportTable|ImportTable]]* || muImportOffsetmpImportTable || Bundle imports offset ||
|-
| 0x8 || 0x4 || uint32_tCgsResource::Type* || muResourceTypeIdmpType || Resource type || Type ID replaced by pointer at runtime. See [[#ResourceType |Resource ResourceTypeTypes]]
|-
| 0xC || 0x20 || [[#rw::ResourceDescriptor|ResourceDescriptor]][4] || mSerialisedResourceDescriptor || Resource sizes in bundle<br />Compressed size if compression used ||
| 0xC || 0x28 || [[#Size and alignment | Size and alignment]][5] || mauSizeAndAlignmentOnDisk || ||
|-
| 0x340x2C || 0x280x20 || [[#Size and alignment rw::ResourceDescriptor| Size and alignmentResourceDescriptor]][54] || mauDiskOffsetmSerialisedOffsetResourceDescriptor || Offsets in bundle || Alignment is unused (always 1)
|-
| 0x5C0x4C || 0x140x10 || uint32_t[5[#rw::Resource|Resource]][4] || mSerialisedResource || Memory addresses || SwappedSet at endianruntime
|}
 
=== CgsResource::Bundle::ImportTable ===
=== Imports ===
This structure is followed by an [[#CgsResource::Bundle::ImportEntry|ImportEntry]] array.
This is not a structure as such; rather, it is <code>uint32_t muImportCount</code> followed by four bytes of padding, then a set of import entries of an amount defined by the aforementioned count.
 
=== ImportEntry ===
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || uint32_t || muNumImports || Number of import entries ||
|-
| 0x8 || 0x4 || uint32_t || pad1 || Padding ||
|}
 
=== CgsResource::Bundle::ImportEntry ===
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x8 || [[Resource ID | ID]] || mResourceIdmImportID || Resource name CRC32 ||
|-
| 0x8 || 0x4 || uint32_tRwUInt32 || muOffset || ||
|-
| 0xC || 0x4 || || || paddingPadding ||
|}
 
=== Size and alignmentrw::ResourceDescriptor ===
==== PlayStation 3 ====
This structure contains fields for size and alignment, though alignment sometimes goes unused. Real name is not known.
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x30 || [[#rw::BaseResourceDescriptors|BaseResourceDescriptors]] || || Base class ||
|}
 
==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x40x28 || uint32_t[[#rw::BaseResourceDescriptors|BaseResourceDescriptors]] || || Size orBase offsetclass ||
|}
 
==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x40x0 || 0x40x20 || uint32_t[[#rw::BaseResourceDescriptors|BaseResourceDescriptors]] || || AlignmentBase class ||
|}
 
=== rw::BaseResourceDescriptors ===
== CgsResource::BundleHeaderV4 ==
==== BundlePlayStation (Additions)3 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x30 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][6] || m_baseResourceDescriptors || ||
|}
 
==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x28 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][5] || m_baseResourceDescriptors || ||
| 0x5C || 0x4 || uint32_t || muFlags || Bundle flags || See [[#Flags | Flags]]
|}
 
==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x20 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][4] || m_baseResourceDescriptors || ||
| 0x60 || 0x4 || uint32_t || || Number of compressed resources ||
|}
 
=== rw::BaseResourceDescriptor ===
This structure contains fields for size and alignment, though alignment sometimes goes unused.
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x640x0 || 0x4 || uint32_t || m_size || CompressionSize informationor offset ||
|-
| 0x4 || 0x4 || uint32_t || m_alignment || Alignment ||
|}
 
=== Compression Informationrw::Resource ===
==== PlayStation 3 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x18 || [[#rw::BaseResources|BaseResources]] || || Base class ||
|}
 
==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x280x14 || [[#Size and alignment rw::BaseResources| Size and alignmentBaseResources]][5] || mauUncompressedSizeAndAlignment || Base class ||
|}
 
==== PC ====
== CgsResource::BundleHeaderV5 ==
=== Bundle (Additions) ===
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x10 || [[#rw::BaseResources|BaseResources]] || || Base class ||
|}
 
=== rw::BaseResources ===
==== PlayStation 3 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x680x0 || 0x40x18 || uint32_t[[#rw::BaseResource|BaseResource]][6] || m_baseResources || Per ||type Nobase idearesource whatpointers this|| does
|}
 
==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x6C0x0 || 0x40x14 || uint32_t |[[#rw::BaseResource| BaseResource]][5] || m_baseResources || AlsoPer notype ideabase whatresource thispointers || does
|}
 
==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x10 || [[#rw::BaseResource|BaseResource]][4] || m_baseResources || Per type base resource pointers ||
|}
 
= Typedefs =
=== rw::BaseResource ===
{| class="wikitable"
! Name !! Type !! Length !! Comments
|-
| BaseResource || void* || 0x4 ||
|}
 
= Enumerations =
=== Platform ===
Three constants used by the platform field.
 
{| class="wikitable"
! Name !! Value !! Comments
|-
| KU_BUNDLE_DX9 || 1 || PC
|-
| KU_BUNDLE_X360 || 2 || Xbox 360
|-
| KU_BUNDLE_PS3 || 3 || PlayStation 3
|}
 
=== CgsResource::EFlags ===
{| class="wikitable"
! Name !! Value !! Comments
|-
| E_BUNDLEFLAG_HAS_DEBUG_DATA || 0x0 || Has a BundleImports resource.<br>This flag does not work correctly.
| ? || 1 || PC
|-
| E_BUNDLEFLAG_COMPRESSED || 0x1 || Resources are zlib compressed
| ? || 2 || Xbox 360
|}
 
= Base resource types =
Anonymous enumeration with name strings.
 
==== PlayStation 3 ====
{| class="wikitable"
! Name !! String !! Index
|-
| BASERESOURCE_MAINMEMORY || main memory || 0
|-
| BASERESOURCE_DISPOSABLE || disposable || 1
|-
| BASERESOURCE_UNINITIALIZED || uninitialized || 2
|-
| BASERESOURCE_DISPOSABLE_UNINITIALIZED || disposable uninitialized || 3
|-
| BASERESOURCE_GRAPHICS_SYSTEM || graphics system || 4
|-
| BASERESOURCE_GRAPHICS_LOCAL || graphics local || 5
|-
| BASERESOURCE_NUMBEROFBASERESOURCETYPES || || 6
| ? || 3 || PlayStation 3
|}
 
==== FlagsXbox 360 ====
{| class="wikitable"
! Name !! String !! Index
|-
| BASERESOURCE_MAINMEMORY || main memory || 0
! Name !! Value !! Comments
|-
| BASERESOURCE_DISPOSABLE || disposable || 1
| IsCompressed || 0x1 || Resources are zlib compressed
|-
| BASERESOURCE_PHYSICAL? || physical || 2
|-
| BASERESOURCE_UNINITIALIZED || uninitialized || 3
|-
| BASERESOURCE_DISPOSABLE_UNINITIALIZED || disposable uninitialized || 4
|-
| BASERESOURCE_NUMBEROFBASERESOURCETYPES || || 5
|}
 
==== ResourceTypePC ====
{| class="wikitable"
See [[Resource Types (Burnout Paradise) | Resource Types]].
! Name !! String !! Index
|-
| BASERESOURCE_MAINMEMORY || main memory || 0
|-
| BASERESOURCE_DISPOSABLE || disposable || 1
|-
| BASERESOURCE_UNINITIALIZED || uninitialized || 2
|-
| BASERESOURCE_DISPOSABLE_UNINITIALIZED || disposable uninitialized || 3
|-
| BASERESOURCE_NUMBEROFBASERESOURCETYPES || || 4
|}