Fixed bug in Inode_ClearCache
[tpg/acess2.git] / Kernel / modules.c
index a4e639b..44c4cb5 100644 (file)
@@ -6,6 +6,7 @@
 #include <modules.h>
 
 // === PROTOTYPES ===
+ int   Modules_LoadBuiltins();
  int   Module_LoadMem(void *Buffer, Uint Length, char *ArgString);
  int   Module_LoadFile(char *Path, char *ArgString);
  int   Module_int_ResolveDeps(tModule *Info);
@@ -46,7 +47,6 @@ int Modules_LoadBuiltins()
                                        if(strcmp(deps[j], gKernelModules[k].Name) == 0)
                                                break;
                                }
-                               Log("%s requires %s\n", gKernelModules[i].Name, deps[j]);
                                if(k == giNumBuiltinModules) {
                                        Warning("Unable to find dependency '%s' for '%s' in kernel",
                                                deps[j], gKernelModules[i].Name);
@@ -78,7 +78,6 @@ int Modules_LoadBuiltins()
                                        }
                                        // `k` is assumed to be less than `giNumBuiltinModules`
                                        
-                                       Log("baIsLoaded[%i(%s)] = %i\n", k, deps[j], baIsLoaded[k]);
                                        // If a dependency failed, skip and mark as failed
                                        if( baIsLoaded[k] == -1 ) {
                                                baIsLoaded[i] = -1;
@@ -99,9 +98,13 @@ int Modules_LoadBuiltins()
                                gKernelModules[i].Name,
                                gKernelModules[i].Version>>8, gKernelModules[i].Version & 0xFF
                                );
-                       gKernelModules[i].Init(NULL);
+                       if( gKernelModules[i].Init(NULL) == 0 ) {
+                               Log("Loading Failed, all modules that depend on this will also fail");
+                               baIsLoaded[i] = -1;
+                       }
                        // Mark as loaded
-                       baIsLoaded[i] = 1;
+                       else
+                               baIsLoaded[i] = 1;
                        numToInit --;
                }
        }
@@ -117,7 +120,7 @@ int Module_LoadMem(void *Buffer, Uint Length, char *ArgString)
 {
        char    path[VFS_MEMPATH_SIZE];
        
-       VFS_GetMemPath(Buffer, Length, path);
+       VFS_GetMemPath(path, Buffer, Length);
        
        return Module_LoadFile( path, ArgString );
 }

UCC git Repository :: git.ucc.asn.au