mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Implement SMSG_MULTIPLE_PACKETS unpacking and fix unused variable warning
- Parse bundled sub-packets from SMSG_MULTIPLE_PACKETS using the WotLK standard wire format (uint16_be size + uint16_le opcode + payload), dispatching each through handlePacket() instead of silently discarding. Rate-limited warning for malformed sub-packet overruns. - Remove unused cullRadiusSq variable in TerrainRenderer::renderShadow() that produced a -Wunused-variable warning.
This commit is contained in:
parent
18e6c2e767
commit
6cba3f5c95
2 changed files with 33 additions and 3 deletions
|
|
@ -4789,10 +4789,42 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
|
||||
// ---- Multiple aggregated packets/moves ----
|
||||
case Opcode::SMSG_MULTIPLE_MOVES:
|
||||
case Opcode::SMSG_MULTIPLE_PACKETS:
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
|
||||
case Opcode::SMSG_MULTIPLE_PACKETS: {
|
||||
// Each sub-packet uses the standard WotLK server wire format:
|
||||
// uint16_be subSize (includes the 2-byte opcode; payload = subSize - 2)
|
||||
// uint16_le subOpcode
|
||||
// payload (subSize - 2 bytes)
|
||||
const auto& pdata = packet.getData();
|
||||
size_t dataLen = pdata.size();
|
||||
size_t pos = packet.getReadPos();
|
||||
static uint32_t multiPktWarnCount = 0;
|
||||
while (pos + 4 <= dataLen) {
|
||||
uint16_t subSize = static_cast<uint16_t>(
|
||||
(static_cast<uint16_t>(pdata[pos]) << 8) | pdata[pos + 1]);
|
||||
if (subSize < 2) break;
|
||||
size_t payloadLen = subSize - 2;
|
||||
if (pos + 4 + payloadLen > dataLen) {
|
||||
if (++multiPktWarnCount <= 10) {
|
||||
LOG_WARNING("SMSG_MULTIPLE_PACKETS: sub-packet overruns buffer at pos=",
|
||||
pos, " subSize=", subSize, " dataLen=", dataLen);
|
||||
}
|
||||
break;
|
||||
}
|
||||
uint16_t subOpcode = static_cast<uint16_t>(pdata[pos + 2]) |
|
||||
(static_cast<uint16_t>(pdata[pos + 3]) << 8);
|
||||
std::vector<uint8_t> subPayload(pdata.begin() + pos + 4,
|
||||
pdata.begin() + pos + 4 + payloadLen);
|
||||
network::Packet subPacket(subOpcode, std::move(subPayload));
|
||||
handlePacket(subPacket);
|
||||
pos += 4 + payloadLen;
|
||||
}
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
}
|
||||
|
||||
// ---- Misc consume ----
|
||||
case Opcode::SMSG_SET_PLAYER_DECLINED_NAMES_RESULT:
|
||||
case Opcode::SMSG_PROPOSE_LEVEL_GRANT:
|
||||
|
|
|
|||
|
|
@ -969,8 +969,6 @@ void TerrainRenderer::renderShadow(VkCommandBuffer cmd, const glm::mat4& lightSp
|
|||
vkCmdPushConstants(cmd, shadowPipelineLayout_, VK_SHADER_STAGE_VERTEX_BIT,
|
||||
0, 128, &push);
|
||||
|
||||
const float cullRadiusSq = shadowRadius * shadowRadius;
|
||||
|
||||
for (const auto& chunk : chunks) {
|
||||
if (!chunk.isValid()) continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue