Fallout 4
0 of 0

File information

Last updated

Original upload

Created by

Karandra

Uploaded by

Karandra

Virus scan

Safe to use

About this mod

This mod allows preload F4SE plugins before the game initializes.

Requirements
Permissions and credits
Mirrors
Changelogs
What it does?
Allows preload F4SE plugins before the game initializes.

Do I need this and is there any benefit to this?
No! You don't need this unless a mod specifically says you require this. There is no benefit to having this for no reason. At the time of writing, you only need this if you are using PrivateProfileRedirector F4 or Buffout 4. There is no other reason to use the preloader otherwise. It allows the mod to make edit to the game code before the game has any chance to run that code.

How does it work?
Library IpHlpAPI.dll is loaded by game automatically, which preloads the plugins, then redirects all function calls to the original IpHlpAPI.dll file in your system directory.

Installation
Put IpHlpAPI.dll and xSE PluginPreloader.xml in your root Fallout 4 directory (where Fallout4.exe is), NOT in the Data folder.

Uninstallation
Delete installed files from your game folder. Any mod that depends on this will cease to work correctly.

Configuration
Preloader is implemented as proxy to IpHlpAPI.dll and thus is incompatible with any mod that changes this DLL (none I found). In such case you need to rename another mod IpHlpAPI.dll to something else and specify new real DLL in xSE PluginPreloader.xml file. Refer to the XML file for more detailed instructions.

ATTENTION!
Go to the xSE PluginPreloader.xml file and change the load method to OnThreadAttach or OnProcessAttach if the default doesn't work.

- If you're using Vortex to install mods use the Injector install method (DINPUT for older Vortex versions) for this mod.

To change the load method, edit the value of the "Name" attribute in the XML file.

<LoadMethod Name="ImportAddressHook">
    ...
</LoadMethod>

For example, if you need to set it to "OnThreadAttach" or "ImportAddressHook" edit this section like this.
<LoadMethod Name="OnThreadAttach">
    ...
</LoadMethod>
<LoadMethod Name="OnProcessAttach">
    ...
</LoadMethod>

User Q&A
Q: Does this have a performance hit or any downsides?
A: Nothing that have been noticed.

Q: Is it compatible with ENB?
A: Yes.

Q: Is ENB required?
A: No.

Q: Doesn't it mess up things if you load F4SE plugins at different time?
A: Only F4SE plugins that have included a special file, indicating that they wish to load earlier, will be preloaded. You should not manually create the file. Plugin author will decide this and include the file with their mod if it must be loaded like that.

Q: I'm having issues where a plugin is not preloaded when it's supposed to!
A: Find file xSE PluginPreloader.log in your game directory and upload it with your issue report. I'll try to find out what's wrong.

Mod author Q&A
Q: How do I make my plugin load before game initializes?
A: Let's say your plugin name is MyPlugin.dll and it's in Data/F4SE/Plugins, then you create a text file called MyPlugin_preload.txt in Data/F4SE/Plugins, the contents of the file does not matter.

Q: How is the plugin loaded?
A: The IpHlpAPI.dll loader will call LoadLibrary on your plugin before game initializes. It does NOT call F4SEPlugin_Query or F4SEPlugin_Load, those are called later by the F4SE itself. That means you must do whatever it is you need to do before the game initializes in your DllMain method. You can also export a function with name Initialize (with signature void(__cdecl*)(void), i.e. no parameters, no return value, C calling convention) to be called after.

Q: F4SE later calls LoadLibrary again, is that a problem?
A: No, LoadLibrary can be called multiple times and will only load the DLL once, unless it's in multiple locations as different files.

Q: Can I install my plugin files (including the _preload.txt) via Mod Organizer/Wrye Bash?
A: Original SKSE Plugin Preloader page says that you can. Considering that plugin packaging is identical, I think it's applicable. Same with Wrye Bash:
be sure to tell users to choose "Override Skips" on the installer so that the .txt installs along with your F4SE plugin

Plugin source is available on GitHub.

Credits:
Nukem - Detours library
meh321 - description template
Augh - testing.