-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load Order v1 #2248
Open
Al12rs
wants to merge
36
commits into
main
Choose a base branch
from
loadorder-v1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Load Order v1 #2248
+2,082
−513
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # src/Games/NexusMods.Games.RedEngine/RedModDeployTool.cs
- separate sorting data from the items being sorted, allowing more control - Use ObservableList as base, and persist when it changes
- fix oderlist resetting DB on starup
# Conflicts: # NexusMods.App.sln # src/Abstractions/NexusMods.Abstractions.Games/RunGameTool.cs # src/Abstractions/NexusMods.Abstractions.Loadouts/ISynchronizerService.cs # src/Games/NexusMods.Games.RedEngine/RedModDeployTool.cs # src/NexusMods.App.UI/LeftMenu/Items/ApplyControlViewModel.cs # src/NexusMods.App.UI/LeftMenu/Items/LaunchButtonViewModel.cs # src/NexusMods.App.UI/NexusMods.App.UI.csproj # src/NexusMods.DataModel/Synchronizer/SynchronizerService.cs
- Have RedModDeployTool use the Provider rather than trying to get the order themselves - add comments
Fix some names
… they are too susceptible irrelevant variations
# Conflicts: # tests/NexusMods.DataModel.SchemaVersions.Tests/LegacyDatabaseSupportTests.TestDatabase_name=SDV.4_11_2024.rocksdb.zip.verified.txt # tests/NexusMods.DataModel.SchemaVersions.Tests/Schema.verified.md
This PR conflicts with |
# Conflicts: # src/NexusMods.App.UI/Pages/CollectionDownload/CollectionDownloadViewModel.cs # src/NexusMods.App.UI/Pages/LibraryPage/NexusModsFileMetadataLibraryItemModel.cs
This PR doesn't conflict with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a first implementation of load order backend and barebones ui for REDmod sorting.
System overview:
Games will expose a list of
ISortableItemProviderFactory
, one for each Load Order that the game has (e.g. RedMods and .archives for Cyberpunk).ISortableItemProviderFactory
exposesGetLoadoutSortableItemProvider()
method that returns aILoadoutSortableItemProvider
, which can be thought of as load order manager for a specific loadout.ISortableItemProviderFactory
implementations should be instantiated on game instance creation (e.g. in the game class constructor), as it needs to listen to Loadouts changes to setup theILoadoutSortableItemProvider
s.For now the loadout providers only expose a collection of sortable items, to be used in the ui, and a
SetRelativePosition()
method to change the order.The
ILoadoutSortableItemProvider
implementations will be in charge of updating the sorting as changes are made to the loadout (e.g. additions or removals of RedMods).Db Models
The sorting information is persisted in the database in the form of two new models:
SortOrder
SortableEntry
SortOrder
contains a reference to the Loadout that it applies to and serves as the containing group for theSortableEntry
s.This is similar enough to a
LoaodutItemGroup
but for now it isn't one.SortableEntry
represent an item being sorted and contains theSortIndex
attribute. Should be extended with implementations that contain the game specific identifier used by the game (e.g. red mod folder name, bg3 .pak uuids, bethesda plugin names).The
SortingIndex
is kept separate from the actualLoadoutItem
s that are being sorted, since we can actually have multiple LoadoutItems at the same position in the load order, what is being sorted depends on what ID the game uses. E.g. for bethesda, what the LoadOrder defines is the sorting of plugin names, notLoadoutItem
s.Keeping
SortingIndex
separate from the actual items allows the possibility of storing backups of load orders that are not bound to a specific configuration ofLoadoutItems
. This also allows keeping the order in case of mod updates, since theSortingIndex
is not lost on removal of theLoadoutItem
but is instead kept on a separate db entity that only has the game specific id (e.g. red mod folder name).Issues and Next steps:
Determining active state and conflict winners
Current implementation is not dealing with conflicts between mods and only approximatively checks if a redmod is actually getting deployed. Data regarding which mod is providing a specific mod in the load order might not be accurate.
Drag&Drop support
Current ui prototype only allows changing the order through up and down buttons. We want Drag&Drop support, but that will require a writable list that will then need to be kept synchronized. More complexity.
Generated load order files
Cyberpunk
.archives
and BG3 pak files load orders require wiring out a file containing the order that the game will then use.Regenerating these files every loadout change and backing up those files in our file store would just create a lot fo churn and should be avoided.
Basically supporting Load Order there requires implementing a new file type
GeneratedFiles
in the synchronizer.We had some early concepts of this in our codebase before, but they were removed since they weren't used at the time.
Eventual consistency nature of load orders
The providers listen to DB changes to know when a new mod is added or removed from the loadout that might matter for the loadorder, this means that when a new mod is added, the commit that adds the mod to the Loadout will not contain the loadorder information for the files inside that mod. That data will only be available in a future commit and there is no way to determine which one.
This can cause issues for systems that also listen to changes in the db and would like to get load order information for newly added files (e.g. diagnostics).
Multiple solutions could be considered:
SortOrders
and the data they are being computed over. This might require a monotonically increasing revision attribute on theLoadouts
to reference, and considering whether we would want to recompute the sorting for every Loadout change, or just the latest available.Either of these require non insignificant changes in the code and our general approach when it comes to changing the loadout and reacting to it.