mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-26 21:13:51 +00:00
Add multi-expansion support with data-driven protocol layer
Replace hardcoded WotLK protocol constants with a data-driven architecture supporting Classic 1.12.1, TBC 2.4.3, and WotLK 3.3.5a. Each expansion has JSON profiles for opcodes, update fields, and DBC layouts, plus C++ polymorphic packet parsers for binary format differences (movement flags, speed fields, transport data, spline format, char enum layout). Key components: - ExpansionRegistry: scans Data/expansions/*/expansion.json at startup - OpcodeTable: logical enum <-> wire values loaded from JSON - UpdateFieldTable: field indices loaded from JSON per expansion - DBCLayout: schema-driven DBC field lookups replacing magic numbers - PacketParsers: WotLK/TBC/Classic parsers with correct flag positions - Multi-manifest AssetManager: layered manifests with priority ordering - HDPackManager: overlay texture packs with expansion compatibility - Auth screen expansion picker replacing hardcoded version dropdown
This commit is contained in:
parent
aa16a687c2
commit
7092844b5e
51 changed files with 5258 additions and 887 deletions
64
include/pipeline/dbc_layout.hpp
Normal file
64
include/pipeline/dbc_layout.hpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
/**
|
||||
* Maps DBC field names to column indices for a single DBC file.
|
||||
* Column indices vary between WoW expansions.
|
||||
*/
|
||||
struct DBCFieldMap {
|
||||
std::unordered_map<std::string, uint32_t> fields;
|
||||
|
||||
/** Get column index by field name. Returns 0xFFFFFFFF if unknown. */
|
||||
uint32_t field(const std::string& name) const {
|
||||
auto it = fields.find(name);
|
||||
return (it != fields.end()) ? it->second : 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
/** Convenience operator for shorter syntax: layout["Name"] */
|
||||
uint32_t operator[](const std::string& name) const { return field(name); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Maps DBC file names to their field layouts.
|
||||
* Loaded from JSON (e.g. Data/expansions/wotlk/dbc_layouts.json).
|
||||
*/
|
||||
class DBCLayout {
|
||||
public:
|
||||
/** Load from JSON file. Returns true if successful. */
|
||||
bool loadFromJson(const std::string& path);
|
||||
|
||||
/** Load built-in WotLK 3.3.5a defaults. */
|
||||
void loadWotlkDefaults();
|
||||
|
||||
/** Get the field map for a DBC file. Returns nullptr if unknown. */
|
||||
const DBCFieldMap* getLayout(const std::string& dbcName) const;
|
||||
|
||||
/** Number of DBC layouts loaded. */
|
||||
size_t size() const { return layouts_.size(); }
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, DBCFieldMap> layouts_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Global active DBC layout (set by Application at startup).
|
||||
*/
|
||||
void setActiveDBCLayout(const DBCLayout* layout);
|
||||
const DBCLayout* getActiveDBCLayout();
|
||||
|
||||
/** Convenience: get field index for a DBC field. */
|
||||
inline uint32_t dbcField(const std::string& dbcName, const std::string& fieldName) {
|
||||
const auto* l = getActiveDBCLayout();
|
||||
if (!l) return 0xFFFFFFFF;
|
||||
const auto* fm = l->getLayout(dbcName);
|
||||
return fm ? fm->field(fieldName) : 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue