mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Originally, we store the search results in a CMemory instance which we then assign to the actual function pointer. CMemory is just a pointer class; we can assign the results directly to the actual function pointer. This commit reduces a lot of code verbosity, and also reduced roughly 2KiB worth of static pointers in the resulting executable. This commit also officially deprecates the support for any GameDLL's below S3 (Season 3), since it makes more sense to port the assets from earlier/later games back to the version this SDK supports.
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#include "core/stdafx.h"
|
|
#include "tier1/cvar.h"
|
|
#include "sys_engine.h"
|
|
#ifdef DEDICATED
|
|
#include "game/shared/shareddefs.h"
|
|
#endif // DEDICATED
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
CEngine* g_pEngine = nullptr;
|
|
IEngine::QuitState_t* gsm_Quitting = nullptr;
|
|
|
|
bool CEngine::_Frame(CEngine* thisp)
|
|
{
|
|
#ifdef DEDICATED
|
|
|
|
// The first engine frame is ran before the global variables are initialized.
|
|
// By default, the tick interval is set to '0.0f'; we can't divide by zero.
|
|
if (TICK_INTERVAL > 0.0f)
|
|
{
|
|
int nTickRate = TIME_TO_TICKS(1.0f);
|
|
if (fps_max->GetInt() != nTickRate)
|
|
{
|
|
// Clamp the framerate of the server to its simulation tick rate.
|
|
// This saves a significant amount of CPU time in CEngine::Frame,
|
|
// as the engine uses this to decided when to run a new frame.
|
|
fps_max->SetValue(nTickRate);
|
|
}
|
|
}
|
|
|
|
#endif // DEDICATED
|
|
return CEngine__Frame(thisp);
|
|
}
|
|
|
|
void VEngine::Detour(const bool bAttach) const
|
|
{
|
|
DetourSetup(&CEngine__Frame, &CEngine::_Frame, bAttach);
|
|
}
|