|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
Local CASC storage. More...
#include <wowlib/fs/casc/casc_storage.hpp>
Classes | |
| struct | Options |
| What to open and how. More... | |
Public Member Functions | |
| ~CascStorage () | |
| CascStorage (const CascStorage &)=delete | |
| CascStorage & | operator= (const CascStorage &)=delete |
| CascStorage (CascStorage &&other) noexcept | |
| CascStorage & | operator= (CascStorage &&other) noexcept |
| Result< FileBuffer > | readFile (const FileKey &key) |
| Read a file into memory. | |
| Result< void > | addEncryptionKey (std::uint64_t keyName, std::span< const std::byte, 16 > key) |
| Register a TACT encryption key so the storage can decrypt content behind it (encrypted BLTE blocks, and thus the encrypted sections of a .db2). | |
| Result< void > | importKeys (std::string_view keyList) |
| Register TACT keys from a text list — the community "KeyName KeyHex" per line format (16 hex nibbles name, 32 hex nibbles key). | |
| bool | exists (const FileKey &key) |
| Whether the file can be opened (probe open + _close). | |
| Result< std::vector< FileDataID > > | enumerateFdids () |
| Enumerate every FileDataID the storage holds: entries whose content is locally available and that carry a valid id, deduplicated and sorted. | |
Static Public Member Functions | |
| static Result< CascStorage > | open (Options options) |
| Open the local storage. | |
| static constexpr StorageKind | kind () |
Local CASC storage.
FileDataID is the primary address; opening by name is a best-effort fallback that only works on clients whose root manifest still carries name hashes (pre-8.2) — on modern clients resolve paths through a listfile in the composition layer instead.
RAII: open() — the only way to obtain an instance — returns a fully open storage, so a constructed CascStorage is an open one. The destructor (and move-assignment onto an open storage) closes the CascLib handle; the only not-open state C++ can hold is a moved-from storage, which is empty and safe to destroy.
Thread safety: one mutex around the storage handle for the whole open-size-read-_close sequence; CascLib handles are not documented thread-safe. A storage-handle pool is a possible future upgrade (memory-heavy — measure first).
Definition at line 37 of file casc_storage.hpp.
|
inline |
Definition at line 59 of file casc_storage.hpp.
|
delete |
References CascStorage().
Referenced by CascStorage(), CascStorage(), open(), operator=(), and operator=().
|
inlinenoexcept |
Definition at line 64 of file casc_storage.hpp.
References CascStorage().
| Result< void > wowlib::fs::CascStorage::addEncryptionKey | ( | std::uint64_t | keyName, |
| std::span< const std::byte, 16 > | key ) |
Register a TACT encryption key so the storage can decrypt content behind it (encrypted BLTE blocks, and thus the encrypted sections of a .db2).
Once registered, readFile returns fully-decrypted bytes and the DB2 reader decodes those sections normally instead of reporting them encrypted.
| keyName | the 64-bit key lookup (the section header's tactKeyHash). |
| key | the 16-byte key. |
Definition at line 221 of file casc_storage.cpp.
References wowlib::BackendError, wowlib::makeError(), and wowlib::StorageNotOpen.
| Result< std::vector< FileDataID > > wowlib::fs::CascStorage::enumerateFdids | ( | ) |
Enumerate every FileDataID the storage holds: entries whose content is locally available and that carry a valid id, deduplicated and sorted.
Modern root manifests are id-keyed, so this is the complete file listing regardless of listfile coverage (name resolution stays the composition layer's job).
Definition at line 242 of file casc_storage.cpp.
References wowlib::BackendError, wowlib::makeError(), and wowlib::StorageNotOpen.
| bool wowlib::fs::CascStorage::exists | ( | const FileKey & | key | ) |
Whether the file can be opened (probe open + _close).
| key | the file identity. |
Definition at line 267 of file casc_storage.cpp.
References wowlib::cascLocaleFlag(), wowlib::FileKey::fdid, and wowlib::FileKey::path.
| Result< void > wowlib::fs::CascStorage::importKeys | ( | std::string_view | keyList | ) |
Register TACT keys from a text list — the community "KeyName KeyHex" per line format (16 hex nibbles name, 32 hex nibbles key).
Lines that do not parse are skipped by CascLib.
| keyList | the newline-separated key list. |
Definition at line 233 of file casc_storage.cpp.
References wowlib::BackendError, wowlib::makeError(), and wowlib::StorageNotOpen.
|
inlinestaticconstexpr |
Definition at line 116 of file casc_storage.hpp.
References wowlib::Casc.
|
static |
Open the local storage.
Fallback ladder for repacks (e.g. WoWCircle) that ship without a root .build.info: (a) plain open of the client root, then Data/; (b) scan Data/config for build configurations, synthesize a .build.info in a temp shim directory (with a Data symlink back to the client) and try each candidate build config until one opens — candidates ordered by Options::build match, then by build number descending.
| options | what to open. |
Definition at line 120 of file casc_storage.cpp.
References CascStorage().
Referenced by wowlib::fs::FileSystem::open().
|
inlinenoexcept |
Definition at line 69 of file casc_storage.hpp.
References CascStorage().
|
delete |
References CascStorage().
| Result< FileBuffer > wowlib::fs::CascStorage::readFile | ( | const FileKey & | key | ) |
Read a file into memory.
Prefers the FileDataID; falls back to open-by-name for path-only keys (pre-8.2 clients only).
| key | the file identity. |
Definition at line 189 of file casc_storage.cpp.
References wowlib::cascLocaleFlag(), wowlib::FileKey::fdid, wowlib::FileNotFound, wowlib::InvalidPath, wowlib::makeError(), wowlib::FileKey::path, wowlib::PathNotResolvable, and wowlib::StorageNotOpen.