3#include <game/mLib/m_dvd.hpp>
4#include <lib/egg/core/eggExpHeap.h>
5#include <lib/egg/core/eggDvdFile.h>
6#include <lib/nw4r/db.h>
24 void RegisterOnDvd(
const char *path,
const OSModuleInfo *moduleInfo);
31 u8
mBuf[
sizeof(nw4r::db::MapFile)];
132 virtual void dump()
override;
133 virtual bool do_load()
override;
136 virtual bool do_link()
override;
A debug map file wrapper.
u8 mBuf[sizeof(nw4r::db::MapFile)]
The raw storage for the MapFile instance.
void RegisterOnDvd(const char *path, const OSModuleInfo *moduleInfo)
Loads and registers a map file from disc.
~DbMapFile()
Destroys the map file.
nw4r::db::MapFile * mpMapFile
A pointer to the internal MapFile instance.
void Unregister()
Unregisters the map file.
DbMapFile()
Creates the map file.
static DynamicModuleControlBase * mLast
The last module in the linked list.
virtual void dump()
Outputs debug information about the module.
DynamicModuleControlBase()
Constructs a new DynamicModuleControlBase and adds it to the linked list.
virtual bool do_unload()
Module-specific implementation for unloading the module from memory.
virtual const char * getModuleTypeString() const
Gets a human-readable module type string.
bool unlink()
Unlinks and unloads the module if needed.
virtual ~DynamicModuleControlBase()
Destroys the DynamicModuleControlBase and removes it from the linked list.
virtual bool do_unlink()
Module-specific implementation for unlinking the module.
bool link()
Loads and links the module if needed.
DynamicModuleControlBase * mpPrev
The previous module in the linked list.
virtual const char * getModuleName() const
Gets the module name.
virtual bool do_load()
Module-specific implementation for loading the module into memory.
virtual bool do_link()
Module-specific implementation for linking the module, making it ready for use.
static DynamicModuleControlBase * mFirst
The first module in the linked list.
bool load_async()
Loads the module asynchronously if needed.
virtual bool do_load_async()
Module-specific implementation for loading the module into memory asynchronously.
DynamicModuleControlBase * mpNext
The next module in the linked list.
u16 mLinkCount
The number of times this module has been successfully linked.
virtual size_t getModuleSize() const
Gets the module size in bytes.
u16 mUsageCount
The number of active users of this module. When this reaches zero, the module may be unloaded.
virtual bool do_link() override
Module-specific implementation for linking the module, making it ready for use.
static EGG::DvdFile * sDvdFile
The DVD file handle used for loading the string table file.
static const char * sModulesDir
The directory on the disk where the modules are located.
ModuleType_e
Identifies where the module data is physically located.
@ MODULE_TYPE_UNKNOWN
The module type has not yet been determined.
@ MODULE_TYPE_DVD
The module is loaded from the disc.
@ MODULE_TYPE_MEM
The module is loaded from main RAM.
@ MODULE_TYPE_ARAM
The module is loaded from ARAM.
u32 mPrologReturn
The return value of the module's prolog function.
virtual ~DynamicModuleControl()
Destroys the DynamicModuleControl.
virtual size_t getModuleSize() const override
Gets the module size in bytes.
static size_t sAllocBytes
The total number of bytes allocated across all active modules.
void * mpBss
The BSS section of the module.
static void initialize(EGG::ExpHeap *heap)
Initializes the global dynamic linking system.
virtual const char * getModuleTypeString() const override
Gets a human-readable module type string.
EGG::ExpHeap * mpHeap
The heap used for module loading and BSS allocation.
virtual bool do_load() override
Module-specific implementation for loading the module into memory.
OSModuleHeader * mpModule
The data of the module, including the header.
virtual const char * getModuleName() const override
Gets the module name.
DbMapFile mDebugMapFile
The debug map file for this module.
DynamicModuleControl(const char *name, EGG::ExpHeap *heap)
Constructs a new DynamicModuleControl.
virtual bool do_load_async() override
Module-specific implementation for loading the module into memory asynchronously.
mDvd_callback_c * mpDvdCallback
The DVD command used to load the module asynchronously.
u16 mChecksum
The checksum of the module.
int mModuleSize
The module size, in bytes.
static EGG::ExpHeap * sDylinkHeap
The heap used for dynamic module loading and BSS allocation.
static size_t sHeapMinAllocatableSize
The lowest observed allocatable space in sDylinkHeap during module loading.
virtual bool do_unlink() override
Module-specific implementation for unlinking the module.
virtual void dump() override
Outputs debug information about the module.
void checkHeapStatus()
Updates the module linking heap statistics.
u8 mLoadCount
The number of times this module has been loaded.
static size_t sHeapMinTotalFreeSize
The lowest observed free space in sDylinkHeap during module loading.
virtual bool do_unload() override
Module-specific implementation for unloading the module from memory.
static void * callback(void *self)
Internal callback used for asynchronous loading operations.
u8 mType
The module type. See ModuleType_e.
const char * mModuleName
The module name.