nw::kernel::Resources
-
struct Resources : public nw::Container, public nw::kernel::Service
Public Types
-
using SearchVector = Vector<LocatorPayload>
Public Functions
-
virtual ~Resources() = default
-
virtual void initialize(ServiceInitTime time) override
Initializes resources management system.
-
bool add_base_container(const std::filesystem::path &path, const String &name, ResourceType::type restype = ResourceType::invalid)
Add a base container
Note
This anything that is BELOW the module in priority
-
bool add_custom_container(Container *container, bool take_ownership = true, ResourceType::type restype = ResourceType::invalid)
Add already created container
Note
These containers are above all others in priority
-
bool add_override_container(const std::filesystem::path &path, const String &name, ResourceType::type restype = ResourceType::invalid)
Add already created container.
Add override container
Note
This anything that is ABOVE the module in priority
-
void clear_containers()
Clears any custom loaded containers.
-
bool load_module(std::filesystem::path path, StringView manifest = {})
Loads container resources for a module.
-
void load_module_haks(const Vector<String> &haks)
Loads module haks.
-
void unload_module()
Unloads module.
-
ResourceData demand_server_vault(StringView cdkey, StringView resref)
Demands a player character file.
-
ResourceData demand_any(Resref resref, std::initializer_list<ResourceType::type> restypes) const
Attempts to locate first matching resource type by container priority.
-
ResourceData demand_in_order(Resref resref, std::initializer_list<ResourceType::type> restypes) const
Attempts to locate first matching resource by resource type priority.
-
void load_palette_textures()
-
const ResroucesStats &metrics() const
-
Image *texture(Resref resref) const
Loads a texture from the resource manager
Note
This is a wrapper around
demand_in_orderwith types dds, and tga passed. plt is not included here or are other image types, png, etc.
-
inline virtual Vector<ResourceDescriptor> all() const override
Get all resources.
-
virtual ResourceData demand(Resource res) const override
Reads resource data, empty ResourceData if no match.
-
virtual int extract(const std::regex &pattern, const std::filesystem::path &output) const override
Extract elements from a container by regex.
-
inline virtual const String &path() const override
Path to container, for basic containers, should be canonical.
-
virtual size_t size() const override
Determines the size, if applicable, of the container.
-
virtual ResourceDescriptor stat(const Resource &res) const override
Get some general data about a resource.
-
inline virtual bool valid() const noexcept override
Return true if loaded, false if not.
-
virtual void visit(std::function<void(const Resource&)> callback, std::initializer_list<ResourceType::type> types = {}) const noexcept override
Visits all resources in a container.
-
virtual int extract_by_glob(StringView glob, const std::filesystem::path &output) const
Extract elements from a container by glob pattern.
-
const std::filesystem::path &working_directory() const
Get container working directory.
-
MemoryResource *allocator() const noexcept
Gets the memory allocator for the servce.
-
using SearchVector = Vector<LocatorPayload>