2022-02-27 03:15:00 +01:00
|
|
|
#pragma once
|
2022-08-09 17:18:07 +02:00
|
|
|
#include "public/globalvars_base.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2022-05-20 11:52:19 +02:00
|
|
|
#include "engine/server/sv_main.h"
|
2022-03-27 22:17:30 +02:00
|
|
|
#endif // !CLIENT_DLL
|
2022-02-27 03:15:00 +01:00
|
|
|
|
2023-01-16 21:09:21 +01:00
|
|
|
typedef uint16_t edict_t;
|
2023-04-08 19:02:14 +02:00
|
|
|
#define FL_EDICT_INVALID 0xFFFF/*-1*/
|
2022-02-27 03:15:00 +01:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: Defines the ways that a map can be loaded.
|
|
|
|
// Note : Only seems to get set and checked on 0 and 2: [r5apex_ds.exe + d55990d] for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
enum MapLoadType_t
|
|
|
|
{
|
|
|
|
MapLoad_NewGame = 0,
|
|
|
|
MapLoad_Background = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: Global variables shared between the engine and the game .dll
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class CGlobalVars : public CGlobalVarsBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Current map
|
|
|
|
const char* m_pszMapName;
|
|
|
|
int m_nMapVersion;
|
|
|
|
const char* m_pszStartSpot; // Seems empty at all times.
|
|
|
|
MapLoadType_t m_eLoadType; // How the current map was loaded.
|
|
|
|
bool m_bMapLoadFailed; // Map has failed to load, we need to kick back to the main menu (unused?).
|
|
|
|
|
2023-02-12 15:06:08 +01:00
|
|
|
int64_t* m_pEdicts; // r5apex_ds.exe 'CBaseServer::Clear() + 0x7E'
|
2022-03-16 01:38:00 +01:00
|
|
|
void* m_pUnk1; // r5apex_ds.exe 'CBaseServer::Clear() + 0x93'
|
|
|
|
void* m_pUnk2; // r5apex_ds.exe 'CServer::FrameJob() + 0x20'
|
2022-02-27 03:15:00 +01:00
|
|
|
void* m_pUnk3;
|
|
|
|
}; // Size 0x0098
|
2023-02-12 14:57:39 +01:00
|
|
|
static_assert(sizeof(CGlobalVars) == 0x98);
|
2022-02-27 03:15:00 +01:00
|
|
|
|
2022-03-27 22:17:30 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CGlobalVars* g_ServerGlobalVariables = nullptr;
|
2022-03-27 22:17:30 +02:00
|
|
|
#endif // !CLIENT_DLL
|
2022-02-27 03:15:00 +01:00
|
|
|
#ifndef DEDICATED
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CGlobalVarsBase* g_ClientGlobalVariables = nullptr;
|
2022-02-27 03:15:00 +01:00
|
|
|
#endif // !DEDICATED
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-13 14:53:25 +02:00
|
|
|
class VEdict : public IDetour
|
2022-02-27 03:15:00 +01:00
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2022-02-27 03:15:00 +01:00
|
|
|
{
|
2022-03-27 22:17:30 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2023-01-25 02:26:52 +01:00
|
|
|
LogVarAdr("g_ServerGlobalVariables", reinterpret_cast<uintptr_t>(g_ServerGlobalVariables));
|
2022-03-27 22:17:30 +02:00
|
|
|
#endif // !CLIENT_DLL
|
2022-02-27 03:15:00 +01:00
|
|
|
#ifndef DEDICATED
|
2023-01-25 02:26:52 +01:00
|
|
|
LogVarAdr("g_ClientGlobalVariables", reinterpret_cast<uintptr_t>(g_ClientGlobalVariables));
|
2022-02-27 03:15:00 +01:00
|
|
|
#endif // !DEDICATED
|
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetFun(void) const { }
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetVar(void) const
|
|
|
|
{
|
|
|
|
#ifndef CLIENT_DLL
|
2022-12-01 22:44:55 +01:00
|
|
|
g_ServerGlobalVariables = g_GameDll.FindPatternSIMD("48 81 EC ?? ?? ?? ?? E8 ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 0F 85 ?? ?? ?? ??")
|
2022-04-18 03:35:08 +02:00
|
|
|
.FindPatternSelf("48 8D ?? ?? ?? ?? 01", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CGlobalVars*>();
|
|
|
|
#endif // !CLIENT_DLL
|
|
|
|
#ifndef DEDICATED
|
|
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
2022-12-01 22:44:55 +01:00
|
|
|
g_ClientGlobalVariables = g_GameDll.FindPatternSIMD("48 8B C4 57 41 54 41 55 41 56 41 57 48 83 EC 60 48 C7 40 ?? ?? ?? ?? ?? 48 89 58 08")
|
2022-04-18 03:35:08 +02:00
|
|
|
.FindPatternSelf("4C 8D ?? ?? ?? ?? 01", CMemory::Direction::DOWN, 8000).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CGlobalVarsBase*>();
|
|
|
|
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
2022-12-01 22:44:55 +01:00
|
|
|
g_ClientGlobalVariables = g_GameDll.FindPatternSIMD("48 8B C4 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 60")
|
2022-04-18 03:35:08 +02:00
|
|
|
.FindPatternSelf("4C 8D ?? ?? ?? ?? 01", CMemory::Direction::DOWN, 8000).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CGlobalVarsBase*>();
|
|
|
|
#endif // GAME_DLL
|
|
|
|
#endif // !DEDICATED
|
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetCon(void) const { }
|
|
|
|
virtual void Attach(void) const { }
|
|
|
|
virtual void Detach(void) const { }
|
2022-02-27 03:15:00 +01:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|