l_qfiles.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. #include "../qcommon/unzip.h"
  19. #define QFILETYPE_UNKNOWN 0x8000
  20. #define QFILETYPE_PAK 0x0001
  21. #define QFILETYPE_PK3 0x0002
  22. #define QFILETYPE_BSP 0x0004
  23. #define QFILETYPE_MAP 0x0008
  24. #define QFILETYPE_MDL 0x0010
  25. #define QFILETYPE_MD2 0x0020
  26. #define QFILETYPE_MD3 0x0040
  27. #define QFILETYPE_WAL 0x0080
  28. #define QFILETYPE_WAV 0x0100
  29. #define QFILETYPE_AAS 0x4000
  30. #define QFILEEXT_UNKNOWN ""
  31. #define QFILEEXT_PAK ".PAK"
  32. #define QFILEEXT_PK3 ".PK3"
  33. #define QFILEEXT_SIN ".SIN"
  34. #define QFILEEXT_BSP ".BSP"
  35. #define QFILEEXT_MAP ".MAP"
  36. #define QFILEEXT_MDL ".MDL"
  37. #define QFILEEXT_MD2 ".MD2"
  38. #define QFILEEXT_MD3 ".MD3"
  39. #define QFILEEXT_WAL ".WAL"
  40. #define QFILEEXT_WAV ".WAV"
  41. #define QFILEEXT_AAS ".AAS"
  42. //maximum path length
  43. #ifndef _MAX_PATH
  44. #define _MAX_PATH 1024
  45. #endif
  46. //for Sin packs
  47. #define MAX_PAK_FILENAME_LENGTH 120
  48. #define SINPAKHEADER (('K'<<24)+('A'<<16)+('P'<<8)+'S')
  49. typedef struct
  50. {
  51. char name[MAX_PAK_FILENAME_LENGTH];
  52. int filepos, filelen;
  53. } dsinpackfile_t;
  54. typedef struct quakefile_s
  55. {
  56. char pakfile[_MAX_PATH];
  57. char filename[_MAX_PATH];
  58. char origname[_MAX_PATH];
  59. int zipfile;
  60. int type;
  61. int offset;
  62. int length;
  63. unz_s zipinfo;
  64. struct quakefile_s *next;
  65. } quakefile_t;
  66. //returns the file extension for the given type
  67. char *QuakeFileTypeExtension(int type);
  68. //returns the file type for the given extension
  69. int QuakeFileExtensionType(char *extension);
  70. //return the Quake file type for the given file
  71. int QuakeFileType(char *filename);
  72. //returns true if the filename complies to the filter
  73. int FileFilter(char *filter, char *filename, int casesensitive);
  74. //find Quake files using the given filter
  75. quakefile_t *FindQuakeFiles(char *filter);
  76. //load the given Quake file, returns the length of the file
  77. int LoadQuakeFile(quakefile_t *qf, void **bufferptr);
  78. //read part of a Quake file into the buffer
  79. int ReadQuakeFile(quakefile_t *qf, void *buffer, int offset, int length);