Profile switching#930
Draft
isXander wants to merge 1 commit into
Draft
Conversation
This file contains hidden or 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
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.
What is profile switching
This PR introduced profile switching.
Since 3.0, Controlify has the concept of profiles. Profiles hold what used to be per-controller configuration, like sensitivity, vibration settings, etc. Basically, a profile holds everything that isn't part of "Global Settings".
Profiles were designed with future splitscreen in mind. Each player will get their own profile.
Since 3.0, people have missed the feature of being able to explicitly select a controller a client uses, so they can make a makeshift splitscreen setup by launching multiple clients and selecting a different controller on each. The new profile system does not allow for this, as the last-used controller is selected.
This PR allows users to create and manage multiple profiles. Each profile will have a new option, controller assignment; by default, "Automatic" (matching current switching behaviour), you will be able to set a profile to a specific controller which will disable the auto switching. This means you assign a different profile to each running instance, and they can have their own separate settings and controller. This also lays important groundwork for the proper first-party splitscreen implementation.
Implementation details
Because each client will manage (read and write) its own profile, each profile will need to be a separate config file
Data fixing and migration is required to split the legacy monolithic file into profiles
Each profile config will have an OS lock associated with it. This informs other running instances that the profile has already been assigned, and prevents concurrent writes.
On client startup, the following precedence is used for picking a profile to use:
UI to manage, create, reset, and delete profiles
This fleshing out of profiles also made one previous implementation detail appear unnecessary. Resource packs can define the default config, but they can do this per-controller-type. Profiles are not linked to controllers, so their defaults should not relate to them. This should be simplified so resource packs provide a default config, but not per-controller-type.