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:1250
virtual void Init(class CSnapshotDelta *pSnapshotDelta, class IConsole *pConsole, class IStorage *pStorage)
Definition: demo.cpp:1243
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
bool ScanFile()
Definition: demo.cpp:571
const char * ErrorMessage() const override
Definition: demo.h:177
int m_LastSnapshotDataSize
Definition: demo.h:129
void SetListener(IListener *pListener)
Definition: demo.cpp:501
bool ExtractMap(class IStorage *pStorage)
Definition: demo.cpp:882
int Load(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, int StorageType)
Definition: demo.cpp:797
bool m_Sixup
Definition: demo.h:148
int m_SpeedIndex
Definition: demo.h:116
int SeekTick(ETickOffset TickOffset) override
Definition: demo.cpp:970
unsigned char m_aSnapshot[CSnapshot::MAX_SIZE]
Definition: demo.h:127
void Construct(class CSnapshotDelta *pSnapshotDelta, bool UseVideo)
Definition: demo.cpp:487
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:482
bool IsSixup() const
Definition: demo.h:180
void AdjustSpeedIndex(int Offset) override
Definition: demo.cpp:1043
bool m_UseVideo
Definition: demo.h:132
int Play()
Definition: demo.cpp:946
unsigned char * GetMapData(class IStorage *pStorage)
Definition: demo.cpp:864
CPlaybackInfo m_Info
Definition: demo.h:118
int SeekPercent(float Percent) override
Definition: demo.cpp:958
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:964
unsigned char m_aCompressedSnapshotData[CSnapshot::MAX_SIZE]
Definition: demo.h:119
void SetSpeedIndex(int SpeedIndex) override
Definition: demo.cpp:1036
int Update(bool RealTime=true)
Definition: demo.cpp:1048
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:1031
class IConsole * m_pConsole
Definition: demo.h:109
std::vector< SKeyFrame > m_vKeyFrames
Definition: demo.h:114
void Unpause() override
Definition: demo.cpp:788
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:506
int64_t Time()
Definition: demo.cpp:919
int64_t m_MapOffset
Definition: demo.h:111
void DoTick()
Definition: demo.cpp:629
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:779
void Stop(const char *pErrorMessage="")
Definition: demo.cpp:1089
CMapInfo m_MapInfo
Definition: demo.h:115
CDemoPlayer(class CSnapshotDelta *pSnapshotDelta, bool UseVideo)
Definition: demo.cpp:477
int SetPos(int WantedTick) override
Definition: demo.cpp:995
void GetDemoName(char *pBuffer, size_t BufferSize) const override
Definition: demo.cpp:1116
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:1121
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:53
void Write(int Type, const void *pData, int Size)
Definition: demo.cpp:269
class CSnapshotDelta * m_pSnapshotDelta
Definition: demo.h:30
void WriteTickMarker(int Tick, bool Keyframe)
Definition: demo.cpp:244
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:319
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:363
int m_NumTimelineMarkers
Definition: demo.h:32
int m_FirstTick
Definition: demo.h:27
void RecordMessage(const void *pData, int Size)
Definition: demo.cpp:351
void AddDemoMarker()
Definition: demo.cpp:429
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:59
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
int64_t m_Filepos
Definition: demo.h:100
SKeyFrame(int64_t Filepos, int Tick)
Definition: demo.h:103
int m_Tick
Definition: demo.h:101
@ IO_MAX_PATH_LENGTH
Definition: types.h:43