NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches

#include <game/bases/d_res_mng.hpp>

Description

A higher-level archive resource management class.

Overview

The dResMng_c class wraps a dRes_c instance to provide higher-level access. For more information on resource loading and management, see dRes_c.

Bulk Resource Loading

Use the setRes() function to open multiple archives at once. Only up to MAX_NUM_RES archives can be open at the same time.

Definition at line 10 of file d_res_mng.hpp.

Classes

class  resCallback_c
 A callback class for processing resources that handles loading g3d data. More...

Public Member Functions

 dResMng_c ()
 Constructs a new dResMng_c.
virtual ~dResMng_c ()
 Destroys this dResMng_c.
void setRes (const char *path, const char **names, int count, EGG::Heap *heap)
 Schedules multiple archives for loading.
bool setRes (const char *path, const char *name, EGG::Heap *heap)
 Schedules a single archive for loading.
nw4r::g3d::ResFile getRes (const char *arcName, const char *resPath) const
 Gets a resource.
nw4r::g3d::ResFile getResSilently (const char *arcName, const char *resPath) const
 Gets a resource without logging a message if the resource is not found.
bool syncAllRes ()
 Attempts to load the resources of an archive that has finished loading since the last call to this function. The callback is executed on all files and folders.

Static Public Attributes

static dResMng_cm_instance
 The instance of this class.

Private Attributes

dRes_c mRes
 The resource manager.
resCallback_c mCallback
 The callback for after a file has been loaded.

Constructor & Destructor Documentation

◆ dResMng_c()

dResMng_c::dResMng_c ( )

Constructs a new dResMng_c.

Definition at line 7 of file d_res_mng.cpp.

◆ ~dResMng_c()

dResMng_c::~dResMng_c ( )
virtual

Destroys this dResMng_c.

Definition at line 12 of file d_res_mng.cpp.

Member Function Documentation

◆ setRes() [1/2]

void dResMng_c::setRes ( const char * path,
const char ** names,
int count,
EGG::Heap * heap )

Schedules multiple archives for loading.

Parameters
pathThe path to the folder containing the archives. See the path notes in dRes_c.
namesAn array of archive names. See the path notes in dRes_c.
countThe number of archives in the array.
heapThe heap to load the archives into, or nullptr to use the default archive heap.

Definition at line 31 of file d_res_mng.cpp.

◆ setRes() [2/2]

bool dResMng_c::setRes ( const char * path,
const char * name,
EGG::Heap * heap )

Schedules a single archive for loading.

Parameters
pathThe path to the folder containing the archive. See the path notes in dRes_c.
nameThe name of the archive. See the path notes in dRes_c.
heapThe heap to load the archive into, or nullptr to use the default archive heap.
Returns
Whether the archive was loaded successfully.

Definition at line 37 of file d_res_mng.cpp.

◆ getRes()

nw4r::g3d::ResFile dResMng_c::getRes ( const char * arcName,
const char * resPath ) const
inline

Gets a resource.

Parameters
arcNameThe name of the archive which contains the resource. See the path notes.
resPathThe path to the resource within the archive. See the path notes.
Returns
The resource file.

Definition at line 42 of file d_res_mng.hpp.

◆ getResSilently()

nw4r::g3d::ResFile dResMng_c::getResSilently ( const char * arcName,
const char * resPath ) const
inline

Gets a resource without logging a message if the resource is not found.

See also
getRes(const char*, const char*) const

Definition at line 47 of file d_res_mng.hpp.

◆ syncAllRes()

bool dResMng_c::syncAllRes ( )
inline

Attempts to load the resources of an archive that has finished loading since the last call to this function. The callback is executed on all files and folders.

Returns
Whether such an archive was found.

Definition at line 52 of file d_res_mng.hpp.

Member Data Documentation

◆ mRes

dRes_c dResMng_c::mRes
private

The resource manager.

Definition at line 57 of file d_res_mng.hpp.

◆ mCallback

resCallback_c dResMng_c::mCallback
private

The callback for after a file has been loaded.

Definition at line 58 of file d_res_mng.hpp.

◆ m_instance

dResMng_c * dResMng_c::m_instance
static

The instance of this class.

Definition at line 61 of file d_res_mng.hpp.