|
NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
|
#include <game/cLib/c_dylink.hpp>
Full implementation of a dynamic module handler.
Definition at line 112 of file c_dylink.hpp.
Public Types | |
| enum | ModuleType_e { MODULE_TYPE_UNKNOWN , MODULE_TYPE_MEM , MODULE_TYPE_ARAM , MODULE_TYPE_DVD } |
| Identifies where the module data is physically located. More... | |
Public Member Functions | |
| DynamicModuleControl (const char *name, EGG::ExpHeap *heap) | |
| Constructs a new DynamicModuleControl. | |
| virtual | ~DynamicModuleControl () |
| Destroys the DynamicModuleControl. | |
| virtual const char * | getModuleName () const override |
| Gets the module name. | |
| virtual size_t | getModuleSize () const override |
| Gets the module size in bytes. | |
| virtual const char * | getModuleTypeString () const override |
| Gets a human-readable module type string. | |
| virtual void | dump () override |
| Outputs debug information about the module. | |
| virtual bool | do_load () override |
| Module-specific implementation for loading the module into memory. | |
| virtual bool | do_load_async () override |
| Module-specific implementation for loading the module into memory asynchronously. | |
| virtual bool | do_unload () override |
| Module-specific implementation for unloading the module from memory. | |
| virtual bool | do_link () override |
| Module-specific implementation for linking the module, making it ready for use. | |
| virtual bool | do_unlink () override |
| Module-specific implementation for unlinking the module. | |
| void | checkHeapStatus () |
| Updates the module linking heap statistics. | |
| Public Member Functions inherited from DynamicModuleControlBase | |
| DynamicModuleControlBase () | |
| Constructs a new DynamicModuleControlBase and adds it to the linked list. | |
| virtual | ~DynamicModuleControlBase () |
| Destroys the DynamicModuleControlBase and removes it from the linked list. | |
| 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 Member Functions | |
| static void | initialize (EGG::ExpHeap *heap) |
| Initializes the global dynamic linking system. | |
| static void * | callback (void *self) |
| Internal callback used for asynchronous loading operations. | |
Public Attributes | |
| u8 | mPad [4] |
| OSModuleHeader * | mpModule |
| The data of the module, including the header. | |
| void * | mpBss |
| The BSS section of the module. | |
| u32 | mPrologReturn |
| The return value of the module's prolog function. | |
| const char * | mModuleName |
| The module name. | |
| u8 | mType |
| The module type. See ModuleType_e. | |
| u8 | mLoadCount |
| The number of times this module has been loaded. | |
| u16 | mChecksum |
| The checksum of the module. | |
| int | mModuleSize |
| The module size, in bytes. | |
| mDvd_callback_c * | mpDvdCallback |
| The DVD command used to load the module asynchronously. | |
| EGG::ExpHeap * | mpHeap |
| The heap used for module loading and BSS allocation. | |
| DbMapFile | mDebugMapFile |
| The debug map file for this module. | |
Static Public Attributes | |
| static EGG::ExpHeap * | sDylinkHeap |
| The heap used for dynamic module loading and BSS allocation. | |
| static EGG::DvdFile * | sDvdFile |
| The DVD file handle used for loading the string table file. | |
| static size_t | sAllocBytes |
| The total number of bytes allocated across all active modules. | |
| static size_t | sHeapMinAllocatableSize |
| The lowest observed allocatable space in sDylinkHeap during module loading. | |
| static size_t | sHeapMinTotalFreeSize |
| The lowest observed free space in sDylinkHeap during module loading. | |
| static const char * | sModulesDir = "/rels" |
| The directory on the disk where the modules are located. | |
| Static Public Attributes inherited from DynamicModuleControlBase | |
| static DynamicModuleControlBase * | mFirst |
| The first module in the linked list. | |
| static DynamicModuleControlBase * | mLast |
| The last module in the linked list. | |
Additional Inherited Members | |
| Protected Attributes inherited from DynamicModuleControlBase | |
| 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. | |
Identifies where the module data is physically located.
Definition at line 116 of file c_dylink.hpp.
| DynamicModuleControl::DynamicModuleControl | ( | const char * | name, |
| EGG::ExpHeap * | heap ) |
Constructs a new DynamicModuleControl.
| name | The module name. |
| heap | The heap to load the module into, or nullptr to use the default heap. |
Definition at line 86 of file c_dylink.cpp.
|
virtual |
Destroys the DynamicModuleControl.
Definition at line 100 of file c_dylink.cpp.
|
overridevirtual |
Gets the module name.
nullptr if unnamed. Reimplemented from DynamicModuleControlBase.
Definition at line 102 of file c_dylink.cpp.
|
overridevirtual |
Gets the module size in bytes.
0 if unknown. Reimplemented from DynamicModuleControlBase.
Definition at line 329 of file c_dylink.cpp.
|
overridevirtual |
Gets a human-readable module type string.
Reimplemented from DynamicModuleControlBase.
Definition at line 340 of file c_dylink.cpp.
|
overridevirtual |
Outputs debug information about the module.
Reimplemented from DynamicModuleControlBase.
Definition at line 245 of file c_dylink.cpp.
|
overridevirtual |
Module-specific implementation for loading the module into memory.
Reimplemented from DynamicModuleControlBase.
Definition at line 146 of file c_dylink.cpp.
|
overridevirtual |
Module-specific implementation for loading the module into memory asynchronously.
Reimplemented from DynamicModuleControlBase.
Definition at line 220 of file c_dylink.cpp.
|
overridevirtual |
Module-specific implementation for unloading the module from memory.
Reimplemented from DynamicModuleControlBase.
Definition at line 237 of file c_dylink.cpp.
|
overridevirtual |
Module-specific implementation for linking the module, making it ready for use.
Reimplemented from DynamicModuleControlBase.
Reimplemented in dDynamicModuleControl.
Definition at line 247 of file c_dylink.cpp.
|
overridevirtual |
Module-specific implementation for unlinking the module.
Reimplemented from DynamicModuleControlBase.
Definition at line 313 of file c_dylink.cpp.
| void DynamicModuleControl::checkHeapStatus | ( | ) |
Updates the module linking heap statistics.
The function tracks the minimum allocatable space and minimum free space size during module operations, probably to aid in debugging.
Definition at line 122 of file c_dylink.cpp.
|
static |
Initializes the global dynamic linking system.
| heap | The heap where all modules will be allocated by default. |
Definition at line 106 of file c_dylink.cpp.
|
static |
Internal callback used for asynchronous loading operations.
The return type is void* to satisfy the type required by mDvd_callback_c.
| self | Pointer to the DynamicModuleControl instance. |
Definition at line 117 of file c_dylink.cpp.
| u8 DynamicModuleControl::mPad[4] |
Definition at line 154 of file c_dylink.hpp.
| OSModuleHeader* DynamicModuleControl::mpModule |
The data of the module, including the header.
Definition at line 155 of file c_dylink.hpp.
| void* DynamicModuleControl::mpBss |
The BSS section of the module.
Definition at line 156 of file c_dylink.hpp.
| u32 DynamicModuleControl::mPrologReturn |
The return value of the module's prolog function.
Definition at line 157 of file c_dylink.hpp.
| const char* DynamicModuleControl::mModuleName |
The module name.
Definition at line 158 of file c_dylink.hpp.
| u8 DynamicModuleControl::mType |
The module type. See ModuleType_e.
Definition at line 159 of file c_dylink.hpp.
| u8 DynamicModuleControl::mLoadCount |
The number of times this module has been loaded.
Definition at line 160 of file c_dylink.hpp.
| u16 DynamicModuleControl::mChecksum |
The checksum of the module.
Definition at line 161 of file c_dylink.hpp.
| int DynamicModuleControl::mModuleSize |
The module size, in bytes.
Definition at line 162 of file c_dylink.hpp.
| mDvd_callback_c* DynamicModuleControl::mpDvdCallback |
The DVD command used to load the module asynchronously.
Definition at line 163 of file c_dylink.hpp.
| EGG::ExpHeap* DynamicModuleControl::mpHeap |
The heap used for module loading and BSS allocation.
Definition at line 164 of file c_dylink.hpp.
| DbMapFile DynamicModuleControl::mDebugMapFile |
The debug map file for this module.
Definition at line 165 of file c_dylink.hpp.
|
static |
The heap used for dynamic module loading and BSS allocation.
Definition at line 167 of file c_dylink.hpp.
|
static |
The DVD file handle used for loading the string table file.
Definition at line 168 of file c_dylink.hpp.
|
static |
The total number of bytes allocated across all active modules.
Definition at line 169 of file c_dylink.hpp.
|
static |
The lowest observed allocatable space in sDylinkHeap during module loading.
Definition at line 170 of file c_dylink.hpp.
|
static |
The lowest observed free space in sDylinkHeap during module loading.
Definition at line 171 of file c_dylink.hpp.
|
static |
The directory on the disk where the modules are located.
Definition at line 172 of file c_dylink.hpp.