All of UFO's data access is through a hierarchical file system, but the contents of the file system can be transparently merged from several sources. The "base directory" is the path to the directory holding the ufo binary and the game directory (base). The base directory is only used during filesystem initialization. The "game directory" is the first tree on the search path and directory that all generated files (savegames, screenshots, config files) will be saved to. More...
#include "common.h"
#include "../ports/system.h"
#include "../shared/defines.h"
#include "../shared/typedefs.h"
#include "../shared/parse.h"
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | listBlock_s |
Defines | |
#define | PK3_SEEK_BUFFER_SIZE 65536 |
#define | MAX_READ 0x10000 |
#define | MAX_PACKFILES 1024 |
Typedefs | |
typedef struct listBlock_s | listBlock_t |
Functions | |
const char * | FS_Gamedir (void) |
Called to find where to write a file (savegames, etc). | |
void | FS_NormPath (char *path) |
Convert operating systems path separators to ufo virtual filesystem separators (/). | |
int | FS_FileLength (qFILE *f) |
Returns the size of a given file. | |
void | FS_CreatePath (const char *path) |
Creates any directories needed to store the given filename. | |
void | FS_CloseFile (qFILE *f) |
Closes a file handle. | |
static int | FS_OpenFileSingle (const char *filename, qFILE *file, filemode_t mode) |
Finds and opens the file in the search path. | |
int | FS_Seek (qFILE *f, long offset, int origin) |
Sets the file position of the given file. | |
int | FS_OpenFile (const char *filename, qFILE *file, filemode_t mode) |
int | FS_CheckFile (const char *fmt,...) |
Just returns the filelength and -1 if the file wasn't found. | |
int | FS_Read (void *buffer, int len, qFILE *f) |
Read a file into a given buffer in memory. | |
int | FS_LoadFile (const char *path, byte **buffer) |
Filenames are relative to the quake search path. | |
void | FS_FreeFile (void *buffer) |
static pack_t * | FS_LoadPackFile (const char *packfile) |
Takes an explicit (not game tree related) path to a pak file. Adding the files at the beginning of the list so they override previous pack files. | |
static void | FS_AddGameDirectory (const char *dir) |
Adds the directory to the head of the search path. | |
char ** | FS_ListFiles (const char *findname, int *numfiles, unsigned musthave, unsigned canthave) |
Builds a qsorted filelist. | |
const char * | FS_NextPath (const char *prevpath) |
Allows enumerating all of the directories in the search path. | |
static void | FS_AddHomeAsGameDirectory (const char *dir) |
void | FS_InitFilesystem (qboolean writeToHomeDir) |
static void | _AddToListBlock (linkedList_t **fl, const char *name, qboolean stripPath) |
Add one name to the filelist. | |
int | FS_BuildFileList (const char *fileList) |
Build a filelist. | |
const char * | FS_NextFileFromFileList (const char *files) |
const char * | FS_GetFileData (const char *files) |
Returns the buffer of a file. | |
void | FS_SkipBlock (const char **text) |
char * | FS_NextScriptHeader (const char *files, const char **name, const char **text) |
static int | FS_MapDefSort (const void *map1, const void *map2) |
static int | CheckBSPFile (const char *filename) |
Checks for valid BSP-file. | |
void | FS_GetMaps (qboolean reset) |
File the fs_maps array with valid maps. | |
int | FS_Printf (qFILE *f, const char *msg,...) |
Can print chunks for 1024 chars into a file. | |
int | FS_Write (const void *buffer, int len, qFILE *f) |
Properly handles partial writes. | |
int | FS_WriteFile (const void *buffer, size_t len, const char *filename) |
const char * | FS_GetCwd (void) |
Return current working dir. | |
qboolean | FS_FileExists (const char *filename) |
Checks whether a file exists (not in virtual filesystem). | |
void | FS_Shutdown (void) |
Cleanup function. | |
void | FS_RestartFilesystem (void) |
Restart the filesystem (reload all pk3 files). | |
void | FS_CopyFile (const char *fromOSPath, const char *toOSPath) |
Copy a fully specified file from one place to another. | |
void | FS_RemoveFile (const char *osPath) |
qboolean | FS_RenameFile (const char *from, const char *to, qboolean relative) |
Renames a file. | |
Variables | |
static int | fs_openedFiles |
static filelink_t * | fs_links |
static searchpath_t * | fs_searchpaths |
static const char * | pakFileExt [] |
static listBlock_t * | fs_blocklist = NULL |
char * | fs_maps [MAX_MAPS] |
int | fs_numInstalledMaps = -1 |
static qboolean | fs_mapsInstalledInit = qfalse |
All of UFO's data access is through a hierarchical file system, but the contents of the file system can be transparently merged from several sources. The "base directory" is the path to the directory holding the ufo binary and the game directory (base). The base directory is only used during filesystem initialization. The "game directory" is the first tree on the search path and directory that all generated files (savegames, screenshots, config files) will be saved to.
Definition in file files.c.
#define MAX_PACKFILES 1024 |
Definition at line 486 of file files.c.
Referenced by FS_AddGameDirectory().
typedef struct listBlock_s listBlock_t |
static void _AddToListBlock | ( | linkedList_t ** | fl, | |
const char * | name, | |||
qboolean | stripPath | |||
) | [static] |
Add one name to the filelist.
Definition at line 867 of file files.c.
References Com_SkipPath(), f, LIST_AddString(), and LIST_ContainsString().
Referenced by FS_BuildFileList().
static int CheckBSPFile | ( | const char * | filename | ) | [static] |
Checks for valid BSP-file.
[in] | filename | BSP-file to check |
Definition at line 1275 of file files.c.
References BSPVERSION, Com_sprintf(), qFILE_s::f, FILE_READ, FS_CloseFile(), FS_OpenFile(), FS_Read(), header, IDBSPHEADER, LittleLong(), MAX_QPATH, and qFILE_s::z.
Referenced by FS_GetMaps().
static void FS_AddGameDirectory | ( | const char * | dir | ) | [static] |
Adds the directory to the head of the search path.
Definition at line 496 of file files.c.
References com_fileSysPool, Com_Printf(), Com_sprintf(), searchpath_s::filename, FS_ListFiles(), FS_LoadPackFile(), i, MAX_OSPATH, MAX_PACKFILES, Mem_Free, Mem_PoolAlloc, searchpath_s::next, searchpath_s::pack, pakFileExt, Q_StringSort(), Q_strncpyz(), SFF_HIDDEN, SFF_SUBDIR, and SFF_SYSTEM.
Referenced by FS_AddHomeAsGameDirectory(), and FS_InitFilesystem().
static void FS_AddHomeAsGameDirectory | ( | const char * | dir | ) | [static] |
Definition at line 642 of file files.c.
References Com_Printf(), Com_sprintf(), FS_AddGameDirectory(), FS_CreatePath(), MAX_OSPATH, Sys_GetHomeDirectory(), UFO_VERSION, and va().
Referenced by FS_InitFilesystem().
int FS_BuildFileList | ( | const char * | fileList | ) |
Build a filelist.
[in] | fileList | e.g. *.cfg to get all config files in the gamedir/ dir |
Definition at line 892 of file files.c.
References _AddToListBlock(), block(), Com_FilePath(), com_fileSysPool, Com_sprintf(), linkedList_s::data, searchpath_s::filename, pack_s::files, listBlock_s::files, FS_ListFiles(), FS_NormPath(), LIST_Count(), LIST_Delete(), MAX_QPATH, Mem_Free, Mem_PoolAlloc, packfile_t::name, searchpath_s::next, listBlock_s::next, pack_s::numfiles, searchpath_s::pack, listBlock_s::path, Q_strncpyz(), qfalse, qtrue, SFF_HIDDEN, SFF_SYSTEM, and Sys_ListFilteredFiles().
Referenced by CL_ReadSinglePlayerData(), Cmd_CompleteExecCommand(), Com_ParseScripts(), FS_GetFileData(), FS_NextFileFromFileList(), M_CompleteMusic(), M_RandomTrack_f(), MD2Visitor(), PrecalcNormalsAndTangentsBatch(), and S_CompleteSounds().
int FS_CheckFile | ( | const char * | fmt, | |
... | ||||
) |
Just returns the filelength and -1 if the file wasn't found.
Definition at line 291 of file files.c.
References FILE_READ, FS_CloseFile(), FS_OpenFileSingle(), MAX_QPATH, and Q_vsnprintf().
Referenced by CIN_PlayCinematic(), CL_CheckAndQueueDownload(), CL_ParseServerInfoMessage(), CL_ParseStartSoundPacket(), FS_RestartFilesystem(), PrecalcNormalsAndTangents(), R_ImageExists(), R_ModLoadAliasMD2Model(), R_ModLoadLevelOfDetailData(), R_ScreenShot(), SV_CheckMap(), SV_NextMapcycle(), UI_CheckRadarImage(), UI_MapInfo(), and UI_RegisterFont().
void FS_CloseFile | ( | qFILE * | f | ) |
Closes a file handle.
Definition at line 118 of file files.c.
References qFILE_s::f, fs_openedFiles, unzCloseCurrentFile(), and qFILE_s::z.
Referenced by ASE_Load(), CheckBSPFile(), CIN_OGM_StopCinematic(), CIN_ROQ_PlayCinematic(), CIN_ROQ_StopCinematic(), CL_LogEvent(), Com_Error(), Com_MD5File(), Com_Quit(), Com_WriteConfigToFile(), Con_LoadConsoleHistory(), Con_SaveConsoleHistory(), FS_CheckFile(), FS_LoadFile(), FS_WriteFile(), GenerateFootstepList(), GenerateMaterialFile(), Key_WriteBindings(), MP_LoadTeamMultiplayer(), MP_MultiplayerTeamSlotComments_f(), R_ScreenShot(), RT_WriteCSVFiles(), SAV_GameLoad(), SAV_GameQuickLoadInit_f(), SAV_GameReadGameComment(), SAV_GameSaveNameCleanup_f(), UI_EditorNodeExtract_f(), WriteBSPBrushMap(), WriteBSPFile(), WriteMapFile(), WriteTGA24(), and WriteToFile().
void FS_CopyFile | ( | const char * | fromOSPath, | |
const char * | toOSPath | |||
) |
Copy a fully specified file from one place to another.
Definition at line 1607 of file files.c.
References byte, com_fileSysPool, Com_Printf(), f, FS_CreatePath(), len, Mem_Free, Mem_PoolAlloc, SEEK_END, SEEK_SET, and Sys_Error().
void FS_CreatePath | ( | const char * | path | ) |
Creates any directories needed to store the given filename.
Definition at line 97 of file files.c.
References MAX_OSPATH, ofs, Q_strncpyz(), and Sys_Mkdir().
Referenced by CL_StartHTTPDownload(), FS_AddHomeAsGameDirectory(), FS_CopyFile(), and FS_OpenFileSingle().
qboolean FS_FileExists | ( | const char * | filename | ) |
Checks whether a file exists (not in virtual filesystem).
[in] | filename | Full filesystem path to the file |
Definition at line 1532 of file files.c.
Referenced by CL_LanguageTest().
int FS_FileLength | ( | qFILE * | f | ) |
Returns the size of a given file.
Definition at line 75 of file files.c.
References dbuffer::end, qFILE_s::f, pos, SEEK_END, and SEEK_SET.
Referenced by ASE_Load(), FS_OpenFileSingle(), FS_WriteFile(), MP_LoadTeamMultiplayer(), and SAV_GameLoad().
void FS_FreeFile | ( | void * | buffer | ) |
Definition at line 412 of file files.c.
References _Mem_Free().
Referenced by CM_AddMapTile(), Cmd_Exec_f(), FS_GetFileData(), FS_NextScriptHeader(), Img_LoadTypedImage(), Irc_Proto_ProcessServerMsg(), LoadBSPFile(), LoadModel(), LoadPNG(), LoadTGA(), M_Start(), M_Stop(), ModelWorker(), R_FontShutdown(), R_LoadMaterials(), R_LoadShader(), R_ModAddMapTile(), R_ModForName(), R_ModLoadAliasMD2Model(), R_ModLoadLevelOfDetailData(), R_ModLoadMDX(), R_PreprocessShader(), S_LoadSampleChunk(), SV_InitGameProgs(), SV_LoadModelMinsMaxs(), SV_ParseMapcycle(), and SV_ParseUMP().
const char* FS_Gamedir | ( | void | ) |
Called to find where to write a file (savegames, etc).
Definition at line 49 of file files.c.
References searchpath_s::filename, searchpath_s::next, and searchpath_s::pack.
Referenced by CL_CheckAndQueueDownload(), CL_FinishHTTPDownload(), CL_StartHTTPDownload(), FS_InitFilesystem(), FS_NextPath(), FS_OpenFileSingle(), FS_RenameFile(), FS_WriteFile(), Key_WriteBindings(), R_ScreenShot(), and SV_InitGameProgs().
const char* FS_GetCwd | ( | void | ) |
Return current working dir.
Definition at line 1519 of file files.c.
References FS_NormPath(), MAX_OSPATH, Q_strncpyz(), and Sys_Cwd().
Referenced by CL_Init(), and CL_LanguageTest().
const char* FS_GetFileData | ( | const char * | files | ) |
Returns the buffer of a file.
[in] | files | If NULL, reset the filelist If not NULL it may be something like *.cfg to get a list of all config files in base/. Calling FS_GetFileData ("*.cfg"); until it returns NULL is sufficient to get one buffer after another. |
Definition at line 1072 of file files.c.
References block(), byte, Com_Printf(), linkedList_s::data, listBlock_s::files, FS_BuildFileList(), FS_FreeFile(), FS_LoadFile(), MAX_QPATH, linkedList_s::next, listBlock_s::next, listBlock_s::path, and Q_strncpyz().
Referenced by Com_GetScriptChecksum().
void FS_GetMaps | ( | qboolean | reset | ) |
File the fs_maps array with valid maps.
[in] | reset | If true the directory is scanned every time for new maps (useful for dedicated servers). If false we only use the maps array (for clients e.g.) |
Definition at line 1310 of file files.c.
References CheckBSPFile(), com_fileSysPool, Com_Printf(), Com_SkipPath(), Com_sprintf(), Com_StripExtension(), searchpath_s::filename, pack_s::files, FS_ListFiles(), FS_MapDefSort(), FS_NormPath(), MAX_MAPS, MAX_OSPATH, MAX_QPATH, Mem_Free, Mem_PoolAlloc, packfile_t::name, searchpath_s::next, pack_s::numfiles, searchpath_s::pack, Q_strncpyz(), qtrue, SFF_HIDDEN, and SFF_SYSTEM.
Referenced by SV_CompleteMapCommand(), and SV_ListMaps_f().
void FS_InitFilesystem | ( | qboolean | writeToHomeDir | ) |
Definition at line 824 of file files.c.
References BASEDIRNAME, Com_Printf(), FS_AddGameDirectory(), FS_AddHomeAsGameDirectory(), and FS_Gamedir().
Referenced by FS_RestartFilesystem(), main(), Qcommon_Init(), and TEST_Init().
char** FS_ListFiles | ( | const char * | findname, | |
int * | numfiles, | |||
unsigned | musthave, | |||
unsigned | canthave | |||
) |
Builds a qsorted filelist.
Definition at line 564 of file files.c.
References com_fileSysPool, i, MAX_FILES, MAX_OSPATH, Mem_PoolAlloc, Mem_PoolStrDup, Q_StringSort(), Q_strlwr(), Q_strncpyz(), Sys_FindClose(), Sys_FindFirst(), and Sys_FindNext().
Referenced by FS_AddGameDirectory(), FS_BuildFileList(), and FS_GetMaps().
int FS_LoadFile | ( | const char * | path, | |
byte ** | buffer | |||
) |
Filenames are relative to the quake search path.
[in] | buffer | a null buffer will just return the file length without loading |
[in] | path |
Definition at line 379 of file files.c.
References _Mem_Alloc(), byte, com_fileSysPool, qFILE_s::f, FILE_READ, FS_CloseFile(), FS_OpenFile(), FS_Read(), len, qtrue, and qFILE_s::z.
Referenced by AddScriptToStack(), Check_InitEntityDefs(), CL_CheckOrDownloadFile(), CL_ReVerifyHTTPQueue(), CM_AddMapTile(), Cmd_Exec_f(), FS_GetFileData(), FS_NextScriptHeader(), Img_LoadTypedImage(), Irc_Proto_ProcessServerMsg(), LoadBSPFile(), LoadJPG(), LoadModel(), LoadPNG(), LoadTGA(), M_Start(), ModelWorker(), R_FontAnalyze(), R_LoadMaterials(), R_LoadShader(), R_ModAddMapTile(), R_ModForName(), R_ModLoadAliasMD2Model(), R_ModLoadLevelOfDetailData(), R_ModLoadMDX(), R_PreprocessShader(), S_LoadSampleChunk(), SV_InitGameProgs(), SV_LoadModelMinsMaxs(), SV_ParseMapcycle(), and SV_ParseUMP().
static pack_t* FS_LoadPackFile | ( | const char * | packfile | ) | [static] |
Takes an explicit (not game tree related) path to a pak file. Adding the files at the beginning of the list so they override previous pack files.
[in] | packfile | The pack filename |
Definition at line 423 of file files.c.
References com_fileSysPool, Com_GetExtension(), Com_Printf(), unz_file_info_s::compressed_size, qFILE_s::f, packfile_t::filelen, pack_s::filename, pack_s::files, gi, pack_s::handle, i, MAX_QPATH, Mem_PoolAlloc, name, unz_global_info_s::number_entry, pack_s::numfiles, Q_StringSort(), Q_strlwr(), Q_strncpyz(), UNZ_OK, unzGetCurrentFileInfo(), unzGetCurrentFileInfoPosition(), unzGetGlobalInfo(), unzGoToFirstFile(), unzGoToNextFile(), unzOpen(), and qFILE_s::z.
Referenced by FS_AddGameDirectory().
static int FS_MapDefSort | ( | const void * | map1, | |
const void * | map2 | |||
) | [static] |
Definition at line 1251 of file files.c.
References Q_StringSort().
Referenced by FS_GetMaps().
const char* FS_NextFileFromFileList | ( | const char * | files | ) |
Definition at line 1018 of file files.c.
References block(), Com_Printf(), linkedList_s::data, listBlock_s::files, FS_BuildFileList(), MAX_QPATH, linkedList_s::next, listBlock_s::next, and listBlock_s::path.
Referenced by Cmd_CompleteExecCommand(), M_CompleteMusic(), M_RandomTrack_f(), MD2Visitor(), PrecalcNormalsAndTangentsBatch(), and S_CompleteSounds().
const char* FS_NextPath | ( | const char * | prevpath | ) |
Allows enumerating all of the directories in the search path.
Definition at line 618 of file files.c.
References searchpath_s::filename, FS_Gamedir(), searchpath_s::next, and searchpath_s::pack.
Referenced by SV_GetGameAPI().
char* FS_NextScriptHeader | ( | const char * | files, | |
const char ** | name, | |||
const char ** | text | |||
) |
Definition at line 1145 of file files.c.
References block(), byte, Com_Parse(), linkedList_s::data, listBlock_s::files, FS_FreeFile(), FS_LoadFile(), FS_SkipBlock(), MAX_QPATH, MAX_VAR, linkedList_s::next, listBlock_s::next, listBlock_s::path, and Q_strncpyz().
Referenced by CL_ReadSinglePlayerData(), and Com_ParseScripts().
void FS_NormPath | ( | char * | path | ) |
Convert operating systems path separators to ufo virtual filesystem separators (/).
Definition at line 66 of file files.c.
References Sys_NormPath().
Referenced by FS_BuildFileList(), FS_GetCwd(), and FS_GetMaps().
int FS_OpenFile | ( | const char * | filename, | |
qFILE * | file, | |||
filemode_t | mode | |||
) |
Definition at line 280 of file files.c.
References FS_OpenFileSingle().
Referenced by ASE_Load(), CheckBSPFile(), CIN_OGM_PlayCinematic(), CIN_ROQ_PlayCinematic(), CL_LogEvent(), Com_MD5File(), Com_vPrintf(), Com_WriteConfigToFile(), Con_LoadConsoleHistory(), Con_SaveConsoleHistory(), FS_LoadFile(), FS_WriteFile(), GenerateFootstepList(), GenerateMaterialFile(), Key_WriteBindings(), MP_LoadTeamMultiplayer(), MP_MultiplayerTeamSlotComments_f(), R_ScreenShot(), RT_WriteCSVFiles(), SAV_GameLoad(), SAV_GameQuickLoadInit_f(), SAV_GameReadGameComment(), SAV_GameSaveNameCleanup_f(), UI_EditorNodeExtract_f(), WriteBSPBrushMap(), WriteBSPFile(), WriteMapFile(), WriteTGA24(), and WriteToFile().
static int FS_OpenFileSingle | ( | const char * | filename, | |
qFILE * | file, | |||
filemode_t | mode | |||
) | [static] |
Finds and opens the file in the search path.
[in] | filename | |
[in,out] | file | The file pointer |
[in] | mode | read, write, append as an enum |
Definition at line 141 of file files.c.
References Com_Printf(), Com_sprintf(), qFILE_s::f, FILE_APPEND, FILE_WRITE, packfile_t::filelen, searchpath_s::filename, pack_s::filename, qFILE_s::filepos, pack_s::files, filelink_s::from, filelink_s::fromlength, FS_CreatePath(), FS_FileLength(), FS_Gamedir(), fs_openedFiles, pack_s::handle, i, MAX_OSPATH, packfile_t::name, qFILE_s::name, searchpath_s::next, filelink_s::next, pack_s::numfiles, searchpath_s::pack, Q_strcasecmp, Q_strncpyz(), Sys_Error(), filelink_s::to, unz_file_info_s::uncompressed_size, UNZ_OK, unzGetCurrentFileInfo(), unzGetCurrentFileInfoPosition(), unzLocateFile(), unzOpenCurrentFile(), and qFILE_s::z.
Referenced by FS_CheckFile(), and FS_OpenFile().
int FS_Printf | ( | qFILE * | f, | |
const char * | msg, | |||
... | ||||
) |
Can print chunks for 1024 chars into a file.
Definition at line 1436 of file files.c.
References qFILE_s::f, len, and Q_vsnprintf().
Referenced by CL_LogEvent(), Cmd_WriteAliases(), Com_WriteConfigToFile(), Cvar_WriteVariables(), GenerateFootstepList(), GenerateMaterialFile(), Key_WriteBindings(), RT_WriteCSVFiles(), UI_EditorNodeExtractNode(), WriteBSPBrushMap(), WriteMapBrush(), WriteMapEntities(), and WriteMapFile().
int FS_Read | ( | void * | buffer, | |
int | len, | |||
qFILE * | f | |||
) |
Read a file into a given buffer in memory.
[out] | buffer | Pointer to memory where file contents are written to. |
[in] | len | The length of the supplied memory area. |
[in] | f | The file which is to be read into the memory area. |
buffer
is not null-terminated at the end of file reading len
. Definition at line 324 of file files.c.
References block(), byte, qFILE_s::f, MAX_READ, Sys_Error(), unzReadCurrentFile(), and qFILE_s::z.
Referenced by ASE_Load(), CheckBSPFile(), CIN_OGM_LoadBlockToSync(), CIN_ROQ_DecodeChunk(), CIN_ROQ_PlayCinematic(), Com_MD5File(), FS_LoadFile(), FS_Seek(), MP_LoadTeamMultiplayer(), MP_MultiplayerTeamSlotComments_f(), SAV_GameLoad(), SAV_GameReadGameComment(), and SAV_GameSaveNameCleanup_f().
void FS_RemoveFile | ( | const char * | osPath | ) |
Definition at line 1649 of file files.c.
References Com_Printf(), and Sys_Error().
Referenced by CL_FinishHTTPDownload(), and Key_WriteBindings().
Renames a file.
[in] | from | The source filename |
[in] | to | The filename we want after the rename |
[in] | relative | If relative is true we have to add the FS_Gamedir path for writing |
Definition at line 1666 of file files.c.
References Com_sprintf(), FS_Gamedir(), MAX_OSPATH, qfalse, qtrue, and Sys_Error().
Referenced by CL_FinishHTTPDownload().
void FS_RestartFilesystem | ( | void | ) |
Restart the filesystem (reload all pk3 files).
if we can't find default.cfg, assume that the paths are busted and error out now, rather than getting an unreadable graphics screen when the font fails to load
Definition at line 1585 of file files.c.
References FS_CheckFile(), FS_InitFilesystem(), FS_Shutdown(), qtrue, and Sys_Error().
Referenced by CL_FinishHTTPDownload().
int FS_Seek | ( | qFILE * | f, | |
long | offset, | |||
int | origin | |||
) |
Sets the file position of the given file.
[in] | f | The opened file handle |
[in] | origin | fsOrigin_t |
[in] | offset | The offset you want to do the |
Definition at line 228 of file files.c.
References byte, qFILE_s::f, qFILE_s::filepos, FS_Read(), FS_SEEK_CUR, FS_SEEK_END, FS_SEEK_SET, PK3_SEEK_BUFFER_SIZE, SEEK_CUR, SEEK_END, SEEK_SET, Sys_Error(), unzOpenCurrentFile(), unzSetCurrentFileInfoPosition(), and qFILE_s::z.
void FS_Shutdown | ( | void | ) |
Cleanup function.
cleanup function
Definition at line 1546 of file files.c.
References com_fileSysPool, Com_Printf(), pack_s::files, fs_openedFiles, pack_s::handle, Mem_Free, Mem_FreePool, searchpath_s::next, next, searchpath_s::pack, qfalse, unzClose(), and qFILE_s::z.
Referenced by FS_RestartFilesystem(), Qcommon_Shutdown(), and TEST_Shutdown().
void FS_SkipBlock | ( | const char ** | text | ) |
Definition at line 1129 of file files.c.
References Com_Parse().
Referenced by AIR_ParseAircraft(), Com_ParseGameTypes(), Com_ParseTeam(), FS_NextScriptHeader(), M_ParseMusic(), and SV_ParseUMP().
int FS_Write | ( | const void * | buffer, | |
int | len, | |||
qFILE * | f | |||
) |
Properly handles partial writes.
Definition at line 1453 of file files.c.
References block(), byte, Com_Printf(), and qFILE_s::f.
Referenced by AddLump(), Com_vPrintf(), Con_SaveConsoleHistory(), FS_WriteFile(), R_WriteCompressedTGA(), WriteBSPFile(), WriteTGA24(), and WriteToFile().
int FS_WriteFile | ( | const void * | buffer, | |
size_t | len, | |||
const char * | filename | |||
) |
Definition at line 1491 of file files.c.
References Com_Printf(), qFILE_s::f, f, FILE_WRITE, FS_CloseFile(), FS_FileLength(), FS_Gamedir(), FS_OpenFile(), FS_Write(), and va().
Referenced by MD2GLCmdsRemove(), MD2SkinFix(), MP_SaveTeamMultiplayer(), and SAV_GameSave().
listBlock_t* fs_blocklist = NULL [static] |
filelink_t* fs_links [static] |
char* fs_maps[MAX_MAPS] |
Definition at line 1244 of file files.c.
Referenced by SV_CompleteMapCommand(), and SV_ListMaps_f().
qboolean fs_mapsInstalledInit = qfalse [static] |
int fs_numInstalledMaps = -1 |
Definition at line 1245 of file files.c.
Referenced by SV_CompleteMapCommand(), and SV_ListMaps_f().
int fs_openedFiles [static] |
counter for opened files - used to check against missing close calls
Definition at line 39 of file files.c.
Referenced by FS_CloseFile(), FS_OpenFileSingle(), and FS_Shutdown().
searchpath_t* fs_searchpaths [static] |
const char* pakFileExt[] [static] |
{ "pk3", "zip", NULL }
Definition at line 488 of file files.c.
Referenced by FS_AddGameDirectory().