Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
heap.c File Reference
#include "engine/game.h"
Include dependency graph for heap.c:

Go to the source code of this file.

Functions

void freeMem (void *ptr)
 Frees a heap block, merging it with the free blocks around it.
 
void heapNop (void)
 HEAP.nop: empty, and nothing calls it.
 
void freeMemByTag (s32 tag)
 Frees every heap block with tag tag
 
void initHeap (void)
 Makes the heap one free block from HEAP_START, followed by the end marker.
 
void zeroMem (void *dst, s32 size)
 Clears size bytes, a word at a time when size is a multiple of 4.
 
void fillMem (s8 *dst, s8 value, s32 count)
 Sets count bytes to value
 
void * tryAllocMem (u32 size, s32 tag)
 First fit from the start of the heap.
 
void * tryAllocMemHigh (u32 size, s32 tag)
 First fit from the end of the heap.
 
void * allocMem (s32 size, s32 tag)
 Evicts cached files until the allocation fits.
 
void allocMemHigh (s32 size, s32 tag)
 The block is returned in v0, left there by tryAllocMemHigh.
 
void * allocMemZeroed (s32 size, s32 tag)
 allocMem, cleared
 
void lockMem (void *ptr, s32 lock)
 Keeps a block alive across mode changes, or hands it back to the mode.
 

Variables

Heap HEAP
 The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take other types are cast to what the tables give their callers.
 

Function Documentation

◆ freeMem()

void freeMem ( void *  ptr)

Frees a heap block, merging it with the free blocks around it.

Definition at line 4 of file heap.c.

Referenced by freeMemByTag().

Here is the caller graph for this function:

◆ heapNop()

void heapNop ( void  )

HEAP.nop: empty, and nothing calls it.

Definition at line 25 of file heap.c.

◆ freeMemByTag()

void freeMemByTag ( s32  tag)

Frees every heap block with tag tag

< the marker that ends the list

Definition at line 29 of file heap.c.

Here is the call graph for this function:

◆ initHeap()

void initHeap ( void  )

Makes the heap one free block from HEAP_START, followed by the end marker.

< the marker that ends the list

Definition at line 40 of file heap.c.

Here is the call graph for this function:

◆ zeroMem()

void zeroMem ( void *  dst,
s32  size 
)

Clears size bytes, a word at a time when size is a multiple of 4.

Definition at line 58 of file heap.c.

Referenced by allocMemZeroed().

Here is the caller graph for this function:

◆ fillMem()

void fillMem ( s8 *  dst,
s8  value,
s32  count 
)

Sets count bytes to value

Definition at line 78 of file heap.c.

◆ tryAllocMem()

void * tryAllocMem ( u32  size,
s32  tag 
)

First fit from the start of the heap.

< the marker that ends the list

Definition at line 87 of file heap.c.

Referenced by allocMem().

Here is the caller graph for this function:

◆ tryAllocMemHigh()

void * tryAllocMemHigh ( u32  size,
s32  tag 
)

First fit from the end of the heap.

Definition at line 116 of file heap.c.

Referenced by allocMemHigh().

Here is the caller graph for this function:

◆ allocMem()

void * allocMem ( s32  size,
s32  tag 
)

Evicts cached files until the allocation fits.

Definition at line 147 of file heap.c.

Referenced by allocMemZeroed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocMemHigh()

void allocMemHigh ( s32  size,
s32  tag 
)

The block is returned in v0, left there by tryAllocMemHigh.

Definition at line 157 of file heap.c.

Here is the call graph for this function:

◆ allocMemZeroed()

void * allocMemZeroed ( s32  size,
s32  tag 
)

allocMem, cleared

Definition at line 164 of file heap.c.

Here is the call graph for this function:

◆ lockMem()

void lockMem ( void *  ptr,
s32  lock 
)

Keeps a block alive across mode changes, or hands it back to the mode.

< kept across mode changes (lockMem)

< the current mode's: freed by main whenever the mode task ends

Definition at line 172 of file heap.c.

Variable Documentation

◆ HEAP

Heap HEAP
Initial value:
= {
0,
((void *)0) ,
((void *)0) ,
(void *(*)(s32, s32))allocMemHigh,
(void (*)(void *, s32, s32))fillMem,
}
signed int s32
Definition common.h:11
void freeMemByTag(s32 tag)
Frees every heap block with tag tag
Definition heap.c:29
void * allocMemZeroed(s32 size, s32 tag)
allocMem, cleared
Definition heap.c:164
void freeMem(void *ptr)
Frees a heap block, merging it with the free blocks around it.
Definition heap.c:4
void lockMem(void *ptr, s32 lock)
Keeps a block alive across mode changes, or hands it back to the mode.
Definition heap.c:172
void initHeap(void)
Makes the heap one free block from HEAP_START, followed by the end marker.
Definition heap.c:40
void allocMemHigh(s32 size, s32 tag)
The block is returned in v0, left there by tryAllocMemHigh.
Definition heap.c:157
void fillMem(s8 *dst, s8 value, s32 count)
Sets count bytes to value
Definition heap.c:78
void * allocMem(s32 size, s32 tag)
Evicts cached files until the allocation fits.
Definition heap.c:147
void heapNop(void)
HEAP.nop: empty, and nothing calls it.
Definition heap.c:25
void zeroMem(void *dst, s32 size)
Clears size bytes, a word at a time when size is a multiple of 4.
Definition heap.c:58

The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take other types are cast to what the tables give their callers.

Definition at line 184 of file heap.c.

Referenced by allocPrimBuffers(), announceTech(), CARDGAME_addSprite(), CARDGAME_clearPanelFlags(), createTalkBox(), createTaskWithId(), decompressorAllocBuffer(), decompressorFree(), destroyLayer(), destroyTask(), evictOldestFile(), FIELDSTG_createActor(), FIELDSTG_createHiddenSpots(), FIELDSTG_createStream(), FIELDSTG_pickStage(), FIELDSTG_resetScriptTimer(), FIELDSTG_runMapStreamer(), FIELDSTG_updateActor(), FIELDSTG_updateHiddenSpots(), FIELDSTG_updateStream(), FIGHTSTG_addFighterModel(), FIGHTSTG_computeStats(), FIGHTSTG_createModel(), FIGHTSTG_lightMesh(), FIGHTSTG_projectMesh(), FIGHTSTG_startAction(), FIGHTSTG_updateItemMenu(), FIGHTSTG_updateMesh(), FIGHTSTG_updateModel(), freeAllFiles(), freeFile(), freeFilesFrom(), freeMemByTag(), freePrimBuffers(), initCardDrawer(), initHeap(), initMemCard(), initPad(), initSpriteDrawer(), initTextTools(), initTimLoader(), layerAllocCallbacks(), layerFree(), main(), memCardCommand(), newGame(), newLayer(), requestFile(), resetGraphics(), setSaveHeader(), setTextBuffer(), SHOCKTST_createEditor(), SHOCKTST_updateEditor(), SHOCKTST_updateLoader(), showField(), startField(), STDGNAME_loadFiles(), STDWTITL_tickMoviePlayer(), STGMCARD_checkInfo(), STGMCARD_freeBuffers(), STGMCARD_loadFiles(), STGMCARD_writeIcons(), STGTRAIN_loadSet(), STGTRAIN_requestFile(), timLoaderLoadArchive(), tryAllocMem(), tryAllocMemHigh(), updateDecompressor(), updateSoundLoading(), updateTextWindow(), and WFIGHTMN_start().