NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_res_mng.hpp
Go to the documentation of this file.
1#pragma once
2#include <types.h>
3#include <game/bases/d_res.hpp>
4/// @file
5
6#define MAX_NUM_RES 300 ///< The maximum number of resources that can be loaded at once.
7
8/// @brief A higher-level archive resource management class.
9/// @ingroup bases
10class dResMng_c {
11private:
12 /// @brief A callback class for processing resources that handles loading g3d data.
14 public:
15 virtual void init(const char *name);
16 virtual void *execute(void *data, u32 folderSig, const char* path);
17 };
18
19public:
20 dResMng_c(); ///< Constructs a new dResMng_c.
21 virtual ~dResMng_c(); ///< Destroys this dResMng_c.
22
23 /**
24 * @brief Schedules multiple archives for loading.
25 * @param path The path to the folder containing the archives. See the path notes in dRes_c.
26 * @param names An array of archive names. See the path notes in dRes_c.
27 * @param count The number of archives in the array.
28 * @param heap The heap to load the archives into, or @p nullptr to use the default archive heap.
29 */
30 void setRes(const char *path, const char **names, int count, EGG::Heap *heap);
31
32 /**
33 * @brief Schedules a single archive for loading.
34 * @param path The path to the folder containing the archive. See the path notes in dRes_c.
35 * @param name The name of the archive. See the path notes in dRes_c.
36 * @param heap The heap to load the archive into, or @p nullptr to use the default archive heap.
37 * @return Whether the archive was loaded successfully.
38 */
39 bool setRes(const char *path, const char *name, EGG::Heap *heap);
40
41 dRes_c mRes; ///< The resource manager.
42
43private:
44 resCallback_c mCallback; ///< The callback for after a file has been loaded.
45
46public:
47 static dResMng_c *m_instance; ///< The instance of this class.
48};
A callback class for processing resources that handles loading g3d data.
Definition d_res_mng.hpp:13
virtual void * execute(void *data, u32 folderSig, const char *path)
Executes the callback.
Definition d_res_mng.cpp:18
virtual void init(const char *name)
Initializes the callback with the resource name.
Definition d_res_mng.cpp:16
static dResMng_c * m_instance
The instance of this class.
Definition d_res_mng.hpp:47
virtual ~dResMng_c()
Destroys this dResMng_c.
Definition d_res_mng.cpp:12
dRes_c mRes
The resource manager.
Definition d_res_mng.hpp:41
dResMng_c()
Constructs a new dResMng_c.
Definition d_res_mng.cpp:7
resCallback_c mCallback
The callback for after a file has been loaded.
Definition d_res_mng.hpp:44
void setRes(const char *path, const char **names, int count, EGG::Heap *heap)
Schedules multiple archives for loading.
Definition d_res_mng.cpp:31
A callback class for processing resources.
Definition d_res.hpp:16
An archive resource management class.
Definition d_res.hpp:11