archiver_qpak.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /*
  2. * QPAK support routines for PhysicsFS.
  3. *
  4. * This archiver handles the archive format utilized by Quake 1 and 2.
  5. * Quake3-based games use the PkZip/Info-Zip format (which our zip.c
  6. * archiver handles).
  7. *
  8. * ========================================================================
  9. *
  10. * This format info (in more detail) comes from:
  11. * http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/pak.txt
  12. *
  13. * Quake PAK Format
  14. *
  15. * Header
  16. * (4 bytes) signature = 'PACK'
  17. * (4 bytes) directory offset
  18. * (4 bytes) directory length
  19. *
  20. * Directory
  21. * (56 bytes) file name
  22. * (4 bytes) file position
  23. * (4 bytes) file length
  24. *
  25. * ========================================================================
  26. *
  27. * Please see the file LICENSE.txt in the source's root directory.
  28. *
  29. * This file written by Ryan C. Gordon.
  30. */
  31. #if (defined PHYSFS_SUPPORTS_QPAK)
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34. #include <string.h>
  35. #include "physfs.h"
  36. #define __PHYSICSFS_INTERNAL__
  37. #include "physfs_internal.h"
  38. #if 1 /* Make this case insensitive? */
  39. #define QPAK_strcmp(x, y) __PHYSFS_stricmpASCII(x, y)
  40. #define QPAK_strncmp(x, y, z) __PHYSFS_strnicmpASCII(x, y, z)
  41. #else
  42. #define QPAK_strcmp(x, y) strcmp(x, y)
  43. #define QPAK_strncmp(x, y, z) strncmp(x, y, z)
  44. #endif
  45. typedef struct
  46. {
  47. char name[56];
  48. PHYSFS_uint32 startPos;
  49. PHYSFS_uint32 size;
  50. } QPAKentry;
  51. typedef struct
  52. {
  53. char *filename;
  54. PHYSFS_sint64 last_mod_time;
  55. PHYSFS_uint32 entryCount;
  56. QPAKentry *entries;
  57. } QPAKinfo;
  58. typedef struct
  59. {
  60. void *handle;
  61. QPAKentry *entry;
  62. PHYSFS_uint32 curPos;
  63. } QPAKfileinfo;
  64. /* Magic numbers... */
  65. #define QPAK_SIG 0x4b434150 /* "PACK" in ASCII. */
  66. static void QPAK_dirClose(dvoid *opaque)
  67. {
  68. QPAKinfo *info = ((QPAKinfo *) opaque);
  69. allocator.Free(info->filename);
  70. allocator.Free(info->entries);
  71. allocator.Free(info);
  72. } /* QPAK_dirClose */
  73. static PHYSFS_sint64 QPAK_read(fvoid *opaque, void *buffer, PHYSFS_uint64 len)
  74. {
  75. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  76. const QPAKentry *entry = finfo->entry;
  77. const PHYSFS_uint64 bytesLeft = (PHYSFS_uint64)(entry->size-finfo->curPos);
  78. PHYSFS_sint64 rc;
  79. if (bytesLeft < len)
  80. len = bytesLeft;
  81. rc = __PHYSFS_platformRead(finfo->handle, buffer, len);
  82. if (rc > 0)
  83. finfo->curPos += (PHYSFS_uint32) rc;
  84. return rc;
  85. } /* QPAK_read */
  86. static PHYSFS_sint64 QPAK_write(fvoid *f, const void *buf, PHYSFS_uint64 len)
  87. {
  88. BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
  89. } /* QPAK_write */
  90. static int QPAK_eof(fvoid *opaque)
  91. {
  92. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  93. QPAKentry *entry = finfo->entry;
  94. return (finfo->curPos >= entry->size);
  95. } /* QPAK_eof */
  96. static PHYSFS_sint64 QPAK_tell(fvoid *opaque)
  97. {
  98. return ((QPAKfileinfo *) opaque)->curPos;
  99. } /* QPAK_tell */
  100. static int QPAK_seek(fvoid *opaque, PHYSFS_uint64 offset)
  101. {
  102. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  103. QPAKentry *entry = finfo->entry;
  104. int rc;
  105. BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
  106. BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
  107. rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
  108. if (rc)
  109. finfo->curPos = (PHYSFS_uint32) offset;
  110. return rc;
  111. } /* QPAK_seek */
  112. static PHYSFS_sint64 QPAK_fileLength(fvoid *opaque)
  113. {
  114. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  115. return ((PHYSFS_sint64) finfo->entry->size);
  116. } /* QPAK_fileLength */
  117. static int QPAK_fileClose(fvoid *opaque)
  118. {
  119. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  120. BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
  121. allocator.Free(finfo);
  122. return 1;
  123. } /* QPAK_fileClose */
  124. static inline int readAll(void *fh, void *buf, const PHYSFS_uint64 len)
  125. {
  126. return (__PHYSFS_platformRead(fh, buf, len) == len);
  127. } /* readAll */
  128. static int qpak_open(const char *filename, int forWriting,
  129. void **fh, PHYSFS_uint32 *count)
  130. {
  131. PHYSFS_uint32 buf;
  132. *fh = NULL;
  133. BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
  134. *fh = __PHYSFS_platformOpenRead(filename);
  135. BAIL_IF_MACRO(*fh == NULL, NULL, 0);
  136. if (!readAll(*fh, &buf, sizeof (PHYSFS_uint32)))
  137. goto openQpak_failed;
  138. buf = PHYSFS_swapULE32(buf);
  139. GOTO_IF_MACRO(buf != QPAK_SIG, ERR_UNSUPPORTED_ARCHIVE, openQpak_failed);
  140. if (!readAll(*fh, &buf, sizeof (PHYSFS_uint32)))
  141. goto openQpak_failed;
  142. buf = PHYSFS_swapULE32(buf); /* directory table offset. */
  143. if (!readAll(*fh, count, sizeof (PHYSFS_uint32)))
  144. goto openQpak_failed;
  145. *count = PHYSFS_swapULE32(*count);
  146. /* corrupted archive? */
  147. GOTO_IF_MACRO((*count % 64) != 0, ERR_CORRUPTED, openQpak_failed);
  148. if (!__PHYSFS_platformSeek(*fh, buf))
  149. goto openQpak_failed;
  150. *count /= 64;
  151. return 1;
  152. openQpak_failed:
  153. if (*fh != NULL)
  154. __PHYSFS_platformClose(*fh);
  155. *count = -1;
  156. *fh = NULL;
  157. return 0;
  158. } /* qpak_open */
  159. static int QPAK_isArchive(const char *filename, int forWriting)
  160. {
  161. void *fh;
  162. PHYSFS_uint32 fileCount;
  163. int retval = qpak_open(filename, forWriting, &fh, &fileCount);
  164. if (fh != NULL)
  165. __PHYSFS_platformClose(fh);
  166. return retval;
  167. } /* QPAK_isArchive */
  168. static int qpak_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
  169. {
  170. if (one != two)
  171. {
  172. const QPAKentry *a = (const QPAKentry *) _a;
  173. return QPAK_strcmp(a[one].name, a[two].name);
  174. } /* if */
  175. return 0;
  176. } /* qpak_entry_cmp */
  177. static void qpak_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
  178. {
  179. if (one != two)
  180. {
  181. QPAKentry tmp;
  182. QPAKentry *first = &(((QPAKentry *) _a)[one]);
  183. QPAKentry *second = &(((QPAKentry *) _a)[two]);
  184. memcpy(&tmp, first, sizeof (QPAKentry));
  185. memcpy(first, second, sizeof (QPAKentry));
  186. memcpy(second, &tmp, sizeof (QPAKentry));
  187. } /* if */
  188. } /* qpak_entry_swap */
  189. static int qpak_load_entries(const char *name, int forWriting, QPAKinfo *info)
  190. {
  191. void *fh = NULL;
  192. PHYSFS_uint32 fileCount;
  193. QPAKentry *entry;
  194. BAIL_IF_MACRO(!qpak_open(name, forWriting, &fh, &fileCount), NULL, 0);
  195. info->entryCount = fileCount;
  196. info->entries = (QPAKentry*) allocator.Malloc(sizeof(QPAKentry)*fileCount);
  197. if (info->entries == NULL)
  198. {
  199. __PHYSFS_platformClose(fh);
  200. BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
  201. } /* if */
  202. for (entry = info->entries; fileCount > 0; fileCount--, entry++)
  203. {
  204. if ( (!readAll(fh, &entry->name, sizeof (entry->name))) ||
  205. (!readAll(fh, &entry->startPos, sizeof (entry->startPos))) ||
  206. (!readAll(fh, &entry->size, sizeof(entry->size))) )
  207. {
  208. __PHYSFS_platformClose(fh);
  209. return 0;
  210. } /* if */
  211. entry->size = PHYSFS_swapULE32(entry->size);
  212. entry->startPos = PHYSFS_swapULE32(entry->startPos);
  213. } /* for */
  214. __PHYSFS_platformClose(fh);
  215. __PHYSFS_sort(info->entries, info->entryCount,
  216. qpak_entry_cmp, qpak_entry_swap);
  217. return 1;
  218. } /* qpak_load_entries */
  219. static void *QPAK_openArchive(const char *name, int forWriting)
  220. {
  221. QPAKinfo *info = (QPAKinfo *) allocator.Malloc(sizeof (QPAKinfo));
  222. PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
  223. BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
  224. memset(info, '\0', sizeof (QPAKinfo));
  225. info->filename = (char *) allocator.Malloc(strlen(name) + 1);
  226. if (info->filename == NULL)
  227. {
  228. __PHYSFS_setError(ERR_OUT_OF_MEMORY);
  229. goto QPAK_openArchive_failed;
  230. } /* if */
  231. if (!qpak_load_entries(name, forWriting, info))
  232. goto QPAK_openArchive_failed;
  233. strcpy(info->filename, name);
  234. info->last_mod_time = modtime;
  235. return info;
  236. QPAK_openArchive_failed:
  237. if (info != NULL)
  238. {
  239. if (info->filename != NULL)
  240. allocator.Free(info->filename);
  241. if (info->entries != NULL)
  242. allocator.Free(info->entries);
  243. allocator.Free(info);
  244. } /* if */
  245. return NULL;
  246. } /* QPAK_openArchive */
  247. static PHYSFS_sint32 qpak_find_start_of_dir(QPAKinfo *info, const char *path,
  248. int stop_on_first_find)
  249. {
  250. PHYSFS_sint32 lo = 0;
  251. PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
  252. PHYSFS_sint32 middle;
  253. PHYSFS_uint32 dlen = strlen(path);
  254. PHYSFS_sint32 retval = -1;
  255. const char *name;
  256. int rc;
  257. if (*path == '\0') /* root dir? */
  258. return 0;
  259. if ((dlen > 0) && (path[dlen - 1] == '/')) /* ignore trailing slash. */
  260. dlen--;
  261. while (lo <= hi)
  262. {
  263. middle = lo + ((hi - lo) / 2);
  264. name = info->entries[middle].name;
  265. rc = QPAK_strncmp(path, name, dlen);
  266. if (rc == 0)
  267. {
  268. char ch = name[dlen];
  269. if (ch < '/') /* make sure this isn't just a substr match. */
  270. rc = -1;
  271. else if (ch > '/')
  272. rc = 1;
  273. else
  274. {
  275. if (stop_on_first_find) /* Just checking dir's existance? */
  276. return middle;
  277. if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
  278. return (middle + 1);
  279. /* there might be more entries earlier in the list. */
  280. retval = middle;
  281. hi = middle - 1;
  282. } /* else */
  283. } /* if */
  284. if (rc > 0)
  285. lo = middle + 1;
  286. else
  287. hi = middle - 1;
  288. } /* while */
  289. return retval;
  290. } /* qpak_find_start_of_dir */
  291. /*
  292. * Moved to seperate function so we can use alloca then immediately throw
  293. * away the allocated stack space...
  294. */
  295. static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
  296. const char *odir, const char *str, PHYSFS_sint32 ln)
  297. {
  298. char *newstr = __PHYSFS_smallAlloc(ln + 1);
  299. if (newstr == NULL)
  300. return;
  301. memcpy(newstr, str, ln);
  302. newstr[ln] = '\0';
  303. cb(callbackdata, odir, newstr);
  304. __PHYSFS_smallFree(newstr);
  305. } /* doEnumCallback */
  306. static void QPAK_enumerateFiles(dvoid *opaque, const char *dname,
  307. int omitSymLinks, PHYSFS_EnumFilesCallback cb,
  308. const char *origdir, void *callbackdata)
  309. {
  310. QPAKinfo *info = ((QPAKinfo *) opaque);
  311. PHYSFS_sint32 dlen, dlen_inc, max, i;
  312. i = qpak_find_start_of_dir(info, dname, 0);
  313. if (i == -1) /* no such directory. */
  314. return;
  315. dlen = strlen(dname);
  316. if ((dlen > 0) && (dname[dlen - 1] == '/')) /* ignore trailing slash. */
  317. dlen--;
  318. dlen_inc = ((dlen > 0) ? 1 : 0) + dlen;
  319. max = (PHYSFS_sint32) info->entryCount;
  320. while (i < max)
  321. {
  322. char *add;
  323. char *ptr;
  324. PHYSFS_sint32 ln;
  325. char *e = info->entries[i].name;
  326. if ((dlen) && ((QPAK_strncmp(e, dname, dlen)) || (e[dlen] != '/')))
  327. break; /* past end of this dir; we're done. */
  328. add = e + dlen_inc;
  329. ptr = strchr(add, '/');
  330. ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
  331. doEnumCallback(cb, callbackdata, origdir, add, ln);
  332. ln += dlen_inc; /* point past entry to children... */
  333. /* increment counter and skip children of subdirs... */
  334. while ((++i < max) && (ptr != NULL))
  335. {
  336. char *e_new = info->entries[i].name;
  337. if ((QPAK_strncmp(e, e_new, ln) != 0) || (e_new[ln] != '/'))
  338. break;
  339. } /* while */
  340. } /* while */
  341. } /* QPAK_enumerateFiles */
  342. /*
  343. * This will find the QPAKentry associated with a path in platform-independent
  344. * notation. Directories don't have QPAKentries associated with them, but
  345. * (*isDir) will be set to non-zero if a dir was hit.
  346. */
  347. static QPAKentry *qpak_find_entry(const QPAKinfo *info, const char *path,
  348. int *isDir)
  349. {
  350. QPAKentry *a = info->entries;
  351. PHYSFS_sint32 pathlen = strlen(path);
  352. PHYSFS_sint32 lo = 0;
  353. PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
  354. PHYSFS_sint32 middle;
  355. const char *thispath = NULL;
  356. int rc;
  357. while (lo <= hi)
  358. {
  359. middle = lo + ((hi - lo) / 2);
  360. thispath = a[middle].name;
  361. rc = QPAK_strncmp(path, thispath, pathlen);
  362. if (rc > 0)
  363. lo = middle + 1;
  364. else if (rc < 0)
  365. hi = middle - 1;
  366. else /* substring match...might be dir or entry or nothing. */
  367. {
  368. if (isDir != NULL)
  369. {
  370. *isDir = (thispath[pathlen] == '/');
  371. if (*isDir)
  372. return NULL;
  373. } /* if */
  374. if (thispath[pathlen] == '\0') /* found entry? */
  375. return &a[middle];
  376. else
  377. hi = middle - 1; /* adjust search params, try again. */
  378. } /* if */
  379. } /* while */
  380. if (isDir != NULL)
  381. *isDir = 0;
  382. BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
  383. } /* qpak_find_entry */
  384. static int QPAK_exists(dvoid *opaque, const char *name)
  385. {
  386. int isDir;
  387. QPAKinfo *info = (QPAKinfo *) opaque;
  388. QPAKentry *entry = qpak_find_entry(info, name, &isDir);
  389. return ((entry != NULL) || (isDir));
  390. } /* QPAK_exists */
  391. static int QPAK_isDirectory(dvoid *opaque, const char *name, int *fileExists)
  392. {
  393. QPAKinfo *info = (QPAKinfo *) opaque;
  394. int isDir;
  395. QPAKentry *entry = qpak_find_entry(info, name, &isDir);
  396. *fileExists = ((isDir) || (entry != NULL));
  397. if (isDir)
  398. return 1; /* definitely a dir. */
  399. BAIL_MACRO(ERR_NO_SUCH_FILE, 0);
  400. } /* QPAK_isDirectory */
  401. static int QPAK_isSymLink(dvoid *opaque, const char *name, int *fileExists)
  402. {
  403. *fileExists = QPAK_exists(opaque, name);
  404. return 0; /* never symlinks in a quake pak. */
  405. } /* QPAK_isSymLink */
  406. static PHYSFS_sint64 QPAK_getLastModTime(dvoid *opaque,
  407. const char *name,
  408. int *fileExists)
  409. {
  410. int isDir;
  411. QPAKinfo *info = ((QPAKinfo *) opaque);
  412. PHYSFS_sint64 retval = -1;
  413. QPAKentry *entry = qpak_find_entry(info, name, &isDir);
  414. *fileExists = ((isDir) || (entry != NULL));
  415. if (*fileExists) /* use time of QPAK itself in the physical filesystem. */
  416. retval = info->last_mod_time;
  417. return retval;
  418. } /* QPAK_getLastModTime */
  419. static fvoid *QPAK_openRead(dvoid *opaque, const char *fnm, int *fileExists)
  420. {
  421. QPAKinfo *info = ((QPAKinfo *) opaque);
  422. QPAKfileinfo *finfo;
  423. QPAKentry *entry;
  424. int isDir;
  425. entry = qpak_find_entry(info, fnm, &isDir);
  426. *fileExists = ((entry != NULL) || (isDir));
  427. BAIL_IF_MACRO(isDir, ERR_NOT_A_FILE, NULL);
  428. BAIL_IF_MACRO(entry == NULL, ERR_NO_SUCH_FILE, NULL);
  429. finfo = (QPAKfileinfo *) allocator.Malloc(sizeof (QPAKfileinfo));
  430. BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
  431. finfo->handle = __PHYSFS_platformOpenRead(info->filename);
  432. if ( (finfo->handle == NULL) ||
  433. (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
  434. {
  435. allocator.Free(finfo);
  436. return NULL;
  437. } /* if */
  438. finfo->curPos = 0;
  439. finfo->entry = entry;
  440. return finfo;
  441. } /* QPAK_openRead */
  442. static fvoid *QPAK_openWrite(dvoid *opaque, const char *name)
  443. {
  444. BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
  445. } /* QPAK_openWrite */
  446. static fvoid *QPAK_openAppend(dvoid *opaque, const char *name)
  447. {
  448. BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
  449. } /* QPAK_openAppend */
  450. static int QPAK_remove(dvoid *opaque, const char *name)
  451. {
  452. BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
  453. } /* QPAK_remove */
  454. static int QPAK_mkdir(dvoid *opaque, const char *name)
  455. {
  456. BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
  457. } /* QPAK_mkdir */
  458. static int QPAK_stat(dvoid *opaque, const char *filename, int *exists,
  459. PHYSFS_Stat *stat)
  460. {
  461. int isDir = 0;
  462. const QPAKinfo *info = (const QPAKinfo *) opaque;
  463. const QPAKentry *entry = qpak_find_entry(info, filename, &isDir);
  464. *exists = ((isDir) || (entry != NULL));
  465. if (!exists)
  466. return 0;
  467. if (isDir)
  468. {
  469. stat->filetype = PHYSFS_FILETYPE_DIRECTORY;
  470. stat->filesize = 0;
  471. } /* if */
  472. else
  473. {
  474. stat->filetype = PHYSFS_FILETYPE_REGULAR;
  475. stat->filesize = entry->size;
  476. } /* else */
  477. stat->modtime = info->last_mod_time;
  478. stat->createtime = info->last_mod_time;
  479. stat->accesstime = 0;
  480. stat->readonly = 1;
  481. return 1;
  482. } /* QPAK_stat */
  483. const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK =
  484. {
  485. "PAK",
  486. QPAK_ARCHIVE_DESCRIPTION,
  487. "Ryan C. Gordon <icculus@icculus.org>",
  488. "http://icculus.org/physfs/",
  489. };
  490. const PHYSFS_Archiver __PHYSFS_Archiver_QPAK =
  491. {
  492. &__PHYSFS_ArchiveInfo_QPAK,
  493. QPAK_isArchive, /* isArchive() method */
  494. QPAK_openArchive, /* openArchive() method */
  495. QPAK_enumerateFiles, /* enumerateFiles() method */
  496. QPAK_exists, /* exists() method */
  497. QPAK_isDirectory, /* isDirectory() method */
  498. QPAK_isSymLink, /* isSymLink() method */
  499. QPAK_getLastModTime, /* getLastModTime() method */
  500. QPAK_openRead, /* openRead() method */
  501. QPAK_openWrite, /* openWrite() method */
  502. QPAK_openAppend, /* openAppend() method */
  503. QPAK_remove, /* remove() method */
  504. QPAK_mkdir, /* mkdir() method */
  505. QPAK_dirClose, /* dirClose() method */
  506. QPAK_stat, /* stat() method */
  507. QPAK_read, /* read() method */
  508. QPAK_write, /* write() method */
  509. QPAK_eof, /* eof() method */
  510. QPAK_tell, /* tell() method */
  511. QPAK_seek, /* seek() method */
  512. QPAK_fileLength, /* fileLength() method */
  513. QPAK_fileClose /* fileClose() method */
  514. };
  515. #endif /* defined PHYSFS_SUPPORTS_QPAK */
  516. /* end of qpak.c ... */