Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
file.h File Reference

The disc file table, the CD reader, the file cache and the decompressor (file/) More...

#include "common.h"
#include <sys/types.h>
#include <libgte.h>
#include <libgpu.h>
#include <libcd.h>
#include "engine/task.h"
Include dependency graph for file.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  FileTableFuncs
 The disc's file table (FILE_TABLE): files are numbered, not named. More...
 
struct  FileSlot
 
struct  CdReader
 Reads whole sectors of a file with CdlReadN, from callbacks. More...
 
struct  CdSectorHeader
 What cdCheckSector reads first of each sector, the 3 words that CdlModeSize1 puts before its data: the sector's header, whose position it compares with the one it expects, and the XA subheader, which nothing reads. More...
 
struct  FileCache
 The file cache (FILE_CACHE): up to 64 files loaded in the heap (tag 3), read in the background one at a time and evicted least recently used first when the heap is full. More...
 
struct  Decompressor
 Expands "RLEN" data (a run-length encoding: a byte n < 0x80 copies n bytes, n | 0x80 repeats the next byte n times, 0 ends), all at once (run) or chunkSize bytes a frame (start, then substate 1 until done). More...
 

Macros

#define FILE_CACHE_SLOTS   64
 The files the cache holds at most.
 
#define CD_SECTOR_SIZE   0x800
 The bytes of data in a sector (Mode 2 Form 1), as the reader reads them.
 
#define RLEN_MAGIC   0x4E454C52
 The first word of "RLEN" data, which its unpacked size follows.
 
#define FILE_MENU_SPRITES   0x286
 Files the engine loads by number.
 
#define FILE_FONT   0x287
 
#define TEXT_FILE(file)   (LANGUAGE + (file) - 1)
 
#define TEXT_AMATERASU_MAP   0x02
 The text files, by their USA disc names (US<name>.BIN), for TEXT_FILE()
 
#define TEXT_ASUKA_MAP   0x09
 ASKMAP: the map screen's before.
 
#define TEXT_CARD_GAME   0x10
 CARDGM: the card battle's.
 
#define TEXT_CARD_NAMES   0x17
 CARDNM.
 
#define TEXT_CARD_EFFECTS   0x1E
 CARDST.
 
#define TEXT_CARD_ALBUM   0x25
 CRDABM: STCRDABM's.
 
#define TEXT_DECK_EDITOR   0x2C
 CRDDEK.
 
#define TEXT_CARD_SHOP   0x33
 CRDSHP: STCRDSHP's, and STCRDDEK's.
 
#define TEXT_DIGI_LAB   0x3A
 DGLABO: STGDGLAB's.
 
#define TEXT_DIGIMON_NAMING   0x41
 DGNMET: STDGNAME's.
 
#define TEXT_DIGIMON_INFO   0x48
 DIGINF.
 
#define TEXT_DIGIMON_NAMES   0x4F
 DIGNAM.
 
#define TEXT_FIGHT_REPORT   0x56
 FGTRPT: STFGTREP's.
 
#define TEXT_INN_NAMES   0x5D
 HTLNAM.
 
#define TEXT_ITEM_INFO   0x64
 ITMINF.
 
#define TEXT_ITEM_NAMES   0x6B
 ITMNAM.
 
#define TEXT_ITEM_SHOP   0x72
 ITSHOP: STITSHOP's.
 
#define TEXT_MEMORY_CARD   0x79
 MEMCRD.
 
#define TEXT_BATTLE_MENU   0x80
 MFIGHT: WFIGHTMN's.
 
#define TEXT_NAME_ENTRY   0x87
 NAMEDT: the keyboard's.
 
#define TEXT_ONLINE   0x8E
 NAMEET: the Digimon Online registration.
 
#define TEXT_SHOP_NAMES   0x95
 SHPNAM.
 
#define TEXT_SKILL_INFO   0x9C
 SKLINF.
 
#define TEXT_SKILL_NAMES   0xA3
 SKLNAM.
 
#define TEXT_AREA_NAMES   0xAA
 STAREA.
 
#define TEXT_STATUS   0xB1
 STATUS: the field menu's and STSTATUS's.
 
#define TEXT_STAGE_NAMES   0xB8
 STNAME.
 
#define TEXT_TALKS_00   0xC6
 The stages' text files, by their USA disc names too: TALKnn hold the stages' talks (a stage's STAGE_TEXT, the file shared by a set of stages), DMGnnn the events of the stages from WSTAGnnn on (EVENT_TEXT_FILE, which counts from TEXT_FILE(1), so is the file - 1), but for DMG260, DMG270 and DMG305, of one stage each.
 
#define TEXT_TALKS_01   0xCD
 
#define TEXT_TALKS_02   0xD4
 
#define TEXT_TALKS_03   0xDB
 
#define TEXT_TALKS_04   0xE2
 
#define TEXT_TALKS_05   0xE9
 
#define TEXT_TALKS_06   0xF0
 
#define TEXT_TALKS_07   0xF7
 
#define TEXT_TALKS_08   0xFE /* TALK08: the extra chapter's */
 
#define TEXT_TALKS_09   0x105 /* TALK09: the extra chapter's */
 
#define TEXT_TRAINING   0x10C
 
#define TEXT_EVENTS_200   0x113
 
#define TEXT_EVENTS_260   0x11A
 
#define TEXT_EVENTS_270   0x121
 
#define TEXT_EVENTS_300   0x128
 
#define TEXT_EVENTS_305   0x12F
 
#define TEXT_EVENTS_400   0x136
 
#define TEXT_EVENTS_500   0x13D
 
#define TEXT_EVENTS_600   0x144
 
#define TEXT_EVENTS_700   0x14B
 
#define TEXT_EVENTS_800   0x152
 
#define TEXT_EVENTS_900   0x159 /* DMG900: the extra chapter's (EXTRA_TEXT) */
 
#define FILE_BATTLE_MENU   0x455
 The battle menu's files (WFIGHTMN, WFIGHTTS): FILE_BATTLE_IMAGES is an archive whose entries go through FILE_CACHE.getEntry, the four after it are archives of images for VRAM.
 
#define FILE_BATTLE_IMAGES   0x456
 
#define FILE_BATTLE_IMAGES_1   0x79E
 
#define FILE_BATTLE_IMAGES_2   0x7AE
 
#define FILE_BATTLE_IMAGES_3   0x7E1
 
#define FILE_BATTLE_IMAGES_4   0x7E3
 

Enumerations

enum  FileSlotState { FILE_FREE , FILE_QUEUED , FILE_READING , FILE_LOADED }
 FileSlot.state. More...
 
enum  CdReadState {
  CD_READ_IDLE , CD_READ_SETLOC , CD_READ_SETMODE , CD_READ_READN ,
  CD_READ_SECTORS
}
 What the CD reader waits for (CdReader.state): the command each state sent to complete, or, in CD_READ_SECTORS, the sectors and then CdlPause. More...
 

Functions

s32 isFileLoading (s32)
 0 once the file is in the cache; requests it if needed
 
FileSlot * findFileSlot (s32 file)
 The cache slot of a file, or NULL.
 
FileSlot * findFreeFileSlot (void)
 A free cache slot, or NULL.
 
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)
 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.
 
void cdSyncCallback (s32 status, u_char *result)
 The CdSyncCallback: Setloc, Setmode (double speed, whole sectors), ReadN, and CdlPause once the sectors are in.
 
s32 cdCheckSector (void)
 Checks that the sector just read is the next one.
 
void cdReadyCallback (s32 status, u_char *result)
 The CdReadyCallback: copies each sector as it arrives, pauses at the end.
 
s32 isCdReading (void)
 Whether the CD reader is busy.
 
void startCdRead (void)
 Starts the read readFile set up: seeks to its first sector.
 
void readFile (s32 file, s32 offset, s32 size, void *buffer, s32 *done)
 Starts reading size sectors (0: all) of a file into buffer; ignored while busy.
 
s32 fileExists (s32 file)
 Whether the disc has file file
 
s32 getFileSectorCount (s32 file)
 The sectors of a file.
 
s32 getFileSector (s32 file)
 The first sector of a file.
 
void getFilePos (s32 file, s32 offset, void *pos)
 The CdlLOC of sector offset of a file.
 
void * decompressorRun (Decompressor *task, s32 *data)
 Decompressor method: unpacks data at once; returns it unpacked (plain data as it is)
 
void decompressorFree (Decompressor *task)
 Decompressor method: frees its buffer.
 
void decompressorSetData (Decompressor *task, s32 *data)
 Points the decompressor at data, which is RLEN-packed or plain.
 
void decompressorAllocBuffer (Decompressor *task)
 Makes the buffer big enough for the unpacked size.
 
void decompressorStep (Decompressor *task)
 Unpacks at least chunkSize bytes; back to substate 0 at the end.
 
Decompressor * createDecompressor (void)
 A decompressor task.
 
void decompressorStart (Decompressor *task, s32 *data, s32 chunkSize)
 Decompressor method: starts unpacking data chunkSize bytes a frame.
 
void * decompressorGetData (Decompressor *task)
 Decompressor method: the unpacked data, or NULL while it is unpacking.
 
void updateDecompressor (Decompressor *task)
 The decompressor task: unpacks a chunk a frame, frees the buffer at the end.
 

Variables

FileTableFuncs FILE_TABLE
 The disc's file table.
 
CdReader CD_READER
 The CD reader.
 
CdSectorHeader CD_SECTOR_HEADER
 file/cd_reader.c's
 
FileCache FILE_CACHE
 The file cache.
 
s32 FILE_SECTORS []
 Where each file starts on the disc, and its size, in sectors.
 
u16 FILE_SECTOR_COUNTS []
 
s32 LANGUAGE
 2-5
 

Detailed Description

The disc file table, the CD reader, the file cache and the decompressor (file/)

Definition in file file.h.

Macro Definition Documentation

◆ FILE_CACHE_SLOTS

#define FILE_CACHE_SLOTS   64

The files the cache holds at most.

Definition at line 27 of file file.h.

◆ CD_SECTOR_SIZE

#define CD_SECTOR_SIZE   0x800

The bytes of data in a sector (Mode 2 Form 1), as the reader reads them.

Definition at line 48 of file file.h.

◆ RLEN_MAGIC

#define RLEN_MAGIC   0x4E454C52

The first word of "RLEN" data, which its unpacked size follows.

Definition at line 103 of file file.h.

◆ FILE_MENU_SPRITES

#define FILE_MENU_SPRITES   0x286

Files the engine loads by number.

The European disc numbers its files differently, and has each text file once per language, in a row: TEXT_FILE() gives the copy of the language the player picked (LANGUAGE, set by CNTY_SEL), copy 1 being at the USA version's number. Every disc has all the copies; the Japanese version reads copy 0, Japanese, which is the European version's LANGUAGE 0 (NAME_ENTRY_JAPANESE), so it is the European code with LANGUAGE a constant. The Japanese disc otherwise numbers its files as the USA one does: every file of the USA disc is at the same number on it (its 55 more stages' files come after), so the Japanese version takes the USA version's file numbers.

Definition at line 188 of file file.h.

◆ FILE_FONT

#define FILE_FONT   0x287

Definition at line 189 of file file.h.

◆ TEXT_FILE

#define TEXT_FILE (   file)    (LANGUAGE + (file) - 1)

Definition at line 190 of file file.h.

◆ TEXT_AMATERASU_MAP

#define TEXT_AMATERASU_MAP   0x02

The text files, by their USA disc names (US<name>.BIN), for TEXT_FILE()

AMTMAP: the map screen's in the second half (STSTATUS_getGameHalf)

Definition at line 200 of file file.h.

◆ TEXT_ASUKA_MAP

#define TEXT_ASUKA_MAP   0x09

ASKMAP: the map screen's before.

Definition at line 201 of file file.h.

◆ TEXT_CARD_GAME

#define TEXT_CARD_GAME   0x10

CARDGM: the card battle's.

Definition at line 202 of file file.h.

◆ TEXT_CARD_NAMES

#define TEXT_CARD_NAMES   0x17

CARDNM.

Definition at line 203 of file file.h.

◆ TEXT_CARD_EFFECTS

#define TEXT_CARD_EFFECTS   0x1E

CARDST.

Definition at line 204 of file file.h.

◆ TEXT_CARD_ALBUM

#define TEXT_CARD_ALBUM   0x25

CRDABM: STCRDABM's.

Definition at line 205 of file file.h.

◆ TEXT_DECK_EDITOR

#define TEXT_DECK_EDITOR   0x2C

CRDDEK.

Definition at line 206 of file file.h.

◆ TEXT_CARD_SHOP

#define TEXT_CARD_SHOP   0x33

CRDSHP: STCRDSHP's, and STCRDDEK's.

Definition at line 207 of file file.h.

◆ TEXT_DIGI_LAB

#define TEXT_DIGI_LAB   0x3A

DGLABO: STGDGLAB's.

Definition at line 208 of file file.h.

◆ TEXT_DIGIMON_NAMING

#define TEXT_DIGIMON_NAMING   0x41

DGNMET: STDGNAME's.

Definition at line 209 of file file.h.

◆ TEXT_DIGIMON_INFO

#define TEXT_DIGIMON_INFO   0x48

DIGINF.

Definition at line 210 of file file.h.

◆ TEXT_DIGIMON_NAMES

#define TEXT_DIGIMON_NAMES   0x4F

DIGNAM.

Definition at line 211 of file file.h.

◆ TEXT_FIGHT_REPORT

#define TEXT_FIGHT_REPORT   0x56

FGTRPT: STFGTREP's.

Definition at line 212 of file file.h.

◆ TEXT_INN_NAMES

#define TEXT_INN_NAMES   0x5D

HTLNAM.

Definition at line 213 of file file.h.

◆ TEXT_ITEM_INFO

#define TEXT_ITEM_INFO   0x64

ITMINF.

Definition at line 214 of file file.h.

◆ TEXT_ITEM_NAMES

#define TEXT_ITEM_NAMES   0x6B

ITMNAM.

Definition at line 215 of file file.h.

◆ TEXT_ITEM_SHOP

#define TEXT_ITEM_SHOP   0x72

ITSHOP: STITSHOP's.

Definition at line 216 of file file.h.

◆ TEXT_MEMORY_CARD

#define TEXT_MEMORY_CARD   0x79

MEMCRD.

Definition at line 217 of file file.h.

◆ TEXT_BATTLE_MENU

#define TEXT_BATTLE_MENU   0x80

MFIGHT: WFIGHTMN's.

Definition at line 218 of file file.h.

◆ TEXT_NAME_ENTRY

#define TEXT_NAME_ENTRY   0x87

NAMEDT: the keyboard's.

Definition at line 219 of file file.h.

◆ TEXT_ONLINE

#define TEXT_ONLINE   0x8E

NAMEET: the Digimon Online registration.

Definition at line 220 of file file.h.

◆ TEXT_SHOP_NAMES

#define TEXT_SHOP_NAMES   0x95

SHPNAM.

Definition at line 221 of file file.h.

◆ TEXT_SKILL_INFO

#define TEXT_SKILL_INFO   0x9C

SKLINF.

Definition at line 222 of file file.h.

◆ TEXT_SKILL_NAMES

#define TEXT_SKILL_NAMES   0xA3

SKLNAM.

Definition at line 223 of file file.h.

◆ TEXT_AREA_NAMES

#define TEXT_AREA_NAMES   0xAA

STAREA.

Definition at line 224 of file file.h.

◆ TEXT_STATUS

#define TEXT_STATUS   0xB1

STATUS: the field menu's and STSTATUS's.

Definition at line 225 of file file.h.

◆ TEXT_STAGE_NAMES

#define TEXT_STAGE_NAMES   0xB8

STNAME.

Definition at line 226 of file file.h.

◆ TEXT_TALKS_00

#define TEXT_TALKS_00   0xC6

The stages' text files, by their USA disc names too: TALKnn hold the stages' talks (a stage's STAGE_TEXT, the file shared by a set of stages), DMGnnn the events of the stages from WSTAGnnn on (EVENT_TEXT_FILE, which counts from TEXT_FILE(1), so is the file - 1), but for DMG260, DMG270 and DMG305, of one stage each.

The European disc numbers the TALK files 7 lower and has its extra chapter's two after them, so the others 7 higher; the Japanese version has the extra chapter's (MSTALK08, MSTALK09, MSDMG900) after its stages' files, and reads them by number.

Definition at line 259 of file file.h.

◆ TEXT_TALKS_01

#define TEXT_TALKS_01   0xCD

Definition at line 260 of file file.h.

◆ TEXT_TALKS_02

#define TEXT_TALKS_02   0xD4

Definition at line 261 of file file.h.

◆ TEXT_TALKS_03

#define TEXT_TALKS_03   0xDB

Definition at line 262 of file file.h.

◆ TEXT_TALKS_04

#define TEXT_TALKS_04   0xE2

Definition at line 263 of file file.h.

◆ TEXT_TALKS_05

#define TEXT_TALKS_05   0xE9

Definition at line 264 of file file.h.

◆ TEXT_TALKS_06

#define TEXT_TALKS_06   0xF0

Definition at line 265 of file file.h.

◆ TEXT_TALKS_07

#define TEXT_TALKS_07   0xF7

Definition at line 266 of file file.h.

◆ TEXT_TALKS_08

#define TEXT_TALKS_08   0xFE /* TALK08: the extra chapter's */

Definition at line 267 of file file.h.

◆ TEXT_TALKS_09

#define TEXT_TALKS_09   0x105 /* TALK09: the extra chapter's */

Definition at line 268 of file file.h.

◆ TEXT_TRAINING

#define TEXT_TRAINING   0x10C

Definition at line 269 of file file.h.

◆ TEXT_EVENTS_200

#define TEXT_EVENTS_200   0x113

Definition at line 270 of file file.h.

◆ TEXT_EVENTS_260

#define TEXT_EVENTS_260   0x11A

Definition at line 271 of file file.h.

◆ TEXT_EVENTS_270

#define TEXT_EVENTS_270   0x121

Definition at line 272 of file file.h.

◆ TEXT_EVENTS_300

#define TEXT_EVENTS_300   0x128

Definition at line 273 of file file.h.

◆ TEXT_EVENTS_305

#define TEXT_EVENTS_305   0x12F

Definition at line 274 of file file.h.

◆ TEXT_EVENTS_400

#define TEXT_EVENTS_400   0x136

Definition at line 275 of file file.h.

◆ TEXT_EVENTS_500

#define TEXT_EVENTS_500   0x13D

Definition at line 276 of file file.h.

◆ TEXT_EVENTS_600

#define TEXT_EVENTS_600   0x144

Definition at line 277 of file file.h.

◆ TEXT_EVENTS_700

#define TEXT_EVENTS_700   0x14B

Definition at line 278 of file file.h.

◆ TEXT_EVENTS_800

#define TEXT_EVENTS_800   0x152

Definition at line 279 of file file.h.

◆ TEXT_EVENTS_900

#define TEXT_EVENTS_900   0x159 /* DMG900: the extra chapter's (EXTRA_TEXT) */

Definition at line 280 of file file.h.

◆ FILE_BATTLE_MENU

#define FILE_BATTLE_MENU   0x455

The battle menu's files (WFIGHTMN, WFIGHTTS): FILE_BATTLE_IMAGES is an archive whose entries go through FILE_CACHE.getEntry, the four after it are archives of images for VRAM.

Definition at line 294 of file file.h.

◆ FILE_BATTLE_IMAGES

#define FILE_BATTLE_IMAGES   0x456

Definition at line 295 of file file.h.

◆ FILE_BATTLE_IMAGES_1

#define FILE_BATTLE_IMAGES_1   0x79E

Definition at line 296 of file file.h.

◆ FILE_BATTLE_IMAGES_2

#define FILE_BATTLE_IMAGES_2   0x7AE

Definition at line 297 of file file.h.

◆ FILE_BATTLE_IMAGES_3

#define FILE_BATTLE_IMAGES_3   0x7E1

Definition at line 298 of file file.h.

◆ FILE_BATTLE_IMAGES_4

#define FILE_BATTLE_IMAGES_4   0x7E3

Definition at line 299 of file file.h.

Enumeration Type Documentation

◆ FileSlotState

FileSlot.state.

Enumerator
FILE_FREE 
FILE_QUEUED 
FILE_READING 
FILE_LOADED 

Definition at line 24 of file file.h.

◆ CdReadState

What the CD reader waits for (CdReader.state): the command each state sent to complete, or, in CD_READ_SECTORS, the sectors and then CdlPause.

Enumerator
CD_READ_IDLE 
CD_READ_SETLOC 
CD_READ_SETMODE 
CD_READ_READN 
CD_READ_SECTORS 

Definition at line 39 of file file.h.

Function Documentation

◆ 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:

◆ 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:

◆ 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.

◆ cdSyncCallback()

void cdSyncCallback ( s32  status,
u_char *  result 
)

The CdSyncCallback: Setloc, Setmode (double speed, whole sectors), ReadN, and CdlPause once the sectors are in.

< Error Detected

< Command Complete

< 0: normal speed 1: double speed

< 0: 2048 byte 1: 2340byte

Definition at line 54 of file cd_reader.c.

Referenced by startCdRead().

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

◆ cdCheckSector()

s32 cdCheckSector ( void  )

Checks that the sector just read is the next one.

Definition at line 17 of file cd_reader.c.

Referenced by cdReadyCallback().

Here is the caller graph for this function:

◆ cdReadyCallback()

void cdReadyCallback ( s32  status,
u_char *  result 
)

The CdReadyCallback: copies each sector as it arrives, pauses at the end.

The two callbacks take the status as an int, not CdlCB's u_char, which GCC would truncate on entry (more code), so they are registered with a cast.

< Data Ready

Definition at line 34 of file cd_reader.c.

Referenced by cdSyncCallback().

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

◆ isCdReading()

s32 isCdReading ( void  )

Whether the CD reader is busy.

Definition at line 95 of file cd_reader.c.

Referenced by readFile().

Here is the caller graph for this function:

◆ startCdRead()

void startCdRead ( void  )

Starts the read readFile set up: seeks to its first sector.

Definition at line 100 of file cd_reader.c.

Referenced by cdSyncCallback(), and readFile().

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

◆ readFile()

void readFile ( s32  file,
s32  offset,
s32  size,
void *  buffer,
s32 *  done 
)

Starts reading size sectors (0: all) of a file into buffer; ignored while busy.

Definition at line 110 of file cd_reader.c.

Here is the call graph for this function:

◆ fileExists()

s32 fileExists ( s32  file)

Whether the disc has file file

Definition at line 2642 of file file_table.c.

◆ getFileSectorCount()

s32 getFileSectorCount ( s32  file)

The sectors of a file.

Definition at line 2647 of file file_table.c.

◆ getFileSector()

s32 getFileSector ( s32  file)

The first sector of a file.

Definition at line 2652 of file file_table.c.

◆ getFilePos()

void getFilePos ( s32  file,
s32  offset,
void *  pos 
)

The CdlLOC of sector offset of a file.

Definition at line 2657 of file file_table.c.

◆ decompressorRun()

void * decompressorRun ( Decompressor *  task,
s32 *  data 
)

Decompressor method: unpacks data at once; returns it unpacked (plain data as it is)

Definition at line 76 of file decompressor.c.

Referenced by createDecompressor().

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

◆ decompressorFree()

void decompressorFree ( Decompressor *  task)

Decompressor method: frees its buffer.

Definition at line 4 of file decompressor.c.

Referenced by createDecompressor().

Here is the caller graph for this function:

◆ decompressorSetData()

void decompressorSetData ( Decompressor *  task,
s32 *  data 
)

Points the decompressor at data, which is RLEN-packed or plain.

Definition at line 13 of file decompressor.c.

Referenced by decompressorRun(), and decompressorStart().

Here is the caller graph for this function:

◆ decompressorAllocBuffer()

void decompressorAllocBuffer ( Decompressor *  task)

Makes the buffer big enough for the unpacked size.

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

Definition at line 28 of file decompressor.c.

Referenced by decompressorRun(), and decompressorStart().

Here is the caller graph for this function:

◆ decompressorStep()

void decompressorStep ( Decompressor *  task)

Unpacks at least chunkSize bytes; back to substate 0 at the end.

Definition at line 40 of file decompressor.c.

Referenced by decompressorRun(), and updateDecompressor().

Here is the caller graph for this function:

◆ createDecompressor()

Decompressor * createDecompressor ( void  )

A decompressor task.

Definition at line 131 of file decompressor.c.

Referenced by FIELDSTG_runMapStreamer().

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

◆ decompressorStart()

void decompressorStart ( Decompressor *  task,
s32 *  data,
s32  chunkSize 
)

Decompressor method: starts unpacking data chunkSize bytes a frame.

Definition at line 88 of file decompressor.c.

Referenced by createDecompressor().

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

◆ decompressorGetData()

void * decompressorGetData ( Decompressor *  task)

Decompressor method: the unpacked data, or NULL while it is unpacking.

Definition at line 98 of file decompressor.c.

Referenced by createDecompressor().

Here is the caller graph for this function:

◆ updateDecompressor()

void updateDecompressor ( Decompressor *  task)

The decompressor task: unpacks a chunk a frame, frees the buffer at the end.

Definition at line 109 of file decompressor.c.

Referenced by createDecompressor().

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

Variable Documentation

◆ FILE_TABLE

◆ CD_READER

◆ CD_SECTOR_HEADER

CdSectorHeader CD_SECTOR_HEADER
extern

file/cd_reader.c's

Definition at line 28 of file game_bss.c.

Referenced by cdCheckSector().

◆ FILE_CACHE

FileCache FILE_CACHE
extern

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().

◆ FILE_SECTORS

s32 FILE_SECTORS[]
extern

Where each file starts on the disc, and its size, in sectors.

Definition at line 838 of file file_table.c.

Referenced by fileExists(), getFilePos(), and getFileSector().

◆ FILE_SECTOR_COUNTS

u16 FILE_SECTOR_COUNTS[]
extern

Definition at line 1436 of file file_table.c.

Referenced by getFileSectorCount().

◆ LANGUAGE

s32 LANGUAGE
extern

2-5

2-5

Every module that uses them reads them through their address, so none of those defines them (in a -G8 unit GCC would read them through $gp); file/file_table.c and task/task.c, the modules linked between the two, never read them.

Definition at line 13 of file eu_settings.c.

Referenced by CARDGAME_drawPanel(), CNTY_SEL_tickMenu(), readPadButtons(), setSaveFileName(), STAGSLCT_updateStageSelect(), STDGNAME_createNameEntry(), STDWTITL_drawSplash(), STDWTITL_leaveTitle(), STDWTITL_loadTitleImages(), STDWTITL_tickMovie(), STDWTITL_tickTitle(), STGMCARD_updateInfo(), and STPLNMET_createNameEntry().