mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* Add CServerGameDLL interface to SDK (unfinished) * Inline all CHostState members. Calling discrete member functions will result in a corrupt stack. It also alters with the VTable layout in the engine since we assign our SDK instance directly to it. Forcing everything to be inline (like the assembled counterpart within the executable itself) will ensure no virtual calls will get created and misalign the base VTable. * Patch SQVM_CompileError to call SQVM_Error with the severity flag set to false (0 = do not terminate process, 1 is terminate process).
61 lines
2.3 KiB
C++
61 lines
2.3 KiB
C++
//=============================================================================//
|
|
//
|
|
// Purpose: Implement things from GameInterface.cpp. Mostly the engine interfaces.
|
|
//
|
|
// $NoKeywords: $
|
|
//=============================================================================//
|
|
|
|
#include "core/stdafx.h"
|
|
#include "engine/sv_main.h"
|
|
#include "game/server/gameinterface.h"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// This is called when a new game is started. (restart, map)
|
|
//-----------------------------------------------------------------------------
|
|
void CServerGameDLL::GameInit(void)
|
|
{
|
|
static int index = 1;
|
|
CallVFunc<void>(index, this);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// This is called when scripts are getting recompiled. (restart, map, changelevel)
|
|
//-----------------------------------------------------------------------------
|
|
void CServerGameDLL::PrecompileScriptsJob(void)
|
|
{
|
|
static int index = 2;
|
|
CallVFunc<void>(index, this);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Called when a level is shutdown (including changing levels)
|
|
//-----------------------------------------------------------------------------
|
|
void CServerGameDLL::LevelShutdown(void)
|
|
{
|
|
static int index = 8;
|
|
CallVFunc<void>(index, this);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// This is called when a game ends (server disconnect, death, restart, load)
|
|
// NOT on level transitions within a game
|
|
//-----------------------------------------------------------------------------
|
|
void CServerGameDLL::GameShutdown(void)
|
|
{
|
|
static int index = 9;
|
|
CallVFunc<void>(index, this);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Gets the simulation tick interfal
|
|
// Output : float
|
|
//-----------------------------------------------------------------------------
|
|
float CServerGameDLL::GetTickInterval(void)
|
|
{
|
|
static int index = 11;
|
|
return CallVFunc<float>(index, this);
|
|
}
|
|
|
|
// Pointer to CServerGameDLL virtual function table.
|
|
CServerGameDLL* g_pServerGameDLL = reinterpret_cast<CServerGameDLL*>(p_SV_CreateBaseline.Offset(0x0).FindPatternSelf("48 8B", ADDRESS::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).Deref().GetPtr());
|