mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
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.
This commit is contained in:
parent
5fda1a3157
commit
aa16a687c2
16 changed files with 1427 additions and 101 deletions
74
include/pipeline/asset_manifest.hpp
Normal file
74
include/pipeline/asset_manifest.hpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue