1
/************************************************************************************
3
AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
4
Copyright © 2006-2012 Michael Kurinnoy, Viewizard
7
AstroMenace is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
12
AstroMenace is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with AstroMenace. If not, see <http://www.gnu.org/licenses/>.
21
Web Site: http://www.viewizard.com/
22
Project: http://sourceforge.net/projects/openastromenace/
23
E-mail: viewizard@viewizard.com
25
*************************************************************************************/
36
// File present in the VFS
37
#define VFS_FILE_VFS 0x0031
38
// File present in the File System
39
#define VFS_FILE_FS 0x0032
45
// Current VFS version
46
#define VFS_VER "v1.5"
48
#define VFS_DATA_ARH_NONE '0'
49
#define VFS_DATA_ARH_RLE '1'
50
#define VFS_DATA_ARH_HAFF '2'
56
char* Name; // File name
57
int VFS_Offset; // File offset in the VFS file
58
int PackLength; // File size in the VFS file
59
int RealLength; // File size in the memory (unpacked file size)
60
long Pos; // Current position in the file
61
BYTE* Data; // Pointer to the file data (unpacked) in the memory
64
int fread(void *buffer, size_t size, size_t count);
65
// Set current position in the file
66
int fseek(long offset, int origin);
67
// Get current position in the file
69
// Check End-of-File indicator
71
// Get string from stream
72
char *fgets(char *str, int num);
75
eFILE* Prev; // Pointer to the previous opened file
76
eFILE* Next; // Pointer to the next opened file
84
int vw_CreateVFS(const char *Name, unsigned int BuildNumber);
85
// Write data from memory into VFS file
86
int vw_WriteIntoVFSfromMemory(const char *Name, const BYTE * buffer, int size);
88
int vw_OpenVFS(const char *Name, unsigned int BuildNumber);
90
void vw_CloseVFS(void);
91
// Shutdown VFS (all eFILE files will be closed)
92
void vw_ShutdownVFS(void);
93
// Get file location status (FS or VFS)
94
int FileDetect(const char *FileName);
95
// Create file "symlink"
96
bool vw_CreateEntryLinkVFS(const char *FileName, const char *FileNameLink);
97
// Delete file "symlink"
98
bool vw_DeleteEntryLinkVFS(const char *FileNameLink);
99
// Delete all "symlinks" in VFS
100
bool vw_DeleteAllLinksVFS();
105
eFILE* vw_fopen(const char *FileName);
107
int vw_fclose(eFILE *stream);
112
int vw_HAFFtoDATA(int size, BYTE **dstVFS, BYTE *srcVFS, int *dsizeVFS, int ssizeVFS);
113
int vw_RLEtoDATA(int size, BYTE **dstVFS, BYTE *srcVFS, int *dsizeVFS, int ssizeVFS);
114
int vw_DATAtoHAFF(BYTE **dstVFS, BYTE *srcVFS, int *dsizeVFS, int ssizeVFS);
115
int vw_DATAtoRLE(BYTE **dstVFS, BYTE *srcVFS, int *dsizeVFS, int ssizeVFS);
123
4b - VFS build number
124
4b - file table offset
126
?b - data (file data one by one)
128
- File table structure
129
1b - 00, if no encoding key
131
1b - encoding key size in byte
135
4b - file position offset in VFS file
136
4b - file size in VFS file
137
4b - original file size