Modding/Burnout Paradise/Memory map: Difference between revisions
(Created page.) |
(Remove BaseEventReceiverQueue (always nullptr in executable, not documented here)) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1:
[[File:Burnout Paradise Resource Memory Debug crop.png|thumb|400px|Memory usage by collision resources in the OpenWorldPhy pool. Displayed using a debug menu in [[Burnout Paradise (2008-01-
Burnout Paradise uses the constant <code>KAC_BINARY_MEMORY_MAP</code> for memory management. When modding, it may be necessary to increase the size of the memory pools listed in the memory map. This has been the case in the past when repairing partially corrupt development builds and was necessary when the Canary Island mod's development was stalled due to the collision resources exceeding the size of the OpenWorldPhy/OWPhysics pool.
Line 9:
The memory map is located in the game's executable. Searching for "Root Bank" and subtracting 0x40 from its start offset will place the cursor at the beginning of the [[#CgsMemory::MemoryMap|memory map structure]]. From here, go to the pools offset (all offsets are relative to the start of the map), find the [[#CgsMemory::MemoryMapPool|pool structure]] with the name "OpenWorldPhy", and change the main memory base resource size to the minimum amount that will satisfy your needs for the foreseeable future. Note the difference between the new and old sizes.
Because the OpenWorldPhy bank is a child of the OpenWorld bank, the OpenWorld bank needs to be edited as well. Go to the banks offset and find the [[#CgsMemory::MemoryMapBank|bank structure]] with the name "OpenWorld". Take the size difference you noted earlier, align it to 0x20000, and add it to the main memory base resource size. Divide this size by 0x20000 and replace the number of
= Structures =
Line 156:
| 0x34 || 0x4 || uint32_t || muMaxImports || Max number of imports that can be held ||
|-
| 0x38 || 0x18 || [[#CgsResource::Entry::ResourceDescriptor|ResourceDescriptor]] || mDescriptor || Pool descriptor || See [[#
|-
| 0x50 || 0xC || uint32_t[3] || mauMaxResources || Max number of resources per small resource type || See [[#
|-
| 0x5C || 0x4 || int32_t || miNumDependencies || Number of dependencies ||
Line 175:
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 ||
|-
| 0x4 || 0x4 || int32_t || miEventId || ID ||
|-
| 0x8 || 0x4 || int32_t || miPoolId || Pool ID ||
|}▼
{| class="wikitable"▼
|-▼
|-▼
|-▼
|-▼
|-▼
|-▼
|}
Line 260 ⟶ 243:
|}
==== PC, PC (Remastered) ====
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
Line 286 ⟶ 269:
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 ||
|-
| 0x4 || 0x4 || int32_t || mnEventId || Event ID ||
Line 378 ⟶ 361:
|}
=== CgsResource::ESmallResourceMemType ===
= Base resource types =▼
==== PlayStation 3 ====
{| class="wikitable"
! Name !!
|-
|
|-
| E_MEMTYPE_GRAPHICS_SYSTEM || 1 ||
| disposable || 1▼
|-
| E_MEMTYPE_GRAPHICS_LOCAL || 2 ||
|-
| E_MEMTYPE_NUMTYPES || 3 ||
▲|}
==== Xbox 360 ====▼
▲{| class="wikitable"
! Name !! Value !! Comments
|-
|
|-
|
▲|-
| ? || 2 || DUMMY
▲|-
| E_MEMTYPE_NUMTYPES || 3 ||
|}
====
{| class="wikitable"▼
! Name !! Value !! Comments
▲|-
| E_MEMTYPE_MAINMEMORY || 0
▲|-
| ? || 1 || DISPOSABLE
▲|-
| ? || 2 || DUMMY
▲|-
| E_MEMTYPE_NUMTYPES || 3 ||
|}▼
▲= Base resource types =
==== PlayStation 3 ====▼
{| class="wikitable"
! Name !! Index
Line 413 ⟶ 419:
|}
====
{| class="wikitable"
! Name !! Index
Line 428 ⟶ 434:
|}
==== PC, Remastered ====▼
▲==== PlayStation 3 ====
{| class="wikitable"
! Name !! Index
|-
|
|-
|
|-
|
▲|}
▲==== Xbox 360 ====
▲{| class="wikitable"
|-
▲==== PC, Remastered ====
|}
|
Latest revision as of 12:43, 10 April 2023
Burnout Paradise uses the constant KAC_BINARY_MEMORY_MAP
for memory management. When modding, it may be necessary to increase the size of the memory pools listed in the memory map. This has been the case in the past when repairing partially corrupt development builds and was necessary when the Canary Island mod's development was stalled due to the collision resources exceeding the size of the OpenWorldPhy/OWPhysics pool.
By editing the memory map, not only can larger resources be used, more resources can be as well because the limits on numbers of resources are placed in the map. Thus, any larger mods or efforts to improve the quality of certain assets may require altering it.
Modification
As a real-world use case, this section uses editing the OpenWorldPhy pool as an example.
The memory map is located in the game's executable. Searching for "Root Bank" and subtracting 0x40 from its start offset will place the cursor at the beginning of the memory map structure. From here, go to the pools offset (all offsets are relative to the start of the map), find the pool structure with the name "OpenWorldPhy", and change the main memory base resource size to the minimum amount that will satisfy your needs for the foreseeable future. Note the difference between the new and old sizes.
Because the OpenWorldPhy bank is a child of the OpenWorld bank, the OpenWorld bank needs to be edited as well. Go to the banks offset and find the bank structure with the name "OpenWorld". Take the size difference you noted earlier, align it to 0x20000, and add it to the main memory base resource size. Divide this size by 0x20000 and replace the number of blocks with the result. Save and run the game. Note: Sizes must be a multiple of the number of banks.
Structures
CgsMemory::MemoryMap
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | int32_t | miVersion | Version number | Always 0 |
0x4 | 0x4 | int32_t | miPlatform | Platform ID | Always 0 |
0x8 | 0x4 | uint32_t | muNumBanks | Number of memory banks | |
0xC | 0x4 | uint32_t | muNumPools | Number of memory pools | |
0x10 | 0x4 | uint32_t | muNumRawResources | Number of raw resources | |
0x14 | 0x4 | uint32_t | muNumLinearAllocators | Number of linear allocators | |
0x18 | 0x4 | uint32_t | muNumHeapAllocators | Number of heap allocators | |
0x1C | 0x4 | uint32_t | muNumRWLinearAllocators | Number of RW linear allocators | |
0x20 | 0x4 | uint32_t | muNumRWGeneralAllocators | Number of RW general allocators | |
0x24 | 0x4 | MemoryMapBank* | mpBanks | Memory banks | |
0x28 | 0x4 | MemoryMapPool* | mpPools | Memory pools | |
0x2C | 0x4 | MemoryMapRawResource* | mpRawResources | Raw resources | |
0x30 | 0x4 | MemoryMapLinearAllocator* | mpLinearAllocators | Linear allocators | |
0x34 | 0x4 | MemoryMapHeapAllocator* | mpHeapAllocators | Heap allocators | |
0x38 | 0x4 | MemoryMapRWLinearAllocator* | mpRWLinearAllocators | RW linear allocators | |
0x3C | 0x4 | MemoryMapRWGeneralAllocator* | mpRWGeneralAllocators | RW general allocators |
CgsMemory::MemoryMapBank
PlayStation 3
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x5C | Params | mBankParams | Memory bank details |
Xbox 360
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x54 | Params | mBankParams | Memory bank details |
PC, Remastered
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4C | Params | mBankParams | Memory bank details |
CgsMemory::MemoryBank::Params
PlayStation 3
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x20 | char[32] | macName | Name | |
0x20 | 0x4 | int32_t | mnParentBankId | Parent ID | |
0x24 | 0x4 | int32_t | mnBankId | ID | |
0x28 | 0x18 | uint32_t[6] | mauBankSize | Allocated size per base resource type | Must be a multiple of the number of blocks See base resource types |
0x40 | 0x18 | uint32_t[6] | mauBankBlocks | Number of blocks per base resource type | Each block is 0x20000 long by default See base resource types |
0x58 | 0x1 | bool | mbIsLeaf | This node is a leaf node | |
0x59 | 0x1 | bool | mbAllowFragmentation | Can this bank can be fragmented across memory | |
0x5A | 0x2 | Padding |
Xbox 360
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x20 | char[32] | macName | Name | |
0x20 | 0x4 | int32_t | mnParentBankId | Parent ID | |
0x24 | 0x4 | int32_t | mnBankId | ID | |
0x28 | 0x14 | uint32_t[5] | mauBankSize | Allocated size per base resource type | Must be a multiple of the number of blocks See base resource types |
0x3C | 0x14 | uint32_t[5] | mauBankBlocks | Number of blocks per base resource type | Each block is 0x20000 long by default See base resource types |
0x50 | 0x1 | bool | mbIsLeaf | This node is a leaf node | |
0x51 | 0x1 | bool | mbAllowFragmentation | Can this bank can be fragmented across memory | |
0x52 | 0x2 | Padding |
PC, Remastered
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x20 | char[32] | macName | Name | |
0x20 | 0x4 | int32_t | mnParentBankId | Parent ID | |
0x24 | 0x4 | int32_t | mnBankId | ID | |
0x28 | 0x10 | uint32_t[4] | mauBankSize | Allocated sizes per base resource type | Must be a multiple of the number of blocks See base resource types |
0x38 | 0x10 | uint32_t[4] | mauBankBlocks | Number of blocks per base resource type | Each block is 0x20000 long by default See base resource types |
0x48 | 0x1 | bool | mbIsLeaf | This node is a leaf node | |
0x49 | 0x1 | bool | mbAllowFragmentation | Can this bank can be fragmented across memory | |
0x4A | 0x2 | Padding |
CgsMemory::MemoryMapPool
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0xAC | CreatePoolRequest | mRequest |
CgsResource::Events::CreatePoolRequest
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0xC | PoolEvent | super_PoolEvent | ||
0xC | 0x20 | char[32] | mpcName | Name | |
0x2C | 0x4 | int32_t | miDeletionDelayFrames | Number of frames to wait before pool is deleted | |
0x30 | 0x4 | uint32_t | muMaxResources | Max number of resources that can be held | |
0x34 | 0x4 | uint32_t | muMaxImports | Max number of imports that can be held | |
0x38 | 0x18 | ResourceDescriptor | mDescriptor | Pool descriptor | See ESmallResourceMemType |
0x50 | 0xC | uint32_t[3] | mauMaxResources | Max number of resources per small resource type | See ESmallResourceMemType |
0x5C | 0x4 | int32_t | miNumDependencies | Number of dependencies | |
0x60 | 0x40 | int32_t[16] | maiDependencyIds | Dependencies | |
0xA0 | 0x4 | int32_t | miBankId | Bank ID | |
0xA4 | 0x4 | int32_t | miParentBankId | Parent bank ID | |
0xA8 | 0x1 | bool | mbAllowDefragmentation | Can this pool can be defragmented |
CgsResource::Events::PoolEvent
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | BaseEventReceiverQueue* | mpUser | Not documented here | |
0x4 | 0x4 | int32_t | miEventId | ID | |
0x8 | 0x4 | int32_t | miPoolId | Pool ID |
CgsResource::SmallResourceDescriptor
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x18 | BaseResourceDescriptors<3u> | Base class |
rw::BaseResourceDescriptors<3u>
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x18 | BaseResourceDescriptor[3] | m_baseResourceDescriptors | Descriptors |
rw::BaseResourceDescriptor
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | uint32_t | m_size | Size | |
0x4 | 0x4 | uint32_t | m_alignment | Alignment |
CgsMemory::MemoryMapRawResource
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x64 | CreateResourceRequest | mRequest |
CgsMemory::MemoryIO::CreateResourceRequest
PlayStation 3
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0xC | MemoryRequest | Base class | ||
0xC | 0x20 | char[32] | macBankName | Bank name | |
0x2C | 0x4 | int32_t | mnBankId | Bank ID | |
0x30 | 0x4 | int32_t | mnParentBankId | Parent bank ID | |
0x34 | 0x30 | ResourceDescriptor | mDescriptor |
Xbox 360
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0xC | MemoryRequest | Base class | ||
0xC | 0x20 | char[32] | macBankName | Bank name | |
0x2C | 0x4 | int32_t | mnBankId | Bank ID | |
0x30 | 0x4 | int32_t | mnParentBankId | Parent bank ID | |
0x34 | 0x28 | ResourceDescriptor | mDescriptor |
PC, PC (Remastered)
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0xC | MemoryRequest | Base class | ||
0xC | 0x20 | char[32] | macBankName | Bank name | |
0x2C | 0x4 | int32_t | mnBankId | Bank ID | |
0x30 | 0x4 | int32_t | mnParentBankId | Parent bank ID | |
0x34 | 0x20 | ResourceDescriptor | mDescriptor |
CgsMemory::MemoryIO::MemoryRequest
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0xC | MemoryEvent | Base class |
CgsMemory::MemoryIO::MemoryEvent
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | BaseEventReceiverQueue* | mpUser | Not documented here | |
0x4 | 0x4 | int32_t | mnEventId | Event ID | |
0x8 | 0x4 | EventType | meEventType | Event type |
CgsMemory::MemoryMapLinearAllocator
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x44 | CreateAllocatorRequest | mRequest |
CgsMemory::CreateAllocatorRequest
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0xC | MemoryRequest | Base class | ||
0xC | 0x20 | char[32] | macBankName | Bank name | |
0x2C | 0x4 | int32_t | mnBankId | Bank ID | |
0x30 | 0x4 | int32_t | mnParentBankId | Parent bank ID | |
0x34 | 0x4 | int32_t | mnResourceType | ||
0x38 | 0x4 | int32_t | mnSize | Size | |
0x3C | 0x4 | HeapMalloc* | mpHeapAllocator | Not documented here | |
0x40 | 0x4 | LinearMalloc* | mpLinearAllocator | Not documented here |
CgsMemory::MemoryMapHeapAllocator
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x44 | CreateAllocatorRequest | mRequest |
CgsMemory::MemoryMapRWLinearAllocator
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x64 | CreateLinearAllocatorRequest | mRequest |
CgsMemory::MemoryIO::CreateLinearAllocatorRequest
Identical to CreateResourceRequest.
CgsMemory::MemoryMapRWGeneralAllocator
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x64 | CreateGeneralAllocatorRequest | mRequest |
CgsMemory::CreateGeneralAllocatorRequest
Identical to CreateResourceRequest.
Typedefs
CgsResource::Entry::ResourceDescriptor
Name | Type | Length | Comments |
---|---|---|---|
ResourceDescriptor | SmallResourceDescriptor | 0x18 |
Enumerations
CgsMemory::MemoryIO::EventType
Name | Value | Comments |
---|---|---|
E_EVENT_TYPE_CREATE_BANK | 0 | |
E_EVENT_TYPE_DESTROY_BANK | 1 | |
E_EVENT_TYPE_CREATE_RW_LINEAR_ALLOCATOR | 2 | |
E_EVENT_TYPE_CREATE_RW_GENERAL_ALLOCATOR | 3 | |
E_EVENT_TYPE_CREATE_ALLOCATOR | 4 | |
E_EVENT_TYPE_DESTROY_ALLOCATOR | 5 | |
E_EVENT_TYPE_CREATE_RESOURCE | 6 | |
E_EVENT_TYPE_COUNT | 7 |
CgsResource::ESmallResourceMemType
PlayStation 3
Name | Value | Comments |
---|---|---|
E_MEMTYPE_MAINMEMORY | 0 | |
E_MEMTYPE_GRAPHICS_SYSTEM | 1 | |
E_MEMTYPE_GRAPHICS_LOCAL | 2 | |
E_MEMTYPE_NUMTYPES | 3 |
Xbox 360
Name | Value | Comments |
---|---|---|
E_MEMTYPE_MAINMEMORY | 0 | |
? | 1 | PHYSICAL |
? | 2 | DUMMY |
E_MEMTYPE_NUMTYPES | 3 |
PC, Remastered
Name | Value | Comments |
---|---|---|
E_MEMTYPE_MAINMEMORY | 0 | |
? | 1 | DISPOSABLE |
? | 2 | DUMMY |
E_MEMTYPE_NUMTYPES | 3 |
Base resource types
PlayStation 3
Name | Index |
---|---|
main memory | 0 |
disposable | 1 |
uninitialized | 2 |
disposable uninitialized | 3 |
graphics system | 4 |
graphics local | 5 |
Xbox 360
Name | Index |
---|---|
main memory | 0 |
disposable | 1 |
physical | 2 |
uninitialized | 3 |
disposable uninitialized | 4 |
PC, Remastered
Name | Index |
---|---|
main memory | 0 |
disposable | 1 |
uninitialized | 2 |
disposable uninitialized | 3 |
Banks
Remastered
Name | ID | Parent |
---|---|---|
Root Bank | 0 | N/A (-1) |
OpenWorld | 1 | Root Bank |
Physics | 2 | Root Bank |
Cars | 3 | Root Bank |
Sound | 4 | Root Bank |
GUI | 5 | Root Bank |
GameData | 6 | Root Bank |
Misc | 8 | Root Bank |
AttribSys | 10 | Root Bank |
Network | 26 | Root Bank |
Cameras | 29 | Root Bank |
VFX | 33 | Root Bank |
Global Textures | 35 | Root Bank |
Replays | 47 | Root Bank |
Player Physics | 50 | Physics |
Massive | 62 | Root Bank |
Pools
Remastered
Name | ID | Bank ID | Parent bank |
---|---|---|---|
Fonts | 0 | 7 | GUI |
Physics | 1 | 11 | Physics |
OpenWorldPhy | 2 | 12 | OpenWorld |
GameData | 5 | 15 | GameData |
Sound | 6 | 16 | Sound |
AttribSysPool | 7 | 17 | AttribSys |
Gui_Persistent_Apt_Pool | 8 | 18 | GUI |
Apt_Streaming_Data | 9 | 28 | GUI |
Global Textures | 10 | 36 | Global Textures |
OpenWorldGr | 3 | 13 | OpenWorld |
Gui_Lang_Fsm_Data_Pool | 11 | 37 | GUI |
Gui_Sat_Nav_Textures | 12 | 39 | GUI |
VFX Pool | 13 | 40 | VFX |
ICE Pool | 14 | 43 | Cameras |
Environment | 16 | 46 | OpenWorld |
Car0 Physics | 17 | 51 | Player Physics |
Car1 Physics | 18 | 52 | Player Physics |
Car2 Physics | 19 | 53 | Player Physics |
Car3 Physics | 20 | 54 | Player Physics |
Car4 Physics | 21 | 55 | Player Physics |
Car5 Physics | 22 | 56 | Player Physics |
Car6 Physics | 23 | 57 | Player Physics |
Car7 Physics | 24 | 58 | Player Physics |
CarSharedPool | 25 | 59 | Cars |
CarPool | 4 | 14 | Cars |
Traffic | 15 | 45 | Cars |
Freeburn Challenges | 26 | 64 | Network |
Sound AI Engines | 27 | 68 | Sound |
Raw resources
Remastered
Name | Bank ID | Parent bank |
---|---|---|
Ice | 34 | Cameras |
Linear allocators
Remastered
Name | Bank ID | Parent bank |
---|---|---|
AttribSysLinAlloc | 22 | AttribSys |
Behaviours | 30 | Cameras |
Gui_State_Allocator | 44 | GUI |
Replays Allocator | 48 | Replays |
SP Allocator | 61 | Physics |
Mugshots | 65 | GUI |
FLAPT_Allocator | 66 | GUI |
Heap allocators
Remastered
Name | Bank ID | Parent bank |
---|---|---|
AttrSysHeap | 19 | AttribSys |
GameTalkAlloc | 20 | AttribSys |
EAStl | 21 | AttribSys |
Network Memory | 27 | Network |
Apt_Heap_Allocator | 32 | GUI |
Gui_FSM_Lang_Alloc | 38 | GUI |
VFX Heap | 41 | VFX |
Massive Heap | 63 | Massive |
LUA | 67 | GameData |
RW linear allocators
Remastered
Name | Bank ID | Parent bank |
---|---|---|
PhysicsAlloc | 23 | Physics |
Network Image Allocator | 42 | Network |
Scene Manager | 49 | Physics |
VFX Graphics Allocator | 60 | VFX |
RW general allocators
Remastered
Name | Bank ID | Parent bank |
---|---|---|
Playback | 9 | Sound |
Rwac | 24 | Sound |
Logic | 25 | Sound |
2D Immediate Heap | 31 | Misc |