Team Fortress 2 Source Code as on 22/4/2020
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.

165 lines
6.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=====================================================================================//
  6. #pragma once
  7. #include <windows.h>
  8. #include <mmreg.h>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <direct.h>
  12. #include <io.h>
  13. #include <time.h>
  14. #include <fcntl.h>
  15. #include <sys/stat.h>
  16. #include <sys/types.h>
  17. #include <sys/utime.h>
  18. #include "tier0/dbg.h"
  19. #include "tier0/icommandline.h"
  20. #include "appframework/appframework.h"
  21. #include "characterset.h"
  22. #include "tier1/strtools.h"
  23. #include "tier1/UtlVector.h"
  24. #include "tier1/UtlBuffer.h"
  25. #include "tier1/UtlString.h"
  26. #include "tier1/UtlRBTree.h"
  27. #include "tier1/UtlDict.h"
  28. #include "tier1/UtlSortVector.h"
  29. #include "tier1/UtlStringMap.h"
  30. #include "tier1/UtlSymbol.h"
  31. #include "tier1/KeyValues.h"
  32. #include "tier1/lzss.h"
  33. #include "lzma/lzma.h"
  34. #include "datamap.h"
  35. #include "XZipTool.h"
  36. #include "../../common/scriplib.h"
  37. #include "../../common/cmdlib.h"
  38. #include "tier2/tier2.h"
  39. #include "dmserializers/idmserializers.h"
  40. #include "datamodel/dmattribute.h"
  41. #include "datamodel/dmelement.h"
  42. #include "studiobyteswap.h"
  43. #include "studio.h"
  44. #include "vphysics_interface.h"
  45. #include "materialsystem/IMaterial.h"
  46. #include "materialsystem/hardwareverts.h"
  47. #include "optimize.h"
  48. #include "soundchars.h"
  49. #include "mdllib/mdllib.h"
  50. enum fileType_e
  51. {
  52. FILETYPE_UNKNOWN = 0,
  53. FILETYPE_WAV,
  54. FILETYPE_VTF,
  55. FILETYPE_MDL,
  56. FILETYPE_ANI,
  57. FILETYPE_VTX,
  58. FILETYPE_VVD,
  59. FILETYPE_PHY,
  60. FILETYPE_BSP,
  61. FILETYPE_AIN,
  62. FILETYPE_CCDAT,
  63. FILETYPE_MP3,
  64. FILETYPE_RESLST,
  65. FILETYPE_PCF,
  66. FILETYPE_SCENEIMAGE
  67. };
  68. typedef struct
  69. {
  70. int result;
  71. CUtlString fileName;
  72. } errorList_t;
  73. //-----------------------------------------------------------------------------
  74. // MakeGameData.cpp
  75. //-----------------------------------------------------------------------------
  76. bool IsLocalizedFile( const char *pFileName );
  77. bool IsLocalizedFileValid( const char *pFileName, const char *pLanguageSuffix = NULL );
  78. bool CompressCallback( CUtlBuffer &inputBuffer, CUtlBuffer &outputBuffer );
  79. bool ReadFileToBuffer( const char *pSourceName, CUtlBuffer &buffer, bool bText, bool bNoOpenFailureWarning );
  80. bool WriteBufferToFile( const char *pTargetName, CUtlBuffer &buffer, bool bWriteToZip, DiskWriteMode_t writeMode );
  81. fileType_e ResolveFileType( const char *pSourceName, char *pTargetName, int targetNameSize );
  82. extern DiskWriteMode_t g_WriteModeForConversions;
  83. extern CXZipTool g_MasterXZip;
  84. extern char g_szGamePath[];
  85. extern char g_szModPath[];
  86. extern bool g_bModPathIsValid;
  87. extern const char *g_GameNames[];
  88. extern bool g_bForce;
  89. extern bool g_bQuiet;
  90. extern bool g_bMakeZip;
  91. extern bool g_bIsPlatformZip;
  92. extern IPhysicsCollision *g_pPhysicsCollision;
  93. extern char g_szSourcePath[];
  94. extern CUtlVector< errorList_t > g_errorList;
  95. //-----------------------------------------------------------------------------
  96. // MakeTextures.cpp
  97. //-----------------------------------------------------------------------------
  98. bool CreateTargetFile_VTF( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  99. bool GetPreloadData_VTF( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
  100. //-----------------------------------------------------------------------------
  101. // MakeScenes.cpp
  102. //-----------------------------------------------------------------------------
  103. bool CreateSceneImageFile( char const *pchModPath, bool bWriteToZip, bool bLittleEndian, bool bQuiet, DiskWriteMode_t eWriteModeForConversions );
  104. //-----------------------------------------------------------------------------
  105. // MakeSounds.cpp
  106. //-----------------------------------------------------------------------------
  107. bool CreateTargetFile_WAV( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  108. bool CreateTargetFile_MP3( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  109. bool GetPreloadData_WAV( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
  110. //-----------------------------------------------------------------------------
  111. // MakeMaps.cpp
  112. //-----------------------------------------------------------------------------
  113. bool CreateTargetFile_BSP( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  114. bool CreateTargetFile_AIN( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  115. bool GetDependants_BSP( const char *pBspName, CUtlVector< CUtlString > *pList );
  116. //-----------------------------------------------------------------------------
  117. // MakeResources.cpp
  118. //-----------------------------------------------------------------------------
  119. bool CreateTargetFile_CCDAT( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  120. bool CreateTargetFile_RESLST( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  121. //-----------------------------------------------------------------------------
  122. // MakeModels.cpp
  123. //-----------------------------------------------------------------------------
  124. bool InitStudioByteSwap( void );
  125. void ShutdownStudioByteSwap( void );
  126. bool CreateTargetFile_Model( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  127. bool GetDependants_MDL( const char *pModelName, CUtlVector< CUtlString > *pList );
  128. bool GetPreloadData_VHV( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
  129. bool GetPreloadData_VTX( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
  130. bool GetPreloadData_VVD( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
  131. bool PreprocessModelFiles( CUtlVector<fileList_t> &fileList );
  132. //-----------------------------------------------------------------------------
  133. // MakeShaders.cpp
  134. //-----------------------------------------------------------------------------
  135. bool GetPreloadData_VCS( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
  136. //-----------------------------------------------------------------------------
  137. // MakeMisc.cpp
  138. //-----------------------------------------------------------------------------
  139. bool ProcessDXSupportConfig( bool bWriteToZip );
  140. //-----------------------------------------------------------------------------
  141. // MakeResources.cpp
  142. //-----------------------------------------------------------------------------
  143. bool CreateTargetFile_PCF( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
  144. //-----------------------------------------------------------------------------
  145. // MakeZip.cpp
  146. //-----------------------------------------------------------------------------
  147. void SetupCriticalPreloadScript( const char *pModPath );