mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Take loaded BSAs into account during sorting
This supports BSAs used from: * Oblivion * Fallout 3 * Fallout: New Vegas * Skyrim * Skyrim: Special Edition If Skyrim VR uses the same BSA format as Skyrim SE, that's also supported. Morrowind BSAs are intentionally not supported because they cannot be loaded by plugins and so are of no interest to LOOT. The BSA parsing code has been adapted from my abandoned libbsa library. This doesn't bother reading folder and file names as hash collisions seem pretty unlikely (2^64 possible folder hashes, and 2^64 possible file hashes per folder). The code checks and requires that BSAs use little-endian numbers, as while big-endian BSAs are apparently possible I've never seen one, and I don't want to try adding support without one to test against.
This commit is contained in:
+11
-5
@@ -59,19 +59,25 @@ can be corrected.
|
||||
|
||||
Plugin overlap edges are then added. Two plugins overlap if they contain the
|
||||
same record, i.e. if they both edit the same record or if one edits a record the
|
||||
other plugin adds.
|
||||
other plugin adds. Plugins also overlap if they both load one or more BSAs and
|
||||
the BSAs loaded by one plugin contain data for a file path that is also included
|
||||
in the BSAs loaded by the other plugin.
|
||||
|
||||
For each plugin, skip it if it overrides no records, otherwise iterate over all
|
||||
other plugins.
|
||||
|
||||
* If the plugin and other plugin override the same number of records, or do not
|
||||
overlap, skip the other plugin.
|
||||
* If the plugin and other plugin override the same number of records and the
|
||||
same number of assets, or do not overlap, skip the other plugin.
|
||||
* Otherwise, add an edge from the plugin which overrides more records to the
|
||||
plugin that overrides fewer records, unless that edge would cause a cycle.
|
||||
plugin that overrides fewer records, unless that edge would cause a cycle. If
|
||||
the plugins don't have overlapping records or override the same number of
|
||||
records, the edge is added from the plugin that loads more assets via its
|
||||
BSAs to the plugin that loads fewer assets.
|
||||
|
||||
For Morrowind, identifying which records override others requires all of a
|
||||
plugin's masters to be installed, so if a plugin has missing masters, its total
|
||||
record count is used in place of its override record count.
|
||||
record count is used in place of its override record count. Morrowind plugins
|
||||
also can't load BSAs, so they can't have overlapping assets.
|
||||
|
||||
Finally, tie-break edges are added to ensure that sorting is consistent. For
|
||||
each plugin, iterate over all other plugins and add an edge between each pair of
|
||||
|
||||
Reference in New Issue
Block a user