aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/engine
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/engine')
-rw-r--r--NorthstarDLL/engine/r2engine.cpp4
-rw-r--r--NorthstarDLL/engine/r2engine.h60
-rw-r--r--NorthstarDLL/engine/runframe.cpp2
3 files changed, 66 insertions, 0 deletions
diff --git a/NorthstarDLL/engine/r2engine.cpp b/NorthstarDLL/engine/r2engine.cpp
index 22884a73..eaa392c8 100644
--- a/NorthstarDLL/engine/r2engine.cpp
+++ b/NorthstarDLL/engine/r2engine.cpp
@@ -21,6 +21,8 @@ namespace R2
char* g_pModName =
nullptr; // we cant set this up here atm since we dont have an offset to it in engine, instead we store it in IsRespawnMod
+
+ CGlobalVars* g_pGlobals;
} // namespace R2
ON_DLL_LOAD("engine.dll", R2Engine, (CModule module))
@@ -37,4 +39,6 @@ ON_DLL_LOAD("engine.dll", R2Engine, (CModule module))
g_pClientArray = module.Offset(0x12A53F90).As<CBaseClient*>();
g_pServerState = module.Offset(0x12A53D48).As<server_state_t*>();
+
+ g_pGlobals = module.Offset(0x7C6F70).As<CGlobalVars*>();
}
diff --git a/NorthstarDLL/engine/r2engine.h b/NorthstarDLL/engine/r2engine.h
index bc242201..ff8876b8 100644
--- a/NorthstarDLL/engine/r2engine.h
+++ b/NorthstarDLL/engine/r2engine.h
@@ -201,4 +201,64 @@ namespace R2
extern server_state_t* g_pServerState;
extern char* g_pModName;
+
+ // clang-format off
+ OFFSET_STRUCT(CGlobalVars)
+ {
+ FIELD(0x0,
+ // Absolute time (per frame still - Use Plat_FloatTime() for a high precision real time
+ // perf clock, but not that it doesn't obey host_timescale/host_framerate)
+ double m_flRealTime);
+
+ FIELDS(0x8,
+ // Absolute frame counter - continues to increase even if game is paused
+ int m_nFrameCount;
+
+ // Non-paused frametime
+ float m_flAbsoluteFrameTime;
+
+ // Current time
+ //
+ // On the client, this (along with tickcount) takes a different meaning based on what
+ // piece of code you're in:
+ //
+ // - While receiving network packets (like in PreDataUpdate/PostDataUpdate and proxies),
+ // this is set to the SERVER TICKCOUNT for that packet. There is no interval between
+ // the server ticks.
+ // [server_current_Tick * tick_interval]
+ //
+ // - While rendering, this is the exact client clock
+ // [client_current_tick * tick_interval + interpolation_amount]
+ //
+ // - During prediction, this is based on the client's current tick:
+ // [client_current_tick * tick_interval]
+ float m_flCurTime;
+ )
+
+ FIELDS(0x30,
+ // Time spent on last server or client frame (has nothing to do with think intervals)
+ float m_flFrameTime;
+
+ // current maxplayers setting
+ int m_nMaxClients;
+ )
+
+ FIELDS(0x3C,
+ // Simulation ticks - does not increase when game is paused
+ uint32_t m_nTickCount; // this is weird and doesn't seem to increase once per frame?
+
+ // Simulation tick interval
+ float m_flTickInterval;
+ )
+
+ FIELDS(0x60,
+ const char* m_pMapName;
+ int m_nMapVersion;
+ )
+
+ //FIELD(0x98, double m_flRealTime); // again?
+ };
+ // clang-format on
+
+ extern CGlobalVars* g_pGlobals;
} // namespace R2
diff --git a/NorthstarDLL/engine/runframe.cpp b/NorthstarDLL/engine/runframe.cpp
index d81356f2..3df93f54 100644
--- a/NorthstarDLL/engine/runframe.cpp
+++ b/NorthstarDLL/engine/runframe.cpp
@@ -5,6 +5,7 @@
#include "server/serverpresence.h"
AUTOHOOK_INIT()
+
// clang-format off
AUTOHOOK(CEngine__Frame, engine.dll + 0x1C8650,
void, __fastcall, (R2::CEngine* self))
@@ -12,6 +13,7 @@ void, __fastcall, (R2::CEngine* self))
{
CEngine__Frame(self);
}
+
ON_DLL_LOAD("engine.dll", RunFrame, (CModule module))
{
AUTOHOOK_DISPATCH()