Kelsidavis-WoWee/include/pipeline/asset_manifest.hpp
Kelsi aa16a687c2 Replace MPQ runtime with loose file asset system
Extract assets from MPQ archives into organized loose files indexed by
manifest.json, enabling fully parallel reads without StormLib serialization.
Add asset_extract and blp_convert tools, PNG texture override support.
2026-02-12 20:32:14 -08:00

74 lines
2 KiB
C++

#pragma once
#include <string>
#include <vector>
#include <cstdint>
#include <unordered_map>
namespace wowee {
namespace pipeline {
/**
* AssetManifest - Maps WoW virtual paths to filesystem paths
*
* Loaded once at startup from manifest.json. Read-only after init,
* so concurrent reads are safe without a mutex.
*/
class AssetManifest {
public:
struct Entry {
std::string filesystemPath; // Relative path from basePath (forward slashes)
uint64_t size; // File size in bytes
uint32_t crc32; // CRC32 for integrity verification
};
AssetManifest() = default;
/**
* Load manifest from JSON file
* @param manifestPath Full path to manifest.json
* @return true if loaded successfully
*/
bool load(const std::string& manifestPath);
/**
* Lookup an entry by normalized WoW path (lowercase, backslash)
* @return Pointer to entry or nullptr if not found
*/
const Entry* lookup(const std::string& normalizedWowPath) const;
/**
* Resolve full filesystem path for a WoW virtual path
* @return Full filesystem path or empty string if not found
*/
std::string resolveFilesystemPath(const std::string& normalizedWowPath) const;
/**
* Check if an entry exists
*/
bool hasEntry(const std::string& normalizedWowPath) const;
/**
* Get base path (directory containing extracted assets)
*/
const std::string& getBasePath() const { return basePath_; }
/**
* Get total number of entries
*/
size_t getEntryCount() const { return entries_.size(); }
/**
* Check if manifest is loaded
*/
bool isLoaded() const { return loaded_; }
private:
bool loaded_ = false;
std::string basePath_; // Root directory for extracted assets
std::string manifestDir_; // Directory containing manifest.json
std::unordered_map<std::string, Entry> entries_;
};
} // namespace pipeline
} // namespace wowee