From f4b263b41240a106debe235a2dd198ab3cf0375a Mon Sep 17 00:00:00 2001
From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>
Date: Tue, 5 Apr 2022 01:13:27 +0200
Subject: [PATCH] Cleanup
---
r5dev/engine/net_chan.h | 4 ++--
r5dev/game/client/c_baseentity.h | 7 +++++++
r5dev/server/vengineserver_impl.cpp | 2 +-
r5dev/tier0/completion.cpp | 24 ++++++++++--------------
r5dev/vproj/clientsdk.vcxproj | 1 +
r5dev/vproj/clientsdk.vcxproj.filters | 9 +++++++++
r5dev/vproj/gamesdk.vcxproj | 1 +
r5dev/vproj/gamesdk.vcxproj.filters | 6 ++++++
8 files changed, 37 insertions(+), 17 deletions(-)
create mode 100644 r5dev/game/client/c_baseentity.h
diff --git a/r5dev/engine/net_chan.h b/r5dev/engine/net_chan.h
index 14a6a0e2..791a33b9 100644
--- a/r5dev/engine/net_chan.h
+++ b/r5dev/engine/net_chan.h
@@ -15,7 +15,7 @@
#include "public/include/inetchannel.h"
#define NET_FRAMES_BACKUP 128
-#define NET_LEN_CHANNELNAME 32
+#define NET_CHANNELNAME_MAXLEN 32
#define NET_FRAMES_MASK (NET_FRAMES_BACKUP-1)
//-----------------------------------------------------------------------------
@@ -160,7 +160,7 @@ private:
int m_nSequencesSkipped_MAYBE;
int m_nSessionRecvs;
uint32_t m_nLiftimeRecvs;
- char m_Name[NET_LEN_CHANNELNAME];
+ char m_Name[NET_CHANNELNAME_MAXLEN];
uint8_t m_bRetrySendLong;
v_netadr_t remote_address;
};
diff --git a/r5dev/game/client/c_baseentity.h b/r5dev/game/client/c_baseentity.h
new file mode 100644
index 00000000..4057f321
--- /dev/null
+++ b/r5dev/game/client/c_baseentity.h
@@ -0,0 +1,7 @@
+#ifndef C_BASEENTITY_H
+#define C_BASEENTITY_H
+
+// How many data slots to use when in multiplayer.
+#define MULTIPLAYER_BACKUP 750
+
+#endif // C_BASEENTITY_H
diff --git a/r5dev/server/vengineserver_impl.cpp b/r5dev/server/vengineserver_impl.cpp
index da277fdd..0d34d53e 100644
--- a/r5dev/server/vengineserver_impl.cpp
+++ b/r5dev/server/vengineserver_impl.cpp
@@ -23,7 +23,7 @@ bool HIVEngineServer__PersistenceAvailable(void* entidx, int clientidx)
{
CNetChan* pNetChan = pClient->GetNetChan();
- string svClientName(pNetChan->GetName(), NET_LEN_CHANNELNAME);
+ string svClientName(pNetChan->GetName(), NET_CHANNELNAME_MAXLEN);
string svIpAddress = pNetChan->GetAddress();
int64_t nOriginID = pClient->GetOriginID();
diff --git a/r5dev/tier0/completion.cpp b/r5dev/tier0/completion.cpp
index 47d0d931..d630efae 100644
--- a/r5dev/tier0/completion.cpp
+++ b/r5dev/tier0/completion.cpp
@@ -13,6 +13,7 @@
#include "engine/cl_rcon.h"
#endif // !DEDICATED
#include "engine/net.h"
+#include "engine/net_chan.h"
#include "engine/sys_utils.h"
#include "engine/baseclient.h"
#include "rtech/rtech_game.h"
@@ -66,31 +67,26 @@ void _Kick_f_CompletionFunc(const CCommand& args)
for (int i = 0; i < MAX_PLAYERS; i++)
{
- CBaseClient* client = g_pClient->GetClient(i);
- if (!client)
+ CBaseClient* pClient = g_pClient->GetClient(i);
+ CNetChan* pNetChan = pClient->GetNetChan();
+ if (!pClient || !pNetChan)
{
continue;
}
- if (!client->GetNetChan())
+ std::string svClientName(pNetChan->GetName(), NET_CHANNELNAME_MAXLEN); // Get full name.
+
+ if (svClientName.empty())
{
continue;
}
- void* clientNamePtr = (void**)(((std::uintptr_t)client->GetNetChan()) + 0x1A8D); // Get client name from netchan.
- std::string clientName((char*)clientNamePtr, 32); // Get full name.
-
- if (clientName.empty())
+ if (strcmp(args.Arg(1), svClientName.c_str()) != 0) // Our wanted name?
{
continue;
}
- if (strcmp(args.Arg(1), clientName.c_str()) != 0) // Our wanted name?
- {
- continue;
- }
-
- NET_DisconnectClient(client, i, "Kicked from Server", 0, 1);
+ NET_DisconnectClient(pClient, i, "Kicked from Server", 0, 1);
}
}
@@ -183,7 +179,7 @@ void _Ban_f_CompletionFunc(const CCommand& args)
continue;
}
- std::string svClientName(pNetChan->GetName(), NET_LEN_CHANNELNAME); // Get full name.
+ std::string svClientName(pNetChan->GetName(), NET_CHANNELNAME_MAXLEN); // Get full name.
if (svClientName.empty())
{
diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj
index ec53a0a1..6fa7c52a 100644
--- a/r5dev/vproj/clientsdk.vcxproj
+++ b/r5dev/vproj/clientsdk.vcxproj
@@ -137,6 +137,7 @@
+
diff --git a/r5dev/vproj/clientsdk.vcxproj.filters b/r5dev/vproj/clientsdk.vcxproj.filters
index 2f1709e4..7478b085 100644
--- a/r5dev/vproj/clientsdk.vcxproj.filters
+++ b/r5dev/vproj/clientsdk.vcxproj.filters
@@ -157,6 +157,12 @@
{cbbed3bf-8879-4269-a518-c526199d95af}
+
+ {45d6a508-a869-4d81-8701-9e4125ed1f7e}
+
+
+ {0b043c41-b53e-44f5-9cbe-7501fcf22478}
+
@@ -1133,6 +1139,9 @@
sdk\client
+
+ sdk\game\client
+
diff --git a/r5dev/vproj/gamesdk.vcxproj b/r5dev/vproj/gamesdk.vcxproj
index ea1e9b91..d4d4d138 100644
--- a/r5dev/vproj/gamesdk.vcxproj
+++ b/r5dev/vproj/gamesdk.vcxproj
@@ -147,6 +147,7 @@
+
diff --git a/r5dev/vproj/gamesdk.vcxproj.filters b/r5dev/vproj/gamesdk.vcxproj.filters
index 1be4070e..02147ef0 100644
--- a/r5dev/vproj/gamesdk.vcxproj.filters
+++ b/r5dev/vproj/gamesdk.vcxproj.filters
@@ -166,6 +166,9 @@
{2535a97c-967a-40af-bb52-02033747b4f0}
+
+ {be813705-b786-4439-b785-eff6bb5f194f}
+
@@ -1199,6 +1202,9 @@
sdk\tier1
+
+ sdk\game\client
+