From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- utils/xbox/MakeGameData/MakeTextures.cpp | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 utils/xbox/MakeGameData/MakeTextures.cpp (limited to 'utils/xbox/MakeGameData/MakeTextures.cpp') 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 -- cgit v1.2.3