24 #define CF_SEEK_SET (0)
25 #define CF_SEEK_CUR (1)
26 #define CF_SEEK_END (2)
39 #define CF_MAX_FILENAME_LENGTH 32 // Includes null terminater, so real length is 31
40 #define CF_MAX_PATHNAME_LENGTH 256 // Includes null terminater, so real length is 255
42 #define CF_TYPE_ANY -1 // Used to check in any directory
44 #define CF_TYPE_INVALID 0
45 #define CF_TYPE_ROOT 1 // Root must be 1!!
46 #define CF_TYPE_DATA 2
47 #define CF_TYPE_MAPS 3
48 #define CF_TYPE_TEXT 4
49 #define CF_TYPE_MODELS 5
50 #define CF_TYPE_TABLES 6
51 #define CF_TYPE_SOUNDS 7
52 #define CF_TYPE_SOUNDS_8B22K 8
53 #define CF_TYPE_SOUNDS_16B11K 9
54 #define CF_TYPE_VOICE 10
55 #define CF_TYPE_VOICE_BRIEFINGS 11
56 #define CF_TYPE_VOICE_CMD_BRIEF 12
57 #define CF_TYPE_VOICE_DEBRIEFINGS 13
58 #define CF_TYPE_VOICE_PERSONAS 14
59 #define CF_TYPE_VOICE_SPECIAL 15
60 #define CF_TYPE_VOICE_TRAINING 16
61 #define CF_TYPE_MUSIC 17
62 #define CF_TYPE_MOVIES 18
63 #define CF_TYPE_INTERFACE 19
64 #define CF_TYPE_FONT 20
65 #define CF_TYPE_EFFECTS 21
66 #define CF_TYPE_HUD 22
67 #define CF_TYPE_PLAYERS 23
68 #define CF_TYPE_PLAYER_IMAGES 24
69 #define CF_TYPE_SQUAD_IMAGES 25
70 #define CF_TYPE_SINGLE_PLAYERS 26
71 #define CF_TYPE_MULTI_PLAYERS 27
72 #define CF_TYPE_CACHE 28
73 #define CF_TYPE_MULTI_CACHE 29
74 #define CF_TYPE_MISSIONS 30
75 #define CF_TYPE_CONFIG 31
76 #define CF_TYPE_DEMOS 32
77 #define CF_TYPE_CBANIMS 33
78 #define CF_TYPE_INTEL_ANIMS 34
79 #define CF_TYPE_SCRIPTS 35
80 #define CF_TYPE_FICTION 36
82 #define CF_MAX_PATH_TYPES 37 // Can be as high as you'd like //DTP; yeah but beware alot of things uses CF_MAX_PATH_TYPES
86 #define CF_TYPE_SPECIFIED(path_type) (((path_type)>CF_TYPE_INVALID) && ((path_type)<CF_MAX_PATH_TYPES))
89 #define CFILE_NORMAL 0 // open file normally
90 #define CFILE_MEMORY_MAPPED (1<<0) // open file as a memory-mapped file
92 #define CF_SORT_NONE 0
93 #define CF_SORT_NAME 1
94 #define CF_SORT_TIME 2
95 #define CF_SORT_REVERSE 3
97 #define cfread_fix(file) (fix)cfread_int(file)
98 #define cfwrite_fix(i,file) cfwrite_int(i,file)
110 #define CFILE_ROOT_DIRECTORY_LEN 256
117 int cfile_init(
const char *exe_dir,
const char *cdrom_dir=NULL);
134 #define cfopen(...) _cfopen(LOCATION, __VA_ARGS__) // Pass source location to the function
140 #define cfopen_special(...) _cfopen_special(LOCATION, __VA_ARGS__) // Pass source location to the function
247 #define CF_RENAME_SUCCESS 0 // successfully renamed the file
248 #define CF_RENAME_FAIL_ACCESS 1 // new name could not be created
249 #define CF_RENAME_FAIL_EXIST 2 // old name does not exist
339 int cf_find_file_location_ext(
const char *
filename,
const int ext_num,
const char **ext_list,
int pathtype,
int max_out = 0,
char *pack_filename = NULL,
int *
size = NULL,
int *
offset = NULL,
bool localize =
false);
345 int cfile_chdrive(
int DriveNum,
int flag);
372 virtual const char *
what()
const throw()
374 return m_excuse.c_str();
int cfwrite_ushort(ushort s, CFILE *file)
cfile_error(const std::string &excuse)
void cfread_string(char *buf, int n, CFILE *file)
int cf_is_valid(CFILE *cfile)
int cfwrite_compressed(void *param_buf, int param_elsize, int param_nelem, CFILE *cfile)
ubyte cfread_ubyte(CFILE *file, int ver=0, ubyte deflt=0)
ushort cf_add_chksum_short(ushort seed, ubyte *buffer, int size)
int cfputc(int c, CFILE *cfile)
int cfwrite_angles(angles *ang, CFILE *file)
char * cfgets(char *buf, int n, CFILE *cfile)
int cfread(void *buf, int elsize, int nelem, CFILE *fp)
int cfwrite(const void *buf, int elsize, int nelem, CFILE *cfile)
void cf_attrib(const char *name, int set, int clear, int type)
int cf_chksum_long(const char *filename, uint *chksum, int max_size=-1, int cf_type=CF_TYPE_ANY)
void cf_set_max_read_len(CFILE *cfile, size_t len)
int cf_get_dir_type(CFILE *cfile)
int cf_exists_full_ext(const char *filename, int dir_type, const int num_ext, const char **ext_list)
virtual const char * what() const
int cfwrite_string_len(const char *buf, CFILE *file)
Write a fixed length string (not including its null terminator), with the length stored in file...
int cf_find_file_location_ext(const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out=0, char *pack_filename=NULL, int *size=NULL, int *offset=NULL, bool localize=false)
int cfile_flush_dir(int type)
int cfwrite_short(short s, CFILE *file)
GLenum GLuint GLenum GLsizei const GLchar * buf
int cfile_push_chdir(int type)
Push current directory onto a 'stack' and change to a new directory.
void cfread_string_len(char *buf, int n, CFILE *file)
Read a fixed length string that is not null-terminated, with the length stored in file...
int cf_get_file_list_preallocated(int max, char arr[][MAX_FILENAME_LEN], char **list, int type, const char *filter, int sort=CF_SORT_NONE, file_list_info *info=NULL)
max_read_length(const std::string &excuse)
int cf_chksum_pack(const char *filename, uint *chk_long, bool full=false)
void cfread_vector(vec3d *vec, CFILE *file, int ver=0, vec3d *deflt=NULL)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
int cf_find_file_location(const char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize=false)
int cfwrite_vector(vec3d *vec, CFILE *file)
int cf_rename(const char *old_name, const char *name, int type=CF_TYPE_ANY)
int cf_exists(const char *filename, int dir_type)
void * cf_returndata(CFILE *cfile)
int cf_chksum_short(const char *filename, ushort *chksum, int max_size=-1, int cf_type=CF_TYPE_ANY)
uint cf_add_chksum_long(uint seed, ubyte *buffer, int size)
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN]
int cf_delete(const char *filename, int dir_type)
Delete the specified file.
int cf_access(const char *filename, int dir_type, int mode)
GLsizei const GLchar ** string
int cfwrite_float(float f, CFILE *file)
float cfread_float(CFILE *file, int ver=0, float deflt=0.0f)
int cfilelength(CFILE *fp)
void cf_sort_filenames(int n, char **list, int sort, file_list_info *info=NULL)
int cf_exists_full(const char *filename, int dir_type)
void cf_set_version(CFILE *cfile, int version)
int cfwrite_uint(uint i, CFILE *file)
int cfile_chdir(const char *dir)
Change to the specified directory.
int cfile_init(const char *exe_dir, const char *cdrom_dir=NULL)
Initialize the cfile system. Called once at application start.
char cfread_char(CFILE *file, int ver=0, char deflt=0)
uint cfread_uint(CFILE *file, int ver=0, uint deflt=0)
short cfread_short(CFILE *file, int ver=0, short deflt=0)
GLuint const GLchar * name
int cfwrite_string(const char *buf, CFILE *file)
int cfwrite_char(char c, CFILE *file)
int cfwrite_int(int i, CFILE *file)
char * cf_add_ext(const char *filename, const char *ext)
CFILE * _cfopen(const char *source_file, int line, const char *filename, const char *mode, int type=CFILE_NORMAL, int dir_type=CF_TYPE_ANY, bool localize=false)
const char * Get_file_list_child
#define CFILE_ROOT_DIRECTORY_LEN
int cfexist(const char *filename)
int cfputs(const char *str, CFILE *cfile)
int cfclose(CFILE *cfile)
int cfread_compressed(void *buf, int elsize, int nelem, CFILE *cfile)
int cfread_int(CFILE *file, int ver=0, int deflt=0)
CFILE * _cfopen_special(const char *source_file, int line, const char *file_path, const char *mode, const int size, const int offset, int dir_type=CF_TYPE_ANY)
int cfwrite_ubyte(ubyte u, CFILE *file)
int cf_get_file_list(SCP_vector< SCP_string > &list, int pathtype, const char *filter, int sort=CF_SORT_NONE, SCP_vector< file_list_info > *info=NULL)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
void cfread_angles(angles *ang, CFILE *file, int ver=0, angles *deflt=NULL)
ushort cfread_ushort(CFILE *file, int ver=0, ushort deflt=0)
int(* Get_file_list_filter)(const char *filename)
int cfseek(CFILE *fp, int offset, int where)