Skip to content

Profile switching#930

Draft
isXander wants to merge 1 commit into
mainfrom
feat/profile-switching
Draft

Profile switching#930
isXander wants to merge 1 commit into
mainfrom
feat/profile-switching

Conversation

@isXander

Copy link
Copy Markdown
Owner

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:

    1. A debug option to force a specific profile
    2. A "preferred startup profile" global setting
    3. Sequential order, starting from profile 1
    4. If all profiles are locked, create a new profile
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant