In short, SML is a library that loads mods and provides a
common API for mods to work together. SML loads
automatically when the game is loaded because of a trick
in Windows. When Windows looks for DLLs to load, it starts
the search in the current directory, before looking
in System32 and other directories on the system path.
SML is named
xinput1_3.dll, the DirectX Xbox
input API, to load itself when Unreal Engine requests that
DLL to be loaded.
After SML is loaded
SML starts by SML scanning the coremods/ folder for any dlls that need to be loaded as a coremod. We will go into the difference between mods, coremods, scripts, and paks in a different guide. After coremods are loaded, the mods/ folder is scanned for mod dlls. After each mod is loaded, the mod is checked to see if it has the correct mod format. if it doesn't, the mod is unloaded and a message is displayed to the user.
The mod setup process
After all the mods with the correct format are loaded, the mod list is iterated to run the setup functions of each mod. The setup function disregards any dependencies, and is run by the order that mods were loaded in. This function should be used for registering your own mods' functionality and adding your hooks. In this context, hooks are functions in Satisfactory that you add custom code to. The postSetup function is run based on dependencies, so you can expect mods that you depend on to have run their postSetup functions before you. postSetup should be used for anything that requires other mods' setup functions to be run first. After postSetup, SML does not run any code unless the mod hooks any functions or registers any chat commands.