mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
segment fault repaired (don't nest others' function thoughtless)
This commit is contained in:
parent
a71339366b
commit
562dffe800
|
@ -3331,7 +3331,7 @@ void CClient::StartVideo(IConsole::IResult *pResult, void *pUserData, const char
|
|||
if (pSelf->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
pSelf->m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "videorecorder", "Can not start videorecorder outside of demoplayer.");
|
||||
|
||||
//pSelf->m_pConsole->Print(IConsole::OUTPUT_LEVEL_DEBUG, "demo_render", pVideoName);
|
||||
pSelf->m_pConsole->Print(IConsole::OUTPUT_LEVEL_DEBUG, "demo_render", pVideoName);
|
||||
if (!IVideo::Current())
|
||||
{
|
||||
new CVideo((CGraphics_Threaded*)pSelf->m_pGraphics, pSelf->Storage(), pSelf->m_pConsole, pSelf->Graphics()->ScreenWidth(), pSelf->Graphics()->ScreenHeight(), pVideoName);
|
||||
|
@ -3530,11 +3530,65 @@ const char *CClient::DemoPlayer_Play(const char *pFilename, int StorageType)
|
|||
}
|
||||
|
||||
const char *CClient::DemoPlayer_Render(const char *pFilename, int StorageType, const char *pVideoName)
|
||||
{
|
||||
int Crc;
|
||||
const char *pError;
|
||||
Disconnect();
|
||||
m_NetClient[0].ResetErrorString();
|
||||
|
||||
// try to start playback
|
||||
m_DemoPlayer.SetListener(this);
|
||||
|
||||
if(m_DemoPlayer.Load(Storage(), m_pConsole, pFilename, StorageType))
|
||||
return "error loading demo";
|
||||
|
||||
// load map
|
||||
Crc = (m_DemoPlayer.Info()->m_Header.m_aMapCrc[0]<<24)|
|
||||
(m_DemoPlayer.Info()->m_Header.m_aMapCrc[1]<<16)|
|
||||
(m_DemoPlayer.Info()->m_Header.m_aMapCrc[2]<<8)|
|
||||
(m_DemoPlayer.Info()->m_Header.m_aMapCrc[3]);
|
||||
pError = LoadMapSearch(m_DemoPlayer.Info()->m_Header.m_aMapName, 0, Crc);
|
||||
if(pError)
|
||||
{
|
||||
DisconnectWithReason(pError);
|
||||
return pError;
|
||||
}
|
||||
|
||||
GameClient()->OnConnected();
|
||||
|
||||
// setup buffers
|
||||
mem_zero(m_aDemorecSnapshotData, sizeof(m_aDemorecSnapshotData));
|
||||
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] = &m_aDemorecSnapshotHolders[SNAP_CURRENT];
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV] = &m_aDemorecSnapshotHolders[SNAP_PREV];
|
||||
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_pSnap = (CSnapshot *)m_aDemorecSnapshotData[SNAP_CURRENT][0];
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_pAltSnap = (CSnapshot *)m_aDemorecSnapshotData[SNAP_CURRENT][1];
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_SnapSize = 0;
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_Tick = -1;
|
||||
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_pSnap = (CSnapshot *)m_aDemorecSnapshotData[SNAP_PREV][0];
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_pAltSnap = (CSnapshot *)m_aDemorecSnapshotData[SNAP_PREV][1];
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_SnapSize = 0;
|
||||
m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_Tick = -1;
|
||||
|
||||
// enter demo playback state
|
||||
SetState(IClient::STATE_DEMOPLAYBACK);
|
||||
|
||||
this->CClient::StartVideo(NULL, this, pVideoName);
|
||||
m_DemoPlayer.Play();
|
||||
//m_pConsole->Print(IConsole::OUTPUT_LEVEL_DEBUG, "demo_recorder", "demo eof");
|
||||
GameClient()->OnEnterGame();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
{
|
||||
DemoPlayer_Play(pFilename, StorageType);
|
||||
//m_pConsole->Print(IConsole::OUTPUT_LEVEL_DEBUG, "demo_recorder", pVideoName);
|
||||
this->CClient::StartVideo(NULL, this, pVideoName);
|
||||
}
|
||||
*/
|
||||
|
||||
void CClient::Con_Play(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ void CVideo::start()
|
|||
char aDate[20];
|
||||
str_timestamp(aDate, sizeof(aDate));
|
||||
char aBuf[256];
|
||||
if (strlen(m_Name) == 0)
|
||||
if (strlen(m_Name) != 0)
|
||||
str_format(aBuf, sizeof(aBuf), "videos/%s", m_Name);
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "videos/%s.mp4", aDate);
|
||||
|
|
Loading…
Reference in a new issue