1#include <game/bases/d_dylink.hpp>
2#include <game/mLib/m_heap.hpp>
3#include <constants/sjis_constants.h>
12 { fProfile::INVALID,
nullptr }
41 for (
int j = 0; j <
nDMC; j++) {
42 if (
pDMC[j] ==
nullptr) {
64 if (
pDMC[profile] ==
nullptr) {
67 return pDMC[profile]->unlink();
75 if (
pDMC[profile] ==
nullptr) {
78 return pDMC[profile]->link();
94 OSSetStringTable(stringTableBuffer);
103 return (
void *)
true;
112 if (
DVD ==
nullptr) {
Base class for managing a relocatable module.
Full implementation of a dynamic module handler.
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.
static void initialize(EGG::ExpHeap *heap)
Initializes the global dynamic linking system.
DynamicModuleControl(const char *name, EGG::ExpHeap *heap)
Constructs a new DynamicModuleControl.
static EGG::ExpHeap * sDylinkHeap
The heap used for dynamic module loading and BSS allocation.
dDynamicModuleControl(const char *name, EGG::ExpHeap *heap)
Constructs a new DynamicModuleControl.
virtual bool do_link() override
Module-specific implementation for linking the module, making it ready for use.
virtual ~dDynamicModuleControl()
Destroys the DynamicModuleControl.
int nDynamicNameTable
The amount of entries in pDynamicNameTable .
const sDynNameTableEntry DynamicNameTable[]
The profile to module name table.
DynamicModuleControl s_ProfileDMC("d_profile", nullptr)
The module handler for the d_profile module.
const sDynNameTableEntry * pDynamicNameTable
A pointer to the profile to module name table.
void * InitCallback(void *self)
Second initialization step of the dynamic module system.
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
@ PROFILE_COUNT
The total number of profiles.
bool Init(int profileCount, const sDynNameTableEntry *pNameTable, int nNameTable, EGG::Heap *heap)
First initialization step of the dynamic module system.
DynamicModuleControlBase ** pDMC
A table that keeps track of which module is associated with each profile.
EGG::FrmHeap * cCc_frmHeap
The heap to be used for allocating the module handlers and the profile to module table.
void InitAsync()
Initializes the dynamic module system.
int LinkASync(ProfileName profile)
Links the module associated with the given profile.
bool InitAsyncIsDone()
Checks whether initialization has completed.
int nDMC
The number of entries in pDMC.
mDvd_callback_c * DVD
The asynchronous DVD task used during the dynamic module system initialization.
bool Unlink(ProfileName profile)
Unlinks the module associated with the given profile.
BOOL Initialized
Whether the dynamic module system has finished initializing.
EGG::FrmHeap * createFrmHeap(size_t size, EGG::Heap *parent, const char *name, ulong align, AllocOptBit_t opt)
Creates a frame heap.
EGG::ExpHeap * g_dylinkHeap
The REL linking heap.
@ OPT_NONE
No special allocation options.
EGG::Heap * setCurrentHeap(EGG::Heap *heap)
Sets the specified heap as the current heap.
An entry in the profile to module name table.
const char * mModuleName
The name of the module to load for the profile, or nullptr if the profile is statically linked.
ProfileName mProf
The profile name of this entry.