mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
feat(runtime): pick up JSON DBC sidecars from --emit-json-dbc
AssetManager::loadDBC now probes for a .json sidecar in the same directory as the binary DBC the manifest resolves to. asset_extract --emit-json-dbc writes that sidecar on extraction, so the runtime client transparently falls back to it when the binary DBC is absent (e.g. open-format-only extraction for end-to-end format testing). Order: binary DBC > JSON sidecar > custom_zones JSON > CSV > error. Servers (AzerothCore/TrinityCore) only read the binary DBC, so this change is invisible to them — the wowee runtime is the only consumer that tries the JSON path. The PNG sidecar pickup (tryLoadPngOverride) was already in place from prior work — this completes the symmetric runtime-side wiring for both BLP→PNG and DBC→JSON open-format outputs.
This commit is contained in:
parent
6872ba2bcb
commit
1995ed9824
1 changed files with 27 additions and 2 deletions
|
|
@ -304,12 +304,37 @@ std::shared_ptr<DBCFile> AssetManager::loadDBC(const std::string& name) {
|
|||
|
||||
std::vector<uint8_t> dbcData;
|
||||
|
||||
// Try binary DBC from extracted MPQs first (preferred source)
|
||||
// Try binary DBC from extracted MPQs first (preferred source).
|
||||
std::string dbcPath = "DBFilesClient\\" + name;
|
||||
{
|
||||
std::string dbcPath = "DBFilesClient\\" + name;
|
||||
dbcData = readFile(dbcPath);
|
||||
}
|
||||
|
||||
// If asset_extract was run with --emit-json-dbc, the DBC's directory
|
||||
// also contains a JSON sidecar. Use it when the binary is missing
|
||||
// (lets users run with PNG/JSON-only extractions for testing the
|
||||
// open-format end-to-end path). Server-mode never reads via this
|
||||
// code path, so private-server compat is unaffected.
|
||||
if (dbcData.empty()) {
|
||||
std::string normalizedDbc = normalizePath(dbcPath);
|
||||
std::string fsPath = resolveFile(normalizedDbc);
|
||||
if (!fsPath.empty() && fsPath.size() >= 4) {
|
||||
std::string sidecar = fsPath.substr(0, fsPath.size() - 4) + ".json";
|
||||
if (std::filesystem::exists(sidecar)) {
|
||||
std::ifstream jf(sidecar, std::ios::binary | std::ios::ate);
|
||||
if (jf) {
|
||||
auto sz = jf.tellg();
|
||||
if (sz > 0) {
|
||||
dbcData.resize(static_cast<size_t>(sz));
|
||||
jf.seekg(0);
|
||||
jf.read(reinterpret_cast<char*>(dbcData.data()), sz);
|
||||
LOG_INFO("Loading JSON DBC sidecar: ", sidecar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue