game,warden,assets: fix unknown player names, warden heap overlap, and Vanilla Item.dbc

- game: clear pendingNameQueries on player out-of-range and DESTROY_OBJECT so
  re-entering players get a fresh name query instead of being silently skipped
- game: add 5s periodic name resync scan that re-queries players with empty names
  and no pending query, recovering from dropped CMSG_NAME_QUERY responses
- warden: fix UC_ERR_MAP by moving HEAP_BASE from 0x200000 to 0x20000000; the old
  heap [0x200000, 0x1200000) overlapped the module at 0x400000, causing Unicorn to
  reject the heap mapping and abort emulator initialisation
- warden: add early overlap check between module and heap regions to catch future
  layout bugs at init time
- assets: add loadDBCOptional() which logs at DEBUG level when a DBC is absent,
  for files that are not distributed on all expansions
- assets: use loadDBCOptional for Item.dbc (absent on Vanilla 1.12 clients) and
  fall back to server-sent itemInfoCache displayInfoId for NPC weapon resolution
This commit is contained in:
Kelsi 2026-03-10 07:00:43 -07:00
parent dc2aab5e90
commit 3cdaf78369
5 changed files with 114 additions and 3 deletions

View file

@ -659,6 +659,30 @@ void GameHandler::update(float deltaTime) {
}
}
// Periodically re-query names for players whose initial CMSG_NAME_QUERY was
// lost (server didn't respond) or whose entity was recreated while the query
// was still pending. Runs every 5 seconds to keep overhead minimal.
if (state == WorldState::IN_WORLD && socket) {
static float nameResyncTimer = 0.0f;
nameResyncTimer += deltaTime;
if (nameResyncTimer >= 5.0f) {
nameResyncTimer = 0.0f;
for (const auto& [guid, entity] : entityManager.getEntities()) {
if (!entity || entity->getType() != ObjectType::PLAYER) continue;
if (guid == playerGuid) continue;
auto player = std::static_pointer_cast<Player>(entity);
if (!player->getName().empty()) continue;
if (playerNameCache.count(guid)) continue;
if (pendingNameQueries.count(guid)) continue;
// Player entity exists with empty name and no pending query — resend.
LOG_DEBUG("Name resync: re-querying guid=0x", std::hex, guid, std::dec);
pendingNameQueries.insert(guid);
auto pkt = NameQueryPacket::build(guid);
socket->send(pkt);
}
}
}
if (pendingLootMoneyNotifyTimer_ > 0.0f) {
pendingLootMoneyNotifyTimer_ -= deltaTime;
if (pendingLootMoneyNotifyTimer_ <= 0.0f) {
@ -7436,6 +7460,9 @@ void GameHandler::handleUpdateObject(network::Packet& packet) {
otherPlayerMoveTimeMs_.erase(guid);
inspectedPlayerItemEntries_.erase(guid);
pendingAutoInspect_.erase(guid);
// Clear pending name query so the query is re-sent when this player
// comes back into range (entity is recreated as a new object).
pendingNameQueries.erase(guid);
} else if (entity->getType() == ObjectType::GAMEOBJECT && gameObjectDespawnCallback_) {
gameObjectDespawnCallback_(guid);
}
@ -8407,6 +8434,7 @@ void GameHandler::handleDestroyObject(network::Packet& packet) {
otherPlayerMoveTimeMs_.erase(data.guid);
inspectedPlayerItemEntries_.erase(data.guid);
pendingAutoInspect_.erase(data.guid);
pendingNameQueries.erase(data.guid);
} else if (entity->getType() == ObjectType::GAMEOBJECT && gameObjectDespawnCallback_) {
gameObjectDespawnCallback_(data.guid);
}