From e1f048c8f922613aec1f63791c2191e55cbd5132 Mon Sep 17 00:00:00 2001 From: boris Date: Thu, 3 Jan 2019 16:51:40 +1300 Subject: ricardo milos :DDDD::D:D:D: --- csgo-loader/csgo-client/Networking/TCPClient.cpp | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'csgo-loader/csgo-client/Networking/TCPClient.cpp') diff --git a/csgo-loader/csgo-client/Networking/TCPClient.cpp b/csgo-loader/csgo-client/Networking/TCPClient.cpp index c20c831..c974f88 100644 --- a/csgo-loader/csgo-client/Networking/TCPClient.cpp +++ b/csgo-loader/csgo-client/Networking/TCPClient.cpp @@ -13,6 +13,22 @@ namespace Networking if(Result == -1) INFO_ASSERT(STR("[000F:00002B00] Server closed the connection unexpectedly.")); + + WRAP_IF_DEBUG( + size_t BreakIndex = 0; + + printf("[DEBUG] Sending data (%zd bytes):\n[DEBUG] ", Bytes.size()); + + for(auto &Byte : Bytes) + { + printf("%02x ", Byte); + + if(BreakIndex++ % 8 == 0) + printf("\n[DEBUG] "); + } + + printf("\n"); + ); } ByteArray TCPClient::ReceiveRawBytes() @@ -40,6 +56,22 @@ namespace Networking break; } + WRAP_IF_DEBUG( + size_t BreakIndex = 0; + + printf("[DEBUG] Receiving data (%zd bytes):\n[DEBUG] ", ReceivedBytes.size()); + + for(auto &Byte : ReceivedBytes) + { + printf("%02x ", Byte); + + if(BreakIndex++ % 8 == 0) + printf("\n[DEBUG] "); + } + + printf("\n"); + ); + return ReceivedBytes; } @@ -103,11 +135,19 @@ namespace Networking return false; // Initialise encryption wrapper. + WRAP_IF_DEBUG( + printf("[DEBUG] Attempting to handshake with server...\n"); + ); + ByteArray EncryptionKey = ReceiveRawBytes(); if(EncryptionKey.empty()) return false; + WRAP_IF_DEBUG( + printf("[DEBUG] Server handshake successful!\n"); + ) + std::memcpy(m_EncryptionKey, EncryptionKey.data(), EncryptionKey.size()); return true; -- cgit v1.2.3