r5sdk/r5dedicated/csourceappsystemgroup.cpp
Amos b42e85b1f4 First work-in-progress dedicated implementation
Based on MrSteyk's dedicated patch.
Additional patches targets the disabling of the client.dll library and VGUI. The disabling of the client.dll library initialization caused several issues to be investigated still (currently loops fine in _Host_RunFrame()). but executing a map command currently makes it only load the mp_common VPK before getting stuck somewhere. Setting hoststate to a valid map with HS_NEW_GAME (manually) does something to the engine but does not force the server to load anything yet.

Added enums and classes from r5dev project.
2021-09-12 16:41:30 -07:00

36 lines
1.4 KiB
C++

#include "pch.h"
#include "hooks.h"
namespace Hooks
{
CSourceAppSystemGroup_CreateFn originalCSourceAppSystemGroup_Create = nullptr;
}
auto g_bIsDedicated = (uint8_t*)0x162C61208;
//-----------------------------------------------------------------------------
// Purpose: sets 'EbisuSDK' globals required in certain engine callbacks.
//-----------------------------------------------------------------------------
void HEbisuSDK_Init()
{
auto ofs000 = (uint8_t*)0x1634F1690;
auto ofs001 = (uint8_t*)0x1634F16B0;
auto ofs002 = (uint8_t*)0x1634F1695;
auto ofs003 = (uint8_t*)0x1634F30D8;
auto ofs004 = (uint8_t*)0x1634F31D8;
*(char*)(ofs000) = (char)0x1; // <-- | 1st EbisuSDK boolean to be checked.
*(char*)(ofs001) = (char)0x1; // <-- | 2nd EbisuSDK boolean to be checked.
*(char*)(ofs002) = (char)0x1; // <-- | 3rd EbisuSDK boolean to be checked.
*(char*)(ofs003) = (char)0x1; // <-- | Gets tested on listenserver for certain ConCommands.
*(char*)(ofs004) = (char)0x0; // <-- | TODO: enforces Necleus cvars when not equal to NULL.
}
//-----------------------------------------------------------------------------
// Purpose: hook 'SourceAppSystemGroup::Create' and set m_bIsDedicated to true.
//-----------------------------------------------------------------------------
char __fastcall Hooks::CSourceAppSystemGroup_Create(__int64 a1)
{
*g_bIsDedicated = 1; // HAS TO BE HERE!!!
HEbisuSDK_Init();
return originalCSourceAppSystemGroup_Create(a1);
}