summaryrefslogtreecommitdiff
path: root/replay/sv_sessioninfopublisher.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /replay/sv_sessioninfopublisher.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'replay/sv_sessioninfopublisher.h')
-rw-r--r--replay/sv_sessioninfopublisher.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/replay/sv_sessioninfopublisher.h b/replay/sv_sessioninfopublisher.h
new file mode 100644
index 0000000..fafb62e
--- /dev/null
+++ b/replay/sv_sessioninfopublisher.h
@@ -0,0 +1,65 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef SV_SESSIONINFOPUBLISHER_H
+#define SV_SESSIONINFOPUBLISHER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "utlbuffer.h"
+#include "sv_filepublish.h"
+#include "replay/replaytime.h"
+#include "sessioninfoheader.h"
+
+//----------------------------------------------------------------------------------------
+
+class CServerRecordingSession;
+class IFilePublisher;
+
+//----------------------------------------------------------------------------------------
+
+class CSessionInfoPublisher : public IPublishCallbackHandler
+{
+public:
+ CSessionInfoPublisher( CServerRecordingSession *pSession );
+ ~CSessionInfoPublisher();
+
+ void Publish();
+ void PublishAllSynchronous();
+
+ bool IsPublishingSessionInfo() const { return m_flSessionInfoPublishTime != 0.0f || m_pFilePublisher; }
+ bool IsDone() const;
+
+ void OnStopRecord( bool bAborting );
+ void AbortPublish();
+ void Think(); // Called explicitly
+
+private:
+ //
+ // IPublishCallback
+ //
+ virtual void OnPublishComplete( const IFilePublisher *pPublisher, void *pUserData );
+ virtual void OnPublishAborted( const IFilePublisher *pPublisher );
+ virtual void AdjustHeader( const IFilePublisher *pPublisher, void *pHeaderData );
+
+ void RefreshSessionInfoBlockData( CUtlBuffer &buf );
+
+ IFilePublisher *m_pFilePublisher;
+ float m_flSessionInfoPublishTime;
+
+ SessionInfoHeader_t m_SessionInfoHeader;
+ int m_itLastCompletedBlockWrittenToBuffer; // The last block written to the buffer that isn't going to change state
+ CUtlBuffer m_bufSessionInfo; // Growable buffer for the session info block data (does not include header)
+
+ CServerRecordingSession *m_pSession;
+
+ bool m_bShouldPublish; // True if we should publish - can be true while already publishing. Means another publish is needed.
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // SV_SESSIONINFOPUBLISHER_H