summaryrefslogtreecommitdiff
path: root/utils/xbox/MakeGameData/MakeTextures.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/xbox/MakeGameData/MakeTextures.cpp')
-rw-r--r--utils/xbox/MakeGameData/MakeTextures.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/utils/xbox/MakeGameData/MakeTextures.cpp b/utils/xbox/MakeGameData/MakeTextures.cpp
new file mode 100644
index 0000000..f267367
--- /dev/null
+++ b/utils/xbox/MakeGameData/MakeTextures.cpp
@@ -0,0 +1,45 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: .360.VTF Creation
+//
+//=====================================================================================//
+
+#include "MakeGameData.h"
+#include "vtf/vtf.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: Create the 360 VTF, use the library!
+//-----------------------------------------------------------------------------
+bool CreateTargetFile_VTF( const char *pSourceName, const char *pTargetName, bool bWriteToZip )
+{
+ CUtlBuffer sourceBuffer;
+ CUtlBuffer targetBuffer;
+
+ if ( !scriptlib->ReadFileToBuffer( pSourceName, sourceBuffer ) )
+ {
+ return false;
+ }
+
+ // using library conversion routine
+ bool bSuccess = ConvertVTFTo360Format( pSourceName, sourceBuffer, targetBuffer, CompressCallback );
+ if ( bSuccess )
+ {
+ bSuccess = WriteBufferToFile( pTargetName, targetBuffer, bWriteToZip, g_WriteModeForConversions );
+ }
+
+ return bSuccess;
+}
+
+//-----------------------------------------------------------------------------
+// Get the preload data for a vtf file
+//-----------------------------------------------------------------------------
+bool GetPreloadData_VTF( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut )
+{
+ if ( !GetVTFPreload360Data( pFilename, fileBufferIn, preloadBufferOut ) )
+ {
+ Msg( "Can't preload: '%s', has bad version\n", pFilename );
+ return false;
+ }
+
+ return true;
+} \ No newline at end of file