Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
4.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef ZIP_UNCOMPRESSED_H
  7. #define ZIP_UNCOMPRESSED_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "datamap.h"
  12. #define PKID( a, b ) (((b)<<24)|((a)<<16)|('K'<<8)|'P')
  13. #pragma pack(1)
  14. struct ZIP_EndOfCentralDirRecord
  15. {
  16. DECLARE_BYTESWAP_DATADESC();
  17. unsigned int signature; // 4 bytes PK56
  18. unsigned short numberOfThisDisk; // 2 bytes
  19. unsigned short numberOfTheDiskWithStartOfCentralDirectory; // 2 bytes
  20. unsigned short nCentralDirectoryEntries_ThisDisk; // 2 bytes
  21. unsigned short nCentralDirectoryEntries_Total; // 2 bytes
  22. unsigned int centralDirectorySize; // 4 bytes
  23. unsigned int startOfCentralDirOffset; // 4 bytes
  24. unsigned short commentLength; // 2 bytes
  25. // zip file comment follows
  26. };
  27. struct ZIP_FileHeader
  28. {
  29. DECLARE_BYTESWAP_DATADESC();
  30. unsigned int signature; // 4 bytes PK12
  31. unsigned short versionMadeBy; // version made by 2 bytes
  32. unsigned short versionNeededToExtract; // version needed to extract 2 bytes
  33. unsigned short flags; // general purpose bit flag 2 bytes
  34. unsigned short compressionMethod; // compression method 2 bytes
  35. unsigned short lastModifiedTime; // last mod file time 2 bytes
  36. unsigned short lastModifiedDate; // last mod file date 2 bytes
  37. unsigned int crc32; // crc-32 4 bytes
  38. unsigned int compressedSize; // compressed size 4 bytes
  39. unsigned int uncompressedSize; // uncompressed size 4 bytes
  40. unsigned short fileNameLength; // file name length 2 bytes
  41. unsigned short extraFieldLength; // extra field length 2 bytes
  42. unsigned short fileCommentLength; // file comment length 2 bytes
  43. unsigned short diskNumberStart; // disk number start 2 bytes
  44. unsigned short internalFileAttribs; // internal file attributes 2 bytes
  45. unsigned int externalFileAttribs; // external file attributes 4 bytes
  46. unsigned int relativeOffsetOfLocalHeader; // relative offset of local header 4 bytes
  47. // file name (variable size)
  48. // extra field (variable size)
  49. // file comment (variable size)
  50. };
  51. struct ZIP_LocalFileHeader
  52. {
  53. DECLARE_BYTESWAP_DATADESC();
  54. unsigned int signature; //local file header signature 4 bytes PK34
  55. unsigned short versionNeededToExtract; // version needed to extract 2 bytes
  56. unsigned short flags; // general purpose bit flag 2 bytes
  57. unsigned short compressionMethod; // compression method 2 bytes
  58. unsigned short lastModifiedTime; // last mod file time 2 bytes
  59. unsigned short lastModifiedDate; // last mod file date 2 bytes
  60. unsigned int crc32; // crc-32 4 bytes
  61. unsigned int compressedSize; // compressed size 4 bytes
  62. unsigned int uncompressedSize; // uncompressed size 4 bytes
  63. unsigned short fileNameLength; // file name length 2 bytes
  64. unsigned short extraFieldLength; // extra field length 2 bytes
  65. // file name (variable size)
  66. // extra field (variable size)
  67. };
  68. //=============================================================================//
  69. // Valve Non standard Extension, Preload Section
  70. // An optional first file in an aligned zip that can be loaded into ram and
  71. // used by the FileSystem to supply header data rather than disk.
  72. // Is is an optimization to prevent the large of amount of small I/O performed
  73. /// by the map loading process.
  74. //=============================================================================//
  75. #define PRELOAD_SECTION_NAME "__preload_section.pre"
  76. #define PRELOAD_HDR_VERSION 3
  77. #define XZIP_COMMENT_LENGTH 32
  78. #define INVALID_PRELOAD_ENTRY ( (unsigned short)-1 )
  79. struct ZIP_PreloadHeader
  80. {
  81. DECLARE_BYTESWAP_DATADESC();
  82. unsigned int Version; // VERSION
  83. unsigned int DirectoryEntries; // Number of zip directory entries.
  84. unsigned int PreloadDirectoryEntries; // Number of preloaded directory entries (equal or less than the zip dir).
  85. unsigned int Alignment; // File alignment of the zip
  86. };
  87. struct ZIP_PreloadDirectoryEntry
  88. {
  89. DECLARE_BYTESWAP_DATADESC();
  90. unsigned int Length; // Length of the file's preload data in bytes
  91. unsigned int DataOffset; // Offset the file data in the .zip, relative to the logical beginning of the preload file.
  92. };
  93. struct ZIP_PreloadRemapTable
  94. {
  95. DECLARE_BYTESWAP_DATADESC();
  96. unsigned short PreloadIndex; // Index into preload directory, entry marked invalid if no preload entry present
  97. };
  98. #pragma pack()
  99. #endif // ZIP_UNCOMPRESSED_H