本文整理汇总了C++中CChoreoScene::SaveToBinaryBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CChoreoScene::SaveToBinaryBuffer方法的具体用法?C++ CChoreoScene::SaveToBinaryBuffer怎么用?C++ CChoreoScene::SaveToBinaryBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChoreoScene
的用法示例。
在下文中一共展示了CChoreoScene::SaveToBinaryBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateTargetFile_VCD
//-----------------------------------------------------------------------------
// Create binary compiled version of VCD. Stores to a dictionary for later
// post processing
//-----------------------------------------------------------------------------
bool CreateTargetFile_VCD( const char *pSourceName, const char *pTargetName, bool bWriteToZip, bool bLittleEndian )
{
CUtlBuffer sourceBuf;
if ( !scriptlib->ReadFileToBuffer( pSourceName, sourceBuf ) )
{
return false;
}
CRC32_t crcSource;
CRC32_Init( &crcSource );
CRC32_ProcessBuffer( &crcSource, sourceBuf.Base(), sourceBuf.TellMaxPut() );
CRC32_Final( &crcSource );
ParseFromMemory( (char *)sourceBuf.Base(), sourceBuf.TellMaxPut() );
CChoreoScene *pChoreoScene = ChoreoLoadScene( pSourceName, NULL, &g_SceneTokenProcessor, Msg );
if ( !pChoreoScene )
{
return false;
}
int iScene = g_SceneFiles.AddToTail();
g_SceneFiles[iScene].fileName.Set( pSourceName );
// Walk all events looking for SPEAK events
CChoreoEvent *pEvent;
for ( int i = 0; i < pChoreoScene->GetNumEvents(); ++i )
{
pEvent = pChoreoScene->GetEvent( i );
FindSoundsInEvent( pEvent, g_SceneFiles[iScene].soundList );
}
// calc duration
g_SceneFiles[iScene].msecs = (unsigned int)( pChoreoScene->FindStopTime() * 1000.0f + 0.5f );
// compile to binary buffer
g_SceneFiles[iScene].compiledBuffer.SetBigEndian( !bLittleEndian );
pChoreoScene->SaveToBinaryBuffer( g_SceneFiles[iScene].compiledBuffer, crcSource, &g_ChoreoStringPool );
unsigned int compressedSize;
unsigned char *pCompressedBuffer = LZMA_Compress( (unsigned char *)g_SceneFiles[iScene].compiledBuffer.Base(), g_SceneFiles[iScene].compiledBuffer.TellMaxPut(), &compressedSize );
if ( pCompressedBuffer )
{
// replace the compiled buffer with the compressed version
g_SceneFiles[iScene].compiledBuffer.Purge();
g_SceneFiles[iScene].compiledBuffer.EnsureCapacity( compressedSize );
g_SceneFiles[iScene].compiledBuffer.Put( pCompressedBuffer, compressedSize );
free( pCompressedBuffer );
}
delete pChoreoScene;
return true;
}