mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Add comprehensive packet boundary debugging for quest opcodes
Logs for opcodes 0x18F, 0x18D, 0x188, 0x186: - Raw header bytes (size + opcode) - Total packet size vs buffer size - Payload hex dump (first 16 bytes) - Next packet header preview This will reveal packet desync issues, wrong size fields, or incorrect opcode mappings.
This commit is contained in:
parent
1e0c03f389
commit
6f797922ea
1 changed files with 35 additions and 0 deletions
|
|
@ -212,6 +212,41 @@ void WorldSocket::tryParsePackets() {
|
|||
// Total packet size: size field (2) + size value (which includes opcode + payload)
|
||||
size_t totalSize = 2 + size;
|
||||
|
||||
// DEBUG: Log packet boundary details for quest-related opcodes
|
||||
if (opcode == 0x18F || opcode == 0x18D || opcode == 0x188 || opcode == 0x186) {
|
||||
char hexBuf[256];
|
||||
snprintf(hexBuf, sizeof(hexBuf),
|
||||
"PACKET BOUNDARY: opcode=0x%04X size=%u totalSize=%zu bufferSize=%zu",
|
||||
opcode, size, totalSize, receiveBuffer.size());
|
||||
core::Logger::getInstance().info(hexBuf);
|
||||
|
||||
// Dump header bytes
|
||||
snprintf(hexBuf, sizeof(hexBuf),
|
||||
" Header: %02x %02x %02x %02x",
|
||||
receiveBuffer[0], receiveBuffer[1], receiveBuffer[2], receiveBuffer[3]);
|
||||
core::Logger::getInstance().info(hexBuf);
|
||||
|
||||
// Dump first 16 bytes of payload (if available)
|
||||
if (totalSize <= receiveBuffer.size()) {
|
||||
std::string payloadHex = " Payload: ";
|
||||
for (size_t i = 4; i < std::min(totalSize, size_t(20)); ++i) {
|
||||
char buf[4];
|
||||
snprintf(buf, sizeof(buf), "%02x ", receiveBuffer[i]);
|
||||
payloadHex += buf;
|
||||
}
|
||||
core::Logger::getInstance().info(payloadHex);
|
||||
}
|
||||
|
||||
// Dump what comes after this packet (next header preview)
|
||||
if (receiveBuffer.size() > totalSize && receiveBuffer.size() >= totalSize + 4) {
|
||||
snprintf(hexBuf, sizeof(hexBuf),
|
||||
" Next header: %02x %02x %02x %02x",
|
||||
receiveBuffer[totalSize], receiveBuffer[totalSize+1],
|
||||
receiveBuffer[totalSize+2], receiveBuffer[totalSize+3]);
|
||||
core::Logger::getInstance().info(hexBuf);
|
||||
}
|
||||
}
|
||||
|
||||
if (receiveBuffer.size() < totalSize) {
|
||||
// Not enough data yet - header stays decrypted in buffer
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue