Bundle (original): Difference between revisions

Content added Content deleted
(Add per-platform info and base resource info. Remove overview as the information is redundant with the main Bundle page.)
Line 4: Line 4:


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.
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.

= Overview =
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.

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.

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.


= 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. On Xbox 360, 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 [[#Base resource types|base resource types]]). Keep these in mind when viewing the structures.


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 Physical on Xbox 360. '''In resource documentation, these will be simplified to a "secondary" type.''' Resources only ever have primary and secondary portions.
# Main Memory
# Disposable
# Physical
# Uninitialized
# Disposable uninitialized


Keep these in mind when viewing the structures.
Keep these in mind when viewing the structures.
Line 28: Line 17:
== CgsResource::BundleHeaderBase ==
== CgsResource::BundleHeaderBase ==
=== Bundle ===
=== Bundle ===
==== PlayStation 3 ====
{| class="wikitable"
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x4 || char[4] || macMagicNumber || Bundle magic || bndl
|-
| 0x4 || 0x4 || uint32_t || muVersion || Bundle version || 3 in base, 4 in V4, 5 in V5
|-
| 0x8 || 0x4 || uint32_t || muResourceEntriesCount || Number of resources in the bundle ||
|-
| 0xC || 0x30 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][6] || || Size and alignment of each chunk ||
|-
| 0x3C || 0x18 || uint32_t[6] || || Memory address of each chunk ||
|-
| 0x54 || 0x4 || uint32_t || || Resource IDs offset ||
|-
| 0x58 || 0x4 || uint32_t || muResourceEntriesOffset || Resource entries offset ||
|-
| 0x5C || 0x4 || uint32_t || || Imports offset ||
|-
| 0x60 || 0x4 || uint32_t || muResourceDataOffset || Resource data offset ||
|-
| 0x64 || 0x4 || uint32_t || muPlatform || Platform the bundle was built for || See [[#Platform|Platform]]
|}

==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
Line 38: Line 52:
| 0x8 || 0x4 || uint32_t || muResourceEntriesCount || Number of resources in the bundle ||
| 0x8 || 0x4 || uint32_t || muResourceEntriesCount || Number of resources in the bundle ||
|-
|-
| 0xC || 0x28 || [[#Size and alignment|Size and alignment]][5] || || Size and alignment of each chunk ||
| 0xC || 0x28 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][5] || || Size and alignment of each chunk ||
|-
|-
| 0x34 || 0x14 || uint32_t[5] || || Memory address of each chunk ||
| 0x34 || 0x14 || uint32_t[5] || || Memory address of each chunk ||
Line 51: Line 65:
|-
|-
| 0x58 || 0x4 || uint32_t || muPlatform || Platform the bundle was built for || See [[#Platform|Platform]]
| 0x58 || 0x4 || uint32_t || muPlatform || Platform the bundle was built for || See [[#Platform|Platform]]
|}

==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || char[4] || macMagicNumber || Bundle magic || bndl
|-
| 0x4 || 0x4 || uint32_t || muVersion || Bundle version || 3 in base, 4 in V4, 5 in V5
|-
| 0x8 || 0x4 || uint32_t || muResourceEntriesCount || Number of resources in the bundle ||
|-
| 0xC || 0x20 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][4] || || Size and alignment of each chunk ||
|-
| 0x2C || 0x10 || uint32_t[4] || || Memory address of each chunk ||
|-
| 0x3C || 0x4 || uint32_t || || Resource IDs offset ||
|-
| 0x40 || 0x4 || uint32_t || muResourceEntriesOffset || Resource entries offset ||
|-
| 0x44 || 0x4 || uint32_t || || Imports offset ||
|-
| 0x48 || 0x4 || uint32_t || muResourceDataOffset || Resource data offset ||
|-
| 0x4C || 0x4 || uint32_t || muPlatform || Platform the bundle was built for || See [[#Platform|Platform]]
|}
|}


=== ResourceEntry ===
=== ResourceEntry ===
==== PlayStation 3 ====
{| class="wikitable"
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x4 || uint32_t || || Resource data memory address ||
|-
| 0x4 || 0x4 || uint32_t || muImportOffset || Bundle imports offset ||
|-
| 0x8 || 0x4 || uint32_t || muResourceTypeId || Resource type || See [[#ResourceType|ResourceType]]
|-
| 0xC || 0x30 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][6] || mauSizeAndAlignmentOnDisk || Resource sizes in bundle<br />Compressed size if compression used ||
|-
| 0x3C || 0x30 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][6] || mauDiskOffset || Offsets in bundle || Alignment is unused (always 1)
|-
| 0x6C || 0x18 || uint32_t[6] || || Memory addresses || Swapped endian
|}

==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
Line 64: Line 120:
| 0x8 || 0x4 || uint32_t || muResourceTypeId || Resource type || See [[#ResourceType|ResourceType]]
| 0x8 || 0x4 || uint32_t || muResourceTypeId || Resource type || See [[#ResourceType|ResourceType]]
|-
|-
| 0xC || 0x28 || [[#Size and alignment|Size and alignment]][5] || mauSizeAndAlignmentOnDisk || ||
| 0xC || 0x28 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][5] || mauSizeAndAlignmentOnDisk || Resource sizes in bundle<br />Compressed size if compression used ||
|-
|-
| 0x34 || 0x28 || [[#Size and alignment|Size and alignment]][5] || mauDiskOffset || Offsets in bundle || Alignment is unused (always 1)
| 0x34 || 0x28 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][5] || mauDiskOffset || Offsets in bundle || Alignment is unused (always 1)
|-
|-
| 0x5C || 0x14 || uint32_t[5] || || Memory addresses || Swapped endian
| 0x5C || 0x14 || uint32_t[5] || || Memory addresses || Swapped endian
|}

==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || uint32_t || || Resource data memory address ||
|-
| 0x4 || 0x4 || uint32_t || muImportOffset || Bundle imports offset ||
|-
| 0x8 || 0x4 || uint32_t || muResourceTypeId || Resource type || See [[#ResourceType|ResourceType]]
|-
| 0xC || 0x20 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][4] || mauSizeAndAlignmentOnDisk || Resource sizes in bundle<br />Compressed size if compression used ||
|-
| 0x2C || 0x20 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][4] || mauDiskOffset || Offsets in bundle || Alignment is unused (always 1)
|-
| 0x4C || 0x10 || uint32_t[4] || || Memory addresses || Swapped endian
|}
|}


Line 76: Line 149:
=== ImportEntry ===
=== ImportEntry ===
{| class="wikitable"
{| class="wikitable"
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
Line 86: Line 158:
|}
|}


=== Size and alignment ===
=== rw::BaseResourceDescriptor ===
This structure contains fields for size and alignment, though alignment sometimes goes unused. Real name is not known.
This structure contains fields for size and alignment, though alignment sometimes goes unused.
{| class="wikitable"
{| class="wikitable"
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x4 || uint32_t || || Size or offset ||
| 0x0 || 0x4 || uint32_t || m_size || Size or offset ||
|-
|-
| 0x4 || 0x4 || uint32_t || || Alignment ||
| 0x4 || 0x4 || uint32_t || m_alignment || Alignment ||
|}
|}


Line 100: Line 171:
=== Bundle (Additions) ===
=== Bundle (Additions) ===
{| class="wikitable"
{| class="wikitable"
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
Line 111: Line 181:


=== Compression Information ===
=== Compression Information ===
==== PlayStation 3 ====
{| class="wikitable"
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x30 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][6] || mauUncompressedSizeAndAlignment || Uncompressed sizes ||
|}

==== Xbox 360 ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x28 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][5] || mauUncompressedSizeAndAlignment || Uncompressed sizes ||
|}

==== PC ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x28 || [[#Size and alignment|Size and alignment]][5] || mauUncompressedSizeAndAlignment || ||
| 0x0 || 0x20 || [[#rw::BaseResourceDescriptor|BaseResourceDescriptor]][4] || mauUncompressedSizeAndAlignment || Uncompressed sizes ||
|}
|}


Line 121: Line 205:
=== Bundle (Additions) ===
=== Bundle (Additions) ===
{| class="wikitable"
{| class="wikitable"
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
Line 132: Line 215:
=== Platform ===
=== Platform ===
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Value !! Comments
! Name !! Value !! Comments
|-
|-
Line 144: Line 226:
=== Flags ===
=== Flags ===
{| class="wikitable"
{| class="wikitable"
|-
! Name !! Value !! Comments
! Name !! Value !! Comments
|-
|-
Line 152: Line 233:
=== ResourceType ===
=== ResourceType ===
See [[Resource Types]].
See [[Resource Types]].

= Base resource types =
==== PlayStation 3 ====
{| class="wikitable"
! Name !! Index
|-
| main memory || 0
|-
| disposable || 1
|-
| uninitialized || 2
|-
| disposable uninitialized || 3
|-
| graphics system || 4
|-
| graphics local || 5
|}

==== Xbox 360 ====
{| class="wikitable"
! Name !! Index
|-
| main memory || 0
|-
| disposable || 1
|-
| physical || 2
|-
| uninitialized || 3
|-
| disposable uninitialized || 4
|}

==== PC ====
{| class="wikitable"
! Name !! Index
|-
| main memory || 0
|-
| disposable || 1
|-
| uninitialized || 2
|-
| disposable uninitialized || 3
|}