Safe Memory Patching

Using `baseserver.h` (https://github.com/L4D-Community/Left4Downtown2/blob/master/extension/l4d2sdk/baseserver.h) instead of hardcoded offsets. Thanks @A1mDev
This commit is contained in:
Accelerator
2025-07-12 17:08:37 +03:00
parent e235106c86
commit 11ab6e1e54
7 changed files with 299 additions and 71 deletions

View File

@ -2,19 +2,23 @@
#define _INCLUDE_GAME_OFFSETS_
#if SH_SYS == SH_SYS_WIN32
int maxplayers_offs = 138; // m_nMaxClientsLimit (in CGameServer::SetMaxClients)
#if SOURCE_ENGINE == SE_LEFT4DEAD
#include "l4d1_offsets_win32.h"
const int maxplayers_offs = 0x228; // m_nMaxClientsLimit (in CGameServer::SetMaxClients)
#if SOURCE_ENGINE == SE_LEFT4DEAD
const int sv_offs = 6; // IServer pointer (in IVEngineServer::CreateFakeClient)
const int maxhuman_idx = 131; // CTerrorGameRules::GetMaxHumanPlayers vtable
#else
const int sv_offs = 8; // IServer pointer (in IVEngineServer::CreateFakeClient)
const int maxhuman_idx = 136; // CTerrorGameRules::GetMaxHumanPlayers vtable
#endif
#else
#include "l4d2_offsets_win32.h"
#endif
#else
int maxplayers_offs = 136; // m_nMaxClientsLimit (in CGameServer::SetMaxClients)
#if SOURCE_ENGINE == SE_LEFT4DEAD
#include "l4d1_offsets_linux.h"
#else
#include "l4d2_offsets_linux.h"
#endif
const int maxplayers_offs = 0x220; // m_nMaxClientsLimit (in CGameServer::SetMaxClients)
#if SOURCE_ENGINE == SE_LEFT4DEAD
const char* engine_dll = "engine.so";
const int maxhuman_idx = 132; // CTerrorGameRules::GetMaxHumanPlayers vtable
#else
const char* engine_dll = "engine_srv.so";
const int maxhuman_idx = 137; // CTerrorGameRules::GetMaxHumanPlayers vtable
#endif
#endif
#endif //_INCLUDE_GAME_OFFSETS_