3639 Commits
Author SHA1 Message Date
Oliver Hamlet 06937ffc83 Update changelog and version for 0.25.0 0.25.0 2025-02-02 21:32:30 +00:00
Oliver Hamlet c26b495c03 Update libloadorder to 18.2.1 2025-02-02 21:32:06 +00:00
Oliver Hamlet c8381617a8 Make plugin loading and sorting more granular
- Don't clear the cache in LoadPlugins()
- Don't load plugins in SortPlugins(), and make it take a vector of strings, not paths.
- Add a ClearLoadedPlugins() method to clear the loaded plugins cache.
- Remove IdentifyMainMasterFile()

Instead of calling IdentifyMainMasterFile(), callers can use LoadPlugins() to initially load all plugin headers only, then omit the main master file when calling LoadPlugins() to fully load plugins.
2025-02-02 18:01:19 +00:00
Oliver Hamlet d8a3604b0c Update changelog 2025-02-01 22:00:00 +00:00
Oliver Hamlet 52aa53c391 Make GameInterface::IdentifyMainMasterFile() take a path
This is a breaking change, but avoids the need for libloot to know anything about how to find the master file for OpenMW.
2025-02-01 21:54:35 +00:00
Oliver Hamlet 84c0cca534 Implement support for OpenMW
Most of the complexity is handled by libloadorder, but it's worth noting that:

- The game path is OpenMW's install path, not Morrowind's
- OpenMW doesn't force master-flagged plugins to load before others
- OpenMW doesn't provide a way to record the load order of inactive plugins
- .omwgame and .omwaddon plugins are equivalent to .esm and .esp respectively, while .omwscripts plugins have a completely different format with none of the metadata that libloot uses.
- OpenMW effectively relies on additional data paths to load Morrowind's (and mods') files, and the last directory listed that contains a given filename is used to load a file with that filename, with the main data path effectively being the first listed.
- I've disabled support for ghosted plugins for OpenMW because it makes the multi-path stuff more confusing and may not provide any benefit.
2025-02-01 21:36:03 +00:00
Oliver Hamlet 2d3192683f Update loot-condition-interpreter to 5.0.0 2025-02-01 19:25:48 +00:00
Oliver Hamlet b18b70f36a Update libloadorder to 18.2.0 2025-02-01 19:25:38 +00:00
Oliver Hamlet 2fa7b919ec Update spdlog to 1.15.1 2025-02-01 19:25:19 +00:00
Oliver Hamlet 1a8f1a0e0a Update fmt to 11.1.3 2025-02-01 19:25:19 +00:00
Oliver Hamlet afdafa492e Fix typo in doc comment 2025-02-01 19:25:19 +00:00
Oliver Hamlet 0fd1b82fb4 Remove test for a logging callback that goes out of scope
I've never understood why this appeared to work, but I've seen this test fail twice due to SEH exceptions in the past week, so it's better off removed. Nothing should be relying on this working (and LOOT doesn't).
2025-01-31 18:06:17 +00:00
Oliver Hamlet 6a32b63c6d Add a gamePath field to CommonGameTestFixture 2025-01-29 20:43:30 +00:00
Oliver Hamlet 553a189b9a Replace mention of BOOST_ROOT 2025-01-26 16:16:02 +00:00
Oliver Hamlet 794e796de8 Fix initialising GroupsPathVisitor::finishedVertices_ 2025-01-21 20:54:35 +00:00
Oliver Hamlet af28706210 Introduce ComparableFilename abstraction
It's a typedef that's std::wstring on Windows and icu::UnicodeString on Linux, to simplify calling CompareFilenames() with cached pre-converted strings.
2025-01-21 20:54:35 +00:00
Oliver Hamlet c3921497e6 Minor refactor of group edge code 2025-01-21 19:56:25 +00:00
Oliver Hamlet 1532c932af Update sorting doc to reflect groups changes 2025-01-18 22:29:50 +00:00
Oliver Hamlet 858a82ba50 Prioritise DFSes from the group graph roots with the longest paths
This means that when there's a potential cycle, it's more likely that an earlier group will have its effect applied than a later group.
2025-01-18 22:28:14 +00:00
Oliver Hamlet 511fa94889 Tidy up GroupsVisitor
A lot of the comments and some of the code were leftovers from an earlier, slightly different approach.
2025-01-18 20:31:31 +00:00
Oliver Hamlet 3df560646d Skip second BFS when checking for paths in both direction
It's actually significantly faster to just check if the path you're
trying to create has already been cached than to check if it actually
already exists. This improves sorting performance by 15%.
2025-01-18 10:29:05 +00:00
Oliver Hamlet 628666e4ce Check if a graph path already exists before adding one
Checking if a path exists is where sorting spends most of its time, and it gets slower the more edges the graph has, so avoid adding an edge between two plugins if there's already a path between them.

This improves sorting performance by 19%.

This doesn't add any additional path checks, as all the specific and hardcoded edges need to be added to ensure their validity (by then checking for cycles), and tie-breaking is more complicated so is worth dealing with separately.
2025-01-18 09:39:20 +00:00
Oliver HamletandOliver Hamlet 0a61358b19 Don't add edges from fully processed group plugins twice
This improves sorting performance by 5%.
2025-01-17 23:40:13 +00:00
Oliver HamletandOliver Hamlet 997631667f Overhaul how group edges are added during sorting
The new logic is conceptually simpler, with fewer special cases to
handle. Unlike the old implementation, the new approach avoids cycles.

It basically does depth-first searches through the group graph, adding
edges from each group's plugins to the plugins in the group's
successors.

This involved reversing the direction of edges in the group graph, as
this switches the logic from trying to find predecessors to trying to
successors: the new direction matches that of plugin graph edges, so
it's less confusing.

I can't think of a situation in which the iteration order of plugins
within a group matters. I tested it manually with my test load order of
~1600 plugins, and saw no difference when the order was randomly
shuffled. I've added a test case but it's a relatively simple scenario
and there may be a more complex scenario where it would matter that I
haven't thought of.

A buffer is used to hold the plugins in the previous groups in the
current path, because that's noticeably faster than just recording the
path and looking up the plugins for each group in the path. It does
duplicate the group vectors, but that's an insignificant amount of
memory used.

The new approach has a negative performance impact, with sorting now 15%
slower than before.

A more efficient solution could be to implement a custom DFS algorithm
that doesn't stop when it reaches a vertex it's already visited (which
would be fine since the graph has already been validated to be acyclic),
as then only the root vertices would need to be searched from.
2025-01-17 23:36:02 +00:00
Oliver Hamlet 60da16e9d0 Move MergeGroups() 2025-01-17 23:13:13 +00:00