|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
Central manager for loading, caching, and unloading game resources. More...
#include <ResourceManager.h>
Public Member Functions | |
| ResourceManager (std::shared_ptr< ThreadPool > threadPool=nullptr, std::shared_ptr< Keystore > keystore=nullptr) | |
| ~ResourceManager () | |
| std::shared_ptr< ArchiveManager > | GetArchiveManager () |
| Returns the ArchiveManager that manages the mounted archives. | |
| std::shared_ptr< ResourceLoader > | GetResourceLoader () |
| Returns the ResourceLoader responsible for deserializing file data. | |
| std::shared_ptr< IResource > | GetCachedResource (const std::string &filePath, bool loadExact=false) |
| Returns a resource from the cache if present, without loading from disk. | |
| std::shared_ptr< IResource > | GetCachedResource (const ResourceIdentifier &identifier, bool loadExact=false) |
| Returns a resource from the cache using a ResourceIdentifier. | |
| std::shared_ptr< IResource > | LoadResource (const std::string &filePath, bool loadExact=false, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Loads a resource synchronously, returning it from the cache if already loaded. | |
| template<typename T > | |
| std::shared_ptr< T > | LoadResource (const std::string &filePath, bool loadExact=false, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Loads a resource synchronously, cast to the concrete type T. | |
| std::shared_ptr< IResource > | LoadResource (const ResourceIdentifier &identifier, bool loadExact=false, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Loads a resource synchronously by ResourceIdentifier. | |
| template<typename T > | |
| std::shared_ptr< T > | LoadResource (const ResourceIdentifier &identifier, bool loadExact=false, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Loads a resource synchronously by ResourceIdentifier, cast to the concrete type T. | |
| std::shared_ptr< IResource > | LoadResource (uint64_t crc, bool loadExact=false, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Loads a resource synchronously by content-hash CRC. | |
| std::shared_ptr< IResource > | LoadResourceProcess (const std::string &filePath, bool loadExact=false, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Loads a resource synchronously, bypassing the cache. | |
| std::shared_ptr< IResource > | LoadResourceProcess (const ResourceIdentifier &identifier, bool loadExact=false, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Loads a resource synchronously by ResourceIdentifier, bypassing the cache. | |
| std::shared_future< std::shared_ptr< IResource > > | LoadResourceAsync (const std::string &filePath, bool loadExact=false, BS::priority_t priority=BS::pr::normal, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Schedules an asynchronous resource load and returns a future. | |
| std::shared_future< std::shared_ptr< IResource > > | LoadResourceAsync (const ResourceIdentifier &identifier, bool loadExact=false, BS::priority_t priority=BS::pr::normal, std::shared_ptr< ResourceInitData > initData=nullptr) |
| Schedules an asynchronous resource load by ResourceIdentifier. | |
| size_t | UnloadResource (const ResourceIdentifier &identifier) |
| Removes a resource from the cache by ResourceIdentifier. | |
| size_t | UnloadResource (const std::string &filePath) |
| Removes a resource from the cache by path. | |
| void | CacheExternalResource (const std::string &filePath, std::shared_ptr< IResource > resource) |
| Inserts a runtime-built resource into the cache so LoadResource[Process] returns it by path, without any backing archive file. Used for textures synthesized at runtime. Evict with UnloadResource(filePath). | |
| bool | WriteResource (const ResourceIdentifier &identifier, const std::vector< uint8_t > &data, bool unloadFile) |
| Writes raw data into an archive and optionally evicts the stale cache entry. | |
| bool | WriteResource (uint64_t hash, const std::vector< uint8_t > &data, bool unloadFile) |
| Writes raw data into an archive by hash and optionally evicts the stale cache entry. | |
| std::shared_ptr< std::vector< std::shared_ptr< IResource > > > | LoadResources (const std::string &searchMask) |
| Loads all resources whose paths match the given glob mask. | |
| std::shared_ptr< std::vector< std::shared_ptr< IResource > > > | LoadResources (const ResourceFilter &filter) |
| Loads all resources matching the given filter. | |
| std::shared_future< std::shared_ptr< std::vector< std::shared_ptr< IResource > > > > | LoadResourcesAsync (const std::string &searchMask, BS::priority_t priority=BS::pr::normal) |
| Asynchronously loads all resources matching a glob mask. | |
| std::shared_future< std::shared_ptr< std::vector< std::shared_ptr< IResource > > > > | LoadResourcesAsync (const ResourceFilter &filter, BS::priority_t priority=BS::pr::normal) |
| Asynchronously loads all resources matching a filter. | |
| void | DirtyResources (const std::string &searchMask) |
| Marks as dirty all cached resources whose paths match a glob mask. | |
| void | DirtyResources (const ResourceFilter &filter) |
| Marks as dirty all cached resources matching a filter. | |
| void | UnloadResources (const std::string &searchMask) |
| Synchronously unloads all resources matching a glob mask. | |
| void | UnloadResources (const ResourceFilter &filter) |
| Synchronously unloads all resources matching a filter. | |
| void | UnloadResourcesAsync (const std::string &searchMask, BS::priority_t priority=BS::pr::normal) |
| Asynchronously unloads all resources matching a glob mask. | |
| void | UnloadResourcesAsync (const ResourceFilter &filter, BS::priority_t priority=BS::pr::normal) |
| Asynchronously unloads all resources matching a filter. | |
| bool | OtrSignatureCheck (const char *fileName) |
| Checks whether a file is a valid OTR archive by reading its header signature. | |
| bool | IsAltAssetsEnabled () |
| Returns whether alt-asset (mod) loading is currently enabled. | |
| void | SetAltAssetsEnabled (bool isEnabled) |
| Enables or disables alt-asset (mod) loading. | |
| std::shared_ptr< File > | LoadFileProcess (const ResourceIdentifier &identifier) |
| Loads raw file bytes from the archive, bypassing resource deserialization. | |
| std::shared_ptr< File > | LoadFileProcess (const std::string &filePath) |
| Loads raw file bytes from the archive by path. | |
| std::shared_ptr< File > | LoadFileProcess (uint64_t hash) |
| Loads raw file bytes from the archive by hash. | |
| size_t | GetResourceSize (std::shared_ptr< IResource > resource) |
| Returns the byte size of the payload of a loaded resource. | |
| size_t | GetResourceSize (const char *name) |
| Returns the byte size of the payload of a resource identified by path. | |
| size_t | GetResourceSize (uint64_t crc) |
| Returns the byte size of the payload of a resource identified by CRC. | |
| bool | GetResourceIsCustom (std::shared_ptr< IResource > resource) |
| Returns true if the given resource originated from an alt-assets override. | |
| bool | GetResourceIsCustom (const char *name) |
| Returns true if the resource at the given path is an alt-asset override. | |
| bool | GetResourceIsCustom (uint64_t crc) |
| Returns true if the resource identified by CRC is an alt-asset override. | |
| void * | GetResourceRawPointer (std::shared_ptr< IResource > resource) |
| Returns a type-erased raw pointer to the resource payload. | |
| void * | GetResourceRawPointer (const char *name) |
| Returns a type-erased raw pointer to the payload of a resource by path. | |
| void * | GetResourceRawPointer (uint64_t crc) |
| Returns a type-erased raw pointer to the payload of a resource by CRC. | |
Public Member Functions inherited from Ship::Component | |
| Component (const std::string &name, std::shared_ptr< Context > context=nullptr) | |
| Constructs a Component with the given name. | |
| virtual | ~Component () |
| void | Init (const nlohmann::json &initArgs=nlohmann::json::object()) |
| Performs one-time initialization of this component. | |
| bool | IsInitialized () const |
| Returns true once Init() (or MarkInitialized()) has completed successfully. | |
| const std::string & | GetName () const |
| Returns the name of this Component. | |
| std::string | ToString () const |
| Returns a human-readable string representation (e.g. "Name (id)"). | |
| std::string | ToTreeString (int depth=0) const |
| Returns a human-readable tree representation of this component and its children. | |
| operator std::string () const | |
| Conversion operator to std::string; equivalent to ToString(). | |
| ParentComponentList & | GetParents () |
| Returns a mutable reference to the parent list. | |
| const ParentComponentList & | GetParents () const |
| Returns a const reference to the parent list. | |
| ComponentList & | GetChildren () |
| Returns a mutable reference to the child list. | |
| const ComponentList & | GetChildren () const |
| Returns a const reference to the child list. | |
| virtual std::shared_ptr< Component > | TryGetSharedComponent () noexcept |
| Returns a shared_ptr to this Component when available, otherwise nullptr. | |
| virtual std::shared_ptr< Component > | GetSharedComponent () |
| Returns a shared_ptr to this Component via the correct enable_shared_from_this base. | |
| template<typename T > | |
| bool | HasInChildren () const |
| Checks whether any descendant Component matches type T via BFS. | |
| template<typename T > | |
| std::shared_ptr< T > | GetFirstInChildren () const |
| Returns the first descendant that matches type T via BFS. | |
| template<typename T > | |
| std::shared_ptr< std::vector< std::shared_ptr< T > > > | GetInChildren () const |
| Returns all descendants that match type T via BFS. | |
| template<typename T > | |
| bool | HasInParents () const |
| Checks whether any ancestor Component matches type T via BFS. | |
| template<typename T > | |
| std::shared_ptr< T > | GetFirstInParents () const |
| Returns the first ancestor that matches type T via BFS. | |
| template<typename T > | |
| std::shared_ptr< std::vector< std::shared_ptr< T > > > | GetInParents () const |
| Returns all ancestors that match type T via BFS. | |
Public Member Functions inherited from Ship::Part | |
| Part () | |
| Constructs a Part and assigns it a unique ID. | |
| Part (std::shared_ptr< Context > context) | |
| Constructs a Part with an explicit Context reference and unique ID. | |
| virtual | ~Part ()=default |
| uint64_t | GetId () const |
| Returns the unique identifier for this Part. | |
| bool | operator== (const Part &other) const |
| Compares two Parts for equality by their unique IDs. | |
| std::shared_ptr< Context > | GetContext () const |
| Returns the Context this Part belongs to, or nullptr if unset. | |
| void | SetContext (std::shared_ptr< Context > ctx) |
| Sets the Context this Part belongs to. | |
Protected Member Functions | |
| void | OnInit (const nlohmann::json &initArgs=nlohmann::json::object()) override |
| Component initialization hook. Mounts archives and starts the thread pool. | |
| std::shared_ptr< std::vector< std::shared_ptr< IResource > > > | LoadResourcesProcess (const ResourceFilter &filter) |
| void | UnloadResourcesProcess (const ResourceFilter &filter) |
| std::variant< ResourceLoadError, std::shared_ptr< IResource > > | CheckCache (const ResourceIdentifier &identifier, bool loadExact=false) |
| std::variant< ResourceLoadError, std::shared_ptr< IResource > > | CheckCache (const std::string &filePath, bool loadExact=false) |
| std::shared_ptr< IResource > | GetCachedResource (std::variant< ResourceLoadError, std::shared_ptr< IResource > > cacheLine) |
| std::shared_ptr< ResourceInitData > | ResolveMetaAlias (const ResourceIdentifier &identifier) |
Resolves the .meta beside this identifier, if its target should load instead. | |
Protected Member Functions inherited from Ship::Component | |
| void | MarkInitialized () |
| Marks this component as initialized without going through Init(). | |
| template<typename T > | |
| std::shared_ptr< T > | RequireDependency (const std::shared_ptr< T > &dependency, const std::string &dependencyName) const |
| Returns a cached dependency after validating it exists and is initialized. | |
Protected Member Functions inherited from Ship::Part | |
| virtual void | OnAdded (bool forced) |
| Called after this Part has been added to a PartList. | |
| virtual void | OnRemoved (bool forced) |
| Called after this Part has been removed from a PartList. | |
Friends | |
| class | ResourceLoader |
Central manager for loading, caching, and unloading game resources.
ResourceManager sits between the game code and the archive/file system. It maintains an in-memory cache of loaded IResource objects, dispatches asynchronous load requests to a thread pool, and delegates actual deserialization to ResourceLoader.
Required dependencies (constructor-injected):
Obtain the instance from Context::GetChildren().GetFirst<ResourceManager>().
|
explicit |
| Ship::ResourceManager::~ResourceManager | ( | ) |
| void Ship::ResourceManager::CacheExternalResource | ( | const std::string & | filePath, |
| std::shared_ptr< IResource > | resource | ||
| ) |
Inserts a runtime-built resource into the cache so LoadResource[Process] returns it by path, without any backing archive file. Used for textures synthesized at runtime. Evict with UnloadResource(filePath).
| filePath | Virtual path the resource will be retrievable under. |
| resource | The resource to cache. |
|
protected |
|
protected |
| void Ship::ResourceManager::DirtyResources | ( | const ResourceFilter & | filter | ) |
Marks as dirty all cached resources matching a filter.
| filter | ResourceFilter. |
| void Ship::ResourceManager::DirtyResources | ( | const std::string & | searchMask | ) |
Marks as dirty all cached resources whose paths match a glob mask.
Dirty resources remain in the cache but are flagged for reload on next access.
| searchMask | Glob pattern. |
| std::shared_ptr< ArchiveManager > Ship::ResourceManager::GetArchiveManager | ( | ) |
Returns the ArchiveManager that manages the mounted archives.
| std::shared_ptr< IResource > Ship::ResourceManager::GetCachedResource | ( | const ResourceIdentifier & | identifier, |
| bool | loadExact = false |
||
| ) |
Returns a resource from the cache using a ResourceIdentifier.
| identifier | Exact resource identifier including owner and parent archive. |
| loadExact | If true, skips alt-asset path resolution. |
| std::shared_ptr< IResource > Ship::ResourceManager::GetCachedResource | ( | const std::string & | filePath, |
| bool | loadExact = false |
||
| ) |
Returns a resource from the cache if present, without loading from disk.
| filePath | Virtual path of the resource. |
| loadExact | If true, skips alt-asset path resolution and uses the exact path. |
|
protected |
| bool Ship::ResourceManager::GetResourceIsCustom | ( | const char * | name | ) |
Returns true if the resource at the given path is an alt-asset override.
| name | Virtual path of the resource. |
| bool Ship::ResourceManager::GetResourceIsCustom | ( | std::shared_ptr< IResource > | resource | ) |
Returns true if the given resource originated from an alt-assets override.
| resource | Shared pointer to the resource. |
| bool Ship::ResourceManager::GetResourceIsCustom | ( | uint64_t | crc | ) |
Returns true if the resource identified by CRC is an alt-asset override.
| crc | 64-bit content hash. |
| std::shared_ptr< ResourceLoader > Ship::ResourceManager::GetResourceLoader | ( | ) |
Returns the ResourceLoader responsible for deserializing file data.
| void * Ship::ResourceManager::GetResourceRawPointer | ( | const char * | name | ) |
Returns a type-erased raw pointer to the payload of a resource by path.
| name | Virtual path of the resource. |
| void * Ship::ResourceManager::GetResourceRawPointer | ( | std::shared_ptr< IResource > | resource | ) |
Returns a type-erased raw pointer to the resource payload.
| resource | Shared pointer to the resource. |
| void * Ship::ResourceManager::GetResourceRawPointer | ( | uint64_t | crc | ) |
Returns a type-erased raw pointer to the payload of a resource by CRC.
| crc | 64-bit content hash. |
| size_t Ship::ResourceManager::GetResourceSize | ( | const char * | name | ) |
Returns the byte size of the payload of a resource identified by path.
| name | Virtual path of the resource. |
| size_t Ship::ResourceManager::GetResourceSize | ( | std::shared_ptr< IResource > | resource | ) |
Returns the byte size of the payload of a loaded resource.
| resource | Shared pointer to the resource. |
| size_t Ship::ResourceManager::GetResourceSize | ( | uint64_t | crc | ) |
Returns the byte size of the payload of a resource identified by CRC.
| crc | 64-bit content hash. |
| bool Ship::ResourceManager::IsAltAssetsEnabled | ( | ) |
Returns whether alt-asset (mod) loading is currently enabled.
| std::shared_ptr< File > Ship::ResourceManager::LoadFileProcess | ( | const ResourceIdentifier & | identifier | ) |
Loads raw file bytes from the archive, bypassing resource deserialization.
| identifier | Exact resource identifier. |
| std::shared_ptr< File > Ship::ResourceManager::LoadFileProcess | ( | const std::string & | filePath | ) |
Loads raw file bytes from the archive by path.
| filePath | Virtual path of the file. |
| std::shared_ptr< File > Ship::ResourceManager::LoadFileProcess | ( | uint64_t | hash | ) |
Loads raw file bytes from the archive by hash.
| hash | Virtual-file hash of the file. |
| std::shared_ptr< IResource > Ship::ResourceManager::LoadResource | ( | const ResourceIdentifier & | identifier, |
| bool | loadExact = false, |
||
| std::shared_ptr< ResourceInitData > | initData = nullptr |
||
| ) |
Loads a resource synchronously by ResourceIdentifier.
| identifier | Exact identifier (path/hash + owner + parent archive). |
| loadExact | If true, skips alt-asset path resolution. |
| initData | Optional metadata overrides. |
|
inline |
Loads a resource synchronously by ResourceIdentifier, cast to the concrete type T.
| T | Concrete resource type (must derive from IResource). |
| identifier | Exact identifier (path/hash + owner + parent archive). |
| loadExact | If true, skips alt-asset path resolution. |
| initData | Optional metadata overrides. |
| std::shared_ptr< IResource > Ship::ResourceManager::LoadResource | ( | const std::string & | filePath, |
| bool | loadExact = false, |
||
| std::shared_ptr< ResourceInitData > | initData = nullptr |
||
| ) |
Loads a resource synchronously, returning it from the cache if already loaded.
| filePath | Virtual path of the resource. |
| loadExact | If true, skips alt-asset path resolution. |
| initData | Optional metadata overrides; pass nullptr to use defaults from the file header. |
|
inline |
Loads a resource synchronously, cast to the concrete type T.
| T | Concrete resource type (must derive from IResource). |
| filePath | Virtual path of the resource. |
| loadExact | If true, skips alt-asset path resolution. |
| initData | Optional metadata overrides. |
| std::shared_ptr< IResource > Ship::ResourceManager::LoadResource | ( | uint64_t | crc, |
| bool | loadExact = false, |
||
| std::shared_ptr< ResourceInitData > | initData = nullptr |
||
| ) |
Loads a resource synchronously by content-hash CRC.
| crc | 64-bit content hash identifying the resource. |
| loadExact | If true, skips alt-asset path resolution. |
| initData | Optional metadata overrides. |
| std::shared_future< std::shared_ptr< IResource > > Ship::ResourceManager::LoadResourceAsync | ( | const ResourceIdentifier & | identifier, |
| bool | loadExact = false, |
||
| BS::priority_t | priority = BS::pr::normal, |
||
| std::shared_ptr< ResourceInitData > | initData = nullptr |
||
| ) |
Schedules an asynchronous resource load by ResourceIdentifier.
| identifier | Exact identifier. |
| loadExact | If true, skips alt-asset path resolution. |
| priority | Thread-pool scheduling priority. |
| initData | Optional metadata overrides. |
| std::shared_future< std::shared_ptr< IResource > > Ship::ResourceManager::LoadResourceAsync | ( | const std::string & | filePath, |
| bool | loadExact = false, |
||
| BS::priority_t | priority = BS::pr::normal, |
||
| std::shared_ptr< ResourceInitData > | initData = nullptr |
||
| ) |
Schedules an asynchronous resource load and returns a future.
| filePath | Virtual path of the resource. |
| loadExact | If true, skips alt-asset path resolution. |
| priority | Thread-pool scheduling priority. |
| initData | Optional metadata overrides. |
| std::shared_ptr< IResource > Ship::ResourceManager::LoadResourceProcess | ( | const ResourceIdentifier & | identifier, |
| bool | loadExact = false, |
||
| std::shared_ptr< ResourceInitData > | initData = nullptr |
||
| ) |
Loads a resource synchronously by ResourceIdentifier, bypassing the cache.
| identifier | Exact identifier. |
| loadExact | If true, skips alt-asset path resolution. |
| initData | Optional metadata overrides. |
| std::shared_ptr< IResource > Ship::ResourceManager::LoadResourceProcess | ( | const std::string & | filePath, |
| bool | loadExact = false, |
||
| std::shared_ptr< ResourceInitData > | initData = nullptr |
||
| ) |
Loads a resource synchronously, bypassing the cache.
Unlike LoadResource(), this always reads from the archive even if a cached copy exists.
| filePath | Virtual path of the resource. |
| loadExact | If true, skips alt-asset path resolution. |
| initData | Optional metadata overrides. |
| std::shared_ptr< std::vector< std::shared_ptr< IResource > > > Ship::ResourceManager::LoadResources | ( | const ResourceFilter & | filter | ) |
Loads all resources matching the given filter.
| filter | ResourceFilter specifying include/exclude masks, owner, and parent archive. |
| std::shared_ptr< std::vector< std::shared_ptr< IResource > > > Ship::ResourceManager::LoadResources | ( | const std::string & | searchMask | ) |
Loads all resources whose paths match the given glob mask.
| searchMask | Glob pattern (e.g. "textures/ui/*" ). |
| std::shared_future< std::shared_ptr< std::vector< std::shared_ptr< IResource > > > > Ship::ResourceManager::LoadResourcesAsync | ( | const ResourceFilter & | filter, |
| BS::priority_t | priority = BS::pr::normal |
||
| ) |
Asynchronously loads all resources matching a filter.
| filter | ResourceFilter. |
| priority | Thread-pool scheduling priority. |
| std::shared_future< std::shared_ptr< std::vector< std::shared_ptr< IResource > > > > Ship::ResourceManager::LoadResourcesAsync | ( | const std::string & | searchMask, |
| BS::priority_t | priority = BS::pr::normal |
||
| ) |
Asynchronously loads all resources matching a glob mask.
| searchMask | Glob pattern. |
| priority | Thread-pool scheduling priority. |
|
protected |
|
overrideprotectedvirtual |
Component initialization hook. Mounts archives and starts the thread pool.
Expected initArgs keys:
Reimplemented from Ship::Component.
| bool Ship::ResourceManager::OtrSignatureCheck | ( | const char * | fileName | ) |
Checks whether a file is a valid OTR archive by reading its header signature.
| fileName | Path to the file to inspect. |
|
protected |
Resolves the .meta beside this identifier, if its target should load instead.
The real asset at the identifier and the .meta's target are both ranked by the archive holding them, and the higher one loads. A tie goes to the .meta.
.meta wins. | void Ship::ResourceManager::SetAltAssetsEnabled | ( | bool | isEnabled | ) |
Enables or disables alt-asset (mod) loading.
| isEnabled | true to enable, false to disable. |
| size_t Ship::ResourceManager::UnloadResource | ( | const ResourceIdentifier & | identifier | ) |
Removes a resource from the cache by ResourceIdentifier.
| identifier | Identifier of the resource to evict. |
| size_t Ship::ResourceManager::UnloadResource | ( | const std::string & | filePath | ) |
Removes a resource from the cache by path.
| filePath | Virtual path of the resource to evict. |
| void Ship::ResourceManager::UnloadResources | ( | const ResourceFilter & | filter | ) |
Synchronously unloads all resources matching a filter.
| filter | ResourceFilter. |
| void Ship::ResourceManager::UnloadResources | ( | const std::string & | searchMask | ) |
Synchronously unloads all resources matching a glob mask.
| searchMask | Glob pattern. |
| void Ship::ResourceManager::UnloadResourcesAsync | ( | const ResourceFilter & | filter, |
| BS::priority_t | priority = BS::pr::normal |
||
| ) |
Asynchronously unloads all resources matching a filter.
| filter | ResourceFilter. |
| priority | Thread-pool scheduling priority. |
| void Ship::ResourceManager::UnloadResourcesAsync | ( | const std::string & | searchMask, |
| BS::priority_t | priority = BS::pr::normal |
||
| ) |
Asynchronously unloads all resources matching a glob mask.
| searchMask | Glob pattern. |
| priority | Thread-pool scheduling priority. |
|
protected |
| bool Ship::ResourceManager::WriteResource | ( | const ResourceIdentifier & | identifier, |
| const std::vector< uint8_t > & | data, | ||
| bool | unloadFile | ||
| ) |
Writes raw data into an archive and optionally evicts the stale cache entry.
| identifier | Identifier of the resource to write. |
| data | Raw bytes to write. |
| unloadFile | If true, removes the old cache entry after writing. |
| bool Ship::ResourceManager::WriteResource | ( | uint64_t | hash, |
| const std::vector< uint8_t > & | data, | ||
| bool | unloadFile | ||
| ) |
Writes raw data into an archive by hash and optionally evicts the stale cache entry.
| hash | Virtual-file hash of the resource to write. |
| data | Raw bytes to write. |
| unloadFile | If true, removes the old cache entry after writing. |
|
friend |