Skip to content

Latest commit

 

History

History
516 lines (410 loc) · 13.8 KB

archiver_wad.c

File metadata and controls

516 lines (410 loc) · 13.8 KB
 
Dec 15, 2003
Dec 15, 2003
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* WAD support routines for PhysicsFS.
*
* This driver handles DOOM engine archives ("wads").
* This format (but not this driver) was designed by id Software for use
* with the DOOM engine.
* The specs of the format are from the unofficial doom specs v1.666
* found here: http://www.gamers.org/dhs/helpdocs/dmsp1666.html
* The format of the archive: (from the specs)
*
* A WAD file has three parts:
* (1) a twelve-byte header
* (2) one or more "lumps"
* (3) a directory or "info table" that contains the names, offsets, and
* sizes of all the lumps in the WAD
*
* The header consists of three four-byte parts:
* (a) an ASCII string which must be either "IWAD" or "PWAD"
* (b) a 4-byte (long) integer which is the number of lumps in the wad
* (c) a long integer which is the file offset to the start of
* the directory
*
* The directory has one 16-byte entry for every lump. Each entry consists
* of three parts:
*
* (a) a long integer, the file offset to the start of the lump
* (b) a long integer, the size of the lump in bytes
* (c) an 8-byte ASCII string, the name of the lump, padded with zeros.
* For example, the "DEMO1" entry in hexadecimal would be
* (44 45 4D 4F 31 00 00 00)
*
* Note that there is no way to tell if an opened WAD archive is a
* IWAD or PWAD with this archiver.
* I couldn't think of a way to provide that information, without being too
* hacky.
* I don't think it's really that important though.
*
*
Mar 11, 2007
Mar 11, 2007
39
* Please see the file LICENSE.txt in the source's root directory.
Dec 15, 2003
Dec 15, 2003
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
*
* This file written by Travis Wells, based on the GRP archiver by
* Ryan C. Gordon.
*/
#if (defined PHYSFS_SUPPORTS_WAD)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
typedef struct
{
Dec 18, 2003
Dec 18, 2003
57
char name[18];
Dec 15, 2003
Dec 15, 2003
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
PHYSFS_uint32 startPos;
PHYSFS_uint32 size;
} WADentry;
typedef struct
{
char *filename;
PHYSFS_uint32 entryCount;
PHYSFS_uint32 entryOffset;
WADentry *entries;
} WADinfo;
typedef struct
{
void *handle;
WADentry *entry;
PHYSFS_uint32 curPos;
} WADfileinfo;
Sep 26, 2004
Sep 26, 2004
78
static void WAD_dirClose(dvoid *opaque)
Dec 15, 2003
Dec 15, 2003
79
{
Sep 26, 2004
Sep 26, 2004
80
WADinfo *info = ((WADinfo *) opaque);
Mar 14, 2005
Mar 14, 2005
81
82
83
allocator.Free(info->filename);
allocator.Free(info->entries);
allocator.Free(info);
Dec 15, 2003
Dec 15, 2003
84
85
86
} /* WAD_dirClose */
Aug 21, 2010
Aug 21, 2010
87
static PHYSFS_sint64 WAD_read(fvoid *opaque, void *buffer, PHYSFS_uint64 len)
Dec 15, 2003
Dec 15, 2003
88
{
Sep 26, 2004
Sep 26, 2004
89
WADfileinfo *finfo = (WADfileinfo *) opaque;
Aug 21, 2010
Aug 21, 2010
90
91
const WADentry *entry = finfo->entry;
const PHYSFS_uint64 bytesLeft = (PHYSFS_uint64)(entry->size-finfo->curPos);
Dec 15, 2003
Dec 15, 2003
92
93
PHYSFS_sint64 rc;
Aug 21, 2010
Aug 21, 2010
94
95
if (bytesLeft < len)
len = bytesLeft;
Dec 15, 2003
Dec 15, 2003
96
Aug 21, 2010
Aug 21, 2010
97
rc = __PHYSFS_platformRead(finfo->handle, buffer, len);
Dec 15, 2003
Dec 15, 2003
98
if (rc > 0)
Aug 21, 2010
Aug 21, 2010
99
finfo->curPos += (PHYSFS_uint32) rc;
Dec 15, 2003
Dec 15, 2003
100
Jan 28, 2010
Jan 28, 2010
101
return rc;
Dec 15, 2003
Dec 15, 2003
102
103
104
} /* WAD_read */
Aug 21, 2010
Aug 21, 2010
105
static PHYSFS_sint64 WAD_write(fvoid *f, const void *buf, PHYSFS_uint64 len)
Dec 15, 2003
Dec 15, 2003
106
107
108
109
110
{
BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
} /* WAD_write */
Sep 26, 2004
Sep 26, 2004
111
static int WAD_eof(fvoid *opaque)
Dec 15, 2003
Dec 15, 2003
112
{
Sep 26, 2004
Sep 26, 2004
113
WADfileinfo *finfo = (WADfileinfo *) opaque;
Dec 15, 2003
Dec 15, 2003
114
WADentry *entry = finfo->entry;
Jan 28, 2010
Jan 28, 2010
115
return (finfo->curPos >= entry->size);
Dec 15, 2003
Dec 15, 2003
116
117
118
} /* WAD_eof */
Sep 26, 2004
Sep 26, 2004
119
static PHYSFS_sint64 WAD_tell(fvoid *opaque)
Dec 15, 2003
Dec 15, 2003
120
{
Jan 28, 2010
Jan 28, 2010
121
return ((WADfileinfo *) opaque)->curPos;
Dec 15, 2003
Dec 15, 2003
122
123
124
} /* WAD_tell */
Sep 26, 2004
Sep 26, 2004
125
static int WAD_seek(fvoid *opaque, PHYSFS_uint64 offset)
Dec 15, 2003
Dec 15, 2003
126
{
Sep 26, 2004
Sep 26, 2004
127
WADfileinfo *finfo = (WADfileinfo *) opaque;
Dec 15, 2003
Dec 15, 2003
128
129
130
131
132
133
134
135
136
WADentry *entry = finfo->entry;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
if (rc)
finfo->curPos = (PHYSFS_uint32) offset;
Jan 28, 2010
Jan 28, 2010
137
return rc;
Dec 15, 2003
Dec 15, 2003
138
139
140
} /* WAD_seek */
Sep 26, 2004
Sep 26, 2004
141
static PHYSFS_sint64 WAD_fileLength(fvoid *opaque)
Dec 15, 2003
Dec 15, 2003
142
{
Sep 26, 2004
Sep 26, 2004
143
WADfileinfo *finfo = (WADfileinfo *) opaque;
Jan 28, 2010
Jan 28, 2010
144
return ((PHYSFS_sint64) finfo->entry->size);
Dec 15, 2003
Dec 15, 2003
145
146
147
} /* WAD_fileLength */
Sep 26, 2004
Sep 26, 2004
148
static int WAD_fileClose(fvoid *opaque)
Dec 15, 2003
Dec 15, 2003
149
{
Sep 26, 2004
Sep 26, 2004
150
WADfileinfo *finfo = (WADfileinfo *) opaque;
Dec 15, 2003
Dec 15, 2003
151
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
Mar 14, 2005
Mar 14, 2005
152
allocator.Free(finfo);
Jan 28, 2010
Jan 28, 2010
153
return 1;
Dec 15, 2003
Dec 15, 2003
154
155
156
} /* WAD_fileClose */
Aug 21, 2010
Aug 21, 2010
157
158
159
160
161
162
static inline int readAll(void *fh, void *buf, const PHYSFS_uint64 len)
{
return (__PHYSFS_platformRead(fh, buf, len) == len);
} /* readAll */
Dec 15, 2003
Dec 15, 2003
163
164
165
166
167
168
169
170
171
172
173
static int wad_open(const char *filename, int forWriting,
void **fh, PHYSFS_uint32 *count,PHYSFS_uint32 *offset)
{
PHYSFS_uint8 buf[4];
*fh = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fh = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fh == NULL, NULL, 0);
Aug 21, 2010
Aug 21, 2010
174
if (!readAll(*fh, buf, 4))
Dec 15, 2003
Dec 15, 2003
175
176
177
178
179
180
181
182
goto openWad_failed;
if (memcmp(buf, "IWAD", 4) != 0 && memcmp(buf, "PWAD", 4) != 0)
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openWad_failed;
} /* if */
Aug 21, 2010
Aug 21, 2010
183
if (!readAll(*fh, count, sizeof (PHYSFS_uint32)))
Dec 15, 2003
Dec 15, 2003
184
185
186
187
goto openWad_failed;
*count = PHYSFS_swapULE32(*count);
Aug 21, 2010
Aug 21, 2010
188
if (!readAll(*fh, offset, sizeof (PHYSFS_uint32)))
Dec 15, 2003
Dec 15, 2003
189
190
191
192
goto openWad_failed;
*offset = PHYSFS_swapULE32(*offset);
Jan 28, 2010
Jan 28, 2010
193
return 1;
Dec 15, 2003
Dec 15, 2003
194
195
196
197
198
199
200
openWad_failed:
if (*fh != NULL)
__PHYSFS_platformClose(*fh);
*count = -1;
*fh = NULL;
Jan 28, 2010
Jan 28, 2010
201
return 0;
Dec 15, 2003
Dec 15, 2003
202
203
204
205
206
} /* wad_open */
static int wad_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
Feb 20, 2008
Feb 20, 2008
207
208
209
if (one != two)
{
const WADentry *a = (const WADentry *) _a;
Jan 28, 2010
Jan 28, 2010
210
return strcmp(a[one].name, a[two].name);
Feb 20, 2008
Feb 20, 2008
211
212
213
} /* if */
return 0;
Dec 15, 2003
Dec 15, 2003
214
215
216
217
218
} /* wad_entry_cmp */
static void wad_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
Feb 20, 2008
Feb 20, 2008
219
220
221
222
223
224
225
226
227
if (one != two)
{
WADentry tmp;
WADentry *first = &(((WADentry *) _a)[one]);
WADentry *second = &(((WADentry *) _a)[two]);
memcpy(&tmp, first, sizeof (WADentry));
memcpy(first, second, sizeof (WADentry));
memcpy(second, &tmp, sizeof (WADentry));
} /* if */
Dec 15, 2003
Dec 15, 2003
228
229
230
231
232
233
234
235
236
} /* wad_entry_swap */
static int wad_load_entries(const char *name, int forWriting, WADinfo *info)
{
void *fh = NULL;
PHYSFS_uint32 fileCount;
PHYSFS_uint32 directoryOffset;
WADentry *entry;
Dec 29, 2003
Dec 29, 2003
237
char lastDirectory[9];
Dec 18, 2003
Dec 18, 2003
238
239
lastDirectory[8] = 0; /* Make sure lastDirectory stays null-terminated. */
Dec 15, 2003
Dec 15, 2003
240
241
242
BAIL_IF_MACRO(!wad_open(name, forWriting, &fh, &fileCount,&directoryOffset), NULL, 0);
info->entryCount = fileCount;
Mar 14, 2005
Mar 14, 2005
243
info->entries = (WADentry *) allocator.Malloc(sizeof(WADentry)*fileCount);
Dec 15, 2003
Dec 15, 2003
244
245
246
247
248
249
250
251
252
253
if (info->entries == NULL)
{
__PHYSFS_platformClose(fh);
BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
} /* if */
__PHYSFS_platformSeek(fh,directoryOffset);
for (entry = info->entries; fileCount > 0; fileCount--, entry++)
{
Aug 21, 2010
Aug 21, 2010
254
255
256
if ( (!readAll(fh, &entry->startPos, sizeof (PHYSFS_uint32))) ||
(!readAll(fh, &entry->size, sizeof (PHYSFS_uint32))) ||
(!readAll(fh, &entry->name, 8)) )
Dec 15, 2003
Dec 15, 2003
257
258
{
__PHYSFS_platformClose(fh);
Jan 28, 2010
Jan 28, 2010
259
return 0;
Dec 15, 2003
Dec 15, 2003
260
261
262
263
264
265
266
267
268
269
270
} /* if */
entry->name[8] = '\0'; /* name might not be null-terminated in file. */
entry->size = PHYSFS_swapULE32(entry->size);
entry->startPos = PHYSFS_swapULE32(entry->startPos);
} /* for */
__PHYSFS_platformClose(fh);
__PHYSFS_sort(info->entries, info->entryCount,
wad_entry_cmp, wad_entry_swap);
Jan 28, 2010
Jan 28, 2010
271
return 1;
Dec 15, 2003
Dec 15, 2003
272
273
274
} /* wad_load_entries */
Sep 26, 2004
Sep 26, 2004
275
static void *WAD_openArchive(const char *name, int forWriting)
Dec 15, 2003
Dec 15, 2003
276
{
Mar 14, 2005
Mar 14, 2005
277
WADinfo *info = (WADinfo *) allocator.Malloc(sizeof (WADinfo));
Dec 15, 2003
Dec 15, 2003
278
Sep 26, 2004
Sep 26, 2004
279
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
Dec 15, 2003
Dec 15, 2003
280
281
memset(info, '\0', sizeof (WADinfo));
Mar 14, 2005
Mar 14, 2005
282
info->filename = (char *) allocator.Malloc(strlen(name) + 1);
Mar 13, 2005
Mar 13, 2005
283
GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, WAD_openArchive_failed);
Dec 15, 2003
Dec 15, 2003
284
285
286
287
288
if (!wad_load_entries(name, forWriting, info))
goto WAD_openArchive_failed;
strcpy(info->filename, name);
Jan 28, 2010
Jan 28, 2010
289
return info;
Dec 15, 2003
Dec 15, 2003
290
291
WAD_openArchive_failed:
Sep 26, 2004
Sep 26, 2004
292
if (info != NULL)
Dec 15, 2003
Dec 15, 2003
293
{
Sep 26, 2004
Sep 26, 2004
294
if (info->filename != NULL)
Mar 14, 2005
Mar 14, 2005
295
allocator.Free(info->filename);
Sep 26, 2004
Sep 26, 2004
296
if (info->entries != NULL)
Mar 14, 2005
Mar 14, 2005
297
298
allocator.Free(info->entries);
allocator.Free(info);
Dec 15, 2003
Dec 15, 2003
299
300
} /* if */
Jan 28, 2010
Jan 28, 2010
301
return NULL;
Dec 15, 2003
Dec 15, 2003
302
303
304
} /* WAD_openArchive */
Sep 29, 2004
Sep 29, 2004
305
static void WAD_enumerateFiles(dvoid *opaque, const char *dname,
Sep 18, 2005
Sep 18, 2005
306
307
int omitSymLinks, PHYSFS_EnumFilesCallback cb,
const char *origdir, void *callbackdata)
Dec 15, 2003
Dec 15, 2003
308
{
Sep 26, 2004
Sep 26, 2004
309
WADinfo *info = ((WADinfo *) opaque);
Dec 15, 2003
Dec 15, 2003
310
311
312
WADentry *entry = info->entries;
PHYSFS_uint32 max = info->entryCount;
PHYSFS_uint32 i;
Sep 29, 2004
Sep 29, 2004
313
const char *name;
Dec 18, 2003
Dec 18, 2003
314
char *sep;
Dec 15, 2003
Dec 15, 2003
315
Sep 29, 2004
Sep 29, 2004
316
if (*dname == '\0') /* root directory enumeration? */
Dec 18, 2003
Dec 18, 2003
317
318
319
{
for (i = 0; i < max; i++, entry++)
{
Sep 29, 2004
Sep 29, 2004
320
321
name = entry->name;
if (strchr(name, '/') == NULL)
Sep 18, 2005
Sep 18, 2005
322
cb(callbackdata, origdir, name);
Dec 18, 2003
Dec 18, 2003
323
324
325
326
327
328
} /* for */
} /* if */
else
{
for (i = 0; i < max; i++, entry++)
{
Sep 29, 2004
Sep 29, 2004
329
330
name = entry->name;
sep = strchr(name, '/');
Dec 18, 2003
Dec 18, 2003
331
332
if (sep != NULL)
{
Sep 29, 2004
Sep 29, 2004
333
if (strncmp(dname, name, (sep - name)) == 0)
Oct 12, 2005
Oct 12, 2005
334
cb(callbackdata, origdir, sep + 1);
Dec 18, 2003
Dec 18, 2003
335
336
337
} /* if */
} /* for */
} /* else */
Dec 15, 2003
Dec 15, 2003
338
339
340
} /* WAD_enumerateFiles */
Feb 15, 2010
Feb 15, 2010
341
static WADentry *wad_find_entry(const WADinfo *info, const char *name)
Dec 15, 2003
Dec 15, 2003
342
343
344
345
346
347
348
349
350
351
352
353
{
WADentry *a = info->entries;
PHYSFS_sint32 lo = 0;
PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
PHYSFS_sint32 middle;
int rc;
while (lo <= hi)
{
middle = lo + ((hi - lo) / 2);
rc = strcmp(name, a[middle].name);
if (rc == 0) /* found it! */
Jan 28, 2010
Jan 28, 2010
354
return &a[middle];
Dec 15, 2003
Dec 15, 2003
355
356
357
358
359
360
361
362
363
364
else if (rc > 0)
lo = middle + 1;
else
hi = middle - 1;
} /* while */
BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
} /* wad_find_entry */
Sep 26, 2004
Sep 26, 2004
365
static int WAD_exists(dvoid *opaque, const char *name)
Dec 15, 2003
Dec 15, 2003
366
{
Jan 28, 2010
Jan 28, 2010
367
return (wad_find_entry((WADinfo *) opaque, name) != NULL);
Dec 15, 2003
Dec 15, 2003
368
369
370
} /* WAD_exists */
Sep 26, 2004
Sep 26, 2004
371
static int WAD_isDirectory(dvoid *opaque, const char *name, int *fileExists)
Dec 15, 2003
Dec 15, 2003
372
{
Sep 26, 2004
Sep 26, 2004
373
WADentry *entry = wad_find_entry(((WADinfo *) opaque), name);
Dec 18, 2003
Dec 18, 2003
374
375
376
377
378
379
380
381
if (entry != NULL)
{
char *n;
*fileExists = 1;
/* Can't be a directory if it's a subdirectory. */
if (strchr(entry->name, '/') != NULL)
Jan 28, 2010
Jan 28, 2010
382
return 0;
Dec 18, 2003
Dec 18, 2003
383
384
385
386
387
388
/* Check if it matches "MAP??" or "E?M?" ... */
n = entry->name;
if ((n[0] == 'E' && n[2] == 'M') ||
(n[0] == 'M' && n[1] == 'A' && n[2] == 'P' && n[6] == 0))
{
Jan 28, 2010
Jan 28, 2010
389
return 1;
Dec 18, 2003
Dec 18, 2003
390
} /* if */
Jan 28, 2010
Jan 28, 2010
391
return 0;
Dec 18, 2003
Dec 18, 2003
392
393
394
395
} /* if */
else
{
*fileExists = 0;
Jan 28, 2010
Jan 28, 2010
396
return 0;
Dec 18, 2003
Dec 18, 2003
397
} /* else */
Dec 15, 2003
Dec 15, 2003
398
399
400
} /* WAD_isDirectory */
Sep 26, 2004
Sep 26, 2004
401
static int WAD_isSymLink(dvoid *opaque, const char *name, int *fileExists)
Dec 15, 2003
Dec 15, 2003
402
{
Sep 26, 2004
Sep 26, 2004
403
*fileExists = WAD_exists(opaque, name);
Jan 28, 2010
Jan 28, 2010
404
return 0; /* never symlinks in a wad. */
Dec 15, 2003
Dec 15, 2003
405
406
407
} /* WAD_isSymLink */
Sep 26, 2004
Sep 26, 2004
408
static fvoid *WAD_openRead(dvoid *opaque, const char *fnm, int *fileExists)
Dec 15, 2003
Dec 15, 2003
409
{
Sep 26, 2004
Sep 26, 2004
410
WADinfo *info = ((WADinfo *) opaque);
Dec 15, 2003
Dec 15, 2003
411
412
413
414
415
416
417
WADfileinfo *finfo;
WADentry *entry;
entry = wad_find_entry(info, fnm);
*fileExists = (entry != NULL);
BAIL_IF_MACRO(entry == NULL, NULL, NULL);
Mar 14, 2005
Mar 14, 2005
418
finfo = (WADfileinfo *) allocator.Malloc(sizeof (WADfileinfo));
Sep 26, 2004
Sep 26, 2004
419
BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
Dec 15, 2003
Dec 15, 2003
420
421
422
423
424
finfo->handle = __PHYSFS_platformOpenRead(info->filename);
if ( (finfo->handle == NULL) ||
(!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
{
Mar 14, 2005
Mar 14, 2005
425
allocator.Free(finfo);
Jan 28, 2010
Jan 28, 2010
426
return NULL;
Dec 15, 2003
Dec 15, 2003
427
428
429
430
} /* if */
finfo->curPos = 0;
finfo->entry = entry;
Jan 28, 2010
Jan 28, 2010
431
return finfo;
Dec 15, 2003
Dec 15, 2003
432
433
434
} /* WAD_openRead */
Sep 26, 2004
Sep 26, 2004
435
static fvoid *WAD_openWrite(dvoid *opaque, const char *name)
Dec 15, 2003
Dec 15, 2003
436
437
438
439
440
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* WAD_openWrite */
Sep 26, 2004
Sep 26, 2004
441
static fvoid *WAD_openAppend(dvoid *opaque, const char *name)
Dec 15, 2003
Dec 15, 2003
442
443
444
445
446
{
BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
} /* WAD_openAppend */
Sep 26, 2004
Sep 26, 2004
447
static int WAD_remove(dvoid *opaque, const char *name)
Dec 15, 2003
Dec 15, 2003
448
449
450
451
452
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* WAD_remove */
Sep 26, 2004
Sep 26, 2004
453
static int WAD_mkdir(dvoid *opaque, const char *name)
Dec 15, 2003
Dec 15, 2003
454
455
456
457
{
BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
} /* WAD_mkdir */
Sep 29, 2004
Sep 29, 2004
458
Aug 22, 2010
Aug 22, 2010
459
static int WAD_stat(dvoid *opaque, const char *filename, int *exists,
Feb 15, 2010
Feb 15, 2010
460
461
462
463
464
465
466
467
468
469
470
PHYSFS_Stat *stat)
{
const WADinfo *info = (const WADinfo *) opaque;
const WADentry *entry = wad_find_entry(info, filename);
*exists = (entry != 0);
if (!entry)
return 0;
stat->filesize = entry->size;
stat->filetype = PHYSFS_FILETYPE_REGULAR;
Aug 25, 2010
Aug 25, 2010
471
472
473
stat->accesstime = -1;
stat->modtime = -1;
stat->createtime = -1;
Feb 15, 2010
Feb 15, 2010
474
475
stat->readonly = 1; /* WADs are always readonly */
Aug 21, 2010
Aug 21, 2010
476
return 1;
Feb 15, 2010
Feb 15, 2010
477
478
479
} /* WAD_stat */
Sep 29, 2004
Sep 29, 2004
480
481
482
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD =
{
"WAD",
Mar 16, 2005
Mar 16, 2005
483
WAD_ARCHIVE_DESCRIPTION,
Sep 29, 2004
Sep 29, 2004
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
"Travis Wells <traviswells@mchsi.com>",
"http://www.3dmm2.com/doom/",
};
const PHYSFS_Archiver __PHYSFS_Archiver_WAD =
{
&__PHYSFS_ArchiveInfo_WAD,
WAD_openArchive, /* openArchive() method */
WAD_enumerateFiles, /* enumerateFiles() method */
WAD_exists, /* exists() method */
WAD_isDirectory, /* isDirectory() method */
WAD_isSymLink, /* isSymLink() method */
WAD_openRead, /* openRead() method */
WAD_openWrite, /* openWrite() method */
WAD_openAppend, /* openAppend() method */
WAD_remove, /* remove() method */
WAD_mkdir, /* mkdir() method */
WAD_dirClose, /* dirClose() method */
Aug 22, 2010
Aug 22, 2010
503
WAD_stat, /* stat() method */
Sep 29, 2004
Sep 29, 2004
504
505
506
507
508
509
WAD_read, /* read() method */
WAD_write, /* write() method */
WAD_eof, /* eof() method */
WAD_tell, /* tell() method */
WAD_seek, /* seek() method */
WAD_fileLength, /* fileLength() method */
Aug 22, 2010
Aug 22, 2010
510
WAD_fileClose /* fileClose() method */
Sep 29, 2004
Sep 29, 2004
511
512
};
Dec 15, 2003
Dec 15, 2003
513
514
515
#endif /* defined PHYSFS_SUPPORTS_WAD */
/* end of wad.c ... */