NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
|
#include <game/bases/d_res.hpp>
An archive holder.
info_c is a high-level interface to resource archives ( .arc
files). It is generally not accessed directly, but is managed by the outer dRes_c class. It wraps the functionalities of mDvd_mountMemArchive_c and EGG::Archive to simplify the loading and iteration of resource archives.
Use the set function to manually schedule an archive for loading. If successful, a file loading command is generated and queued to continue the loading process in the background.
Use the setRes function to query the archive's loading state. Once the loading process is completed, the command is deleted and the archive's resource list is built using the provided callback.
Each archive holder features a reference count, which acts as a garbage disposal mechanism: each time the archive is requested the count increases, while it decreases when its deletion is requested. When the counter reaches zero (or the holder is deleted), the archive is automatically disposed.
Public Types | |
enum | LOAD_STATUS_e { LOAD_ERROR = -1 , LOAD_SUCCESS = 0 , LOAD_IN_PROGRESS = 1 } |
The loading status of the archive. More... | |
Public Member Functions | |
info_c () | |
Constructs a new archive holder. | |
~info_c () | |
Destroys the archive holder. | |
bool | cleanup () |
Unmounts the archive and frees the holder for use. | |
bool | set (const char *arcName, const char *containingFolder, u8 allocDirection, EGG::Heap *heap) |
Sets information about the archive to be loaded. | |
LOAD_STATUS_e | setRes (callback_c *callback) |
Attempts to load the archive into memory and load the resources with a callback. | |
const char * | getName () const |
int | getRefCount () const |
mDvd_mountMemArchive_c * | getDvdCmd () const |
Gets the file loading command. | |
EGG::Archive * | getArchive () const |
Gets the archive accessor. | |
void | incRefCount () |
Increments the reference count. | |
void | decRefCount () |
Decrements the reference count. | |
Private Member Functions | |
LOAD_STATUS_e | loadRes (callback_c *callback) |
Builds the resource list and executes a callback on each file and directory. | |
Private Attributes | |
char | mName [0x20] |
The name of the archive. | |
u16 | mRefCount |
The number of references to this archive. | |
mDvd_mountMemArchive_c * | mpDvdCmd |
The DVD command for mounting the archive. | |
EGG::Archive * | mpArchive |
The accessor for this archive. | |
EGG::Heap * | mpMountHeap |
The heap used for mounting the archive. | |
void * | mpArcBinary |
The raw archive data. | |
int | mArchiveSize |
The archive size. | |
EGG::FrmHeap * | mDataHeap |
The heap used for loading the resources of the archive. | |
u8 ** | mpFiles |
An array of pointers to the data of each loaded resource. | |
dRes_c::info_c::info_c | ( | ) |
Constructs a new archive holder.
Definition at line 7 of file d_res_info.cpp.
dRes_c::info_c::~info_c | ( | ) |
Destroys the archive holder.
Definition at line 17 of file d_res_info.cpp.
bool dRes_c::info_c::cleanup | ( | ) |
Unmounts the archive and frees the holder for use.
Definition at line 27 of file d_res_info.cpp.
bool dRes_c::info_c::set | ( | const char * | arcName, |
const char * | containingFolder, | ||
u8 | allocDirection, | ||
EGG::Heap * | heap ) |
Sets information about the archive to be loaded.
arcName | The name of the archive. |
containingFolder | The path to the folder which the archive is in. |
allocDirection | The allocation direction. See MEMExpHeapAllocDir. |
heap | The heap to load the resources of the archive into, or nullptr to use the default heap. |
Definition at line 63 of file d_res_info.cpp.
dRes_c::info_c::LOAD_STATUS_e dRes_c::info_c::setRes | ( | callback_c * | callback | ) |
Attempts to load the archive into memory and load the resources with a callback.
callback | The resource loaded callback, or nullptr . |
Definition at line 79 of file d_res_info.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Builds the resource list and executes a callback on each file and directory.
callback | The resource loaded callback, or nullptr . |
Definition at line 143 of file d_res_info.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |