fix: load binary DBCs from Data/db/ fallback path

CreatureDisplayInfo.dbc (691KB, 24K+ entries) exists at Data/db/ but
the loader only checked DBFilesClient\ (MPQ manifest) and expansion CSV.
The CSV had only 13248 entries (malformed export), so TBC+ creatures
(Mana Wyrms, Blood Elf area) had no display data and were invisible.

Now checks Data/db/ as a fallback for binary DBCs. This path contains
pre-extracted DBCs shared across expansions. Binary DBCs have complete
record data including proper IDs.
This commit is contained in:
Kelsi 2026-03-28 16:17:59 -07:00
parent d8c768701d
commit c58537e2b8

View file

@ -285,6 +285,28 @@ std::shared_ptr<DBCFile> AssetManager::loadDBC(const std::string& name) {
dbcData = readFile(dbcPath);
}
// Try Data/db/ directory (pre-extracted binary DBCs shared across expansions)
if (dbcData.empty()) {
// dataPath is expansion-specific (e.g. Data/expansions/wotlk/); go up to Data/
for (const std::string& base : {dataPath + "/db/" + name,
dataPath + "/../../db/" + name,
"Data/db/" + name}) {
if (std::filesystem::exists(base)) {
std::ifstream f(base, 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("Loaded binary DBC from: ", base, " (", size, " bytes)");
break;
}
}
}
}
}
// Fall back to expansion-specific CSV (e.g. Data/expansions/wotlk/db/Spell.csv)
if (dbcData.empty() && !expansionDataPath_.empty()) {
std::string baseName = name;