summaryrefslogtreecommitdiff
path: root/utils/xbox/MakeGameData/MakeGameData.h
blob: c2f20040adc96f09c70a557a0c086dc8af7542bb (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=====================================================================================//

#pragma once

#include <windows.h>
#include <mmreg.h>
#include <stdio.h>
#include <stdlib.h>
#include <direct.h>
#include <io.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utime.h>
#include "tier0/dbg.h"
#include "tier0/icommandline.h"
#include "appframework/appframework.h"
#include "characterset.h"
#include "tier1/strtools.h"
#include "tier1/UtlVector.h"
#include "tier1/UtlBuffer.h"
#include "tier1/UtlString.h"
#include "tier1/UtlRBTree.h"
#include "tier1/UtlDict.h"
#include "tier1/UtlSortVector.h"
#include "tier1/UtlStringMap.h"
#include "tier1/UtlSymbol.h"
#include "tier1/KeyValues.h"
#include "tier1/lzss.h"
#include "lzma/lzma.h"
#include "datamap.h"
#include "XZipTool.h"
#include "../../common/scriplib.h"
#include "../../common/cmdlib.h"
#include "tier2/tier2.h"
#include "dmserializers/idmserializers.h"
#include "datamodel/dmattribute.h"
#include "datamodel/dmelement.h"
#include "studiobyteswap.h"
#include "studio.h"
#include "vphysics_interface.h"
#include "materialsystem/IMaterial.h"
#include "materialsystem/hardwareverts.h"
#include "optimize.h"
#include "soundchars.h"
#include "mdllib/mdllib.h"

enum fileType_e
{
	FILETYPE_UNKNOWN = 0,
	FILETYPE_WAV,
	FILETYPE_VTF,
	FILETYPE_MDL,
	FILETYPE_ANI,
	FILETYPE_VTX,
	FILETYPE_VVD,
	FILETYPE_PHY,
	FILETYPE_BSP,
	FILETYPE_AIN,
	FILETYPE_CCDAT,
	FILETYPE_MP3,
	FILETYPE_RESLST,
	FILETYPE_PCF,
	FILETYPE_SCENEIMAGE
};

typedef struct
{
	int			result;
	CUtlString	fileName;
} errorList_t;

//-----------------------------------------------------------------------------
// MakeGameData.cpp
//-----------------------------------------------------------------------------


bool								IsLocalizedFile( const char *pFileName );
bool								IsLocalizedFileValid( const char *pFileName, const char *pLanguageSuffix = NULL );
bool								CompressCallback( CUtlBuffer &inputBuffer, CUtlBuffer &outputBuffer );
bool								ReadFileToBuffer( const char *pSourceName, CUtlBuffer &buffer, bool bText, bool bNoOpenFailureWarning );
bool								WriteBufferToFile( const char *pTargetName, CUtlBuffer &buffer, bool bWriteToZip, DiskWriteMode_t writeMode );
fileType_e							ResolveFileType( const char *pSourceName, char *pTargetName, int targetNameSize );

extern DiskWriteMode_t				g_WriteModeForConversions;
extern CXZipTool					g_MasterXZip;
extern char							g_szGamePath[];
extern char							g_szModPath[];
extern bool							g_bModPathIsValid;
extern const char					*g_GameNames[];
extern bool							g_bForce;
extern bool							g_bQuiet;
extern bool							g_bMakeZip;
extern bool							g_bIsPlatformZip;
extern IPhysicsCollision			*g_pPhysicsCollision;
extern char							g_szSourcePath[];
extern CUtlVector< errorList_t >	g_errorList;

//-----------------------------------------------------------------------------
// MakeTextures.cpp
//-----------------------------------------------------------------------------
bool CreateTargetFile_VTF( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
bool GetPreloadData_VTF( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );

//-----------------------------------------------------------------------------
// MakeScenes.cpp
//-----------------------------------------------------------------------------
bool CreateSceneImageFile( char const *pchModPath, bool bWriteToZip, bool bLittleEndian, bool bQuiet, DiskWriteMode_t eWriteModeForConversions );

//-----------------------------------------------------------------------------
// MakeSounds.cpp
//-----------------------------------------------------------------------------
bool CreateTargetFile_WAV( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
bool CreateTargetFile_MP3( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
bool GetPreloadData_WAV( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );

//-----------------------------------------------------------------------------
// MakeMaps.cpp
//-----------------------------------------------------------------------------
bool CreateTargetFile_BSP( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
bool CreateTargetFile_AIN( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
bool GetDependants_BSP( const char *pBspName, CUtlVector< CUtlString > *pList );

//-----------------------------------------------------------------------------
// MakeResources.cpp
//-----------------------------------------------------------------------------
bool CreateTargetFile_CCDAT( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
bool CreateTargetFile_RESLST( const char *pSourceName, const char *pTargetName, bool bWriteToZip );

//-----------------------------------------------------------------------------
// MakeModels.cpp
//-----------------------------------------------------------------------------
bool InitStudioByteSwap( void );
void ShutdownStudioByteSwap( void );
bool CreateTargetFile_Model( const char *pSourceName, const char *pTargetName, bool bWriteToZip );
bool GetDependants_MDL( const char *pModelName, CUtlVector< CUtlString > *pList );
bool GetPreloadData_VHV( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
bool GetPreloadData_VTX( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
bool GetPreloadData_VVD( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );
bool PreprocessModelFiles( CUtlVector<fileList_t> &fileList );

//-----------------------------------------------------------------------------
// MakeShaders.cpp
//-----------------------------------------------------------------------------
bool GetPreloadData_VCS( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut );

//-----------------------------------------------------------------------------
// MakeMisc.cpp
//-----------------------------------------------------------------------------
bool ProcessDXSupportConfig( bool bWriteToZip );

//-----------------------------------------------------------------------------
// MakeResources.cpp
//-----------------------------------------------------------------------------
bool CreateTargetFile_PCF( const char *pSourceName, const char *pTargetName, bool bWriteToZip );

//-----------------------------------------------------------------------------
// MakeZip.cpp
//-----------------------------------------------------------------------------
void SetupCriticalPreloadScript( const char *pModPath );