View source: Memory Management (USE/fREe) (revision 415)

From Wulinshu
Jump to navigation Jump to search

2019-01-20T17:36:17Z · PhilYeahz · Download source

=Static Storage=
The static memory storage is 322 entries big and located at 0x142A760C0 (v1.07).<br>
The entries have a max content size of 32 bytes.<br>
Due to this restriction the memory de/allocation in this storage is way faster than in the dynamic storage.<br>

=Dynamic Storage=
The dynamic storage is allocated with the function at 0x140361A40 (v1.07).<br>
Two HLib entries will be added, one at the start and one at the end of the allocated memory.<br>
After the first HLib entry a new fREe entry will be added and looks like this.<br>
This entry has the previous entry pointer set to the first HLib entry and the next entry pointer set to the HLib entry at the end.<br>

=Free Storage=
To free storage the function 0x14049CDD0 (v1.07) is used.<br>

=Allocate Storage=
To allocate storage the function 0x14049CB40 (v1.07) is used.<br>

=Storage entry=
{| class="wikitable"
|-
! Position !! Length !! Type !! Description 
|-
| 0x00 || 0x04 || string || Memory type token
|-
| 0x04 || 0x04 || ? || Padding?
|-
| 0x08 || 0x08 || uint64_t || Content size
|-
| 0x10 || 0x08 || uint64_t* || Previous storage entry pointer
|-
| 0x18 || 0x08 || uint64_t* || Next storage entry pointer
|-
| 0x20 || 0x04 || string  || USE/fREe token (determines if the space is being used)
|-
| 0x40 || Content size || ? || Storage data
|}

=Storage tokens=

==Identified==
{| class="wikitable"
|-
! Name !! Description 
|-
| HLib || Root storage entry type
|-
| TASK || Contains various data for a task
|-
| MDL  || MT7 model
|-
| INFO || Mapinfo
|-
| CHID || Character ID
|}

==Unidentified==
{| class="wikitable"
|-
! Name !! Description 
|-
| MAI || Model data?
|-
| SHDM || Model data
|-
| SCNC || Scene stuff?
|-
| WNDB || ?
|-
| SHAD || Textures?
|-
| WARN || Warning (uses textures?)
|-
| WARP || (uses textures?)
|-
| ITPH || (uses textures?)
|-
| SNCT || (uses textures?)
|-
| PAWN || Pawnshop?
|-
| FLDD || Collision data
|-
| ACPH || ?
|-
| ACPD || ?
|-
| DOME || Skybox dome?
|-
| CVIX || Indexing?
|-
| ADFS || ?
|-
| MODL || Model info?
|-
| MAIX || Model info?
|-
| PAKT || ?
|-
| PAKa || ?
|-
| PAKM || ?
|-
| CLIP || ?
|-
| WALL || ?
|-
| WALC || ?
|-
| FLAG || FLAG.BIN?
|-
| HMDL || Model?
|-
| STCH || NPC related
|}