Adds a proper plugin check - NVSE will now load only DLLs that export NVSEPlugin_Query function.
Previously, NVSE would load all DLLs located in "nvse\plugins", and then check if they have NVSE functions. With this PR, the order is inverted, which safely allows to place non-NVSE libraries alongside NVSE ones if one has such need.
Adds a simple plugin preload system - By default, NVSE plugins are loaded with a slight delay regarding game's initialization, which makes it impossible to edit things like, MemoryManger or structure sizes that are initialized right at the start if the program. Mods like NVHR work around this limitation by spoofing themselves as game's includes (d3x9_38.dll in this case), which renders them incompatible with Mod Organizer 2 and complicates installation.
With the new preload system, plugins can opt-in into being loaded as early as possible through nvse_steam_loader. Plugin needs to declare and export a "bool NVSEPlugin_Preload()" function in order to be loaded at such early stage.
Since NVSE does not exist at that point of time, usage of its interfaces must be limited to the standard load time (NVSEPlugin_Load()).
Same thing applies to game's data, but I think modders who are going to benefit from this method are well aware of game's state on launch.
This PR implements two things:
Adds a proper plugin check - NVSE will now load only DLLs that export NVSEPlugin_Query function. Previously, NVSE would load all DLLs located in "nvse\plugins", and then check if they have NVSE functions. With this PR, the order is inverted, which safely allows to place non-NVSE libraries alongside NVSE ones if one has such need.
Adds a simple plugin preload system - By default, NVSE plugins are loaded with a slight delay regarding game's initialization, which makes it impossible to edit things like, MemoryManger or structure sizes that are initialized right at the start if the program. Mods like NVHR work around this limitation by spoofing themselves as game's includes (d3x9_38.dll in this case), which renders them incompatible with Mod Organizer 2 and complicates installation.
With the new preload system, plugins can opt-in into being loaded as early as possible through nvse_steam_loader. Plugin needs to declare and export a "bool NVSEPlugin_Preload()" function in order to be loaded at such early stage.
Since NVSE does not exist at that point of time, usage of its interfaces must be limited to the standard load time (NVSEPlugin_Load()). Same thing applies to game's data, but I think modders who are going to benefit from this method are well aware of game's state on launch.