libloadorder-ffi provides a C API wrapper around libloadorder, a free software library for manipulating the load order and active status of plugins for the following games:
- TES III: Morrowind
- TES IV: Oblivion
- TES V: Skyrim
- TES V: Skyrim Special Edition
- Fallout 3
- Fallout: New Vegas
- Fallout 4
- Fallout 4 VR
libloadorder-ffi uses character strings and integers for information input/output.
- All strings are null-terminated byte character strings encoded in UTF-8.
- All return, game and load order method codes are unsigned integers at least 16 bits in size.
- All array sizes are unsigned integers at least 16 bits in size.
- File paths are case-sensitive if and only if the underlying file system is case-sensitive.
libloadorder-ffi is thread-safe. Reading and writing data for a single game handle is protected by a reader-writer lock, and error messages are stored thread-locally.
Game handles operate independently, so using more than one game handle for a single game across multiple threads is not advised, as filesystem changes made when writing data are not atomic and data races may occur under such usage.
libloadorder caches plugin data to improve performance. Each game handle has its own unique cache, which is cleared when
- an error is encountered writing a change.
Where libloadorder functions take one or more plugin filenames, it checks that these filenames correspond to valid plugins. libloadorder defines a valid plugin as one that:
.esl.ghostfor Skyrim Special Edition, Fallout 4 and Fallout 4 VR).
Contains a header record with:
- The correct type (
- A size that is not larger than the total file size.
- Subrecords with sizes that do not together sum to larger than the expected total subrecords size.
- The correct type (
This definition is substantially more permissive than games or other utilities may be for performance reasons, and because libloadorder uses no plugin data beyond the header record, so later corruption or invalid data would not affect its behaviour.
This permissivity does allow more strictly invalid plugins to be positioned in the load order and activated, which may cause game issues, but protecting against such circumstances is beyond the scope of libloadorder.
Any load order that is set using libloadorder must meet all the following conditions:
- Contains only installed plugins.
- Contains no duplicate entries.
- Loads all master files (including light masters and false-flagged plugins) before all plugin files.
- Contains no more than 255 active plugins, excluding light masters.
- Contains no more than 4096 active light masters.
- Contains all the game's implicitly active plugins that are installed (e.g.
- Starts with the game's main master file (Skyrim, Skyrim SE, Fallout 4 and Fallout 4 VR only).
Libloadorder considers a load order that fulfills all the above conditions to be valid, though there are additional conditions that may be enforced by the game (e.g. a plugin must load after all the plugins it depends on).
Libloadorder is less strict when loading load orders and will adjust them at load time to be valid, similar to game behaviour.
The specified file could not be found.
The specified file is not encoded in UTF-8.
There was an error parsing a plugin file.
A file could not be renamed.
The library encountered an error that should not have been possible to encounter.
Invalid arguments were given for the function.
An unknown I/O error occurred. This is used when the I/O error kind doesn't fit another error code.
Permission denied while trying to access a filesystem path.
A thread lock was poisoned.
Text expected to be encoded in Windows-1252 could not be decoded to UTF-8.
A plugin filename contains characters that do not have Windows-1252 code points, or a character string contains a null character.
The modification date of a file could not be set.
Game code for Fallout: New Vegas.
Game code for Fallout 3.
Game code for Fallout 4.
Game code for Fallout 4 VR.
Game code for The Elder Scrolls III: Morrowind.
Game code for The Elder Scrolls IV: Oblivion.
Game code for The Elder Scrolls V: Skyrim.
Game code for The Elder Scrolls V: Skyrim Special Edition.
Game code for The Elder Scrolls V: Skyrim VR.
The asterisk load order system, used by Fallout 4 and Skyrim Special Edition.
he game handle is using the textfile-based load order system. Skyrim uses this system.
The game handle is using the timestamp-based load order system. Morrowind, Oblivion, Fallout 3 and Fallout: New Vegas all use this system.
Success return code.
Matches the value of the highest-numbered return code.
There is a mismatch between the files used to keep track of load order.
Initialise a new game handle.
Destroy an existing game handle.
Fix up the text file(s) used by the load order and active plugins systems.
Free memory allocated to string output.
Free memory allocated to string array output.
Gets the list of currently active plugins.
Get the message for the last error or warning encountered.
Get the list of implicitly active plugins for the given handle's game.
Get filename of the plugin at a specific load order position.
Get the current load order.
Get which method is used for the load order.
Checks if a given plugin is active.
Get the load order position of a plugin.
Gets the library version.
Load the current load order state, discarding any previously held state.
Sets the list of currently active plugins.
Set the load order.
Activates or deactivates a given plugin.
Set the load order position of a plugin.
A structure that holds all game-specific data used by libloadorder.