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

Go to the source code of this file.

Functions

FileSlot * findFileSlot (s32 file)
 The cache slot of a file, or NULL.
 
FileSlot * findFreeFileSlot (void)
 A free cache slot, or NULL.
 
s32 isFileLoading (s32 file)
 0 once the file is in the cache; requests it if needed
 
FileSlot * findOldestFile (void)
 The loaded file used least recently (the biggest one on a tie)
 
void evictOldestFile (void)
 Frees the loaded file used least recently, to make room in the heap.
 
void requestFile (s32 file)
 Queues a file for the cache (just marks it used when it is there)
 
void updateFileCache (void)
 Starts reading the next queued file and marks the one read as loaded.
 
void waitForFile (s32 file)
 Reads a file into the cache before returning.
 
void * loadFile (u32 file)
 Returns the file's data, reading it now if it is not in the cache.
 
void freeFile (s32 file)
 Drops a loaded file from the cache.
 
void freeAllFiles (void)
 Drops every file from the cache.
 
void freeFilesFrom (u32 addr)
 Frees the files that reach past addr (to load something there)
 
void * getFileEntry (u32 fileAndIndex)
 Files are often archives: a table of offsets from the start of the file.
 
void * getArchiveEntry (s32 index, void *archive)
 Entry index (the low 16 bits) of an archive already in memory.
 
void markCachedFiles (void)
 markCachedFiles + touchMarkedFiles: refresh the files cached before a load
 
void touchMarkedFiles (void)
 Marks the files markCachedFiles saw as just used (the European and Japanese versions, 10 frames before), so they stay cached.
 

Variables

FileCache FILE_CACHE
 The file cache.
 

Function Documentation

◆ findFileSlot()

FileSlot * findFileSlot ( s32  file)

The cache slot of a file, or NULL.

Definition at line 25 of file file_cache.c.

Referenced by freeFile(), isFileLoading(), loadFile(), and requestFile().

Here is the caller graph for this function:

◆ findFreeFileSlot()

FileSlot * findFreeFileSlot ( void  )

A free cache slot, or NULL.

Definition at line 38 of file file_cache.c.

Referenced by requestFile().

Here is the caller graph for this function:

◆ isFileLoading()

s32 isFileLoading ( s32  file)

0 once the file is in the cache; requests it if needed

Definition at line 51 of file file_cache.c.

Referenced by waitForFile().

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

◆ findOldestFile()

FileSlot * findOldestFile ( void  )

The loaded file used least recently (the biggest one on a tie)

Definition at line 66 of file file_cache.c.

Referenced by evictOldestFile().

Here is the caller graph for this function:

◆ evictOldestFile()

void evictOldestFile ( void  )

Frees the loaded file used least recently, to make room in the heap.

Definition at line 86 of file file_cache.c.

Here is the call graph for this function:

◆ requestFile()

void requestFile ( s32  file)

Queues a file for the cache (just marks it used when it is there)

Definition at line 98 of file file_cache.c.

Referenced by isFileLoading(), and waitForFile().

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

◆ updateFileCache()

void updateFileCache ( void  )

Starts reading the next queued file and marks the one read as loaded.

Definition at line 115 of file file_cache.c.

Referenced by waitForFile().

Here is the caller graph for this function:

◆ waitForFile()

void waitForFile ( s32  file)

Reads a file into the cache before returning.

Definition at line 152 of file file_cache.c.

Referenced by loadFile().

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

◆ loadFile()

void * loadFile ( u32  file)

Returns the file's data, reading it now if it is not in the cache.

Definition at line 160 of file file_cache.c.

Referenced by getFileEntry().

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

◆ freeFile()

void freeFile ( s32  file)

Drops a loaded file from the cache.

Definition at line 174 of file file_cache.c.

Here is the call graph for this function:

◆ freeAllFiles()

void freeAllFiles ( void  )

Drops every file from the cache.

Definition at line 188 of file file_cache.c.

◆ freeFilesFrom()

void freeFilesFrom ( u32  addr)

Frees the files that reach past addr (to load something there)

Definition at line 205 of file file_cache.c.

◆ getFileEntry()

void * getFileEntry ( u32  fileAndIndex)

Files are often archives: a table of offsets from the start of the file.

getFileEntry((file << 16) | index) loads the file and returns that entry.

Definition at line 230 of file file_cache.c.

Here is the call graph for this function:

◆ getArchiveEntry()

void * getArchiveEntry ( s32  index,
void *  archive 
)

Entry index (the low 16 bits) of an archive already in memory.

Definition at line 239 of file file_cache.c.

◆ markCachedFiles()

void markCachedFiles ( void  )

markCachedFiles + touchMarkedFiles: refresh the files cached before a load

Definition at line 246 of file file_cache.c.

◆ touchMarkedFiles()

void touchMarkedFiles ( void  )

Marks the files markCachedFiles saw as just used (the European and Japanese versions, 10 frames before), so they stay cached.

Definition at line 263 of file file_cache.c.

Variable Documentation

◆ FILE_CACHE

FileCache FILE_CACHE
Initial value:
= {
0,
{{0}},
}
void * getFileEntry(u32 fileAndIndex)
Files are often archives: a table of offsets from the start of the file.
Definition file_cache.c:230
void freeFilesFrom(u32 addr)
Frees the files that reach past addr (to load something there)
Definition file_cache.c:205
void freeFile(s32 file)
Drops a loaded file from the cache.
Definition file_cache.c:174
void updateFileCache(void)
Starts reading the next queued file and marks the one read as loaded.
Definition file_cache.c:115
void requestFile(s32 file)
Queues a file for the cache (just marks it used when it is there)
Definition file_cache.c:98
s32 isFileLoading(s32 file)
0 once the file is in the cache; requests it if needed
Definition file_cache.c:51
void * getArchiveEntry(s32 index, void *archive)
Entry index (the low 16 bits) of an archive already in memory.
Definition file_cache.c:239
void markCachedFiles(void)
markCachedFiles + touchMarkedFiles: refresh the files cached before a load
Definition file_cache.c:246
void freeAllFiles(void)
Drops every file from the cache.
Definition file_cache.c:188
void evictOldestFile(void)
Frees the loaded file used least recently, to make room in the heap.
Definition file_cache.c:86
void * loadFile(u32 file)
Returns the file's data, reading it now if it is not in the cache.
Definition file_cache.c:160
void touchMarkedFiles(void)
Marks the files markCachedFiles saw as just used (the European and Japanese versions,...
Definition file_cache.c:263

The file cache.

Definition at line 7 of file file_cache.c.

Referenced by allocMem(), allocMemHigh(), cardDrawerSetCard(), CARDGAME_drawBackground(), CARDGAME_drawBlinker(), CARDGAME_drawCenteredText(), CARDGAME_drawDeckWindow(), CARDGAME_drawGauge(), CARDGAME_drawMarker(), CARDGAME_drawMenuFrame(), CARDGAME_drawMessageFrame(), CARDGAME_drawMessageMark(), CARDGAME_drawNumber(), CARDGAME_drawPanel(), CARDGAME_drawPanelIcon(), CARDGAME_drawSpriteBlink(), CARDGAME_drawSpriteCard(), CARDGAME_drawSpriteDim(), CARDGAME_drawSpriteEffect(), CARDGAME_drawSpriteHighlights(), CARDGAME_drawSpriteMarks(), CARDGAME_drawSpriteOrder(), CARDGAME_drawWindowFrame(), CARDGAME_drawWindowText(), CARDGAME_loadOpponent(), CARDGAME_tickPreloader(), CARDGAME_updateBattle(), CARDGAME_updateMenuWindow(), CARDGAME_updateScene(), CNTY_SEL_drawBackground(), CNTY_SEL_drawCursor(), CNTY_SEL_drawLeftPanel(), CNTY_SEL_drawRightPanel(), CNTY_SEL_drawTopPanel(), CNTY_SEL_tickScreen(), drawActorMark(), drawBackground(), drawCardMark(), drawCardNumbers(), drawEffect(), drawEffect(), drawEntryPanel(), drawFaller(), drawFieldMenuFade(), drawFloaterPart(), drawFlyer(), drawFlyerGate(), drawGauge(), drawGlow(), drawKeyboard(), drawMessageBoxArrow(), drawMessageBoxFrame(), drawPairSprite(), drawPanelParts(), drawScroller(), drawStageEffect(), drawTalkBoxArrow(), drawTalkBoxFrame(), drawTimer(), drawWindowCount(), FIELDSTG_animateActor(), FIELDSTG_closeField(), FIELDSTG_createActor(), FIELDSTG_createSpeech(), FIELDSTG_createTalk(), FIELDSTG_drawBalloon(), FIELDSTG_drawMapObject(), FIELDSTG_drawSpotEffect(), FIELDSTG_loadFieldFiles(), FIELDSTG_loadStreamSprites(), FIELDSTG_playBattleTransition(), FIELDSTG_playCutsceneAnim(), FIELDSTG_requestInnNames(), FIELDSTG_requestSlotFiles(), FIELDSTG_runChoice(), FIELDSTG_runEvent(), FIELDSTG_selectMap(), FIELDSTG_showAreaName(), FIELDSTG_showSpotHint(), FIELDSTG_startEvent(), FIELDSTG_updateActor(), FIELDSTG_updateActorIcon(), FIELDSTG_updateEffect(), FIELDSTG_updateHiddenSpots(), FIELDSTG_updateMapObjects(), FIGHTSTG_blendBone(), FIGHTSTG_cacheFighter(), FIGHTSTG_createItemWindows(), FIGHTSTG_createMesh(), FIGHTSTG_createModel(), FIGHTSTG_createSwitchWindows(), FIGHTSTG_createTechWindows(), FIGHTSTG_drawConfusedMessageBox(), FIGHTSTG_drawCursorSprites(), FIGHTSTG_drawHud(), FIGHTSTG_drawItemMenu(), FIGHTSTG_drawMessageBox(), FIGHTSTG_drawPageArrows(), FIGHTSTG_drawPartnerViewFrame(), FIGHTSTG_drawSpriteAnim(), FIGHTSTG_drawStatsFrame(), FIGHTSTG_drawSwitchInMenu(), FIGHTSTG_drawSwitchMenu(), FIGHTSTG_drawTechIcons(), FIGHTSTG_drawTechMenu(), FIGHTSTG_findBattleTableIndex(), FIGHTSTG_getBattleTableEntry(), FIGHTSTG_getFighterFace(), FIGHTSTG_getFighterInfo(), FIGHTSTG_getFighterRange(), FIGHTSTG_getStageLights(), FIGHTSTG_getStageMotionsFile(), FIGHTSTG_poseBone(), FIGHTSTG_runScriptEffect(), FIGHTSTG_runScriptEffectModel(), FIGHTSTG_runScriptModel(), FIGHTSTG_runScriptStage(), FIGHTSTG_setMessageName(), FIGHTSTG_setMotion(), FIGHTSTG_showCommands(), FIGHTSTG_showConfusedCommands(), FIGHTSTG_showConfusedMessage(), FIGHTSTG_showDigivolveNames(), FIGHTSTG_showFighterNames(), FIGHTSTG_showFightersMessage(), FIGHTSTG_showItemPage(), FIGHTSTG_showMessage(), FIGHTSTG_showPageButtons(), FIGHTSTG_showSwitchInChoices(), FIGHTSTG_showSwitchInNames(), FIGHTSTG_showTechPage(), FIGHTSTG_showTechs(), FIGHTSTG_trySteal(), FIGHTSTG_updateBattleScript(), FIGHTSTG_updateDigimonChange(), FIGHTSTG_updateEntrance(), FIGHTSTG_updateHitEffect(), FIGHTSTG_updateHud(), FIGHTSTG_updateModel(), FIGHTSTG_updateSpriteEffect(), FIGHTSTG_updateStage(), FIGHTSTG_updateSwitchMenu(), fillEffectLists(), findFileSlot(), findFreeFileSlot(), findOldestFile(), freeAllFiles(), freeFilesFrom(), giveItem(), giveMoney(), giveNextSkill(), initNewGameData(), initSound(), learnNextDigimon(), loadEntranceExtras(), loadFont(), loadModeOverlay(), loadSoundBankInto(), loadSubOverlay(), main(), markCachedFiles(), markNextSkillKnown(), openFieldMenu(), openListMenuMessage(), raisePartnerLevel(), requestBattleFiles(), requestFile(), setUpBattle(), SHOCKTST_updateEditor(), showDigimonLevelUp(), showExp(), showFieldMenuMoney(), showFieldMenuOptions(), showListMenuOptions(), showMenuOptions(), showMenuPageLabel(), showMenuPageTitle(), showMenuTitle(), showMessagePrompt(), showMessageText(), showNameWindows(), showPartnerPage(), showPartyTitle(), showRecipeName(), showRecipeTitle(), startField(), STCRDABM_drawAlbum(), STCRDABM_drawCards(), STCRDABM_drawTurningSlots(), STCRDABM_filesLoading(), STCRDABM_loadFiles(), STCRDABM_showCardInfo(), STCRDABM_showPageInfo(), STCRDDEK_drawDeckCards(), STCRDDEK_drawEditor(), STCRDDEK_drawScreen(), STCRDDEK_filesLoading(), STCRDDEK_loadFiles(), STCRDDEK_openDeckOptions(), STCRDDEK_showCardList(), STCRDDEK_showEditorWindows(), STCRDDEK_showListCard(), STCRDDEK_stepEditor(), STCRDDEK_stepScreen(), STCRDSHP_closePackList(), STCRDSHP_createShop(), STCRDSHP_drawBuy(), STCRDSHP_drawCards(), STCRDSHP_drawPackOpen(), STCRDSHP_drawShop(), STCRDSHP_drawTurningSlots(), STCRDSHP_filesLoading(), STCRDSHP_loadFiles(), STCRDSHP_openBuyCard(), STCRDSHP_openBuyTotal(), STCRDSHP_runBuy(), STCRDSHP_runShop(), STCRDSHP_showBuyCard(), STCRDSHP_showOptions(), STCRDSHP_showPack(), STCRDSHP_showPackCard(), STCRDSHP_showPackPage(), STCRDSHP_showTitle(), STCRDSHP_turnBuyPage(), STDGNAME_drawBackground(), STDGNAME_drawMenu(), STDGNAME_filesLoading(), STDGNAME_loadFiles(), STDGNAME_showMenuWindow(), STDWTITL_drawBackground(), STDWTITL_drawBackgroundSprites(), STDWTITL_drawGlint(), STDWTITL_drawGlintAlt(), STDWTITL_drawLogo(), STDWTITL_drawMenu(), STDWTITL_drawSplash(), STDWTITL_drawTitle0(), STDWTITL_drawTitle0Alt(), STDWTITL_drawTitle1(), STDWTITL_drawTitle1Alt(), STDWTITL_loadTitleImages(), STDWTITL_stepTitle(), STDWTITL_tickSplashLoader(), STFGTREP_drawPartner(), STFGTREP_drawReport(), STFGTREP_filesLoading(), STFGTREP_fillPartnerWindows(), STFGTREP_loadFiles(), STFGTREP_runPartner(), STGDGLAB_askMark(), STGDGLAB_drawEntryList(), STGDGLAB_drawMenu(), STGDGLAB_drawPartyScreen(), STGDGLAB_drawRecipeScreen(), STGDGLAB_drawSkillPanel(), STGDGLAB_drawSlotScreen(), STGDGLAB_filesLoading(), STGDGLAB_loadFiles(), STGDGLAB_pickSkill(), STGDGLAB_runSlotScreen(), STGDGLAB_showEntryList(), STGDGLAB_showEntryPanel(), STGDGLAB_showEntryPanelOptions(), STGDGLAB_showMenuPage(), STGDGLAB_showPartyPage(), STGDGLAB_showSkillPanel(), STGDGLAB_showSlotScreen(), STGDGLAB_updateLab(), STGDGLAB_updateSkillPanel(), STGMCARD_answerError(), STGMCARD_askError(), STGMCARD_drawSaves(), STGMCARD_filesLoading(), STGMCARD_loadFiles(), STGMCARD_openSaves(), STGMCARD_pickPort(), STGMCARD_pickSlot(), STGMCARD_promptSlot(), STGMCARD_refreshInfo(), STGMCARD_showDone(), STGMCARD_showPort(), STGMCARD_slideInTitle(), STGMCARD_startInfoRead(), STGMCARD_startLoad(), STGMCARD_startSave(), STGMCARD_updateInfo(), STGMCARD_updateMenu(), STGMCARD_updatePanel(), STGMCARD_updateScreen(), STGTRAIN_applyTry(), STGTRAIN_askToTrain(), STGTRAIN_drawMenu(), STGTRAIN_drawResult(), STGTRAIN_drawScreen(), STGTRAIN_drawSession(), STGTRAIN_freeFile(), STGTRAIN_getFile(), STGTRAIN_loadImages(), STGTRAIN_openBattleStats(), STGTRAIN_openTp(), STGTRAIN_requestFile(), STGTRAIN_runMenu(), STGTRAIN_runScreen(), STGTRAIN_runSession(), STGTRAIN_runTraining(), STGTRAIN_showGains(), STGTRAIN_showIntensities(), STGTRAIN_showPageHint(), STGTRAIN_showStatChanges(), STGTRAIN_showTp(), STGTRAIN_showTrainingInfo(), STGTRAIN_showTrainingName(), STGTRAIN_showVitals(), STGTRAIN_updateActor(), STGTRAIN_updateScreen(), STITSHOP_drawBuy(), STITSHOP_drawItemList(), STITSHOP_drawSell(), STITSHOP_drawShop(), STITSHOP_drawStatsPage(), STITSHOP_filesLoading(), STITSHOP_fillPartnerRows(), STITSHOP_loadFiles(), STITSHOP_openBuyInfo(), STITSHOP_openEquipQuestion(), STITSHOP_openSellQuantity(), STITSHOP_openSellTotal(), STITSHOP_openSellTypes(), STITSHOP_pickBuyItem(), STITSHOP_runBuy(), STITSHOP_runSell(), STITSHOP_runShop(), STITSHOP_showBuyTotal(), STITSHOP_showEquipMarker(), STITSHOP_showItemDesc(), STITSHOP_showItemPage(), STITSHOP_showItemRows(), STITSHOP_showQuantity(), STITSHOP_startInfoPageTurn(), STITSHOP_updateInfo(), STPLNMET_createTabs(), STPLNMET_drawChoice(), STPLNMET_drawConfirm(), STPLNMET_drawTitle(), STPLNMET_filesLoading(), STPLNMET_loadFiles(), STPLNMET_loadScroll(), STPLNMET_runConfirm(), STPLNMET_showChoiceWindows(), STPLNMET_showConfirmWindows(), STPLNMET_updateScroll(), STPLNMET_updateShine(), STPLNMET_updateSparkles(), STPLNMET_updateWelcome(), STSTATUS_chooseFirstToSwap(), STSTATUS_chooseItemList(), STSTATUS_chooseSecondToSwap(), STSTATUS_chooseTech(), STSTATUS_chooseTechTarget(), STSTATUS_closeDigivolveQuestion(), STSTATUS_closeEntryTechs(), STSTATUS_closeNoFieldTechs(), STSTATUS_closePartnerTech(), STSTATUS_closeQuestionForTechs(), STSTATUS_closeSlotsForPartnerTech(), STSTATUS_closeSlotsForQuestion(), STSTATUS_createMapScreen(), STSTATUS_createMenu(), STSTATUS_drawBackground(), STSTATUS_drawCardScreen(), STSTATUS_drawDemoScreen(), STSTATUS_drawDigivolvePanel(), STSTATUS_drawEquipPanel(), STSTATUS_drawItemList(), STSTATUS_drawItemScreen(), STSTATUS_drawMapScreen(), STSTATUS_drawSortScreen(), STSTATUS_drawStatusScreen(), STSTATUS_drawTechScreen(), STSTATUS_filesLoading(), STSTATUS_loadFiles(), STSTATUS_lockItemOptions(), STSTATUS_openCardScreenAlone(), STSTATUS_openDemoScreenAlone(), STSTATUS_openDigivolveTitle(), STSTATUS_openEquipTitle(), STSTATUS_openFirstMemberPage(), STSTATUS_openFirstOfThreeItemPages(), STSTATUS_openFirstOfThreeStatusPages(), STSTATUS_openFirstOfThreeTechPages(), STSTATUS_openFirstOfTwoItemPages(), STSTATUS_openFirstOfTwoStatusPages(), STSTATUS_openFirstOfTwoTechPages(), STSTATUS_openFirstSortPage(), STSTATUS_openItemScreenAlone(), STSTATUS_openSecondOfTwoCardPages(), STSTATUS_openSecondOfTwoDemoPages(), STSTATUS_openSecondOfTwoItemPages(), STSTATUS_openSecondOfTwoStatusPages(), STSTATUS_openSecondSortPage(), STSTATUS_openStatusScreenAlone(), STSTATUS_openTechList(), STSTATUS_openTechScreenAlone(), STSTATUS_openThirdCardPage(), STSTATUS_openThirdDemoPage(), STSTATUS_openThirdItemPage(), STSTATUS_openThirdSortPage(), STSTATUS_openThirdStatusPage(), STSTATUS_refreshItemList(), STSTATUS_reopenItemOptions(), STSTATUS_runDigivolvePanel(), STSTATUS_runStatusChoice(), STSTATUS_sayNoFieldTechs(), STSTATUS_showBattleMessage(), STSTATUS_showCardChoices(), STSTATUS_showCardPage(), STSTATUS_showChosenItem(), STSTATUS_showChosenPage(), STSTATUS_showChosenTech(), STSTATUS_showDemoChoices(), STSTATUS_showDemoPage(), STSTATUS_showDigivolveChoices(), STSTATUS_showDigivolveSlots(), STSTATUS_showDigivolveStats(), STSTATUS_showEquipItem(), STSTATUS_showEquipList(), STSTATUS_showEquipment(), STSTATUS_showItemHelp(), STSTATUS_showItemListPage(), STSTATUS_showItemLists(), STSTATUS_showItemPage(), STSTATUS_showMapArea(), STSTATUS_showMoney(), STSTATUS_showPartnerEquipment(), STSTATUS_showPartnerSlots(), STSTATUS_showPartnerStats(), STSTATUS_showPartnerTech(), STSTATUS_showSlotItem(), STSTATUS_showSortPage(), STSTATUS_showStatusChoices(), STSTATUS_showStatusPage(), STSTATUS_showTechCost(), STSTATUS_showTechHelp(), STSTATUS_showTechList(), STSTATUS_showTechPage(), STSTATUS_unlockItemOptions(), STSTATUS_updateMapScreen(), STSTATUS_updateMenu(), STSTATUS_useItem(), STSTATUS_useTech(), timLoaderLoadArchive(), touchMarkedFiles(), updateBackground(), updateEvent1510(), updateEvent1512(), updateEvent1514(), updateEvent1516(), updateEvent1518(), updateEvent1520(), updateEvent1602(), updateEvent1604(), updateEvent1616(), updateEvent1618(), updateEvent9(), updateFarSprites(), updateFieldMenu(), updateFileCache(), updateInn(), updateInnMenu(), updateKeyboard(), updateListMenu(), updateMenu(), updateNameEntry(), updateScroller(), updateSoundLoading(), updateSpriteField(), WFIGHTMN_loadFiles(), WFIGHTTS_fighterList(), WFIGHTTS_loadImages(), and WFIGHTTS_motionList().