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/MakeParticles.cpp | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 utils/xbox/MakeGameData/MakeParticles.cpp (limited to 'utils/xbox/MakeGameData/MakeParticles.cpp') diff --git a/utils/xbox/MakeGameData/MakeParticles.cpp b/utils/xbox/MakeGameData/MakeParticles.cpp new file mode 100644 index 0000000..7e6a5f1 --- /dev/null +++ b/utils/xbox/MakeGameData/MakeParticles.cpp @@ -0,0 +1,37 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: .360 file creation of PCF files +// +//=====================================================================================// + +#include "MakeGameData.h" + +bool CreateTargetFile_PCF( const char *pSourceName, const char *pTargetName, bool bWriteToZip ) +{ + DmxHeader_t header; + CDmElement *pRoot; + if ( g_pDataModel->RestoreFromFile( pSourceName, NULL, NULL, &pRoot, CR_DELETE_NEW, &header ) == DMFILEID_INVALID ) + { + Msg( "CreateTargetFile_PCF: Error reading file \"%s\"!\n", pSourceName ); + return false; + } + + const char *pOutFormat = header.formatName; + if ( !g_pDataModel->FindFormatUpdater( pOutFormat ) ) + { + pOutFormat = "dmx"; + } + + CUtlBuffer binaryBuffer; + if ( !g_pDataModel->Serialize( binaryBuffer, "binary", pOutFormat, pRoot->GetHandle() ) ) + { + Msg( "CreateTargetFile_PCF: Error writing buffer\n" ); + return false; + } + + g_pDataModel->RemoveFileId( pRoot->GetFileId() ); + + WriteBufferToFile( pTargetName, binaryBuffer, bWriteToZip, g_WriteModeForConversions ); + + return true; +} -- cgit v1.2.3