Initial Hooking of functions

This commit is contained in:
Diavolo 2021-09-12 13:47:35 +02:00
parent e873b48571
commit 3f726d3d0d
3 changed files with 20 additions and 3 deletions

View File

@ -342,6 +342,17 @@ namespace Components
Game::NET_DeferPacketToClient(from, msg); Game::NET_DeferPacketToClient(from, msg);
} }
void Network::SVExecuteClientMessageStub(Game::client_t* client, Game::msg_t* msg)
{
const char* message = Utils::String::VA("ServerID: %d, Sequence: %d, Acknowledge: %d, Sent: %d, Message: %d\n", client->serverID,
client->reliableSequence, client->reliableAcknowledge,
client->reliableSent, client->messageAcknowledge);
OutputDebugStringA(message);
Utils::Hook::Call<void(Game::client_t*, Game::msg_t*)>(0x414D40)(client, msg);
}
Network::Network() Network::Network()
{ {
AssertSize(Game::netadr_t, 20); AssertSize(Game::netadr_t, 20);
@ -381,6 +392,8 @@ namespace Components
// Fix packets causing buffer overflow // Fix packets causing buffer overflow
Utils::Hook(0x6267E3, Network::NET_DeferPacketToClientStub, HOOK_CALL).install()->quick(); Utils::Hook(0x6267E3, Network::NET_DeferPacketToClientStub, HOOK_CALL).install()->quick();
Utils::Hook(0x626996, Network::SVExecuteClientMessageStub, HOOK_CALL).install()->quick();
Network::Handle("resolveAddress", [](Address address, const std::string& /*data*/) Network::Handle("resolveAddress", [](Address address, const std::string& /*data*/)
{ {
Network::SendRaw(address, address.getString()); Network::SendRaw(address, address.getString());

View File

@ -89,6 +89,8 @@ namespace Components
static void PacketErrorCheck(); static void PacketErrorCheck();
static void NET_DeferPacketToClientStub(Game::netadr_t* from, Game::msg_t* msg); static void NET_DeferPacketToClientStub(Game::netadr_t* from, Game::msg_t* msg);
static void SVExecuteClientMessageStub(Game::client_t* client, Game::msg_t* msg);
}; };
} }

View File

@ -4662,7 +4662,8 @@ namespace Game
int reliableSequence; // 134748 int reliableSequence; // 134748
int reliableAcknowledge; // 134752 int reliableAcknowledge; // 134752
int reliableSent; // 134756 int reliableSent; // 134756
char __pad4[1084]; // 134760 int messageAcknowledge; // 134760
char __pad4[1080]; // 134764
char name[16]; // 135844 char name[16]; // 135844
char __pad5[12]; // 135860 char __pad5[12]; // 135860
int snapNum; // 135872 int snapNum; // 135872
@ -4670,7 +4671,8 @@ namespace Game
short ping; // 135880 short ping; // 135880
char __pad7[133158]; // 135882 char __pad7[133158]; // 135882
int isBot; // 269040 int isBot; // 269040
char __pad8[9228]; // 269044 int serverID; // 269044
char __pad8[9224]; // 269048
unsigned __int64 steamID; // 278272 unsigned __int64 steamID; // 278272
char __pad9[403592]; // 278280 char __pad9[403592]; // 278280
} client_t; } client_t;