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

@ -296,6 +296,55 @@ std::shared_ptr<DBCFile> AssetManager::loadDBC(const std::string& name) {
return dbc;
}
std::shared_ptr<DBCFile> AssetManager::loadDBCOptional(const std::string& name) {
// Check cache first
auto it = dbcCache.find(name);
if (it != dbcCache.end()) return it->second;
// Try binary DBC
std::vector<uint8_t> dbcData;
{
std::string dbcPath = "DBFilesClient\\" + name;
dbcData = readFile(dbcPath);
}
// Fall back to expansion-specific CSV
if (dbcData.empty() && !expansionDataPath_.empty()) {
std::string baseName = name;
auto dot = baseName.rfind('.');
if (dot != std::string::npos) baseName = baseName.substr(0, dot);
std::string csvPath = expansionDataPath_ + "/db/" + baseName + ".csv";
if (std::filesystem::exists(csvPath)) {
std::ifstream f(csvPath, std::ios::binary | std::ios::ate);
if (f) {
auto size = f.tellg();
if (size > 0) {
f.seekg(0);
dbcData.resize(static_cast<size_t>(size));
f.read(reinterpret_cast<char*>(dbcData.data()), size);
LOG_INFO("Binary DBC not found, using CSV fallback: ", csvPath);
}
}
}
}
if (dbcData.empty()) {
// Expected on some expansions — log at debug level only.
LOG_DEBUG("Optional DBC not found (expected on some expansions): ", name);
return nullptr;
}
auto dbc = std::make_shared<DBCFile>();
if (!dbc->load(dbcData)) {
LOG_ERROR("Failed to load DBC: ", name);
return nullptr;
}
dbcCache[name] = dbc;
LOG_INFO("Loaded optional DBC: ", name, " (", dbc->getRecordCount(), " records)");
return dbc;
}
std::shared_ptr<DBCFile> AssetManager::getDBC(const std::string& name) const {
auto it = dbcCache.find(name);
if (it != dbcCache.end()) {