NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
dRes_c::info_c Class Reference

#include <dol/bases/d_res.hpp>

Description

A class that holds information about an archive.

Definition at line 59 of file d_res.hpp.

Public Member Functions

 info_c ()
 Constructs a new info_c.
 
 ~info_c ()
 Destroys this info_c.
 
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.
 
int 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
 
void * getDvdCmd () const
 
EGG::ArchivegetArchive () const
 
void incRefCount ()
 Increments the reference count.
 
void decRefCount ()
 Decrements the reference count.
 

Private Member Functions

int loadRes (callback_c *callback)
 Executes a callback on each file and folder of the archive.
 

Private Attributes

char mName [0x20]
 The name of the archive.
 
u16 mRefCount
 The number of references to this archive.
 
mDvd_mountMemArchive_cmpDvdCmd
 The DVD command for mounting the archive.
 
EGG::ArchivempArchive
 An EGG::Archive instance for this archive.
 
EGG::HeapmpMountHeap
 The heap used for mounting the archive.
 
void * mpArcBinary
 The raw archive data.
 
int mUnk
 Unknown.
 
EGG::FrmHeapmDataHeap
 The heap used for loading the resources of the archive. [No p because of the string "dRes_c::info_c::mDataHeap"].
 
u8 ** mpFiles
 An array of pointers to the data of each loaded resource.
 

Constructor & Destructor Documentation

◆ info_c()

dRes_c::info_c::info_c ( )

Constructs a new info_c.

Definition at line 7 of file d_res_info.cpp.

◆ ~info_c()

dRes_c::info_c::~info_c ( )

Destroys this info_c.

Definition at line 17 of file d_res_info.cpp.

Member Function Documentation

◆ cleanup()

bool dRes_c::info_c::cleanup ( )

Unmounts the archive and frees the holder for use.

Returns
Whether the operation was successful.

Definition at line 27 of file d_res_info.cpp.

◆ set()

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.

Parameters
arcNameThe name of the archive.
containingFolderThe path to the folder which the archive is in.
allocDirectionThe allocation direction. 1: top-down, anything else: bottom-up.
heapThe heap to load the resources of the archive into.
Returns
Whether the archive was prepared successfully and will be loaded.

Definition at line 63 of file d_res_info.cpp.

◆ setRes()

int dRes_c::info_c::setRes ( callback_c callback)

Attempts to load the archive into memory and load the resources with a callback.

Parameters
callbackThe callback for the resources.
Returns
A status code for the result of the operation. -1: error, 0: success, 1: not finished loading

Definition at line 79 of file d_res_info.cpp.

◆ getName()

const char * dRes_c::info_c::getName ( ) const
inline

Definition at line 87 of file d_res.hpp.

◆ getRefCount()

int dRes_c::info_c::getRefCount ( ) const
inline

Definition at line 88 of file d_res.hpp.

◆ getDvdCmd()

void * dRes_c::info_c::getDvdCmd ( ) const
inline

Definition at line 89 of file d_res.hpp.

◆ getArchive()

EGG::Archive * dRes_c::info_c::getArchive ( ) const
inline

Definition at line 90 of file d_res.hpp.

◆ incRefCount()

void dRes_c::info_c::incRefCount ( )
inline

Increments the reference count.

Definition at line 92 of file d_res.hpp.

◆ decRefCount()

void dRes_c::info_c::decRefCount ( )
inline

Decrements the reference count.

Definition at line 93 of file d_res.hpp.

◆ loadRes()

int dRes_c::info_c::loadRes ( dRes_c::callback_c callback)
private

Executes a callback on each file and folder of the archive.

If the callback is nullptr , the files will still be loaded and pointers to each file will be stored in mpFiles.

Parameters
callbackThe callback for this resource, or nullptr .
Returns
Whether the resource was opened successfully.

Definition at line 143 of file d_res_info.cpp.

Member Data Documentation

◆ mName

char dRes_c::info_c::mName[0x20]
private

The name of the archive.

Definition at line 106 of file d_res.hpp.

◆ mRefCount

u16 dRes_c::info_c::mRefCount
private

The number of references to this archive.

Definition at line 107 of file d_res.hpp.

◆ mpDvdCmd

mDvd_mountMemArchive_c* dRes_c::info_c::mpDvdCmd
private

The DVD command for mounting the archive.

Definition at line 108 of file d_res.hpp.

◆ mpArchive

EGG::Archive* dRes_c::info_c::mpArchive
private

An EGG::Archive instance for this archive.

Definition at line 109 of file d_res.hpp.

◆ mpMountHeap

EGG::Heap* dRes_c::info_c::mpMountHeap
private

The heap used for mounting the archive.

Definition at line 110 of file d_res.hpp.

◆ mpArcBinary

void* dRes_c::info_c::mpArcBinary
private

The raw archive data.

Definition at line 111 of file d_res.hpp.

◆ mUnk

int dRes_c::info_c::mUnk
private

Unknown.

Definition at line 112 of file d_res.hpp.

◆ mDataHeap

EGG::FrmHeap* dRes_c::info_c::mDataHeap
private

The heap used for loading the resources of the archive. [No p because of the string "dRes_c::info_c::mDataHeap"].

Definition at line 113 of file d_res.hpp.

◆ mpFiles

u8** dRes_c::info_c::mpFiles
private

An array of pointers to the data of each loaded resource.

Definition at line 114 of file d_res.hpp.