hl2_src-leak-2017/src/engine/demofile.h
BotoX 60f625f414 import hl2_src from full.7z
source: magnet:?xt=urn:btih:21DDA6847DDE983F2F8063739249D2D1D09A5DDA
2020-12-25 16:26:23 +01:00

89 lines
2.4 KiB
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//===========================================================================//
#ifndef DEMOFILE_H
#define DEMOFILE_H
#ifdef _WIN32
#pragma once
#endif
#define DEMO_FILE_UTLBUFFER 1
#define DEMO_FILE_MAX_STRINGTABLE_SIZE 5000000 // 5 mb
#include "demo.h"
#ifdef DEMO_FILE_UTLBUFFER
#include "tier2/utlstreambuffer.h"
#else
#include <filesystem.h>
#endif
#include "tier1/bitbuf.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class IDemoBuffer;
//-----------------------------------------------------------------------------
// Demo file
//-----------------------------------------------------------------------------
class CDemoFile
{
public:
CDemoFile();
~CDemoFile();
bool Open(const char *name, bool bReadOnly, bool bMemoryBuffer = false, int nBufferSize = 0, bool bAllowHeaderWrite = true);
bool IsOpen();
void Close();
void SeekTo( int position, bool bRead );
unsigned int GetCurPos( bool bRead );
int GetSize();
void WriteRawData( const char *buffer, int length );
int ReadRawData( char *buffer, int length );
void WriteSequenceInfo(int nSeqNrIn, int nSeqNrOutAck);
void ReadSequenceInfo(int &nSeqNrIn, int &nSeqNrOutAck);
void WriteCmdInfo( democmdinfo_t& info );
void ReadCmdInfo( democmdinfo_t& info );
void WriteCmdHeader( unsigned char cmd, int tick );
void ReadCmdHeader( unsigned char& cmd, int& tick );
void WriteConsoleCommand( const char *cmd, int tick );
const char *ReadConsoleCommand( void );
void WriteNetworkDataTables( bf_write *buf, int tick );
int ReadNetworkDataTables( bf_read *buf );
void WriteStringTables( bf_write *buf, int tick );
int ReadStringTables( bf_read *buf );
void WriteUserCmd( int cmdnumber, const char *buffer, unsigned char bytes, int tick );
int ReadUserCmd( char *buffer, int &size );
void WriteDemoHeader();
demoheader_t *ReadDemoHeader();
void WriteFileBytes( FileHandle_t fh, int length );
// Returns the PROTOCOL_VERSION used when .dem was recorded
int GetProtocolVersion();
public:
char m_szFileName[MAX_PATH]; //name of current demo file
demoheader_t m_DemoHeader; //general demo info
CUtlBuffer *m_pBuffer;
bool m_bAllowHeaderWrite;
bool m_bIsStreamBuffer;
};
#endif // DEMOFILE_H