int Module_int_Initialise(tModule *Module, const char *ArgString);
void Modules_int_GetBuiltinArray(void);
void Modules_LoadBuiltins(void);
-void Modules_SetBuiltinParams(char *Name, char *ArgString);
+void Modules_SetBuiltinParams(const char *Name, char *ArgString);
+ int Modules_InitialiseBuiltin(const char *Name);
// int Module_RegisterLoader(tModuleLoader *Loader);
// int Module_LoadMem(void *Buffer, Uint Length, char *ArgString);
// int Module_LoadFile(char *Path, char *ArgString);
int Module_int_ResolveDeps(tModule *Info);
int Module_IsLoaded(const char *Name);
+// int Module_EnsureLoaded(const char *Name);
// === EXPORTS ===
EXPORT(Module_RegisterLoader);
// All Dependencies OK? Initialise
StartupPrint(Module->Name);
- Log_Log("Module", "Initialising %p '%s' v%i.%i...",
+ Log_Log("Module", "Starting %p '%s' v%i.%i",
Module, Module->Name,
Module->Version >> 8, Module->Version & 0xFF
);
Log_Warning("Module", "Unable to load, reason: Miscelanious");
break;
case MODULE_ERR_NOTNEEDED:
- Log_Warning("Module", "Unable to load, reason: Module not needed");
+ Log_Debug("Module", "Unable to load, reason: Module not needed");
break;
case MODULE_ERR_MALLOC:
Log_Warning("Module", "Unable to load, reason: Error in malloc/realloc/calloc, probably not good");
/**
* \brief Sets the parameters for a builtin module
*/
-void Modules_SetBuiltinParams(char *Name, char *ArgString)
+void Modules_SetBuiltinParams(const char *Name, char *ArgString)
{
int i;
// not found - return false
return 0;
}
+
+/**
+ * \brief Load a module if needed
+ */
+int Module_EnsureLoaded(const char *Name)
+{
+ if( Module_IsLoaded(Name) )
+ return 0;
+
+ if( Modules_InitialiseBuiltin(Name) == 0 )
+ return 0;
+
+ // TODO: Load from a file?
+
+ return -1;
+}