Fix demo recording support for CS:GO
The IDemoRecorder interface was heavily modified.
This commit is contained in:
parent
98657d2619
commit
737b2ab1d0
@ -47,7 +47,11 @@
|
|||||||
#include "ihltv.h"
|
#include "ihltv.h"
|
||||||
#include "iserver.h"
|
#include "iserver.h"
|
||||||
#include "iclient.h"
|
#include "iclient.h"
|
||||||
#include "ihltvdemorecorder.h"
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
# include "ihltvdemorecorder_csgo.h"
|
||||||
|
#else
|
||||||
|
# include "ihltvdemorecorder.h"
|
||||||
|
#endif
|
||||||
#include "igameevents.h"
|
#include "igameevents.h"
|
||||||
#include "inetmessage.h"
|
#include "inetmessage.h"
|
||||||
#include "netadr.h"
|
#include "netadr.h"
|
||||||
|
10
forwards.cpp
10
forwards.cpp
@ -463,17 +463,15 @@ void CForwardManager::CallOnStopRecording(IDemoRecorder *recorder)
|
|||||||
|
|
||||||
if (!recorder->IsRecording())
|
if (!recorder->IsRecording())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
|
||||||
char *pDemoFile = (char *)recorder->GetDemoFile() + 4;
|
|
||||||
#else
|
|
||||||
char *pDemoFile = (char *)recorder->GetDemoFile();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HLTVServerWrapper *wrapper = g_HLTVServers.GetWrapper(recorder);
|
HLTVServerWrapper *wrapper = g_HLTVServers.GetWrapper(recorder);
|
||||||
int instance = -1;
|
int instance = -1;
|
||||||
|
char *pDemoFile = "";
|
||||||
if (wrapper)
|
if (wrapper)
|
||||||
|
{
|
||||||
instance = wrapper->GetInstanceNumber();
|
instance = wrapper->GetInstanceNumber();
|
||||||
|
pDemoFile = wrapper->GetDemoFileName();
|
||||||
|
}
|
||||||
|
|
||||||
m_StopRecordingFwd->PushCell(instance);
|
m_StopRecordingFwd->PushCell(instance);
|
||||||
m_StopRecordingFwd->PushString(pDemoFile);
|
m_StopRecordingFwd->PushString(pDemoFile);
|
||||||
|
@ -67,6 +67,18 @@ IDemoRecorder *HLTVServerWrapper::GetDemoRecorder()
|
|||||||
return m_DemoRecorder;
|
return m_DemoRecorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *HLTVServerWrapper::GetDemoFileName()
|
||||||
|
{
|
||||||
|
if (!m_DemoRecorder)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
return (char *)m_DemoRecorder + 8;
|
||||||
|
#else
|
||||||
|
return (char *)m_DemoRecorder->GetDemoFile();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int HLTVServerWrapper::GetInstanceNumber()
|
int HLTVServerWrapper::GetInstanceNumber()
|
||||||
{
|
{
|
||||||
return g_HLTVServers.GetInstanceNumber(m_HLTVServer);
|
return g_HLTVServers.GetInstanceNumber(m_HLTVServer);
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
IHLTVServer *GetHLTVServer();
|
IHLTVServer *GetHLTVServer();
|
||||||
IServer *GetBaseServer();
|
IServer *GetBaseServer();
|
||||||
IDemoRecorder *GetDemoRecorder();
|
IDemoRecorder *GetDemoRecorder();
|
||||||
|
char *GetDemoFileName();
|
||||||
HLTVClientWrapper *GetClient(int index);
|
HLTVClientWrapper *GetClient(int index);
|
||||||
int GetInstanceNumber();
|
int GetInstanceNumber();
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
class CDemoFile;
|
class CDemoFile;
|
||||||
class bf_read;
|
class bf_read;
|
||||||
class ServerClass;
|
class ServerClass;
|
||||||
class CGameInfo;
|
|
||||||
|
|
||||||
class IDemoRecorder
|
class IDemoRecorder
|
||||||
{
|
{
|
||||||
@ -19,21 +18,14 @@ public:
|
|||||||
virtual bool IsRecording(void) = 0;
|
virtual bool IsRecording(void) = 0;
|
||||||
virtual void PauseRecording(void) = 0;
|
virtual void PauseRecording(void) = 0;
|
||||||
virtual void ResumeRecording(void) = 0;
|
virtual void ResumeRecording(void) = 0;
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
|
||||||
virtual void StopRecording(CGameInfo const *info) = 0;
|
|
||||||
#else
|
|
||||||
virtual void StopRecording(void) = 0;
|
virtual void StopRecording(void) = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void RecordCommand(const char *cmdstring) = 0;
|
virtual void RecordCommand(const char *cmdstring) = 0;
|
||||||
virtual void RecordUserInput(int cmdnumber) = 0;
|
virtual void RecordUserInput(int cmdnumber) = 0;
|
||||||
virtual void RecordMessages(bf_read &data, int bits) = 0;
|
virtual void RecordMessages(bf_read &data, int bits) = 0;
|
||||||
virtual void RecordPacket(void) = 0;
|
virtual void RecordPacket(void) = 0;
|
||||||
virtual void RecordServerClasses(ServerClass *pClasses) = 0;
|
virtual void RecordServerClasses(ServerClass *pClasses) = 0;
|
||||||
virtual void RecordStringTables(void);
|
virtual void RecordStringTables(void) = 0;
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
|
||||||
virtual void RecordCustomData(int, void const *, unsigned int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void ResetDemoInterpolation(void) = 0;
|
virtual void ResetDemoInterpolation(void) = 0;
|
||||||
};
|
};
|
||||||
|
26
ihltvdemorecorder_csgo.h
Normal file
26
ihltvdemorecorder_csgo.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef _INCLUDE_DEMORECORDER_H
|
||||||
|
#define _INCLUDE_DEMORECORDER_H
|
||||||
|
|
||||||
|
|
||||||
|
class bf_read;
|
||||||
|
class ServerClass;
|
||||||
|
class CGameInfo;
|
||||||
|
|
||||||
|
class IDemoRecorder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void SetSignonState(int state) = 0;
|
||||||
|
virtual void RecordServerClasses(ServerClass *pClasses) = 0;
|
||||||
|
virtual void RecordMessages(bf_read &data, int bits) = 0;
|
||||||
|
virtual void RecordPacket(void) = 0;
|
||||||
|
virtual void RecordCommand(const char *cmdstring) = 0;
|
||||||
|
virtual void RecordUserInput(int cmdnumber) = 0;
|
||||||
|
virtual void RecordCustomData(int, void const *, unsigned int) = 0;
|
||||||
|
virtual void ResetDemoInterpolation(void) = 0;
|
||||||
|
virtual void StartRecording(const char *filename, bool bContinuously) = 0;
|
||||||
|
virtual void StopRecording(CGameInfo const *info) = 0;
|
||||||
|
virtual bool IsRecording(void) = 0;
|
||||||
|
virtual int GetRecordingTick(void) = 0;
|
||||||
|
};
|
||||||
|
#endif
|
@ -555,11 +555,7 @@ static cell_t Native_GetDemoFileName(IPluginContext *pContext, const cell_t *par
|
|||||||
if (!hltvserver->GetDemoRecorder()->IsRecording())
|
if (!hltvserver->GetDemoRecorder()->IsRecording())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
char *pDemoFile = hltvserver->GetDemoFileName();
|
||||||
char *pDemoFile = (char *)hltvserver->GetDemoRecorder()->GetDemoFile() + 4;
|
|
||||||
#else
|
|
||||||
char *pDemoFile = (char *)hltvserver->GetDemoRecorder()->GetDemoFile();
|
|
||||||
#endif
|
|
||||||
if (!pDemoFile)
|
if (!pDemoFile)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
{
|
{
|
||||||
"library" "engine"
|
"library" "engine"
|
||||||
"linux" "@_ZN11CHLTVServer24GetRecordingDemoFilenameEv"
|
"linux" "@_ZN11CHLTVServer24GetRecordingDemoFilenameEv"
|
||||||
"windows" "\x8B\x81\x2A\x2A\x2A\x2A\x81\xC1\x2A\x2A\x2A\x2A\xFF\x10"
|
"windows" "\x8B\x81\x2A\x2A\x2A\x2A\x81\xC1\x2A\x2A\x2A\x2A\x8B\x40\x2A\xFF\xE0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartRecording and StopRecording are virtual, but get called directly in the linux binary..
|
// StartRecording and StopRecording are virtual, but get called directly in the linux binary..
|
||||||
|
Loading…
Reference in New Issue
Block a user