Unify asset system: one asset set, always high-res

Remove HDPackManager, expansion overlay manifests, and BLP size-comparison
logic. Assets now resolve through a single manifest with a simple override
directory (Data/override/) for future HD upgrades.
This commit is contained in:
Kelsi 2026-02-15 04:18:34 -08:00
parent 1bc7b12b20
commit d7e2b26af7
13 changed files with 31 additions and 658 deletions

View file

@ -17,8 +17,8 @@ namespace pipeline {
* AssetManager - Unified interface for loading WoW assets
*
* Reads pre-extracted loose files indexed by manifest.json.
* Supports layered manifests: overlay manifests (HD packs, mods)
* are checked before the base manifest, with higher priority first.
* Supports an override directory (Data/override/) checked before the manifest
* for HD textures, custom content, or mod overrides.
* Use the asset_extract tool to extract MPQ archives first.
* All reads are fully parallel (no serialization mutex needed).
*/
@ -44,26 +44,6 @@ public:
*/
bool isInitialized() const { return initialized; }
/**
* Add an overlay manifest (HD packs, mods) checked before the base manifest.
* Higher priority overlays are checked first.
* @param manifestPath Full path to the overlay's manifest.json
* @param priority Priority level (higher = checked first)
* @param id Unique identifier for this overlay (e.g. "hd_character")
* @return true if overlay loaded successfully
*/
bool addOverlayManifest(const std::string& manifestPath, int priority, const std::string& id);
/**
* Remove a previously added overlay manifest by id.
*/
void removeOverlay(const std::string& id);
/**
* Get list of active overlay IDs.
*/
std::vector<std::string> getOverlayIds() const;
/**
* Load a BLP texture
* @param path Virtual path to BLP file (e.g., "Textures\\Minimap\\Background.blp")
@ -140,24 +120,17 @@ private:
bool initialized = false;
std::string dataPath;
std::string expansionDataPath_; // e.g. "Data/expansions/wotlk"
std::string overridePath_; // e.g. "Data/override"
// Base manifest (loaded from dataPath/manifest.json)
AssetManifest manifest_;
LooseFileReader looseReader_;
// Overlay manifests (HD packs, mods) - sorted by priority descending
struct ManifestLayer {
AssetManifest manifest;
int priority;
std::string id;
};
std::vector<ManifestLayer> overlayLayers_; // Sorted by priority desc
/**
* Resolve filesystem path checking overlays first, then base manifest.
* Returns empty string if not found in any layer.
* Resolve filesystem path: check override dir first, then base manifest.
* Returns empty string if not found.
*/
std::string resolveLayeredPath(const std::string& normalizedPath) const;
std::string resolveFile(const std::string& normalizedPath) const;
mutable std::mutex cacheMutex;
std::map<std::string, std::shared_ptr<DBCFile>> dbcCache;

View file

@ -1,97 +0,0 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <unordered_map>
namespace wowee {
namespace pipeline {
class AssetManager;
/**
* Metadata for a single HD texture pack on disk.
*
* Each pack lives in Data/hd/<packDir>/ and contains:
* pack.json - metadata (id, name, group, compatible expansions, size)
* manifest.json - standard asset manifest with HD override textures
* assets/ - the actual HD files
*/
struct HDPack {
std::string id; // Unique identifier (e.g. "character_hd")
std::string name; // Human-readable name
std::string group; // Grouping label (e.g. "Character", "Terrain")
std::vector<std::string> expansions; // Compatible expansion IDs
uint32_t totalSizeMB = 0; // Approximate total size on disk
std::string manifestPath; // Full path to manifest.json
std::string packDir; // Full path to pack directory
bool enabled = false; // User-toggled enable state
};
/**
* HDPackManager - discovers, manages, and wires HD texture packs.
*
* Scans Data/hd/ subdirectories for pack.json files. Each pack can be
* enabled/disabled via setPackEnabled(). Enabled packs are wired into
* AssetManager as high-priority overlay manifests so that HD textures
* override the base expansion assets transparently.
*/
class HDPackManager {
public:
HDPackManager() = default;
/**
* Scan the HD root directory for available packs.
* @param hdRootPath Path to Data/hd/ directory
*/
void initialize(const std::string& hdRootPath);
/**
* Get all discovered packs.
*/
const std::vector<HDPack>& getAllPacks() const { return packs_; }
/**
* Get packs compatible with a specific expansion.
*/
std::vector<const HDPack*> getPacksForExpansion(const std::string& expansionId) const;
/**
* Enable or disable a pack. Persists state in enabledPacks_ map.
*/
void setPackEnabled(const std::string& packId, bool enabled);
/**
* Check if a pack is enabled.
*/
bool isPackEnabled(const std::string& packId) const;
/**
* Apply enabled packs as overlays to the asset manager.
* Removes previously applied overlays and re-adds enabled ones.
*/
void applyToAssetManager(AssetManager* assetManager, const std::string& expansionId);
/**
* Save enabled pack state to a settings file.
*/
void saveSettings(const std::string& settingsPath) const;
/**
* Load enabled pack state from a settings file.
*/
void loadSettings(const std::string& settingsPath);
private:
std::vector<HDPack> packs_;
std::unordered_map<std::string, bool> enabledState_; // packId → enabled
// Overlay IDs currently applied to AssetManager (for removal on re-apply)
std::vector<std::string> appliedOverlayIds_;
static constexpr int HD_OVERLAY_PRIORITY_BASE = 100; // High priority, above expansion base
};
} // namespace pipeline
} // namespace wowee