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.

44 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: .360.VTF Creation
  4. //
  5. //=====================================================================================//
  6. #include "MakeGameData.h"
  7. #include "vtf/vtf.h"
  8. //-----------------------------------------------------------------------------
  9. // Purpose: Create the 360 VTF, use the library!
  10. //-----------------------------------------------------------------------------
  11. bool CreateTargetFile_VTF( const char *pSourceName, const char *pTargetName, bool bWriteToZip )
  12. {
  13. CUtlBuffer sourceBuffer;
  14. CUtlBuffer targetBuffer;
  15. if ( !scriptlib->ReadFileToBuffer( pSourceName, sourceBuffer ) )
  16. {
  17. return false;
  18. }
  19. // using library conversion routine
  20. bool bSuccess = ConvertVTFTo360Format( pSourceName, sourceBuffer, targetBuffer, CompressCallback );
  21. if ( bSuccess )
  22. {
  23. bSuccess = WriteBufferToFile( pTargetName, targetBuffer, bWriteToZip, g_WriteModeForConversions );
  24. }
  25. return bSuccess;
  26. }
  27. //-----------------------------------------------------------------------------
  28. // Get the preload data for a vtf file
  29. //-----------------------------------------------------------------------------
  30. bool GetPreloadData_VTF( const char *pFilename, CUtlBuffer &fileBufferIn, CUtlBuffer &preloadBufferOut )
  31. {
  32. if ( !GetVTFPreload360Data( pFilename, fileBufferIn, preloadBufferOut ) )
  33. {
  34. Msg( "Can't preload: '%s', has bad version\n", pFilename );
  35. return false;
  36. }
  37. return true;
  38. }