diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /replay/cl_recordingsessionmanager.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'replay/cl_recordingsessionmanager.h')
| -rw-r--r-- | replay/cl_recordingsessionmanager.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/replay/cl_recordingsessionmanager.h b/replay/cl_recordingsessionmanager.h new file mode 100644 index 0000000..b38429b --- /dev/null +++ b/replay/cl_recordingsessionmanager.h @@ -0,0 +1,94 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +//=======================================================================================// + +#ifndef CL_RECORDINGSESSIONMANAGER_H +#define CL_RECORDINGSESSIONMANAGER_H +#ifdef _WIN32 +#pragma once +#endif + +//---------------------------------------------------------------------------------------- + +#include "baserecordingsessionmanager.h" +#include "igameevents.h" +#include "replaysystem.h" +#include "replay/shared_defs.h" + +//---------------------------------------------------------------------------------------- + +// +// Manages and serializes all replay recording session data on the client +// +class CClientRecordingSessionManager : public CBaseRecordingSessionManager, + public IGameEventListener2 +{ + typedef CBaseRecordingSessionManager BaseClass; + +public: + CClientRecordingSessionManager( IReplayContext *pContext ); + ~CClientRecordingSessionManager(); + + virtual bool Init(); + + void CleanupUnneededBlocks(); + + virtual CBaseRecordingSession *OnSessionStart( int nCurrentRecordingStartTick, const char *pSessionName ); + virtual void OnSessionEnd(); + + void ClearServerRecordingState() { m_ServerRecordingState.Clear(); } + void OnReplayDeleted( CReplay *pReplay ); + void OnReplaysLoaded(); + + // + // CGenericPersistentManager + // + virtual CBaseRecordingSession *Create(); + + struct ServerRecordingState_t + { + ServerRecordingState_t() { Clear(); } + void Clear() { m_strSessionName = ""; m_nDumpInterval = m_nCurrentBlock = m_nStartTick = 0; } + + CUtlString m_strSessionName; // Name of current recording session + int m_nDumpInterval; // The interval at which the server is dumping partial replays + int m_nCurrentBlock; // Current session block being written to on the server (approximation - may be ahead but never behind) + int m_nStartTick; // The tick on the server when the session began - used to calculate an adjusted spawn tick on the client + + bool IsValid() + { + return !m_strSessionName.IsEmpty() && + m_nDumpInterval >= MIN_SERVER_DUMP_INTERVAL && + m_nDumpInterval <= MAX_SERVER_DUMP_INTERVAL; + } + } + m_ServerRecordingState; + +private: + // + // CGenericPersistentManager + // + virtual int GetVersion() const; + virtual void Think(); + virtual IReplayContext *GetReplayContext() const; + virtual void OnObjLoaded( CBaseRecordingSession *pSession ); + + // + // IRecordingSessionManager + // + virtual const char *GetNewSessionName() const; + virtual void FireGameEvent( IGameEvent *pEvent ); + + void AddEventsForListen(); + void DownloadThink(); + + float m_flNextBlockUpdateTime; + float m_flNextPossibleDownloadTime; + + int m_nNumSessionBlockDownloaders; // TODO: Manage the number of session block downloaders +}; + +//---------------------------------------------------------------------------------------- + + +#endif // CL_RECORDINGSESSIONMANAGER_H |