Sources/CryGame C++/Solution1/CryGame/XDemoMgr.cpp
//////////////////////////////////////////////////////////////////////////
// Prepares recording of a new demo.

Prepares recording of a new demo.
Prepares recording of a new demo .
bool CXDemoMgr::StartRecord(const char *sFileName, CStream &stm)
{
	Stop();
	m_pFile=fopen(sFileName,"wb+");
	if(m_pFile==NULL)
		return false;
	if(fwrite(DEMOMAGIC1, strlen(DEMOMAGIC1)+1, 1, m_pFile)!=1)
		return false;
	int hd[2] = { DEMOVERSION, (int)stm.GetSize() };
	if(fwrite(&hd, sizeof(hd), 1, m_pFile)!=1)
		return false;	
	if(fwrite(stm.GetPtr(), BITS2BYTES(stm.GetSize()), 1, m_pFile)!=1)
		return false;
	if(fwrite(DEMOMAGIC2, strlen(DEMOMAGIC2)+1, 1,m_pFile)!=1)
		return false;
	return true;
}
bool CXDemoMgr :: StartRecord ( const char * sFileName , CStream & stm ) { Stop ( ) ; m_pFile = fopen ( sFileName , " " ) ; if ( m_pFile == NULL ) return false ; if ( fwrite ( DEMOMAGIC1 , strlen ( DEMOMAGIC1 ) + 1 , 1 , m_pFile ) != 1 ) return false ; int hd [ 2 ] = { DEMOVERSION , ( int ) stm . GetSize ( ) } ; if ( fwrite ( & hd , sizeof ( hd ) , 1 , m_pFile ) != 1 ) return false ; if ( fwrite ( stm . GetPtr ( ) , BITS2BYTES ( stm . GetSize ( ) ) , 1 , m_pFile ) != 1 ) return false ; if ( fwrite ( DEMOMAGIC2 , strlen ( DEMOMAGIC2 ) + 1 , 1 , m_pFile ) != 1 ) return false ; return true ; }
Prepares recording of a new demo.
Prepares recording of a new demo .
// header: string + version	+ savegamesize
 // savegame, has its own header and version
 // header for the network stream part, just as sanity check
