|
NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
|
#include <game/cLib/c_dylink.hpp>
Base class for managing a relocatable module.
The class tracks how many times a module is being used via reference counting. It automatically handles the physical loading/linking when the first user requests it, and unloads it only when the last user is finished. All active modules are tracked in a global doubly-linked list.
Derived classes are expected to override the do_* methods to implement module-specific behavior.
Definition at line 46 of file c_dylink.hpp.
Public Member Functions | |
| DynamicModuleControlBase () | |
| Constructs a new DynamicModuleControlBase and adds it to the linked list. | |
| virtual | ~DynamicModuleControlBase () |
| Destroys the DynamicModuleControlBase and removes it from the linked list. | |
| virtual const char * | getModuleName () const |
| Gets the module name. | |
| virtual size_t | getModuleSize () const |
| Gets the module size in bytes. | |
| virtual const char * | getModuleTypeString () const |
| Gets a human-readable module type string. | |
| virtual void | dump () |
| Outputs debug information about the module. | |
| virtual bool | do_load () |
| Module-specific implementation for loading the module into memory. | |
| virtual bool | do_load_async () |
| Module-specific implementation for loading the module into memory asynchronously. | |
| virtual bool | do_unload () |
| Module-specific implementation for unloading the module from memory. | |
| virtual bool | do_link () |
| Module-specific implementation for linking the module, making it ready for use. | |
| virtual bool | do_unlink () |
| Module-specific implementation for unlinking the module. | |
| bool | link () |
| Loads and links the module if needed. | |
| bool | unlink () |
| Unlinks and unloads the module if needed. | |
| bool | load_async () |
| Loads the module asynchronously if needed. | |
Static Public Attributes | |
| static DynamicModuleControlBase * | mFirst |
| The first module in the linked list. | |
| static DynamicModuleControlBase * | mLast |
| The last module in the linked list. | |
Protected Attributes | |
| u16 | mUsageCount |
| The number of active users of this module. When this reaches zero, the module may be unloaded. | |
| u16 | mLinkCount |
| The number of times this module has been successfully linked. | |
| DynamicModuleControlBase * | mpPrev |
| The previous module in the linked list. | |
| DynamicModuleControlBase * | mpNext |
| The next module in the linked list. | |
| DynamicModuleControlBase::DynamicModuleControlBase | ( | ) |
Constructs a new DynamicModuleControlBase and adds it to the linked list.
Definition at line 25 of file c_dylink.cpp.
|
virtual |
Destroys the DynamicModuleControlBase and removes it from the linked list.
Definition at line 8 of file c_dylink.cpp.
|
inlinevirtual |
Gets the module name.
nullptr if unnamed. Reimplemented in DynamicModuleControl.
Definition at line 59 of file c_dylink.hpp.
|
virtual |
Gets the module size in bytes.
0 if unknown. Reimplemented in DynamicModuleControl.
Definition at line 73 of file c_dylink.cpp.
|
inlinevirtual |
Gets a human-readable module type string.
Reimplemented in DynamicModuleControl.
Definition at line 66 of file c_dylink.hpp.
|
virtual |
Outputs debug information about the module.
Reimplemented in DynamicModuleControl.
Definition at line 71 of file c_dylink.cpp.
|
inlinevirtual |
Module-specific implementation for loading the module into memory.
Reimplemented in DynamicModuleControl.
Definition at line 74 of file c_dylink.hpp.
|
inlinevirtual |
Module-specific implementation for loading the module into memory asynchronously.
Reimplemented in DynamicModuleControl.
Definition at line 78 of file c_dylink.hpp.
|
inlinevirtual |
Module-specific implementation for unloading the module from memory.
Reimplemented in DynamicModuleControl.
Definition at line 82 of file c_dylink.hpp.
|
inlinevirtual |
Module-specific implementation for linking the module, making it ready for use.
Reimplemented in dDynamicModuleControl, and DynamicModuleControl.
Definition at line 86 of file c_dylink.hpp.
|
inlinevirtual |
Module-specific implementation for unlinking the module.
Reimplemented in DynamicModuleControl.
Definition at line 90 of file c_dylink.hpp.
| bool DynamicModuleControlBase::link | ( | ) |
Loads and links the module if needed.
Definition at line 36 of file c_dylink.cpp.
| bool DynamicModuleControlBase::unlink | ( | ) |
Unlinks and unloads the module if needed.
Definition at line 54 of file c_dylink.cpp.
| bool DynamicModuleControlBase::load_async | ( | ) |
Loads the module asynchronously if needed.
true if the load is finished, false if it is still in progress. Definition at line 64 of file c_dylink.cpp.
|
protected |
The number of active users of this module. When this reaches zero, the module may be unloaded.
Definition at line 48 of file c_dylink.hpp.
|
protected |
The number of times this module has been successfully linked.
Definition at line 49 of file c_dylink.hpp.
|
protected |
The previous module in the linked list.
Definition at line 50 of file c_dylink.hpp.
|
protected |
The next module in the linked list.
Definition at line 51 of file c_dylink.hpp.
|
static |
The first module in the linked list.
Definition at line 106 of file c_dylink.hpp.
|
static |
The last module in the linked list.
Definition at line 107 of file c_dylink.hpp.