30 if (slot->
file == file) {
43 if (slot->
file == 0) {
126 if (slot->
file != 0) {
127 switch (slot->
state) {
193 if (slot->
file != 0) {
211 if (slot->
file != 0) {
231 s32 index = fileAndIndex & 0xFFFF;
235 return (
void *)(table[index] + (
s32)table);
240 s32 *table = archive;
242 return (
void *)(table[index & 0xFFFF] + (
s32)table);
251 if (slot->
file == 0) {
267#elif VERSION_EU || VERSION_JP
CdReader CD_READER
The CD reader.
GfxState GFX
GFX: the graphics state and its methods.
#define CD_SECTOR_SIZE
The bytes of data in a sector (Mode 2 Form 1), as the reader reads them.
#define FILE_CACHE_SLOTS
The files the cache holds at most.
void * getFileEntry(u32 fileAndIndex)
Files are often archives: a table of offsets from the start of the file.
FileSlot * findOldestFile(void)
The loaded file used least recently (the biggest one on a tie)
void freeFilesFrom(u32 addr)
Frees the files that reach past addr (to load something there)
void freeFile(s32 file)
Drops a loaded file from the cache.
void updateFileCache(void)
Starts reading the next queued file and marks the one read as loaded.
FileSlot * findFreeFileSlot(void)
A free cache slot, or NULL.
void requestFile(s32 file)
Queues a file for the cache (just marks it used when it is there)
s32 isFileLoading(s32 file)
0 once the file is in the cache; requests it if needed
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 freeAllFiles(void)
Drops every file from the cache.
void waitForFile(s32 file)
Reads a file into the cache before returning.
void evictOldestFile(void)
Frees the loaded file used least recently, to make room in the heap.
void * loadFile(u32 file)
Returns the file's data, reading it now if it is not in the cache.
void touchMarkedFiles(void)
Marks the files markCachedFiles saw as just used (the European and Japanese versions,...
FileSlot * findFileSlot(s32 file)
The cache slot of a file, or NULL.
FileCache FILE_CACHE
The file cache.
FileTableFuncs FILE_TABLE
The disc's file table.
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
void(* read)(s32 file, s32 offset, s32 size, void *buf, s32 *done)
The file cache (FILE_CACHE): up to 64 files loaded in the heap (tag 3), read in the background one at...
s32(* getSectorCount)(s32 file)
void *(* alloc)(s32 size, s32 tag)