3#ifndef ENGINE_SHARED_DEMO_H
4#define ENGINE_SHARED_DEMO_H
41 void Write(
int Type,
const void *pData,
int Size);
48 int Start(
class IStorage *pStorage,
class IConsole *pConsole,
const char *pFilename,
const char *pNetversion,
const char *pMap,
const SHA256_DIGEST &Sha256,
unsigned MapCrc,
const char *pType,
unsigned MapSize,
unsigned char *pMapData,
IOHANDLE MapFile,
DEMOFUNC_FILTER pfnFilter,
void *pUser);
133#if defined(CONF_VIDEORECORDER)
159 int Load(
class IStorage *pStorage,
class IConsole *pConsole,
const char *pFilename,
int StorageType);
163 void Pause()
override;
165 void Stop(
const char *pErrorMessage =
"");
166 void SetSpeed(
float Speed)
override;
170 int SeekTime(
float Seconds)
override;
172 int SetPos(
int WantedTick)
override;
174 void GetDemoName(
char *pBuffer,
size_t BufferSize)
const override;
179 int Update(
bool RealTime =
true);
195 bool Slice(
const char *pDemo,
const char *pDst,
int StartTick,
int EndTick,
DEMOFUNC_FILTER pfnFilter,
void *pUser)
override;
IConsole * m_pConsole
Definition: demo.h:189
class CSnapshotDelta * m_pSnapshotDelta
Definition: demo.h:191
bool Slice(const char *pDemo, const char *pDst, int StartTick, int EndTick, DEMOFUNC_FILTER pfnFilter, void *pUser) override
Definition: demo.cpp:1230
virtual void Init(class CSnapshotDelta *pSnapshotDelta, class IConsole *pConsole, class IStorage *pStorage)
Definition: demo.cpp:1223
IStorage * m_pStorage
Definition: demo.h:190
virtual void OnDemoPlayerMessage(void *pData, int Size)=0
virtual ~IListener()
Definition: demo.h:69
virtual void OnDemoPlayerSnapshot(void *pData, int Size)=0
long m_MapOffset
Definition: demo.h:111
bool ScanFile()
Definition: demo.cpp:551
const char * ErrorMessage() const override
Definition: demo.h:177
int m_LastSnapshotDataSize
Definition: demo.h:129
void SetListener(IListener *pListener)
Definition: demo.cpp:481
bool ExtractMap(class IStorage *pStorage)
Definition: demo.cpp:862
int Load(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, int StorageType)
Definition: demo.cpp:777
bool m_Sixup
Definition: demo.h:148
int m_SpeedIndex
Definition: demo.h:116
int SeekTick(ETickOffset TickOffset) override
Definition: demo.cpp:950
unsigned char m_aSnapshot[CSnapshot::MAX_SIZE]
Definition: demo.h:127
void Construct(class CSnapshotDelta *pSnapshotDelta, bool UseVideo)
Definition: demo.cpp:467
IListener * m_pListener
Definition: demo.h:93
const char * Filename() const
Definition: demo.h:176
IOHANDLE m_File
Definition: demo.h:110
bool IsPlaying() const override
Definition: demo.h:183
EReadChunkHeaderResult
Definition: demo.h:138
@ CHUNKHEADER_SUCCESS
Definition: demo.h:139
@ CHUNKHEADER_ERROR
Definition: demo.h:140
@ CHUNKHEADER_EOF
Definition: demo.h:141
~CDemoPlayer() override
Definition: demo.cpp:462
bool IsSixup() const
Definition: demo.h:180
void AdjustSpeedIndex(int Offset) override
Definition: demo.cpp:1023
bool m_UseVideo
Definition: demo.h:132
int Play()
Definition: demo.cpp:926
unsigned char * GetMapData(class IStorage *pStorage)
Definition: demo.cpp:844
CPlaybackInfo m_Info
Definition: demo.h:118
int SeekPercent(float Percent) override
Definition: demo.cpp:938
char m_aFilename[IO_MAX_PATH_LENGTH]
Definition: demo.h:112
class CSnapshotDelta * m_pSnapshotDelta
Definition: demo.h:130
int SeekTime(float Seconds) override
Definition: demo.cpp:944
unsigned char m_aCompressedSnapshotData[CSnapshot::MAX_SIZE]
Definition: demo.h:119
void SetSpeedIndex(int SpeedIndex) override
Definition: demo.cpp:1016
int Update(bool RealTime=true)
Definition: demo.cpp:1028
const CMapInfo * GetMapInfo() const
Definition: demo.h:184
const CInfo * BaseInfo() const override
Definition: demo.h:173
bool m_WasRecording
Definition: demo.h:134
const CPlaybackInfo * Info() const
Definition: demo.h:182
void SetSpeed(float Speed) override
Definition: demo.cpp:1011
class IConsole * m_pConsole
Definition: demo.h:109
std::vector< SKeyFrame > m_vKeyFrames
Definition: demo.h:114
void Unpause() override
Definition: demo.cpp:768
unsigned char m_aDecompressedSnapshotData[CSnapshot::MAX_SIZE]
Definition: demo.h:120
char m_aErrorMessage[256]
Definition: demo.h:113
EReadChunkHeaderResult ReadChunkHeader(int *pType, int *pSize, int *pTick)
Definition: demo.cpp:486
int64_t Time()
Definition: demo.cpp:899
void DoTick()
Definition: demo.cpp:609
unsigned char m_aChunkData[CSnapshot::MAX_SIZE]
Definition: demo.h:124
unsigned char m_aLastSnapshotData[CSnapshot::MAX_SIZE]
Definition: demo.h:128
void Pause() override
Definition: demo.cpp:759
void Stop(const char *pErrorMessage="")
Definition: demo.cpp:1069
CMapInfo m_MapInfo
Definition: demo.h:115
CDemoPlayer(class CSnapshotDelta *pSnapshotDelta, bool UseVideo)
Definition: demo.cpp:457
int SetPos(int WantedTick) override
Definition: demo.cpp:975
void GetDemoName(char *pBuffer, size_t BufferSize) const override
Definition: demo.cpp:1096
TUpdateIntraTimesFunc m_UpdateIntraTimesFunc
Definition: demo.h:95
bool GetDemoInfo(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, int StorageType, CDemoHeader *pDemoHeader, CTimelineMarkers *pTimelineMarkers, CMapInfo *pMapInfo, IOHANDLE *pFile=nullptr, char *pErrorMessage=nullptr, size_t ErrorMessageSize=0) const override
Definition: demo.cpp:1101
int m_LastKeyFrame
Definition: demo.h:26
bool IsRecording() const override
Definition: demo.h:57
class IConsole * m_pConsole
Definition: demo.h:20
~CDemoRecorder() override
Definition: demo.cpp:55
void Write(int Type, const void *pData, int Size)
Definition: demo.cpp:249
class CSnapshotDelta * m_pSnapshotDelta
Definition: demo.h:30
void WriteTickMarker(int Tick, bool Keyframe)
Definition: demo.cpp:224
char m_aCurrentFilename[IO_MAX_PATH_LENGTH]
Definition: demo.h:24
int Length() const override
Definition: demo.h:60
void RecordSnapshot(int Tick, const void *pData, int Size)
Definition: demo.cpp:299
class IStorage * m_pStorage
Definition: demo.h:21
bool m_NoMapData
Definition: demo.h:35
IOHANDLE m_File
Definition: demo.h:23
int m_LastTickMarker
Definition: demo.h:25
int Stop(IDemoRecorder::EStopMode Mode, const char *pTargetFilename="") override
Definition: demo.cpp:343
int m_NumTimelineMarkers
Definition: demo.h:32
int m_FirstTick
Definition: demo.h:27
void RecordMessage(const void *pData, int Size)
Definition: demo.cpp:331
void AddDemoMarker()
Definition: demo.cpp:409
CDemoRecorder()
Definition: demo.h:45
DEMOFUNC_FILTER m_pfnFilter
Definition: demo.h:37
int m_aTimelineMarkers[MAX_TIMELINE_MARKERS]
Definition: demo.h:33
const char * CurrentFilename() const override
Definition: demo.h:58
unsigned char m_aLastSnapshotData[CSnapshot::MAX_SIZE]
Definition: demo.h:29
void * m_pUser
Definition: demo.h:38
int Start(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, const char *pNetversion, const char *pMap, const SHA256_DIGEST &Sha256, unsigned MapCrc, const char *pType, unsigned MapSize, unsigned char *pMapData, IOHANDLE MapFile, DEMOFUNC_FILTER pfnFilter, void *pUser)
Definition: demo.cpp:61
Definition: snapshot.h:74
@ MAX_SIZE
Definition: snapshot.h:52
ETickOffset
Definition: demo.h:78
EStopMode
Definition: demo.h:106
bool(* DEMOFUNC_FILTER)(const void *pData, int DataSize, void *pUser)
Definition: demo.h:23
@ MAX_TIMELINE_MARKERS
Definition: demo.h:15
@ SERVER_TICK_SPEED
Definition: protocol.h:80
void * IOHANDLE
Definition: logger.h:11
std::function< void()> TUpdateIntraTimesFunc
Definition: demo.h:16
CTimelineMarkers m_TimelineMarkers
Definition: demo.h:77
float m_IntraTickSincePrev
Definition: demo.h:88
CDemoHeader m_Header
Definition: demo.h:76
float m_IntraTick
Definition: demo.h:87
IDemoPlayer::CInfo m_Info
Definition: demo.h:79
int64_t m_CurrentTime
Definition: demo.h:82
int64_t m_LastUpdate
Definition: demo.h:81
int m_NextTick
Definition: demo.h:84
int m_PreviousTick
Definition: demo.h:85
float m_TickTime
Definition: demo.h:89
long m_Filepos
Definition: demo.h:100
int m_Tick
Definition: demo.h:101
SKeyFrame(long Filepos, int Tick)
Definition: demo.h:103
@ IO_MAX_PATH_LENGTH
Definition: types.h:43