1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//
#include "baserecordingsessionblockmanager.h"
#include "baserecordingsessionblock.h"
#include "replay/replayutils.h"
#include "replay/ireplaycontext.h"
#include "replay/shared_defs.h"
#include "KeyValues.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//----------------------------------------------------------------------------------------
#define RECORDINGSESSIONBLOCKMANAGER_VERSION 0
//----------------------------------------------------------------------------------------
CBaseRecordingSessionBlockManager::CBaseRecordingSessionBlockManager( IReplayContext *pContext )
: m_pContext( pContext )
{
}
bool CBaseRecordingSessionBlockManager::Init()
{
// Call CGenericPersistentManager::Init() to do setup, but don't actually load any blocks on the server.
return BaseClass::Init( ShouldLoadBlocks() );
}
const char *CBaseRecordingSessionBlockManager::GetRelativeIndexPath() const
{
return Replay_va( "%s%c", SUBDIR_BLOCKS, CORRECT_PATH_SEPARATOR );
}
float CBaseRecordingSessionBlockManager::GetNextThinkTime() const
{
return g_pEngine->GetHostTime() + 0.1f;
}
int CBaseRecordingSessionBlockManager::GetVersion() const
{
return RECORDINGSESSIONBLOCKMANAGER_VERSION;
}
CBaseRecordingSessionBlock *CBaseRecordingSessionBlockManager::GetBlock( ReplayHandle_t hBlock )
{
return Find( hBlock );
}
void CBaseRecordingSessionBlockManager::DeleteBlock( CBaseRecordingSessionBlock *pBlock )
{
Remove( pBlock );
}
void CBaseRecordingSessionBlockManager::UnloadBlock( CBaseRecordingSessionBlock *pBlock )
{
FlagForUnload( pBlock );
}
CBaseRecordingSessionBlock *CBaseRecordingSessionBlockManager::FindBlockForSession( ReplayHandle_t hSession, int iReconstruction )
{
FOR_EACH_OBJ( this, i )
{
CBaseRecordingSessionBlock *pCurBlock = m_vecObjs[ i ];
if ( pCurBlock->m_hSession == hSession && pCurBlock->m_iReconstruction == iReconstruction )
{
return pCurBlock;
}
}
return NULL;
}
const char *CBaseRecordingSessionBlockManager::GetSavePath() const
{
return Replay_va(
"%s%c%s%c%s%c",
SUBDIR_REPLAY, CORRECT_PATH_SEPARATOR,
m_pContext->GetReplaySubDir(), CORRECT_PATH_SEPARATOR,
SUBDIR_BLOCKS, CORRECT_PATH_SEPARATOR
);
}
const char *CBaseRecordingSessionBlockManager::GetBlockPath() const
{
return GetSavePath();
}
void CBaseRecordingSessionBlockManager::LoadBlockFromFileName( const char *pFilename, IRecordingSession *pSession )
{
CBaseRecordingSessionBlock *pBlock;
if ( ReadObjFromFile( pFilename, pBlock, true ) )
{
pSession->AddBlock( pBlock );
}
}
//----------------------------------------------------------------------------------------
|