From 236eb861d55ebd0444eaf18bce6f889bcb0be4b8 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 12 Feb 2023 11:32:05 +0100 Subject: [PATCH] Add global netadr to SDK Global from engine used in the 'status' command etc.. --- r5dev/engine/net.cpp | 1 + r5dev/engine/net.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/r5dev/engine/net.cpp b/r5dev/engine/net.cpp index b90ab9c1..fb4dc890 100644 --- a/r5dev/engine/net.cpp +++ b/r5dev/engine/net.cpp @@ -301,5 +301,6 @@ void VNet::Detach() const } /////////////////////////////////////////////////////////////////////////////// +netadr_t* g_pNetAdr = nullptr; netkey_t* g_pNetKey = nullptr; #endif // !NETCONSOLE diff --git a/r5dev/engine/net.h b/r5dev/engine/net.h index 90bf551f..8d044374 100644 --- a/r5dev/engine/net.h +++ b/r5dev/engine/net.h @@ -46,6 +46,7 @@ void NET_Shutdown(void* thisptr, const char* szReason, uint8_t bBadRep, bool bRe void NET_RemoveChannel(CClient* pClient, int nIndex, const char* szReason, uint8_t bBadRep, bool bRemoveNow); /////////////////////////////////////////////////////////////////////////////// +extern netadr_t* g_pNetAdr; extern netkey_t* g_pNetKey; /////////////////////////////////////////////////////////////////////////////// @@ -59,6 +60,7 @@ class VNet : public IDetour LogFunAdr("NET_ReceiveDatagram", p_NET_ReceiveDatagram.GetPtr()); LogFunAdr("NET_SendDatagram", p_NET_SendDatagram.GetPtr()); LogFunAdr("NET_PrintFunc", p_NET_PrintFunc.GetPtr()); + LogVarAdr("g_NetAdr", reinterpret_cast(g_pNetAdr)); LogVarAdr("g_NetKey", reinterpret_cast(g_pNetKey)); } virtual void GetFun(void) const @@ -85,6 +87,7 @@ class VNet : public IDetour } virtual void GetVar(void) const { + g_pNetAdr = g_GameDll.FindPatternSIMD("C7 05 ?? ?? ?? ?? ?? ?? ?? ?? 48 89 05 ?? ?? ?? ?? 48 89 05 ?? ?? ?? ?? 66 89 05 ?? ?? ?? ?? 88 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 33 C0").ResolveRelativeAddressSelf(0x2, 0xA).RCast(); g_pNetKey = g_GameDll.FindString("client:NetEncryption_NewKey").FindPatternSelf("48 8D ?? ?? ?? ?? ?? 48 3B", CMemory::Direction::UP, 300).ResolveRelativeAddressSelf(0x3, 0x7).RCast(); } virtual void GetCon(void) const { }