2001-02-21 19:35:06 +00:00
|
|
|
/*
|
|
|
|
quakefs.h
|
|
|
|
|
|
|
|
quake virtual filesystem definitions
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
|
|
|
Please see the file "AUTHORS" for a list of contributors
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __quakefs_h
|
|
|
|
#define __quakefs_h
|
|
|
|
|
2004-11-08 23:27:00 +00:00
|
|
|
/** \defgroup quakefs Quake Filesystem
|
2006-12-05 11:40:00 +00:00
|
|
|
\ingroup utils
|
2004-11-08 23:27:00 +00:00
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
|
2001-03-27 23:36:02 +00:00
|
|
|
#include "QF/qtypes.h"
|
2002-08-27 07:16:28 +00:00
|
|
|
#include "QF/quakeio.h"
|
2001-02-21 19:35:06 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#define MAX_OSPATH 128 // max length of a filesystem pathname
|
|
|
|
|
2004-02-03 03:01:06 +00:00
|
|
|
#define MAX_GAMEDIR_CALLBACKS 128 // most QFS_GamedirCallback calls.
|
|
|
|
|
2004-04-20 22:25:52 +00:00
|
|
|
typedef struct filelist_s {
|
|
|
|
char **list;
|
|
|
|
int count;
|
|
|
|
int size;
|
|
|
|
} filelist_t;
|
|
|
|
|
2001-11-05 22:24:16 +00:00
|
|
|
typedef struct searchpath_s {
|
|
|
|
char filename[MAX_OSPATH];
|
2002-07-21 06:11:28 +00:00
|
|
|
struct pack_s *pack; // only one of filename / pack will be used
|
2001-11-05 22:24:16 +00:00
|
|
|
struct searchpath_s *next;
|
|
|
|
} searchpath_t;
|
|
|
|
|
2003-01-10 22:47:18 +00:00
|
|
|
typedef struct gamedir_s {
|
|
|
|
const char *name;
|
2003-02-14 22:36:10 +00:00
|
|
|
const char *gamedir;
|
2003-01-10 22:47:18 +00:00
|
|
|
const char *path;
|
|
|
|
const char *gamecode;
|
2003-02-14 22:36:10 +00:00
|
|
|
struct {
|
|
|
|
const char *def;
|
|
|
|
const char *skins;
|
|
|
|
const char *progs;
|
|
|
|
const char *sound;
|
|
|
|
const char *maps;
|
|
|
|
} dir;
|
2003-01-10 22:47:18 +00:00
|
|
|
} gamedir_t;
|
|
|
|
|
2004-02-03 03:01:06 +00:00
|
|
|
typedef void gamedir_callback_t (void);
|
|
|
|
|
2003-02-14 19:46:07 +00:00
|
|
|
extern searchpath_t *qfs_searchpaths;
|
2003-01-10 22:47:18 +00:00
|
|
|
extern gamedir_t *qfs_gamedir;
|
2001-11-05 22:24:16 +00:00
|
|
|
|
2001-05-31 03:41:35 +00:00
|
|
|
extern struct cvar_s *fs_sharepath;
|
2003-05-23 17:17:01 +00:00
|
|
|
extern struct cvar_s *fs_userpath;
|
|
|
|
|
|
|
|
extern const char *qfs_userpath;
|
2001-02-21 19:35:06 +00:00
|
|
|
|
2001-10-29 17:46:03 +00:00
|
|
|
extern int file_from_pak;
|
2003-02-14 19:46:07 +00:00
|
|
|
extern int qfs_filesize;
|
|
|
|
|
|
|
|
struct cache_user_s;
|
2003-04-09 05:55:41 +00:00
|
|
|
struct dstring_s;
|
2002-06-14 20:36:28 +00:00
|
|
|
|
2003-05-23 17:17:01 +00:00
|
|
|
void QFS_Init (const char *game);
|
|
|
|
|
|
|
|
void QFS_Gamedir (const char *dir);
|
|
|
|
|
|
|
|
QFile *QFS_Open (const char *path, const char *mode);
|
2003-02-14 22:36:10 +00:00
|
|
|
QFile *QFS_WOpen (const char *path, int zip);
|
2004-01-19 07:47:41 +00:00
|
|
|
void QFS_WriteFile (const char *filename, const void *data, int len);
|
2003-05-23 17:17:01 +00:00
|
|
|
void QFS_WriteBuffers (const char *filename, int count, ...);
|
2001-02-21 19:35:06 +00:00
|
|
|
|
2003-05-23 17:17:01 +00:00
|
|
|
int _QFS_FOpenFile (const char *filename, QFile **gzfile,
|
|
|
|
struct dstring_s *foundname, int zip);
|
|
|
|
int QFS_FOpenFile (const char *filename, QFile **gzfile);
|
2003-02-14 19:46:07 +00:00
|
|
|
byte *QFS_LoadFile (const char *path, int usehunk);
|
|
|
|
byte *QFS_LoadStackFile (const char *path, void *buffer, int bufsize);
|
|
|
|
byte *QFS_LoadTempFile (const char *path);
|
|
|
|
byte *QFS_LoadHunkFile (const char *path);
|
|
|
|
void QFS_LoadCacheFile (const char *path, struct cache_user_s *cu);
|
2003-05-23 17:17:01 +00:00
|
|
|
|
2004-05-09 22:58:37 +00:00
|
|
|
int QFS_CreatePath (const char *path);
|
2007-03-18 07:12:45 +00:00
|
|
|
int QFS_Rename (const char *old_path, const char *new_path);
|
2003-05-23 17:17:01 +00:00
|
|
|
int QFS_Remove (const char *path);
|
|
|
|
int QFS_NextFilename (struct dstring_s *filename, const char *prefix,
|
|
|
|
const char *ext);
|
|
|
|
|
2003-07-08 22:39:45 +00:00
|
|
|
char *QFS_FileBase (const char *in);
|
2003-05-23 17:17:01 +00:00
|
|
|
void QFS_DefaultExtension (char *path, const char *extension);
|
|
|
|
void QFS_StripExtension (const char *in, char *out);
|
|
|
|
char *QFS_CompressPath (const char *pth);
|
|
|
|
const char *QFS_SkipPath (const char *pathname);
|
|
|
|
const char *QFS_FileExtension (const char *in);
|
2001-02-21 19:35:06 +00:00
|
|
|
|
2004-02-03 03:01:06 +00:00
|
|
|
void QFS_GamedirCallback (gamedir_callback_t *);
|
|
|
|
|
2004-04-20 22:25:52 +00:00
|
|
|
filelist_t *QFS_FilelistNew (void);
|
2004-04-23 22:53:39 +00:00
|
|
|
void QFS_FilelistAdd (filelist_t *filelist, const char *fname,
|
|
|
|
const char *ext);
|
2004-04-20 22:52:09 +00:00
|
|
|
void QFS_FilelistFill (filelist_t *list, const char *path, const char *ext,
|
|
|
|
int strip);
|
2004-04-20 22:25:52 +00:00
|
|
|
void QFS_FilelistFree (filelist_t *list);
|
2007-03-19 10:43:29 +00:00
|
|
|
void QFS_FilelistEnumerate(filelist_t* list, const char* path);
|
|
|
|
qboolean QFS_IsDirectory (const char *path);
|
|
|
|
|
2004-04-20 22:25:52 +00:00
|
|
|
|
2003-05-25 05:40:25 +00:00
|
|
|
// FIXME: This is here temporarily until fs_usercfg gets sorted out
|
|
|
|
char *expand_squiggle (const char *path);
|
|
|
|
|
2004-11-08 23:27:00 +00:00
|
|
|
//@}
|
|
|
|
|
2001-02-21 19:35:06 +00:00
|
|
|
#endif // __quakefs_h
|