#include <file.h>
Public Methods | |
| file_manager_c () | |
| C'tor. | |
| ~file_manager_c () | |
| D'tor. | |
| ulong | load_pak (const char *filename) |
| load a pak file | |
| void | unload_pak (ulong n) |
| unload a pak | |
| void | close_paks () |
| unload all pak | |
| file_t * | create () |
| create a new file | |
| void | resize (file_t *file, ulong newsize) |
| change file size | |
| file_t * | load (const char *filename, bool async) |
| load a file | |
| void | save (file_t *file, const char *filename) |
| save a file | |
| file_t * | load_from_disk (const char *filename, bool async) |
| load a file from disk | |
| file_t * | load_from_pak (const char *filename) |
| load a file from a pak | |
| void | close (file_t *file) |
| close a file | |
| ulong | seek (file_t *file, slong offset, ulong origin) |
| Seek a file. | |
| ulong | tell (file_t *file) |
| tell position | |
| bool | eof (file_t *file) |
| end of file? | |
| ulong | read (void *out, ulong size, ulong n, file_t *file) |
| read data from a file | |
| ulong | getch (file_t *file) |
| read a character from a file | |
| const char * | gets (char *dst, ulong count, file_t *file) |
| read a string from a file | |
| void | getpixel (file_t *file, char *r, char *g, char *b, char *a, char bpp) |
| Read a pixel from a file. | |
| ulong | write (void *buf, ulong size, ulong n, file_t *file) |
| write data to a file | |
| slong | putch (slong ch, file_t *file) |
| write a character to a file | |
| slong | puts (const char *string, file_t *file) |
| write a string to a file | |
| void | putpixel (file_t *file, char r, char g, char b, char a, char bpp) |
| Write a pixel to a file. | |
Protected Attributes | |
| list_c< file_t > * | async_files |
| A list of all asynchronous files. | |
| char | datadir [128] |
| The data directory. | |
Definition at line 101 of file file.h.
|
|
Closes a file by freeing it's buffer and the file_t pointer.
Definition at line 531 of file f_main.cpp. References SafeArrayDelete, and SafeDelete. Referenced by ~file_manager_c(). |
|
|
Removes all paks from list of paks. Definition at line 557 of file f_main.cpp. References _log_printf(), and SafeArrayDelete. Referenced by ~file_manager_c(). |
|
|
Creates a new file in memory. The file will not be written to the file system before you call save() for it. Definition at line 510 of file f_main.cpp. References file_s::asyncloading, file_s::buf, file_s::pos, and file_s::size. |
|
|
Returns the End Of File status. This is the is equivalent to "feof".
Definition at line 617 of file f_main.cpp. |
|
|
Returns the read char. This is the equivalent to "fgetc".
|
|
||||||||||||||||||||||||||||
|
16 Bit Pixels are interpreted as they are in targa files (1/5/5/5): Byte 1 Byte 2 where A is alpha and R, G and B are ARRRRRGG GGGBBBBB red green and blue values respectively
|
|
||||||||||||||||
|
Returns a pointer to the read string. This is the equivalent to "fgets".
|
|
||||||||||||
|
Tries to load the file from disk. If that fails, it will be loaded from the loaded paks. If that also fails NULL is returned, a pointer that can be used to refer to the file otherwise. The file is loaded completely into memory. If async is true, the file will be loaded in small pieces each frame.
Definition at line 397 of file f_main.cpp. References _log_printf(). |
|
||||||||||||
|
Tries to load the file from disk. If that fails, NULL is returned, a pointer that can be used to refer to the file otherwise.
Definition at line 160 of file f_main.cpp. References _log_printf(), file_s::asyncloading, file_s::buf, file_s::f, file_s::pos, SafeDelete, and file_s::size. |
|
|
Tries to load the file from a pak. If that fails, NULL is returned, a pointer that can be used to refer to the file otherwise.
Definition at line 237 of file f_main.cpp. References _log_printf(), file_s::buf, pak_header_s::entrycount, fileentry_s::filename, fileentry_s::offset, fileentry_s::realsize, SafeArrayDelete, SafeDelete, fileentry_s::size, and file_s::size. |
|
|
Actually stores the name of a pak file for later loading when needed.
Definition at line 422 of file f_main.cpp. References _convert_file_path(), _log_printf(), and SafeArrayDelete. |
|
||||||||||||
|
Returns character written. This is the is equivalent to "fputc".
|
|
||||||||||||||||||||||||||||
|
16 Bit Pixels are interpreted as they are in targa files (1/5/5/5): Byte 1 Byte 2 where A is alpha and R, G and B are ARRRRRGG GGGBBBBB red green and blue values respectively
|
|
||||||||||||
|
Returns the number of bytes written. This is the is equivalent to "fputs".
|
|
||||||||||||||||||||
|
Returns number of elements read. This is the is equivalent to "fread".
|
|
||||||||||||
|
Changes file size to newsize. If newsize is larger than the current size of the file, the contents of the new bytes is undefined. If newsize is smaller, every data after newsize bytes will be lost. This function is usually only used by the write and put* functions.
Definition at line 482 of file f_main.cpp. References SafeArrayDelete. |
|
||||||||||||
|
Writes the file to the file system.
Definition at line 450 of file f_main.cpp. |
|
||||||||||||||||
|
Sets the position pointer to a given position. The syntax is equivalent to "fseek".
Definition at line 590 of file f_main.cpp. |
|
|
Returns the position pointer. This is the is equivalent to "ftell"
Definition at line 546 of file f_main.cpp. |
|
|
Removes pak n from list of paks.
Definition at line 574 of file f_main.cpp. References _log_printf(), and SafeArrayDelete. |
|
||||||||||||||||||||
|
Returns number of elements written. This is the is equivalent to "fwrite".
|
1.2.18