r5sdk/r5dev/game/server/gameinterface.h

86 lines
3.4 KiB
C
Raw Normal View History

//=============================================================================//
//
// Purpose: Interface server dll virtual functions to the SDK.
//
// $NoKeywords: $
//=============================================================================//
#include "public/eiface.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
2022-12-03 02:57:11 +01:00
class ServerClass;
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
class CServerGameDLL
{
public:
void GameInit(void);
void PrecompileScriptsJob(void);
void LevelShutdown(void);
void GameShutdown(void);
float GetTickInterval(void);
2022-12-03 02:57:11 +01:00
ServerClass* GetAllServerClasses(void);
static void __fastcall OnReceivedSayTextMessage(void* thisptr, int senderId, const char* text, bool isTeamChat);
};
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
class CServerGameClients : public IServerGameClients
{
};
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
class CServerGameEnts : public IServerGameEnts
{
};
inline CMemory p_CServerGameDLL__OnReceivedSayTextMessage;
inline auto CServerGameDLL__OnReceivedSayTextMessage = p_CServerGameDLL__OnReceivedSayTextMessage.RCast<void(__fastcall*)(void* thisptr, int senderId, const char* text, bool isTeamChat)>();
extern CServerGameDLL* g_pServerGameDLL;
extern CServerGameClients* g_pServerGameClients;
extern CServerGameEnts* g_pServerGameEntities;
2023-01-17 11:21:10 +01:00
extern CGlobalVars* g_pGlobals;
void CServerGameDLL_Attach();
void CServerGameDLL_Detach();
///////////////////////////////////////////////////////////////////////////////
class VServerGameDLL : public IDetour
{
virtual void GetAdr(void) const
{
2022-09-21 21:07:43 +02:00
spdlog::debug("| FUN: OnReceivedSayTextMessage : {:#18x} |\n", p_CServerGameDLL__OnReceivedSayTextMessage.GetPtr());
spdlog::debug("| VAR: g_pServerGameDLL : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pServerGameDLL));
spdlog::debug("| VAR: g_pServerGameClients : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pServerGameClients));
spdlog::debug("| VAR: g_pServerGameEntities : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pServerGameEntities));
2023-01-17 11:21:10 +01:00
spdlog::debug("| VAR: g_pGlobals : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pGlobals));
spdlog::debug("+----------------------------------------------------------------+\n");
}
virtual void GetFun(void) const
{
#if defined(GAMEDLL_S3)
p_CServerGameDLL__OnReceivedSayTextMessage = g_GameDll.FindPatternSIMD("85 D2 0F 8E ?? ?? ?? ?? 4C 8B DC");
CServerGameDLL__OnReceivedSayTextMessage = p_CServerGameDLL__OnReceivedSayTextMessage.RCast<void(__fastcall*)(void* thisptr, int senderId, const char* text, bool isTeamChat)>();
#endif
}
2023-01-17 11:21:10 +01:00
virtual void GetVar(void) const
{
g_pGlobals = g_GameDll.FindPatternSIMD("4C 8B 0D ? ? ? ? 48 8B D1").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CGlobalVars*>();
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }
virtual void Detach(void) const { }
};
///////////////////////////////////////////////////////////////////////////////
REGISTER(VServerGameDLL);