fix: validate displayId range and skip missing equipment textures

Reject displayId values >100k (corrupted update-field data) to avoid
pointless DBC lookups and log spam. Add fileExists() guard before
using base texture path in 4 equipment compositing code paths that
were falling through without checking, causing excessive "Texture not
found" warnings when users have incomplete MPQ extractions.
This commit is contained in:
Kelsi 2026-04-14 04:20:28 -07:00
parent 2f3a973444
commit 83eef878fb
4 changed files with 18 additions and 5 deletions

View file

@ -649,6 +649,14 @@ void EntitySpawner::buildCreatureDisplayLookups() {
}
std::string EntitySpawner::getModelPathForDisplayId(uint32_t displayId) const {
// WotLK 3.3.5a CreatureDisplayInfo tops out around ~32000; values far
// beyond that are corrupted update-field data or packet parse errors.
// Silently reject to avoid pointless DBC lookups and log spam.
constexpr uint32_t kMaxReasonableDisplayId = 100000;
if (displayId == 0 || displayId > kMaxReasonableDisplayId) {
return "";
}
if (displayId == 30412) return "Creature\\Gryphon\\Gryphon.m2";
if (displayId == 30413) return "Creature\\Wyvern\\Wyvern.m2";

View file

@ -769,10 +769,12 @@ void EntitySpawner::setOnlinePlayerEquipment(uint64_t guid,
std::string base = "Item\\TextureComponents\\" + std::string(componentDirs[region]) + "\\" + texName;
std::string genderPath = base + (isFemale ? "_F.blp" : "_M.blp");
std::string unisexPath = base + "_U.blp";
std::string basePath = base + ".blp";
std::string fullPath;
if (assetManager_->fileExists(genderPath)) fullPath = genderPath;
else if (assetManager_->fileExists(unisexPath)) fullPath = unisexPath;
else fullPath = base + ".blp";
else if (assetManager_->fileExists(basePath)) fullPath = basePath;
else continue;
regionLayers.emplace_back(region, fullPath);
}

View file

@ -463,9 +463,10 @@ void EntitySpawner::processCreatureSpawnQueue(bool unlimited) {
std::string(compDirs[region]) + "\\" + texName;
std::string gp = base + (isFem ? "_F.blp" : "_M.blp");
std::string up = base + "_U.blp";
std::string bp = base + ".blp";
if (am->fileExists(gp)) displaySkinPaths.push_back(gp);
else if (am->fileExists(up)) displaySkinPaths.push_back(up);
else displaySkinPaths.push_back(base + ".blp");
else if (am->fileExists(bp)) displaySkinPaths.push_back(bp);
}
}
}
@ -673,9 +674,10 @@ std::vector<std::string> EntitySpawner::resolveEquipmentTexturePaths(uint64_t gu
std::string(componentDirs[region]) + "\\" + texName;
std::string genderPath = base + (isFemale ? "_F.blp" : "_M.blp");
std::string unisexPath = base + "_U.blp";
std::string basePath = base + ".blp";
if (assetManager_->fileExists(genderPath)) paths.push_back(genderPath);
else if (assetManager_->fileExists(unisexPath)) paths.push_back(unisexPath);
else paths.push_back(base + ".blp");
else if (assetManager_->fileExists(basePath)) paths.push_back(basePath);
}
}
return paths;

View file

@ -315,9 +315,10 @@ void GameScreen::updateCharacterTextures(game::Inventory& inventory) {
fullPath = genderPath;
} else if (assetManager->fileExists(unisexPath)) {
fullPath = unisexPath;
} else {
// Last resort: try without suffix
} else if (assetManager->fileExists(base + ".blp")) {
fullPath = base + ".blp";
} else {
continue;
}
regionLayers.emplace_back(region, fullPath);
}