If you are working on protocol downgrade and get client debugs, you may want to view what bytes were send to Tibia Client before debug.
Tibia Client 'error report' after crash shows only few last bytes.
Only way to view all send bytes is to print them in server console or write to some file.
Here is code that print all bytes to server console.
In
with:
Tested on Nekiro 1.5 downgrade.
Example server console:
EDIT:
Version that prints single OTS packets, not network packets send to client, which may contain multiple OTS packets.
It also prints packets in hex format.
In
Paste:
Example output:
Tibia Client 'error report' after crash shows only few last bytes.
Only way to view all send bytes is to print them in server console or write to some file.
Here is code that print all bytes to server console.
In
connection.cpp
replace:
C++:
void Connection::send(const OutputMessage_ptr& msg)
{
std::lock_guard<std::recursive_mutex> lockClass(connectionLock);
if (closed) {
return;
}
bool noPendingWrite = messageQueue.empty();
messageQueue.emplace_back(msg);
if (noPendingWrite) {
internalSend(msg);
}
}
C++:
void Connection::send(const OutputMessage_ptr& msg)
{
std::lock_guard<std::recursive_mutex> lockClass(connectionLock);
if (closed) {
return;
}
uint8_t* tmpOutputBuffer = msg->getOutputBuffer();
std::cout << "PACKET: ";
for (int i = 0; i < msg->getLength(); i++) {
std::cout << (int) tmpOutputBuffer[i] << " ";
}
std::cout << std::endl;
bool noPendingWrite = messageQueue.empty();
messageQueue.emplace_back(msg);
if (noPendingWrite) {
internalSend(msg);
}
}
Tested on Nekiro 1.5 downgrade.
Example server console:
Code:
PACKET: 107 253 3 1 4 7 1 99 0 2 0 0 64 2
PACKET: 109 0 4 3 4 7 1 255 3 3 4 7
PACKET: 109 252 3 2 4 7 4 253 3 2 4 7
PACKET: 134 0 0 0 64 0 131 254 3 2 4 7 4
PACKET: 134 1 0 0 64 0 108 254 3 2 4 7 2 105 254 3 2 4 7 253 3 237 17 98 0 7 0 0 16 76 0 136 0 0 0 0 0 0 0 220 0 0 0 151 16 151 16 151 16 151 16 151 16 151 16 0 255 106 254 3 2 4 7 73 11 2 131 254 3 2 4 7 1 180 20 48 0 89 111 117 32 108 111 115 101 32 51 32 104 105 116 112 111 105 110 116 115 32 100 117 101 32 116 111 32 97 110 32 97 116 116 97 99 107 32 98 121 32 97 32 98 101 97 114 46 132 254 3 2 4 7 180 1 0 51 160 111 0 150 0 77 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 160 111 0 150 0 77 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 140 7 0 0 16 74
PACKET: 107 253 3 1 4 7 1 99 0 2 0 0 64 1 134 2 0 0 64 0 108 254 3 2 4 7 2 105 254 3 2 4 7 253 3 237 17 98 0 7 0 0 16 74 0 136 0 0 0 0 0 0 0 220 0 0 0 151 16 151 16 151 16 151 16 151 16 151 16 0 255 106 254 3 2 4 7 73 11 2 131 254 3 2 4 7 1 180 20 47 0 89 111 117 32 108 111 115 101 32 56 32 104 105 116 112 111 105 110 116 115 32 100 117 101 32 116 111 32 97 110 32 97 116 116 97 99 107 32 98 121 32 97 32 98 117 103 46 132 254 3 2 4 7 180 1 0 56 160 103 0 150 0 77 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 160 103 0 150 0 77 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 140 7 0 0 16 69
EDIT:
Version that prints single OTS packets, not network packets send to client, which may contain multiple OTS packets.
It also prints packets in hex format.
In
protocolgame.cpp
under:
C++:
void ProtocolGame::writeToOutputBuffer(const NetworkMessage& msg)
{
C++:
const uint8_t *tmpOutputBuffer = msg.getBuffer();
std::cout << std::hex;
for (int i = 0; i < msg.getLength(); i++) {
std::cout << (int) (tmpOutputBuffer[i] / 16) << (int) tmpOutputBuffer[i] % 16;
}
std::cout << std::endl;
std::cout << std::dec;
Code:
6dfb0300040701fc03000407
aa0300000004005445737401fe0302040705003132333435
Last edited: