diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/common/replay | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/common/replay')
44 files changed, 2152 insertions, 0 deletions
diff --git a/mp/src/common/replay/basereplayserializeable.h b/mp/src/common/replay/basereplayserializeable.h new file mode 100644 index 00000000..d30da7e2 --- /dev/null +++ b/mp/src/common/replay/basereplayserializeable.h @@ -0,0 +1,43 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef REPLAYSERIALIIZEABLE_H
+#define REPLAYSERIALIIZEABLE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "replay/ireplayserializeable.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+class CBaseReplaySerializeable : public IReplaySerializeable
+{
+public:
+ CBaseReplaySerializeable();
+
+ virtual void SetHandle( ReplayHandle_t h );
+ virtual ReplayHandle_t GetHandle() const;
+ virtual bool Read( KeyValues *pIn );
+ virtual void Write( KeyValues *pOut );
+ virtual const char *GetFilename() const;
+ virtual const char *GetFullFilename() const;
+ virtual const char *GetDebugName() const;
+ virtual void SetLocked( bool bLocked );
+ virtual bool IsLocked() const;
+ virtual void OnDelete();
+ virtual void OnUnload();
+ virtual void OnAddedToDirtyList();
+
+private:
+ ReplayHandle_t m_hThis;
+ bool m_bLocked;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // REPLAYSERIALIIZEABLE_H
\ No newline at end of file diff --git a/mp/src/common/replay/iclientreplay.h b/mp/src/common/replay/iclientreplay.h new file mode 100644 index 00000000..31362f4e --- /dev/null +++ b/mp/src/common/replay/iclientreplay.h @@ -0,0 +1,64 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef ICLIENTREPLAY_H
+#define ICLIENTREPLAY_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+#define CLIENT_REPLAY_INTERFACE_VERSION "ClientReplay001"
+
+//----------------------------------------------------------------------------------------
+
+class IReplayFactory;
+class IReplayScreenshotSystem;
+class IReplayPerformancePlaybackHandler;
+class KeyValues;
+class IReplayCamera;
+class CReplayPerformance;
+struct RenderMovieParams_t;
+class IGameEvent;
+
+//----------------------------------------------------------------------------------------
+
+//
+// Allows the replay and engine DLL's to talk to the client.
+//
+class IClientReplay : public IBaseInterface
+{
+public:
+ virtual uint64 GetServerSessionId() = 0;
+ virtual bool CacheReplayRagdolls( const char* pFilename, int nStartTick ) = 0; // Cache replay ragdolls
+ virtual IReplayScreenshotSystem *GetReplayScreenshotSystem() = 0; // Get the client's replay screenshot system
+ virtual IReplayPerformancePlaybackHandler *GetPerformancePlaybackHandler() = 0;
+ virtual IReplayCamera *GetReplayCamera() = 0;
+ virtual void DisplayReplayMessage( const char *pLocalizeStr, bool bUrgent, bool bDlg, const char *pSound ) = 0;
+ virtual void DisplayReplayMessage( const wchar_t *pText, bool bUrgent, bool bDlg, const char *pSound ) = 0;
+ virtual void InitPerformanceEditor( ReplayHandle_t hReplay ) = 0;
+ virtual void HidePerformanceEditor() = 0;
+ virtual bool ShouldRender() = 0;
+ virtual void PlaySound( const char *pSound ) = 0;
+ virtual void UploadOgsData( KeyValues *pData, bool bIncludeTimeField ) = 0;
+ virtual bool ShouldCompletePendingReplay( IGameEvent *pEvent ) = 0;
+
+ virtual void OnSaveReplay( ReplayHandle_t hNewReplay, bool bShowInputDlg ) = 0;
+ virtual void OnDeleteReplay( ReplayHandle_t hReplay ) = 0; // Called before replay is actually removed from the replay manager
+ virtual void OnPlaybackComplete( ReplayHandle_t hReplay, int iPerformance ) = 0;
+ virtual void OnRenderStart() = 0;
+ virtual void OnRenderComplete( const RenderMovieParams_t &RenderParams, bool bCancelled, bool bSuccess, bool bShowBrowser ) = 0;
+ virtual bool OnConfirmQuit() = 0;
+ virtual bool OnEndOfReplayReached() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // ICLIENTREPLAY_H
\ No newline at end of file diff --git a/mp/src/common/replay/iclientreplaycontext.h b/mp/src/common/replay/iclientreplaycontext.h new file mode 100644 index 00000000..bdafa15e --- /dev/null +++ b/mp/src/common/replay/iclientreplaycontext.h @@ -0,0 +1,58 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef ICLIENTREPLAYCONTEXT_H
+#define ICLIENTREPLAYCONTEXT_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "replay/ireplaycontext.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+#define REPLAYHISTORYMANAGER_INTERFACE_VERSION_CLIENT "VENGINE_CLIENT_REPLAY_HISTORY_MANAGER_001"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+class CReplayPerformance;
+class IReplayManager;
+class IReplayMovieManager;
+class IReplayMovieRenderer;
+class IReplayScreenshotManager;
+class IReplayPerformanceManager;
+class IReplayPerformanceController;
+class IReplayRenderQueue;
+
+//----------------------------------------------------------------------------------------
+
+class IClientReplayContext : public IReplayContext
+{
+public:
+ virtual CReplay *GetReplay( ReplayHandle_t hReplay ) = 0; // Shorthand to GetReplayManager()->GetReplay()
+ virtual IReplayManager *GetReplayManager() = 0;
+ virtual IReplayMovieRenderer *GetMovieRenderer() = 0;
+ virtual IReplayMovieManager *GetMovieManager() = 0;
+ virtual IReplayScreenshotManager *GetScreenshotManager() = 0;
+ virtual IReplayPerformanceManager *GetPerformanceManager() = 0;
+ virtual IReplayPerformanceController *GetPerformanceController() = 0;
+ virtual IReplayRenderQueue *GetRenderQueue() = 0;
+ virtual void SetMovieRenderer( IReplayMovieRenderer *pRenderer ) = 0; // Set to be the panel that renders replay movies, or NULL when nothing is rendering
+ virtual void OnSignonStateFull() = 0;
+ virtual void OnClientSideDisconnect() = 0; // Called when client disconnects
+ virtual void PlayReplay( ReplayHandle_t hReplay, int iPerformance, bool bPlaySound ) = 0; // Play the given replay, from spawn tick to death tick
+ virtual bool ReconstructReplayIfNecessary( CReplay *pReplay ) = 0;
+ virtual void OnPlayerSpawn() = 0; // Called on the client when player is spawned
+ virtual void OnPlayerClassChanged() = 0; // Called when the player's class changes - we use this instead of an event for immediacy
+ virtual void GetPlaybackTimes( float &flOutTime, float &flOutLength, const CReplay *pReplay, const CReplayPerformance *pPerformance ) = 0; // Calculate the current time and length of a replay or performance - takes in tick and out tick into account for performances - flCurTime should be gpGlobals->curtime. pPerformance can be NULL.
+ virtual uint64 GetServerSessionId( ReplayHandle_t hReplay ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // ICLIENTREPLAYCONTEXT_H
diff --git a/mp/src/common/replay/iclientreplayhistorymanager.h b/mp/src/common/replay/iclientreplayhistorymanager.h new file mode 100644 index 00000000..6eb3f9eb --- /dev/null +++ b/mp/src/common/replay/iclientreplayhistorymanager.h @@ -0,0 +1,104 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef ICLIENTREPLAYHISTORYMANAGER_H
+#define ICLIENTREPLAYHISTORYMANAGER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "replay/replayhandle.h"
+#include "replay/screenshot.h"
+#include "interface.h"
+#include "qlimits.h"
+#include "convar.h"
+#include "engine/http.h"
+#include "tier1/utllinkedlist.h"
+#include "tier1/checksum_crc.h"
+#include <time.h>
+
+//----------------------------------------------------------------------------------------
+
+class IReplayDownloadGroup;
+class IReplayDownloadGroupHelper;
+class CDmxElement;
+class KeyValues;
+struct CaptureScreenshotParams_t;
+struct RenderMovieParams_t;
+class CBaseReplay;
+class CReplay;
+class IReplayMovieRenderer;
+class IReplayMovieManager;
+class IReplayMovie;
+class IReplayPerformanceManager;
+class IGameEvent;
+
+//----------------------------------------------------------------------------------------
+
+class IClientReplayHistoryManager : public IBaseInterface
+{
+public:
+ virtual bool Init( CreateInterfaceFn fnCreateFactory ) = 0;
+ virtual void Shutdown() = 0;
+ virtual void Think() = 0;
+
+ virtual bool IsInitialized() const = 0;
+ virtual bool Commit( CBaseReplay *pNewReplay ) = 0;
+
+ virtual void Save() = 0; // Write the entire index and any replays/groups/movies that are marked as dirty
+ virtual void FlagReplayForFlush( CBaseReplay *pReplay, bool bForceImmediateWrite ) = 0; // Mark the given replay as dirty - flush to disk at the next opportunity (see CBaseReplayHistoryManager::FlushThink())
+
+ virtual void Nuke() = 0;
+
+ virtual void DeleteReplay( ReplayHandle_t hReplay, bool bNotifyUI ) = 0;
+ virtual CBaseReplay *GetReplay( ReplayHandle_t hReplay ) = 0;
+
+ virtual const char *GetBaseDirectory() = 0; // Returns full directory to wherever replays.dmx lives, e.g. c:\program files (x86)\steam\steamapps\someuser\team fortress 2\game\tf\replays\client\ (or server\) - NOTE: includes trailing slash
+ virtual const char *GetReplaysSubDir() = 0; // Returns "client" or "server"
+
+ // For loop through all replays - indices should not be cached
+ virtual int GetReplayCount() const = 0;
+// virtual CBaseReplay *GetReplayAtIndex( int nIndex ) = 0;
+
+ virtual const char *GetFullReplayPath() = 0; // Get c:\...\game\tf\replays\<client or server>\
+
+ // Client-specific
+ virtual int GetAdjustedDeathTick( CReplay *pReplay ) = 0;
+ virtual void FlagDownloadGroupForFlush( IReplayDownloadGroup *pGroup, bool bForceImmediate ) = 0;
+ virtual void FlagMovieForFlush( IReplayMovie *pMovie, bool bForceImmediate ) = 0; // Flag the movie for flush - if pMovie is NULL, mark the index for flush
+ virtual void SetMovieRenderer( IReplayMovieRenderer *pRenderer ) = 0; // Set to be the panel that renders replay movies, or NULL when nothing is rendering
+ virtual bool ShouldGameRenderView() = 0; // Called from V_RenderView() to determine whether the game should render - used during movie rendering
+ virtual int GetUnrenderedReplayCount() = 0; // Get the number of unrendered replays
+ virtual void UpdateCurrentReplayDataFromServer() = 0; // Updates start tick, current file url, demo filename
+ virtual void LinkReplayToDownloadGroup() = 0;
+ virtual void CaptureScreenshot( CaptureScreenshotParams_t ¶ms ) = 0; // Schedules a screenshot capture at flDelay seconds in the future
+ virtual void DoCaptureScreenshot() = 0; // Takes the screenshot right now
+ virtual bool ShouldCaptureScreenshot() = 0; // Is screenshot scheduled to be taken right now?
+ virtual void GetUnpaddedScreenshotSize( int &nWidth, int &nHeight ) = 0; // Get the dimensions for a screenshot if we take one right now, based on replay_screenshotresolution and the current aspect ratio
+ virtual void DeleteScreenshotsForReplay( CReplay *pReplay ) = 0; // Deletes all screenshots associated with the given replay
+ virtual void PlayReplay( ReplayHandle_t hReplay ) = 0; // Play the given replay, from spawn tick to death tick
+ virtual void RenderMovie( RenderMovieParams_t const& params ) = 0; // Renders the given replay - or if params.hReplay is -1, render all unrendered replays
+ virtual void CompleteRender( bool bSuccess ) = 0;
+ virtual void OnClientSideDisconnect() = 0; // Called when client disconnects
+ virtual void OnSignonStateFull() = 0;
+ virtual void OnPlayerSpawn() = 0; // Called on the client when player is spawned
+ virtual void OnPlayerClassChanged() = 0; // Called when the player's class changes - we use this instead of an event for immediacy
+ virtual void OnReplayRecordingCvarChanged() = 0; // Called (on client only) when replay_recording is set to 1
+ virtual void OnGroupDeleted() = 0;
+ virtual CReplay *GetPlayingReplay() = 0; // Get the currently playing replay, otherwise NULL if one isn't playing
+ virtual CReplay *GetReplayForCurrentLife() = 0; // Gets the current replay (constant from local player spawn until next spawn/disconnect/exit)
+ virtual bool IsRendering() = 0; // Are we currently rendering a movie?
+ virtual void CancelRender() = 0; // If we're currently rendering, cancel
+ virtual IReplayMovieManager *GetMovieManager() = 0;
+ virtual IReplayMovieRenderer *GetMovieRenderer() = 0;
+ virtual const RenderMovieParams_t *GetRenderSettings() = 0;
+ virtual IReplayDownloadGroupHelper *GetDownloadGroupHelper() = 0;
+ virtual IReplayPerformanceManager *GetPerformanceManager() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // ICLIENTREPLAYHISTORYMANAGER_H
diff --git a/mp/src/common/replay/ienginereplay.h b/mp/src/common/replay/ienginereplay.h new file mode 100644 index 00000000..90de4d3b --- /dev/null +++ b/mp/src/common/replay/ienginereplay.h @@ -0,0 +1,116 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IENGINEREPLAY_H
+#define IENGINEREPLAY_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+#define ENGINE_REPLAY_INTERFACE_VERSION "EngineReplay001"
+
+#if !defined( DEDICATED )
+# define ENGINE_REPLAY_CLIENT_INTERFACE_VERSION "EngineClientReplay001"
+#endif
+
+//----------------------------------------------------------------------------------------
+
+class IServer;
+class INetChannel;
+class IReplayServer;
+class IClientEntityList;
+class IClientReplay;
+struct demoheader_t;
+class CGlobalVarsBase;
+class IDemoBuffer;
+class CBaseRecordingSessionBlock;
+
+//----------------------------------------------------------------------------------------
+
+//
+// Allows the replay, client & server DLL's to talk to the engine
+//
+class IEngineReplay : public IBaseInterface
+{
+public:
+ virtual bool IsSupportedModAndPlatform() = 0;
+
+ virtual float GetHostTime() = 0;
+ virtual int GetHostTickCount() = 0;
+ virtual int TimeToTicks( float flTime ) = 0;
+ virtual float TicksToTime( int nTick ) = 0;
+
+ virtual bool ReadDemoHeader( const char *pFilename, demoheader_t &header ) = 0;
+ virtual const char *GetGameDir() = 0;
+ virtual void Cbuf_AddText( const char *pCmd ) = 0;
+ virtual void Cbuf_Execute() = 0;
+ virtual void Host_Disconnect( bool bShowMainMenu ) = 0;
+ virtual void HostState_Shutdown() = 0;
+ virtual const char *GetModDir() = 0;
+
+ virtual bool CopyFile( const char *pSource, const char *pDest ) = 0;
+
+ virtual bool LZSS_Compress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
+ virtual bool LZSS_Decompress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
+
+ virtual bool MD5_HashBuffer( unsigned char pDigest[16], const unsigned char *pBuffer, int nSize, unsigned int pSeed[4] ) = 0;
+
+ // Server-specific
+ virtual IReplayServer *GetReplayServer() = 0;
+ virtual IServer *GetReplayServerAsIServer() = 0;
+ virtual IServer *GetGameServer() = 0;
+ virtual bool GetSessionRecordBuffer( uint8 **ppSessionBuffer, int *pSize ) = 0;
+ virtual bool IsDedicated() = 0;
+ virtual void ResetReplayRecordBuffer() = 0;
+ virtual demoheader_t *GetReplayDemoHeader() = 0;
+ virtual void RecalculateTags() = 0;
+ virtual bool NET_GetHostnameAsIP( const char *pHostname, char *pOut, int nOutSize ) = 0;
+};
+
+//
+// Allows the replay and client DLL's to talk to the engine
+//
+#if !defined( DEDICATED )
+class IEngineClientReplay : public IBaseInterface
+{
+public:
+ virtual INetChannel *GetNetChannel() = 0;
+ virtual bool IsConnected() = 0;
+ virtual bool IsListenServer() = 0;
+ virtual float GetLastServerTickTime() = 0;
+ virtual const char *GetLevelName() = 0;
+ virtual const char *GetLevelNameShort() = 0;
+ virtual int GetPlayerSlot() = 0;
+ virtual bool IsPlayingReplayDemo() = 0;
+ virtual IClientEntityList *GetClientEntityList() = 0;
+ virtual IClientReplay *GetClientReplayInt() = 0;
+ virtual uint32 GetClientSteamID() = 0;
+ virtual void Con_NPrintf( int nPos, PRINTF_FORMAT_STRING const char *pFormat, ... ) = 0;
+ virtual CGlobalVarsBase *GetClientGlobalVars() = 0;
+ virtual void VGui_PlaySound( const char *pSound ) = 0;
+ virtual void EngineVGui_ConfirmQuit() = 0;
+ virtual int GetScreenWidth() = 0;
+ virtual int GetScreenHeight() = 0;
+ virtual bool IsDemoPlayingBack() = 0;
+ virtual bool IsGamePathValidAndSafeForDownload( const char *pGamePath ) = 0;
+ virtual bool IsInGame() = 0;
+
+ virtual void InitSoundRecord() = 0;
+
+ virtual void Wave_CreateTmpFile( const char *pFilename ) = 0;
+ virtual void Wave_AppendTmpFile( const char *pFilename, void *pBuffer, int nNumSamples ) = 0;
+ virtual void Wave_FixupTmpFile( const char *pFilename ) = 0;
+
+};
+#endif // !defined( DEDICATED )
+
+//----------------------------------------------------------------------------------------
+
+#endif // IENGINEREPLAY_H
\ No newline at end of file diff --git a/mp/src/common/replay/iqueryablereplayitem.h b/mp/src/common/replay/iqueryablereplayitem.h new file mode 100644 index 00000000..dbf05c13 --- /dev/null +++ b/mp/src/common/replay/iqueryablereplayitem.h @@ -0,0 +1,46 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IQUERYABLEREPLAYITEM_H
+#define IQUERYABLEREPLAYITEM_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "iqueryablereplayitem.h"
+#include "replay/replayhandle.h"
+#include "replay/replaytime.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+
+//----------------------------------------------------------------------------------------
+
+typedef int QueryableReplayItemHandle_t;
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IQueryableReplayItem : public IBaseInterface
+{
+public:
+ virtual const CReplayTime &GetItemDate() const = 0;
+ virtual bool IsItemRendered() const = 0;
+ virtual CReplay *GetItemReplay() = 0;
+ virtual ReplayHandle_t GetItemReplayHandle() const = 0;
+ virtual QueryableReplayItemHandle_t GetItemHandle() const = 0; // Get the handle of this item
+ virtual const wchar_t *GetItemTitle() const = 0;
+ virtual void SetItemTitle( const wchar_t *pTitle ) = 0;
+ virtual float GetItemLength() const = 0;
+ virtual void *GetUserData() = 0;
+ virtual void SetUserData( void *pUserData ) = 0;
+ virtual bool IsItemAMovie() const = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IQUERYABLEREPLAYITEM_H
\ No newline at end of file diff --git a/mp/src/common/replay/irecordingsession.h b/mp/src/common/replay/irecordingsession.h new file mode 100644 index 00000000..a8c739ef --- /dev/null +++ b/mp/src/common/replay/irecordingsession.h @@ -0,0 +1,27 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IRECORDINGSESSION_H
+#define IRECORDINGSESSION_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class CBaseRecordingSessionBlock;
+
+class IRecordingSession : public IBaseInterface
+{
+public:
+ virtual void AddBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IRECORDINGSESSION_H
diff --git a/mp/src/common/replay/irecordingsessionblockmanager.h b/mp/src/common/replay/irecordingsessionblockmanager.h new file mode 100644 index 00000000..6b2262fb --- /dev/null +++ b/mp/src/common/replay/irecordingsessionblockmanager.h @@ -0,0 +1,30 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IRECORDINGSESSIONBLOCKMANAGER_H
+#define IRECORDINGSESSIONBLOCKMANAGER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+class IRecordingSessionBlockManager : public IBaseInterface
+{
+public:
+ virtual CBaseRecordingSessionBlock *GetBlock( ReplayHandle_t hBlock ) = 0;
+ virtual void DeleteBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
+ virtual void UnloadBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
+ virtual const char *GetBlockPath() const = 0;
+ virtual void LoadBlockFromFileName( const char *pFilename, IRecordingSession *pSession ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IRECORDINGSESSIONBLOCKMANAGER_H
diff --git a/mp/src/common/replay/irecordingsessionmanager.h b/mp/src/common/replay/irecordingsessionmanager.h new file mode 100644 index 00000000..998f1956 --- /dev/null +++ b/mp/src/common/replay/irecordingsessionmanager.h @@ -0,0 +1,33 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IRECORDINGSESSIONMANAGER_H
+#define IRECORDINGSESSIONMANAGER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+class CBaseRecordingSession;
+
+//----------------------------------------------------------------------------------------
+
+class IRecordingSessionManager : public IBaseInterface
+{
+public:
+ virtual CBaseRecordingSession *FindSession( ReplayHandle_t hSession ) = 0;
+ virtual const CBaseRecordingSession *FindSession( ReplayHandle_t hSession ) const = 0;
+ virtual void FlagSessionForFlush( CBaseRecordingSession *pSession, bool bForceImmediate ) = 0;
+ virtual int GetServerStartTickForSession( ReplayHandle_t hSession ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IRECORDINGSESSIONMANAGER_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplaycamera.h b/mp/src/common/replay/ireplaycamera.h new file mode 100644 index 00000000..0e07be15 --- /dev/null +++ b/mp/src/common/replay/ireplaycamera.h @@ -0,0 +1,25 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//----------------------------------------------------------------------------------------
+
+#ifndef IREPLAYCAMERA_H
+#define IREPLAYCAMERA_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IReplayCamera : public IBaseInterface
+{
+public:
+ virtual void ClearOverrideView() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYCAMERA_H
diff --git a/mp/src/common/replay/ireplaycontext.h b/mp/src/common/replay/ireplaycontext.h new file mode 100644 index 00000000..34430ab9 --- /dev/null +++ b/mp/src/common/replay/ireplaycontext.h @@ -0,0 +1,47 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYCONTEXT_H
+#define IREPLAYCONTEXT_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+class IRecordingSessionManager;
+class IRecordingSessionBlockManager;
+class IRecordingSession;
+class IReplayErrorSystem;
+
+//----------------------------------------------------------------------------------------
+
+class IReplayContext : public IBaseInterface
+{
+public:
+ virtual bool Init( CreateInterfaceFn fnCreateFactory ) = 0;
+ virtual void Shutdown() = 0;
+
+ virtual void Think() = 0;
+
+ virtual bool IsInitialized() const = 0;
+
+ virtual const char *GetRelativeBaseDir() const = 0; // Returns path to wherever the index .dmx lives relative to the game path, e.g. "replay\client\"
+ virtual const char *GetBaseDir() const = 0; // Returns full directory to wherever the index .dmx lives, e.g. c:\program files (x86)\steam\steamapps\<username>\team fortress 2\tf\replays\<client|server>\ -- NOTE: includes trailing slash
+ virtual const char *GetReplaySubDir() const = 0; // Returns "client" or "server"
+
+ virtual IReplayErrorSystem *GetErrorSystem() = 0;
+ virtual IRecordingSessionManager *GetRecordingSessionManager() = 0;
+ virtual IRecordingSessionBlockManager *GetRecordingSessionBlockManager() = 0;
+ virtual IRecordingSession *GetRecordingSession( ReplayHandle_t hSession ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYCONTEXT_H
diff --git a/mp/src/common/replay/ireplaydemoplayer.h b/mp/src/common/replay/ireplaydemoplayer.h new file mode 100644 index 00000000..ddd7b6de --- /dev/null +++ b/mp/src/common/replay/ireplaydemoplayer.h @@ -0,0 +1,42 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYDEMOPLAYER_H
+#define IREPLAYDEMOPLAYER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/replay.h"
+
+//----------------------------------------------------------------------------------------
+
+#define INTERFACEVERSION_REPLAYDEMOPLAYER "ReplayDemoPlayer001"
+
+//----------------------------------------------------------------------------------------
+
+//
+// Interface for replay demo player
+//
+class IReplayDemoPlayer : public IBaseInterface
+{
+public:
+ virtual void PlayReplay( ReplayHandle_t hReplay, int iPerformance ) = 0;
+ virtual void PlayNextReplay() = 0;
+ virtual void ClearReplayList() = 0;
+ virtual void AddReplayToList( ReplayHandle_t hReplay, int iPerformance ) = 0;
+ virtual CReplay *GetCurrentReplay() = 0;
+ virtual CReplayPerformance *GetCurrentPerformance() = 0; // The playing replay, or NULL if playing the original replay
+ virtual void PauseReplay() = 0;
+ virtual bool IsReplayPaused() = 0;
+ virtual void ResumeReplay() = 0;
+ virtual void OnSignonStateFull() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYDEMOPLAYER_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplayerrorsystem.h b/mp/src/common/replay/ireplayerrorsystem.h new file mode 100644 index 00000000..4f0c5d02 --- /dev/null +++ b/mp/src/common/replay/ireplayerrorsystem.h @@ -0,0 +1,33 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYERRORSYSYTEM_H
+#define IREPLAYERRORSYSYTEM_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class KeyValues;
+
+//----------------------------------------------------------------------------------------
+
+//
+// Replay error system
+//
+class IReplayErrorSystem : public IBaseInterface
+{
+public:
+ virtual void AddErrorFromTokenName( const char *pToken ) = 0;
+ virtual void AddFormattedErrorFromTokenName( const char *pFormatToken, KeyValues *pFormatArgs ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYERRORSYSYTEM_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplayfactory.h b/mp/src/common/replay/ireplayfactory.h new file mode 100644 index 00000000..09f0a16d --- /dev/null +++ b/mp/src/common/replay/ireplayfactory.h @@ -0,0 +1,31 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYFACTORY_H
+#define IREPLAYFACTORY_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IReplayFactory : public IBaseInterface
+{
+public:
+ virtual CReplay *Create() = 0;
+};
+
+#define INTERFACE_VERSION_REPLAY_FACTORY "IReplayFactory001"
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYFACTORY_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplaymanager.h b/mp/src/common/replay/ireplaymanager.h new file mode 100644 index 00000000..4f11dfdf --- /dev/null +++ b/mp/src/common/replay/ireplaymanager.h @@ -0,0 +1,42 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYMANAGER_H
+#define IREPLAYMANAGER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/replayhandle.h"
+#include "utllinkedlist.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+class IQueryableReplayItem;
+
+//----------------------------------------------------------------------------------------
+
+class IReplayManager : public IBaseInterface
+{
+public:
+ virtual CReplay *GetReplay( ReplayHandle_t hReplay ) = 0;
+ virtual CReplay *GetPlayingReplay() = 0;
+ virtual CReplay *GetReplayForCurrentLife() = 0;
+ virtual void FlagReplayForFlush( CReplay *pReplay, bool bForceImmediate ) = 0;
+ virtual void DeleteReplay( ReplayHandle_t hReplay, bool bNotifyUI ) = 0;
+ virtual int GetReplayCount() const = 0;
+ virtual int GetUnrenderedReplayCount() = 0; // Get the number of unrendered replays
+ virtual void GetReplays( CUtlLinkedList< CReplay *, int > &lstReplays ) = 0;
+ virtual void GetReplaysAsQueryableItems( CUtlLinkedList< IQueryableReplayItem *, int > &lstReplays ) = 0;
+ virtual float GetDownloadProgress( const CReplay *pReplay ) = 0;
+ virtual const char *GetReplaysDir() const = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYMANAGER_H
diff --git a/mp/src/common/replay/ireplaymovie.h b/mp/src/common/replay/ireplaymovie.h new file mode 100644 index 00000000..6b271111 --- /dev/null +++ b/mp/src/common/replay/ireplaymovie.h @@ -0,0 +1,42 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYMOVIE_H
+#define IREPLAYMOVIE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "iqueryablereplayitem.h"
+#include "replay/rendermovieparams.h"
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IReplayMovie : public IQueryableReplayItem
+{
+public:
+ virtual ReplayHandle_t GetMovieHandle() const = 0;
+ virtual ReplayHandle_t GetReplayHandle() const = 0;
+ virtual const ReplayRenderSettings_t &GetRenderSettings() = 0;
+ virtual void GetFrameDimensions( int &nWidth, int &nHeight ) = 0;
+ virtual void SetIsRendered( bool bIsRendered ) = 0;
+ virtual void SetMovieFilename( const char *pFilename ) = 0;
+ virtual const char *GetMovieFilename() const = 0;
+ virtual void SetMovieTitle( const wchar_t *pTitle ) = 0;
+ virtual void SetRenderTime( float flRenderTime ) = 0;
+ virtual float GetRenderTime() const = 0;
+ virtual void CaptureRecordTime() = 0;
+ virtual void SetLength( float flLength ) = 0;
+
+ virtual bool IsUploaded() const = 0;
+ virtual void SetUploaded( bool bUploaded ) = 0;
+ virtual void SetUploadURL( const char *pURL ) = 0;
+ virtual const char *GetUploadURL() const = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYMOVIE_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplaymoviemanager.h b/mp/src/common/replay/ireplaymoviemanager.h new file mode 100644 index 00000000..b7fe0f23 --- /dev/null +++ b/mp/src/common/replay/ireplaymoviemanager.h @@ -0,0 +1,56 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYMOVIEMANAGER_H
+#define IREPLAYMOVIEMANAGER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "utlstring.h"
+#include "utllinkedlist.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+class IReplayMovie;
+class CReplay;
+struct RenderMovieParams_t;
+class IQueryableReplayItem;
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IReplayMovieManager : public IBaseInterface
+{
+public:
+ virtual int GetMovieCount() = 0;
+ virtual void GetMovieList( CUtlLinkedList< IReplayMovie * > &list ) = 0; // Fills the list with all movies
+ virtual IReplayMovie *GetMovie( ReplayHandle_t hMovie ) = 0;
+ virtual IReplayMovie *CreateAndAddMovie( ReplayHandle_t hReplay ) = 0; // Creates and adds a movie based on the given replay
+ virtual void DeleteMovie( ReplayHandle_t hMovie ) = 0; // Delete a movie
+ virtual int GetNumMoviesDependentOnReplay( const CReplay *pReplay ) = 0; // Get the number of movies that depend on the given replay
+ virtual void GetCachedMovieTitleAndClear( wchar_t *pOut, int nOutBufLength ) = 0; // TODO: This is a hack - fix this
+ virtual void SetPendingMovie( IReplayMovie *pMovie ) = 0;
+ virtual IReplayMovie *GetPendingMovie() = 0;
+ virtual void FlagMovieForFlush( IReplayMovie *pMovie, bool bImmediate ) = 0;
+ virtual void GetMoviesAsQueryableItems( CUtlLinkedList< IQueryableReplayItem *, int > &lstMovies ) = 0;
+ virtual const char *GetRenderDir() const = 0;
+ virtual const char *GetRawExportDir() const = 0;
+
+ // TODO: Is this the best place for code that actually manages rendering?
+ virtual bool IsRendering() const = 0;
+ virtual bool RenderingCancelled() const = 0;
+ virtual void RenderMovie( RenderMovieParams_t const& params ) = 0; // Renders the given replay - or if params.hReplay is -1, render all unrendered replays
+ virtual void RenderNextMovie() = 0;
+ virtual void CompleteRender( bool bSuccess, bool bShowBrowser ) = 0;
+ virtual void CancelRender() = 0;
+ virtual void ClearRenderCancelledFlag() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYMOVIEMANAGER_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplaymovierenderer.h b/mp/src/common/replay/ireplaymovierenderer.h new file mode 100644 index 00000000..94d5117f --- /dev/null +++ b/mp/src/common/replay/ireplaymovierenderer.h @@ -0,0 +1,33 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYMOVIERENDERER_H
+#define IREPLAYMOVIERENDERER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+class IReplayMovie;
+struct RenderMovieParams_t;
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IReplayMovieRenderer : public IBaseInterface
+{
+public:
+ virtual bool SetupRenderer( RenderMovieParams_t ¶ms, IReplayMovie *pMovie ) = 0;
+ virtual void ShutdownRenderer() = 0;
+ virtual void RenderVideo() = 0;
+ virtual void RenderAudio( unsigned char *pBuffer, int nSize, int nNumSamples ) = 0;
+
+ virtual void SetAudioSyncFrame( bool isSync = false ) = 0;
+ virtual bool IsAudioSyncFrame() = 0;
+ virtual float GetRecordingFrameDuration() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYMOVIERENDERER_H
diff --git a/mp/src/common/replay/ireplayperformancecontroller.h b/mp/src/common/replay/ireplayperformancecontroller.h new file mode 100644 index 00000000..2479fac5 --- /dev/null +++ b/mp/src/common/replay/ireplayperformancecontroller.h @@ -0,0 +1,107 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYPERFORMANCECONTROLLER_H
+#define IREPLAYPERFORMANCECONTROLLER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "tier1/strtools.h"
+
+//----------------------------------------------------------------------------------------
+
+class IReplayPerformanceEditor;
+class CReplay;
+class Vector;
+class QAngle;
+class CReplayPerformance;
+
+//----------------------------------------------------------------------------------------
+
+// These values are what we use to represent
+
+struct SetViewParams_t
+{
+ SetViewParams_t() { V_memset( this, 0, sizeof( SetViewParams_t ) ); }
+ SetViewParams_t( float flTime, Vector *pOrigin, QAngle *pAngles, float flFov, float flAccel,
+ float flSpeed, float flRotFilter )
+ : m_flTime( flTime ),
+ m_pOrigin( pOrigin ),
+ m_pAngles( pAngles ),
+ m_flFov( flFov ),
+ m_flAccel( flAccel ),
+ m_flSpeed( flSpeed ),
+ m_flRotationFilter( flRotFilter )
+ {
+ }
+
+ float m_flTime;
+ Vector *m_pOrigin;
+ QAngle *m_pAngles;
+ float m_flFov;
+
+ // Right now only used for updating UI during playback:
+ float m_flAccel;
+ float m_flSpeed;
+ float m_flRotationFilter;
+};
+
+//----------------------------------------------------------------------------------------
+
+class IReplayPerformanceController : public IBaseInterface
+{
+public:
+ virtual void SetEditor( IReplayPerformanceEditor *pEditor ) = 0;
+
+ virtual bool IsPlaybackDataLeft() = 0;
+
+ virtual void StartRecording( CReplay *pReplay, bool bSnip ) = 0;
+ virtual void NotifyRewinding() = 0;
+
+ virtual void Stop() = 0;
+ virtual bool SaveAsync() = 0;
+ virtual bool SaveAsAsync( const wchar *pTitle ) = 0;
+
+ virtual bool IsSaving() const = 0;
+
+ virtual void SaveThink() = 0;
+
+ virtual bool GetLastSaveStatus() const = 0;
+
+ virtual bool IsRecording() const = 0;
+ virtual bool IsPlaying() const = 0;
+
+ virtual bool IsDirty() const = 0;
+ virtual void NotifyDirty() = 0;
+
+ virtual CReplayPerformance *GetPerformance() = 0;
+ virtual CReplayPerformance *GetSavedPerformance() = 0;
+ virtual bool HasSavedPerformance() = 0;
+
+ virtual void NotifyPauseState( bool bPaused ) = 0;
+
+ virtual void ClearRewinding() = 0;
+
+ virtual void OnSignonStateFull() = 0;
+
+ virtual float GetPlaybackTimeScale() const = 0;
+
+ //
+ // Recorder-specific:
+ //
+ virtual void AddEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
+ virtual void AddEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
+ virtual void AddEvent_Camera_Change_Free( float flTime ) = 0;
+ virtual void AddEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
+ virtual void AddEvent_Camera_SetView( const SetViewParams_t ¶ms ) = 0;
+ virtual void AddEvent_TimeScale( float flTime, float flScale ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYPERFORMANCECONTROLLER_H
diff --git a/mp/src/common/replay/ireplayperformanceeditor.h b/mp/src/common/replay/ireplayperformanceeditor.h new file mode 100644 index 00000000..f5a09d8c --- /dev/null +++ b/mp/src/common/replay/ireplayperformanceeditor.h @@ -0,0 +1,33 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYPERFORMANCEEDITOR_H
+#define IREPLAYPERFORMANCEEDITOR_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+
+//----------------------------------------------------------------------------------------
+
+//
+// Interface to allow the replay DLL to talk to the actual UI.
+//
+class IReplayPerformanceEditor : public IBaseInterface
+{
+public:
+ virtual CReplay *GetReplay() = 0;
+ virtual void OnRewindComplete() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYPERFORMANCEEDITOR_H
diff --git a/mp/src/common/replay/ireplayperformancemanager.h b/mp/src/common/replay/ireplayperformancemanager.h new file mode 100644 index 00000000..728624fd --- /dev/null +++ b/mp/src/common/replay/ireplayperformancemanager.h @@ -0,0 +1,36 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYPERFORMANCEMANAGER_H
+#define IREPLAYPERFORMANCEMANAGER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplayPerformance;
+class CReplay;
+
+//----------------------------------------------------------------------------------------
+
+class IReplayPerformanceManager : public IBaseInterface
+{
+public:
+ virtual CReplayPerformance *CreatePerformance( CReplay *pReplay ) = 0;
+ virtual void DeletePerformance( CReplayPerformance *pPerformance ) = 0;
+
+ virtual const char *GetRelativePath() const = 0;
+ virtual const char *GetFullPath() const = 0;
+
+ virtual const char *GeneratePerformanceFilename( CReplay *pReplay ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYPERFORMANCEMANAGER_H
diff --git a/mp/src/common/replay/ireplayperformanceplaybackhandler.h b/mp/src/common/replay/ireplayperformanceplaybackhandler.h new file mode 100644 index 00000000..bb3ad111 --- /dev/null +++ b/mp/src/common/replay/ireplayperformanceplaybackhandler.h @@ -0,0 +1,36 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYPERFORMANCEPLAYBACKHANDLER_H
+#define IREPLAYPERFORMANCEPLAYBACKHANDLER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/ireplayperformancecontroller.h"
+
+//----------------------------------------------------------------------------------------
+
+class Vector;
+class QAngle;
+
+//----------------------------------------------------------------------------------------
+
+class IReplayPerformancePlaybackHandler : public IBaseInterface
+{
+public:
+ virtual void OnEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
+ virtual void OnEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
+ virtual void OnEvent_Camera_Change_Free( float flTime ) = 0;
+ virtual void OnEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
+ virtual void OnEvent_Camera_SetView( const SetViewParams_t ¶ms ) = 0;
+ virtual void OnEvent_TimeScale( float flTime, float flScale ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYPERFORMANCEPLAYBACKHANDLER_H
diff --git a/mp/src/common/replay/ireplayperformanceplayer.h b/mp/src/common/replay/ireplayperformanceplayer.h new file mode 100644 index 00000000..cd7e7628 --- /dev/null +++ b/mp/src/common/replay/ireplayperformanceplayer.h @@ -0,0 +1,33 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYPERFORMANCEPLAYER_H
+#define IREPLAYPERFORMANCEPLAYER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+class CReplayPerformance;
+
+//----------------------------------------------------------------------------------------
+
+class IReplayPerformancePlayer : public IBaseInterface
+{
+public:
+ virtual void BeginPerformancePlay( CReplayPerformance *pPerformance ) = 0;
+ virtual void EndPerformancePlay() = 0;
+
+ virtual bool IsPlaying() const = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYPERFORMANCEPLAYER_H
diff --git a/mp/src/common/replay/ireplayperformancerecorder.h b/mp/src/common/replay/ireplayperformancerecorder.h new file mode 100644 index 00000000..83997eb7 --- /dev/null +++ b/mp/src/common/replay/ireplayperformancerecorder.h @@ -0,0 +1,49 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYPERFORMANCERECORDER_H
+#define IREPLAYPERFORMANCERECORDER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+class Vector;
+class QAngle;
+class CReplayPerformance;
+
+//----------------------------------------------------------------------------------------
+
+class IReplayPerformanceRecorder : public IBaseInterface
+{
+public:
+ virtual void BeginPerformanceRecord( CReplay *pReplay ) = 0;
+ virtual void EndPerformanceRecord() = 0;
+
+ virtual void NotifyPauseState( bool bPaused ) = 0;
+
+ virtual CReplayPerformance *GetPerformance() = 0;
+ virtual bool IsRecording() const = 0;
+
+ virtual void SnipAtTime( float flTime ) = 0;
+ virtual void NotifySkipping() = 0;
+ virtual void ClearSkipping() = 0;
+
+ virtual void AddEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
+ virtual void AddEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
+ virtual void AddEvent_Camera_Change_Free( float flTime ) = 0;
+ virtual void AddEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
+ virtual void AddEvent_Camera_SetView( float flTime, const Vector& origin, const QAngle &angles, float fov ) = 0;
+ virtual void AddEvent_Slowmo( float flTime, float flScale ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYPERFORMANCERECORDER_H
diff --git a/mp/src/common/replay/ireplayplayercache.h b/mp/src/common/replay/ireplayplayercache.h new file mode 100644 index 00000000..e27ad2e7 --- /dev/null +++ b/mp/src/common/replay/ireplayplayercache.h @@ -0,0 +1,41 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//----------------------------------------------------------------------------------------
+
+#ifndef IREPLAYPLAYERCACHE_H
+#define IREPLAYPLAYERCACHE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+#define REPLAYPLAYERCACHE_INTERFACE_VERSION "VENGINE_REPLAY_PLAYER_CACHE_001"
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IReplayPlayerCache : public IBaseInterface
+{
+public:
+ virtual bool Init() = 0;
+ virtual void Shutdown() = 0;
+
+ virtual void SetupPlayer( int nEntIndex ) = 0;
+ virtual void DeletePlayerEntry( int nEntIndex ) = 0;
+
+ virtual bool PlayerHasCacheEntry( int nEntIndex ) = 0;
+
+ virtual void SetPlayerClass( int nEntIndex, const char *pPlayerClass ) = 0;
+ virtual void SetPlayerSpawnTick( int nEntIndex, int nTick ) = 0;
+ virtual void SetPlayerDeathTick( int nEntIndex, int nTick ) = 0;
+
+ virtual const char *GetPlayerClass( int nEntIndex ) = 0;
+ virtual int GetPlayerSpawnTick( int nEntIndex ) = 0;
+ virtual int GetPlayerDeathTick( int nEntIndex ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYPLAYERCACHE_H
diff --git a/mp/src/common/replay/ireplayrenderqueue.h b/mp/src/common/replay/ireplayrenderqueue.h new file mode 100644 index 00000000..e92b33e4 --- /dev/null +++ b/mp/src/common/replay/ireplayrenderqueue.h @@ -0,0 +1,32 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYRENDERQUEUE_H
+#define IREPLAYRENDERQUEUE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IReplayRenderQueue : IBaseInterface
+{
+public:
+ virtual void Add( ReplayHandle_t hReplay, int iPerformance ) = 0;
+ virtual void Remove( ReplayHandle_t hReplay, int iPerformance ) = 0;
+ virtual void Clear() = 0;
+
+ virtual int GetCount() const = 0;
+ virtual bool GetEntryData( int iIndex, ReplayHandle_t *pHandleOut, int *pPerformanceOut ) const = 0;
+ virtual bool IsInQueue( ReplayHandle_t hReplay, int iPerformance ) const = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYRENDERQUEUE_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplayscreenshotmanager.h b/mp/src/common/replay/ireplayscreenshotmanager.h new file mode 100644 index 00000000..c23d8028 --- /dev/null +++ b/mp/src/common/replay/ireplayscreenshotmanager.h @@ -0,0 +1,32 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYSCREENSHOTMANAGER_H
+#define IREPLAYSCREENSHOTMANAGER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+struct CaptureScreenshotParams_t;
+
+//----------------------------------------------------------------------------------------
+
+class IReplayScreenshotManager : public IBaseInterface
+{
+public:
+ virtual void CaptureScreenshot( CaptureScreenshotParams_t& params ) = 0;
+ virtual void GetUnpaddedScreenshotSize( int &nOutWidth, int &nOutHeight ) = 0;
+ virtual void DeleteScreenshotsForReplay( CReplay *pReplay ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYSCREENSHOTMANAGER_H
diff --git a/mp/src/common/replay/ireplayscreenshotsystem.h b/mp/src/common/replay/ireplayscreenshotsystem.h new file mode 100644 index 00000000..00e6e334 --- /dev/null +++ b/mp/src/common/replay/ireplayscreenshotsystem.h @@ -0,0 +1,34 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYSCREENSHOTSYSTEM_H
+#define IREPLAYSCREENSHOTSYSTEM_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+struct WriteReplayScreenshotParams_t;
+
+//----------------------------------------------------------------------------------------
+
+//
+// Implementation lives in the client - allows replay to tell the client to grab a
+// screenshot or update the cache.
+//
+class IReplayScreenshotSystem : public IBaseInterface
+{
+public:
+ virtual void WriteReplayScreenshot( WriteReplayScreenshotParams_t ¶ms ) = 0;
+ virtual void UpdateReplayScreenshotCache() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYSCREENSHOTSYSTEM_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplayserializeable.h b/mp/src/common/replay/ireplayserializeable.h new file mode 100644 index 00000000..a2ba5cd9 --- /dev/null +++ b/mp/src/common/replay/ireplayserializeable.h @@ -0,0 +1,48 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYSERIALIIZEABLE_H
+#define IREPLAYSERIALIIZEABLE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+#include "replay/replayhandle.h"
+
+//----------------------------------------------------------------------------------------
+
+class KeyValues;
+
+//----------------------------------------------------------------------------------------
+
+class IReplaySerializeable : public IBaseInterface
+{
+public:
+ virtual void SetHandle( ReplayHandle_t h ) = 0;
+ virtual ReplayHandle_t GetHandle() const = 0;
+
+ virtual bool Read( KeyValues *pIn ) = 0;
+ virtual void Write( KeyValues *pOut ) = 0;
+
+ virtual const char *GetSubKeyTitle() const = 0;
+ virtual const char *GetFilename() const = 0;
+ virtual const char *GetPath() const = 0;
+
+ virtual const char *GetFullFilename() const = 0;
+
+ virtual void SetLocked( bool bLocked ) = 0;
+ virtual bool IsLocked() const = 0;
+
+ virtual void OnDelete() = 0;
+ virtual void OnUnload() = 0;
+
+ virtual const char *GetDebugName() const = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYSERIALIIZEABLE_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplayserver.h b/mp/src/common/replay/ireplayserver.h new file mode 100644 index 00000000..f6de4e56 --- /dev/null +++ b/mp/src/common/replay/ireplayserver.h @@ -0,0 +1,48 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+
+#ifndef IREPLAYSERVER_H
+#define IREPLAYSERVER_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+//-----------------------------------------------------------------------------
+
+#include "interface.h"
+
+//-----------------------------------------------------------------------------
+
+class IServer;
+class IReplayDirector;
+class IGameEvent;
+struct netadr_s;
+class CServerReplay;
+
+//-----------------------------------------------------------------------------
+// Interface the Replay module exposes to the engine
+//-----------------------------------------------------------------------------
+#define INTERFACEVERSION_REPLAYSERVER "ReplayServer001"
+
+class IReplayServer : public IBaseInterface
+{
+public:
+ virtual ~IReplayServer() {}
+
+ virtual IServer *GetBaseServer() = 0; // get Replay base server interface
+ virtual IReplayDirector *GetDirector() = 0; // get director interface
+ virtual int GetReplaySlot() = 0; // return entity index-1 of Replay in game
+ virtual float GetOnlineTime() = 0; // seconds since broadcast started
+ virtual void BroadcastEvent(IGameEvent *event) = 0; // send a director command to all specs
+ virtual bool IsRecording() = 0;
+ virtual void StartRecording() = 0;
+ virtual void StopRecording() = 0;
+};
+
+#endif
diff --git a/mp/src/common/replay/ireplaysessionrecorder.h b/mp/src/common/replay/ireplaysessionrecorder.h new file mode 100644 index 00000000..846a6831 --- /dev/null +++ b/mp/src/common/replay/ireplaysessionrecorder.h @@ -0,0 +1,27 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYSESSIONRECORDER_H
+#define IREPLAYSESSIONRECORDER_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class IReplaySessionRecorder : public IBaseInterface
+{
+public:
+ virtual void StartRecording() = 0;
+ virtual void StopRecording( bool bAborting ) = 0;
+ virtual void SetCurrentRecordingStartTick( int nStartTick ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYSESSIONRECORDER_H
\ No newline at end of file diff --git a/mp/src/common/replay/ireplaysystem.h b/mp/src/common/replay/ireplaysystem.h new file mode 100644 index 00000000..19c9c24b --- /dev/null +++ b/mp/src/common/replay/ireplaysystem.h @@ -0,0 +1,60 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef IREPLAYSYSTEM_H
+#define IREPLAYSYSTEM_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "appframework/IAppSystem.h"
+
+//----------------------------------------------------------------------------------------
+
+class IClientReplayContext;
+class IServerReplayContext;
+class IGameEvent;
+
+//----------------------------------------------------------------------------------------
+
+abstract_class IReplaySystem : public IAppSystem
+{
+public:
+ // IAppSystem:
+ virtual bool Connect( CreateInterfaceFn fnFactory ) = 0;
+ virtual void Disconnect() = 0;
+ virtual InitReturnVal_t Init() = 0;
+ virtual void Shutdown() = 0;
+
+ // To be called client- & server-side
+ virtual void Think() = 0;
+ virtual bool IsReplayEnabled() = 0;
+ virtual bool IsRecording() = 0;
+
+ // To be called client-side only - on dedicated servers, only subs defined
+ virtual bool CL_Init( CreateInterfaceFn fnClientFactory ) = 0;
+ virtual void CL_Shutdown() = 0;
+ virtual void CL_Render() = 0;
+ virtual IClientReplayContext *CL_GetContext() = 0;
+
+ // To be called server-side only
+ virtual bool SV_Init( CreateInterfaceFn fnFactory ) = 0;
+ virtual void SV_Shutdown() = 0;
+ virtual void SV_EndRecordingSession( bool bForceSynchronousPublish = false ) = 0;
+ virtual void SV_SendReplayEvent( const char *pEventName, int nClientSlot ) = 0;
+ virtual void SV_SendReplayEvent( IGameEvent *pEvent, int nClientSlot ) = 0;
+ virtual bool SV_ShouldBeginRecording( bool bIsInWaitingForPlayers ) = 0;
+ virtual void SV_NotifyReplayRequested() = 0;
+ virtual IServerReplayContext *SV_GetContext() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#define REPLAY_INTERFACE_VERSION "ReplaySystem001"
+
+//----------------------------------------------------------------------------------------
+
+#endif // IREPLAYSYSTEM_H
\ No newline at end of file diff --git a/mp/src/common/replay/iserverengine.h b/mp/src/common/replay/iserverengine.h new file mode 100644 index 00000000..0581a7f0 --- /dev/null +++ b/mp/src/common/replay/iserverengine.h @@ -0,0 +1,27 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef ISERVERENGINE_H
+#define ISERVERENGINE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+class IReplayServerEngine : public IBaseInterface
+{
+public:
+ virtual void EndReplayRecordingSession() = 0;
+ virtual bool IsReplayRecording() = 0;
+ virtual bool IsReplay() = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // ISERVERENGINE_H
\ No newline at end of file diff --git a/mp/src/common/replay/iserverreplay.h b/mp/src/common/replay/iserverreplay.h new file mode 100644 index 00000000..666220a6 --- /dev/null +++ b/mp/src/common/replay/iserverreplay.h @@ -0,0 +1,37 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef ISERVERREPLAY_H
+#define ISERVERREPLAY_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "interface.h"
+
+//----------------------------------------------------------------------------------------
+
+#define SERVER_REPLAY_INTERFACE_VERSION "ServerReplay001"
+
+//----------------------------------------------------------------------------------------
+
+class IReplayFactory;
+class KeyValues;
+
+//----------------------------------------------------------------------------------------
+
+//
+// Allows the replay DLL to talk to the server
+//
+class IServerReplay : public IBaseInterface
+{
+public:
+ virtual void UploadOgsData( KeyValues *pData, bool bIncludeTimeField ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // ISERVERREPLAY_H
\ No newline at end of file diff --git a/mp/src/common/replay/iserverreplaycontext.h b/mp/src/common/replay/iserverreplaycontext.h new file mode 100644 index 00000000..a8e07d15 --- /dev/null +++ b/mp/src/common/replay/iserverreplaycontext.h @@ -0,0 +1,38 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef ISERVERREPLAYCONTEXT_H
+#define ISERVERREPLAYCONTEXT_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "replay/ireplaycontext.h"
+
+//----------------------------------------------------------------------------------------
+
+class IGameEvent;
+class IReplaySessionRecorder;
+
+//----------------------------------------------------------------------------------------
+
+#define REPLAYHISTORYMANAGER_INTERFACE_VERSION_SERVER "VENGINE_SERVER_REPLAY_HISTORY_MANAGER_001"
+
+//----------------------------------------------------------------------------------------
+
+class IServerReplayContext : public IReplayContext
+{
+public:
+ virtual void FlagForConVarSanityCheck() = 0; // Checks replay_enable / replay_local_fileserver_path / replay_downloadurlport / replay_downloadurlpath
+ virtual IGameEvent *CreateReplaySessionInfoEvent() = 0; // Create "replay_sessioninfo" event w/ appropriate fields filled in
+ virtual IReplaySessionRecorder *GetSessionRecorder() = 0;
+ virtual const char *GetLocalFileServerPath() const = 0; // Returns the local path where session blocks and such should be published for download
+ virtual void CreateSessionOnClient( int nClientSlot ) = 0;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // ISERVERREPLAYCONTEXT_H
diff --git a/mp/src/common/replay/performance.h b/mp/src/common/replay/performance.h new file mode 100644 index 00000000..e6541cd3 --- /dev/null +++ b/mp/src/common/replay/performance.h @@ -0,0 +1,63 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef REPLAYPERFORMANCE_H
+#define REPLAYPERFORMANCE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "shared_defs.h"
+#include "qlimits.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplay;
+class KeyValues;
+
+//----------------------------------------------------------------------------------------
+
+class CReplayPerformance
+{
+public:
+ CReplayPerformance( CReplay *pReplay );
+
+ inline bool HasInTick() const { return m_nTickIn >= 0; }
+ inline bool HasOutTick() const { return m_nTickOut >= 0; }
+
+ inline int GetTickIn() const { return m_nTickIn; }
+ inline int GetTickOut() const { return m_nTickOut; }
+
+ void Copy( const CReplayPerformance *pSrc );
+ void CopyTicks( const CReplayPerformance *pSrc );
+
+ void SetFilename( const char *pFilename );
+ const char *GetFullPerformanceFilename();
+
+ void AutoNameIfHasNoTitle( const char *pMapName );
+ void SetTitle( const wchar_t *pTitle );
+
+ // NOTE: Doesn't copy exactly - gets a valid filename for the returned performance.
+ CReplayPerformance *MakeCopy() const;
+
+ void Read( KeyValues *pIn );
+ void Write( KeyValues *pOut );
+
+ // NOTE: Any changes made here should be reflected in the copy constructor
+ // (which is called from MakeCopy()).
+ wchar_t m_wszTitle[MAX_TAKE_TITLE_LENGTH];
+ char m_szBaseFilename[ MAX_OSPATH ];
+ CReplay *m_pReplay;
+ int m_nTickIn;
+ int m_nTickOut;
+
+private:
+ CReplayPerformance( const CReplayPerformance *pPerformance );
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // REPLAYPERFORMANCE_H
\ No newline at end of file diff --git a/mp/src/common/replay/rendermovieparams.h b/mp/src/common/replay/rendermovieparams.h new file mode 100644 index 00000000..8076d8e6 --- /dev/null +++ b/mp/src/common/replay/rendermovieparams.h @@ -0,0 +1,62 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef RENDERMOVIEPARAMS_H
+#define RENDERMOVIEPARAMS_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "tier1/utlstring.h"
+#include "tier1/strtools.h"
+#include "replay/replayhandle.h"
+#include "replay/shared_defs.h"
+#include "video/ivideoservices.h"
+
+//----------------------------------------------------------------------------------------
+
+typedef unsigned int MovieHandle_t;
+
+struct RenderMovieParams_t
+{
+ inline RenderMovieParams_t() : m_iPerformance( -1 ) { V_memset( this, 0, sizeof( RenderMovieParams_t ) ); m_Settings.m_FPS.SetFPS( 0, false ); }
+
+ ReplayHandle_t m_hReplay;
+ int m_iPerformance; // -1 for default view, otherwise this is an index into the replay's m_vecPerformances vector.
+ wchar_t m_wszTitle[MAX_REPLAY_TITLE_LENGTH];
+ char m_szVideoPreset[64];
+ char m_szExtension[16]; // File extension
+ bool m_bQuitWhenFinished;
+ bool m_bExportRaw; // Export movie as raw TGA frames and a .WAV
+ float m_flEngineFps;
+
+ struct ReplayRenderSettings_t
+ {
+ uint16 m_nWidth;
+ uint16 m_nHeight;
+ int8 m_nMotionBlurQuality; // [0,MAX_MOTION_BLUR_QUALITY]
+ VideoFrameRate_t m_FPS; // Actual framerate can be calculated with m_FPS.GetFps()
+ VideoEncodeCodec_t m_Codec;
+ bool m_bMotionBlurEnabled; // Motion blur enabled?
+ bool m_bAAEnabled; // Antialiasing enabled?
+ int8 m_nEncodingQuality; // [0,100]
+ bool m_bRaw; // This movie was exported as raw TGA frames and a .WAV file?
+ }
+ m_Settings;
+};
+
+typedef RenderMovieParams_t::ReplayRenderSettings_t ReplayRenderSettings_t;
+
+//----------------------------------------------------------------------------------------
+
+#define MAX_DOF_QUALITY 2
+#define MAX_MOTION_BLUR_QUALITY 3
+#define SUBPIXEL_JITTER_SAMPLES 16
+#define CHEAP_DOF_SAMPLES 4
+
+//----------------------------------------------------------------------------------------
+
+#endif // RENDERMOVIEPARAMS_H
diff --git a/mp/src/common/replay/replay.h b/mp/src/common/replay/replay.h new file mode 100644 index 00000000..32f245ce --- /dev/null +++ b/mp/src/common/replay/replay.h @@ -0,0 +1,146 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef REPLAY_H
+#define REPLAY_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "replay/iqueryablereplayitem.h"
+#include "replay/replaytime.h"
+#include "replay/basereplayserializeable.h"
+#include "qlimits.h"
+#include "utlstring.h"
+#include "utlvector.h"
+#include "replay/shared_defs.h"
+
+//----------------------------------------------------------------------------------------
+
+class IReplayDownloadEventHandler;
+class CReplayScreenshot;
+class CReplayPerformance;
+
+//----------------------------------------------------------------------------------------
+
+class CReplay : public CBaseReplaySerializeable,
+ public IQueryableReplayItem
+{
+ typedef CBaseReplaySerializeable BaseClass;
+
+public:
+ enum ReplayStatus_t
+ {
+ REPLAYSTATUS_INVALID,
+ REPLAYSTATUS_ERROR,
+ REPLAYSTATUS_DOWNLOADPHASE, // Multiple sub-states during download state
+ REPLAYSTATUS_READYTOCONVERT, // Download is complete, ready to convert
+ REPLAYSTATUS_RENDERING, // Currently rendering the file
+ REPLAYSTATUS_RENDERED,
+ REPLAYSTATUS_MAX
+ };
+
+ CReplay();
+ virtual ~CReplay() {}
+
+ //
+ // IReplaySerializeable
+ //
+ virtual const char *GetSubKeyTitle() const;
+ virtual const char *GetPath() const;
+ virtual void OnDelete();
+ virtual bool Read( KeyValues *pIn );
+ virtual void Write( KeyValues *pOut );
+
+ virtual void DumpGameSpecificData() const {}
+
+ virtual void Update() {}
+
+ // Hooks to allow replays to setup event listeners, etc.
+ virtual void OnBeginRecording() {}
+ virtual void OnEndRecording() {}
+
+ // Called when a replay is "completed"
+ virtual void OnComplete();
+
+ // Should we allow this replay to be deleted?
+ virtual bool ShouldAllowDelete() const { return true; }
+
+ void AutoNameTitleIfEmpty();
+
+ void AddScreenshot( int nWidth, int nHeight, const char *pBaseFilename );
+
+ bool HasReconstructedReplay() const;
+ bool IsSignificantBlock( int iBlockReconstruction ) const; // Does this replay care about the given block?
+
+ CReplayPerformance *AddNewPerformance( bool bGenTitle = true, bool bGenFilename = true );
+ void AddPerformance( KeyValues *pIn );
+ void AddPerformance( CReplayPerformance *pPerformance );
+
+ // Accessors:
+ inline int GetScreenshotCount() const { return m_vecScreenshots.Count(); }
+ inline const CReplayScreenshot *GetScreenshot( int i ) const { return m_vecScreenshots[ i ]; }
+ bool IsDownloaded() const;
+ inline int GetPerformanceCount() const { return m_vecPerformances.Count(); }
+ CReplayPerformance *GetPerformance( int i );
+ const CReplayPerformance *GetPerformance( int i ) const;
+ inline bool HasPerformance( CReplayPerformance *pPerformance ) { return m_vecPerformances.Find( pPerformance ) != m_vecPerformances.InvalidIndex(); }
+ bool FindPerformance( CReplayPerformance *pPerformance, int &iResult );
+ CReplayPerformance *GetPerformanceWithTitle( const wchar_t *pTitle );
+ inline const char *GetMapName() const { return m_szMapName; }
+ inline int GetSpawnTick() const { return m_nSpawnTick; }
+ inline int GetDeathTick() const { return m_nDeathTick; }
+
+ // IQueryableReplayItem implementation:
+ virtual const CReplayTime &GetItemDate() const;
+ virtual bool IsItemRendered() const;
+ virtual CReplay *GetItemReplay();
+ virtual ReplayHandle_t GetItemReplayHandle() const;
+ virtual QueryableReplayItemHandle_t GetItemHandle() const;
+ virtual const wchar_t *GetItemTitle() const;
+ virtual void SetItemTitle( const wchar_t *pTitle );
+ virtual float GetItemLength() const;
+ virtual void *GetUserData();
+ virtual void SetUserData( void* pUserData );
+ virtual bool IsItemAMovie() const;
+
+ // Non-persistent data
+ mutable IReplayDownloadEventHandler *m_pDownloadEventHandler; // Implemented by replay browser - the reason we've got one per replay rather than
+ // one per download group is because the browser needs to receive events per-thumbnail
+ bool m_bSaved; // True as soon as the replay is saved to disk for the first time
+ bool m_bRequestedByUser; // Did the user request to save this replay?
+ bool m_bComplete; // Indicates whether the replay is done recording - this should be false
+ // until the player dies, the round ends, or the level changes
+ void *m_pUserData;
+ float m_flNextUpdateTime;
+ bool m_bDirty;
+
+ // Persistent data
+ ReplayHandle_t m_hSession; // The recording session in which this replay was recorded
+ char m_szMapName[MAX_OSPATH];
+ ReplayStatus_t m_nStatus;
+ const char* m_pFileURL; // In the form <protocol>://<server address>:<port number>/path/file - points to the string in the download group
+ wchar_t m_wszTitle[MAX_REPLAY_TITLE_LENGTH];
+ CUtlString m_strKilledBy; // Name of player who killed, if any
+ int m_nDeathTime;
+ int m_nSpawnTick;
+ int m_nDeathTick;
+ float m_flLength; // The length of the entire replay, including the post-death time, in seconds
+ bool m_bRendered; // Has the replay been rendered yet?
+ int m_nPlayerSlot; // Player slot (+1), used to determine which player recorded the demo during playback
+ int m_nPostDeathRecordTime; // replay_postdeathrecordtime at the time of record
+ CUtlVector< CReplayScreenshot * > m_vecScreenshots;
+ CUtlVector< CReplayPerformance * > m_vecPerformances;
+ int m_iMaxSessionBlockRequired; // The maximum session block required to reconstruct a viewable .dem file from spawn tick until length
+ CReplayTime m_RecordTime; // Contains time/date when spawn tick was recorded
+ float m_flStartTime; // Start time (uses engine's host_time)
+ CUtlString m_strReconstructedFilename;
+ bool m_bSavedDuringThisSession;
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // REPLAY_H
\ No newline at end of file diff --git a/mp/src/common/replay/replayhandle.h b/mp/src/common/replay/replayhandle.h new file mode 100644 index 00000000..1c920a55 --- /dev/null +++ b/mp/src/common/replay/replayhandle.h @@ -0,0 +1,25 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef REPLAYHANDLE_H
+#define REPLAYHANDLE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "platform.h"
+
+//----------------------------------------------------------------------------------------
+
+typedef uint32 ReplayHandle_t;
+
+//----------------------------------------------------------------------------------------
+
+#define REPLAY_HANDLE_INVALID ( (ReplayHandle_t)-1 )
+
+//----------------------------------------------------------------------------------------
+
+#endif // REPLAYHANDLE_H
\ No newline at end of file diff --git a/mp/src/common/replay/replaylib.h b/mp/src/common/replay/replaylib.h new file mode 100644 index 00000000..34cb1a9d --- /dev/null +++ b/mp/src/common/replay/replaylib.h @@ -0,0 +1,21 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef REPLAYLIB_H
+#define REPLAYLIB_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+class IClientReplayContext;
+
+//----------------------------------------------------------------------------------------
+
+bool ReplayLib_Init( const char *pGameDir, IClientReplayContext *pClientReplayContext );
+
+//----------------------------------------------------------------------------------------
+
+#endif // REPLAYLIB_H
\ No newline at end of file diff --git a/mp/src/common/replay/replaytime.h b/mp/src/common/replay/replaytime.h new file mode 100644 index 00000000..02359db7 --- /dev/null +++ b/mp/src/common/replay/replaytime.h @@ -0,0 +1,57 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef REPLAYTIME_H
+#define REPLAYTIME_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+class KeyValues;
+
+//----------------------------------------------------------------------------------------
+
+#include "vgui/ILocalize.h"
+
+//----------------------------------------------------------------------------------------
+
+class CReplayTime
+{
+public:
+ CReplayTime();
+
+ void InitDateAndTimeToNow();
+
+ void Read( KeyValues *pIn );
+ void Write( KeyValues *pOut );
+
+ // Modifiers:
+ void SetDate( int nDay, int nMonth, int nYear );
+ void SetTime( int nHour, int nMin, int nSec );
+ inline void SetRawDate( int nRawDate ) { m_fDate = nRawDate; }
+ inline void SetRawTime( int nRawTime ) { m_fTime = nRawTime; }
+
+ // Accessors:
+ void GetTime( int &nHour, int &nMin, int &nSec ) const;
+ void GetDate( int &nDay, int &nMonth, int &nYear ) const;
+
+ static const char *FormatTimeString( int nSecs );
+ static const char *FormatPreciseTimeString( float flSecs );
+ static const wchar_t *GetLocalizedMonth( vgui::ILocalize *pLocalize, int nMonth );
+ static const wchar_t *GetLocalizedDay( vgui::ILocalize *pLocalize, int nDay );
+ static const wchar_t *GetLocalizedYear( vgui::ILocalize *pLocalize, int nYear );
+ static const wchar_t *GetLocalizedTime( vgui::ILocalize *pLocalize, int nHour, int nMin, int nSec );
+ static const wchar_t *GetLocalizedDate( vgui::ILocalize *pLocalize, int nDay, int nMonth, int nYear,
+ int *pHour = NULL, int *pMin = NULL, int *pSec = NULL, bool bForceFullFormat = false ); // bForceFullFormat true will keep from returning "today" or "yesterday"
+ static const wchar_t *GetLocalizedDate( vgui::ILocalize *pLocalize, const CReplayTime &t, bool bForceFullFormat = false );
+
+ int m_fDate; // Representation of a date (bitfield)
+ int m_fTime; // Representation of time (bitfield)
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // REPLAYTIME_H
\ No newline at end of file diff --git a/mp/src/common/replay/replayutils.h b/mp/src/common/replay/replayutils.h new file mode 100644 index 00000000..97e011c2 --- /dev/null +++ b/mp/src/common/replay/replayutils.h @@ -0,0 +1,43 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//----------------------------------------------------------------------------------------
+
+#ifndef REPLAYUTILS_H
+#define REPLAYUTILS_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "utlstring.h"
+
+void Replay_GetFirstAvailableFilename( char *pDst, int nDstLen, const char *pIdealFilename, const char *pExt,
+ const char *pFilePath, int nStartIndex );
+
+void Replay_ConstructReplayFilenameString( CUtlString &strOut, const char *pReplaySubDir, const char *pFilename, const char *pGameDir );
+
+//----------------------------------------------------------------------------------------
+// Util function, copied from src/engine/common.cpp
+//----------------------------------------------------------------------------------------
+char *Replay_va( PRINTF_FORMAT_STRING const char *format, ... );
+
+//----------------------------------------------------------------------------------------
+// Return the base dir, e.g. "c:\...\game\tf\replays\"
+//----------------------------------------------------------------------------------------
+const char *Replay_GetBaseDir();
+
+//----------------------------------------------------------------------------------------
+// Set the game directory (only to be called from ReplayLib_Init())
+//----------------------------------------------------------------------------------------
+void Replay_SetGameDir( const char *pGameDir );
+
+//----------------------------------------------------------------------------------------
+// Return the base dir, e.g. "c:\...\game\tf\replays\"
+//----------------------------------------------------------------------------------------
+const char *Replay_GetGameDir();
+
+//----------------------------------------------------------------------------------------
+// Get a name of the format "<map>: <current date & time>" - used for replays and takes.
+//----------------------------------------------------------------------------------------
+void Replay_GetAutoName( OUT_Z_BYTECAP(nDestSizeInBytes) wchar_t *pDest, int nDestSizeInBytes, const char *pMapName );
+
+#endif // REPLAY_H
diff --git a/mp/src/common/replay/screenshot.h b/mp/src/common/replay/screenshot.h new file mode 100644 index 00000000..b6126e95 --- /dev/null +++ b/mp/src/common/replay/screenshot.h @@ -0,0 +1,72 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef SCREENSHOT_H
+#define SCREENSHOT_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "replay/basereplayserializeable.h"
+#include "mathlib/vector.h"
+#include "qlimits.h"
+#include "strtools.h"
+
+//----------------------------------------------------------------------------------------
+
+#define SUBDIR_SCREENSHOTS "screenshots"
+
+//----------------------------------------------------------------------------------------
+
+class CReplayScreenshot : public CBaseReplaySerializeable
+{
+public:
+ inline CReplayScreenshot( int nWidth = 0, int nHeight = 0, const char *pBaseFilename = NULL )
+ : m_nWidth( nWidth ), m_nHeight( nHeight )
+ {
+ if ( pBaseFilename )
+ {
+ V_strncpy( m_szBaseFilename, pBaseFilename, sizeof( m_szBaseFilename ) );
+ }
+ }
+
+ virtual bool Read( KeyValues *pIn );
+ virtual void Write( KeyValues *pOut );
+ virtual const char *GetSubKeyTitle() const;
+ virtual const char *GetPath() const;
+
+ int m_nWidth; // Screenshot width (does not include power-of-2 padding)
+ int m_nHeight; // Screenshot height (does not include power-of-2 padding)
+ char m_szBaseFilename[ MAX_OSPATH ];
+};
+
+//----------------------------------------------------------------------------------------
+
+struct CaptureScreenshotParams_t // To be passed from the client into IReplayHistoryManager::CaptureScreenshot()
+{
+ float m_flDelay; // Delay from now (in seconds) when we will take the screenshot
+ int m_nEntity; // Should be 0 if no camera adjustment is needed, otherwise should be the index of the entity index from which m_posCamera will be based
+ Vector m_posCamera; // Local position, relative to entity's index (if m_nEntity > 0) for camera position
+ QAngle m_angCamera; // World angles of camera - used if m_bUseCameraAngles is true
+ bool m_bUseCameraAngles; // Should we use m_angCamera - m_nEntity can't be 0
+ bool m_bIgnoreMinTimeBetweenScreenshots; // Force screenshot, regardless of replay_mintimebetweenscreenshots?
+ bool m_bPrimary; // Only set to true for the primary screenshot, which is taken when the user saves their replay
+};
+
+//----------------------------------------------------------------------------------------
+
+struct WriteReplayScreenshotParams_t // Passed from the engine into the client to take a screenshot
+{
+ const char *m_pFilename;
+ int m_nWidth;
+ int m_nHeight;
+ Vector *m_pOrigin; // Perspective origin from which to render. Can be NULL
+ QAngle *m_pAngles; // Perspective angles from which to render. Can be NULL
+};
+
+//----------------------------------------------------------------------------------------
+
+#endif // SCREENSHOT_H
diff --git a/mp/src/common/replay/shared_defs.h b/mp/src/common/replay/shared_defs.h new file mode 100644 index 00000000..550e8678 --- /dev/null +++ b/mp/src/common/replay/shared_defs.h @@ -0,0 +1,73 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//=======================================================================================//
+
+#ifndef SHARED_DEFS_H
+#define SHARED_DEFS_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+//----------------------------------------------------------------------------------------
+
+#include "platform.h"
+
+//----------------------------------------------------------------------------------------
+
+#define SUBDIR_REPLAY "replay"
+#define SUBDIR_REPLAYS "replays"
+#define SUBDIR_SESSIONS "sessions"
+#define SUBDIR_BLOCKS "blocks"
+#define SUBDIR_CLIENT "client"
+#define SUBDIR_MOVIES "movies"
+#define SUBDIR_PERFORMANCES "edits"
+#define SUBDIR_SERVER "server"
+#define SUBDIR_RENDERED "rendered"
+#define SUBDIR_TMP "tmp"
+
+//----------------------------------------------------------------------------------------
+
+#define BLOCK_FILE_EXTENSION "block"
+#define GENERIC_FILE_EXTENSION "dmx"
+#define DEMO_FILE_EXTENSION "dem"
+
+//----------------------------------------------------------------------------------------
+
+#define MOVIE_HANDLE_BASE 10000 // 10,000
+
+//----------------------------------------------------------------------------------------
+
+#define BUILD_CURL ( defined( WIN32 ) && !defined( _X360 ) ) || defined( POSIX )
+
+//----------------------------------------------------------------------------------------
+
+#define MIN_SERVER_DUMP_INTERVAL 10
+#define MAX_SERVER_DUMP_INTERVAL 30
+
+#define DOWNLOAD_TIMEOUT_THRESHOLD 90 // Timeout for a replay download - if no blocks
+ // are added or updated after this many seconds,
+ // the replay will be put in the error state.
+
+//----------------------------------------------------------------------------------------
+
+#define MAX_TIMES_TO_SHOW_REPLAY_WELCOME_DLG 1
+
+//----------------------------------------------------------------------------------------
+
+#define MAX_SESSIONNAME_LENGTH 260
+#define MAX_REPLAY_TITLE_LENGTH 256
+#define MAX_TAKE_TITLE_LENGTH 256
+
+//----------------------------------------------------------------------------------------
+
+#define DEFAULT_COMPRESSOR_TYPE COMPRESSORTYPE_BZ2
+
+//----------------------------------------------------------------------------------------
+
+#define JOB_FAILED ( (JobStatus_t) -1 )
+
+#define DOWNLOAD_MAX_SIZE ( 8 * 1024 * 1024 ) // 8 MB
+
+//----------------------------------------------------------------------------------------
+
+#endif // SHARED_DEFS_H
|