2022-08-19 21:33:31 +02:00
|
|
|
|
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ========//
|
|
|
|
|
//
|
|
|
|
|
// Purpose:
|
|
|
|
|
//
|
|
|
|
|
// $NoKeywords: $
|
|
|
|
|
//=============================================================================//
|
|
|
|
|
|
|
|
|
|
#include "core/stdafx.h"
|
|
|
|
|
#include "tier0/frametask.h"
|
|
|
|
|
#include "engine/host.h"
|
2022-09-11 23:48:11 +02:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
#include "vgui/vgui_debugpanel.h"
|
|
|
|
|
#endif // !DEDICATED
|
2022-08-19 21:33:31 +02:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
==================
|
|
|
|
|
_Host_RunFrame
|
|
|
|
|
|
|
|
|
|
Runs all active servers
|
|
|
|
|
==================
|
|
|
|
|
*/
|
|
|
|
|
void _Host_RunFrame(void* unused, float time)
|
|
|
|
|
{
|
2022-09-11 23:48:11 +02:00
|
|
|
|
for (IFrameTask* const& task : g_FrameTasks)
|
2022-08-19 21:33:31 +02:00
|
|
|
|
{
|
|
|
|
|
task->RunFrame();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_FrameTasks.erase(std::remove_if(g_FrameTasks.begin(), g_FrameTasks.end(), [](const IFrameTask* task)
|
|
|
|
|
{
|
|
|
|
|
return task->IsFinished();
|
|
|
|
|
}), g_FrameTasks.end());
|
|
|
|
|
|
2022-09-11 23:48:11 +02:00
|
|
|
|
#ifndef DEDICATED
|
|
|
|
|
g_pLogSystem.ShouldDraw(time);
|
|
|
|
|
#endif // !DEDICATED
|
|
|
|
|
|
2022-08-19 21:33:31 +02:00
|
|
|
|
return v_Host_RunFrame(unused, time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
void Host_Attach()
|
|
|
|
|
{
|
|
|
|
|
DetourAttach((LPVOID*)&v_Host_RunFrame, &_Host_RunFrame);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Host_Detach()
|
|
|
|
|
{
|
|
|
|
|
DetourDetach((LPVOID*)&v_Host_RunFrame, &_Host_RunFrame);
|
|
|
|
|
}
|