mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
Fix Warden module parsing and DBC loading for Classic expansion
Warden: copy/skip pair order was reversed — format is [copy][data][skip] per MaNGOS/TrinityCore, not [skip][copy][data]. All copy sizes read as 0, causing module load failure and server disconnect. DBC: when binary DBCs aren't available (no MPQ extraction), fall back to expansion CSV files even for visual DBCs (CreatureDisplayInfo, CharSections, ItemDisplayInfo, etc.) instead of failing with "DBC not found".
This commit is contained in:
parent
60c26a17aa
commit
d045c1215a
2 changed files with 49 additions and 24 deletions
|
|
@ -294,10 +294,36 @@ std::shared_ptr<DBCFile> AssetManager::loadDBC(const std::string& name) {
|
|||
if (dbcData.empty()) {
|
||||
std::string dbcPath = "DBFilesClient\\" + name;
|
||||
dbcData = readFile(dbcPath);
|
||||
if (dbcData.empty()) {
|
||||
LOG_WARNING("DBC not found: ", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If binary DBC not found and we skipped CSV earlier (forceBinaryForVisualDbc),
|
||||
// try CSV as a last resort — better than no data at all (e.g. Classic expansion
|
||||
// where binary DBCs come from MPQ extraction the user may not have done).
|
||||
if (dbcData.empty() && forceBinaryForVisualDbc && !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);
|
||||
loadedFromCSV = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dbcData.empty()) {
|
||||
LOG_WARNING("DBC not found: ", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto dbc = std::make_shared<DBCFile>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue