Repository navigation
Controlify v4 - #1002
Merged
Merged
Controlify v4#1002
Conversation
… controller manager
…lement ControllerMapping for pipeline; implement radial deadzones
Owner
Author
|
Things left to do until ready for review:
|
… listeners if a listener throws an exception, fix references to old "contexts"
- finished presses stayed in the dispatcher's press owners, so a later chord claim cancelled them and turned toggles off - a controller counts as giving input again only while a button is held or an axis is beyond 0.5, so stick jitter no longer switches input mode or ends the temporary cursor - changing the deadzone setting is applied on the next frame instead of waiting for the axis to move - repeat pulse with initial_delay_ms=0 no longer pulses twice back to back - default binds for drop_stack, pick_block_nbt and show_player_list use long_press instead of hold, and gesture/activator kind mismatches in default binds are logged as errors - binding conflicts now detect actions in distinct layers that are active together and both receive the input - a malformed controller mapping is logged and skipped instead of failing the whole reload, and deadzone group validation no longer throws out of the codec
- closing a screen back to the game no longer hides the cursor, which replaced the disabled cursor mode and broke mouse look - gyro look and stick look share one aiming predicate (bow, trident, spear, spyglass; not crossbow) - gyro toggle state is kept on the gyro component so it survives the in-game input handler being rebuilt - ControlifyActions no longer reads Minecraft options during class initialisation
- reinitializing a controller no longer shows the disconnect toast, fires disconnect/connect events or switches selection and input mode - controller creation failures (e.g. on hotplug) are caught and logged instead of crashing, and the opened handle and subscriptions are released - Steam API initialisation failures are caught and logged instead of crashing startup - gyro calibration no longer learns smooth constant-rate rotation as bias (stationary rate check and minimum time window) - battery level is read when a controller connects instead of only on change events - duplicate controller uids get the first free suffix, vendor/product ids are no longer sign-extended - low battery notifier ignores unknown battery percentages
- bindings migrated from old schemas were bare values the current codec could not decode, resetting the whole profile; added a schema 15 fix that wraps them in lists - gyro and flick stick settings from old schemas were silently reset; added a schema 15 fix mapping them to the new gyro and flick stick fields - steam api and guide scale fixes now target the shared config - keep_default_bindings is honoured again when saving bindings in the config screen - queued setup wizards no longer start over a running one - rule set managers use their reload id - added migration regression tests with a schema 8 profile
- sodium on 26.1 is now 0.9.2 so the video settings mixins match, and the video settings screen shadows the right button type - compat mixin configs now soft-fail with defaultRequire 0, and client-only compat mixins are in the client list - rrls force_load list now matches every reload listener id - event bus also survives linkage errors from compat listeners and a failing screen behaviour factory is skipped instead of breaking its screen - simple voice chat push to talk and whisper holds keep working while a screen is open and toggles survive switching to keyboard and mouse - a malformed services entry is logged and skipped for addon entrypoints and SDL loaders on both loaders - gametest controller state and toast caches are thread safe
- vanilla sliders could not be adjusted with the keyboard because focus gain reset their editing state - keyboard focus was wiped on every screen open/widget rebuild in keyboard and mouse mode - virtual mouse sent a second press without a release, and its position never snapped to the target - north in containers both quick-moved and dropped the carried stack - handled slider/container actions swallowed back/tab input in the same tick - touchpad click restored as a default virtual mouse left click - virtual mouse toggle could not turn off for subclassed screens - container navigate haptic played when leaving a slot - containers without snappable children (selection lists) get a snap point again - world/server entry press no longer plays a click sound - virtual mouse shift latch can no longer act as a global shift outside virtual mouse screens
- on-screen keyboard backspace did nothing in chat and other edit boxes on 26.3 because synthesised key events carried no keycode - chords could be bound to continuous actions and stick half-axes could act as chord modifiers; such bindings are now rejected on capture and dropped on load - deadzone preview read pre-mapping values and leaked a pipeline subscription per config screen build - mapping maker captured resting axes as presses and saved a partial mapping when aborted - clear mapping did not persist - null default font map NPE, and unmapped joystick inputs now render a text label instead of a missing glyph - keyboard layout file name parsing could fail the whole reload - bind capture screen leaked its subscription on resize - tap max could be set above long press; the sliders now push each other apart - radial menu entries for proxied key mappings (sprint, attack, use, modded keys) now hold the key long enough to register
- block break rumble never played in creative mode as its code path was not hooked - block break rumble restarted every tick while mining the same block - feedback scale easing was decoded but never applied - menu feedback (ui navigation) was silenced by the pause menu - deactivating a controller left rumble, trigger rumble and light stuck as its feedback was never cleared or flushed - trigger rumble no longer relies on SDL treating a duration of 0 as forever - PCM haptics queue lead scales with frame time and effects keep real time down to 10 fps - partially decoded feedback effects are no longer registered - feedback colours no longer accept signed hex values - fixed feedback rule documentation claiming "for" is optional
- replaced the vibration, origin vibration and entity vibration packets with one packet that plays a registered feedback effect by id, so no effect definitions are sent over the network - the packet carries an optional position or entity origin (looked up live on the client, safe without a level), the feedback groups and named float params - replaced /vibratecontroller with /feedback play, whose origin, groups, param and to clauses chain in any order like /execute - unknown effect ids are ignored on the client with a debug log
- reese's sodium options provides its own controlify compatibility, so the stale compat mixins, mixin config and dep.rso build plumbing (never compiled) are removed
- /feedback is now /controlify feedback; every controlify command registers under the /controlify root so it can't clash with vanilla or other mods
- chat on-screen keyboard typing and backspace are covered by a client gametest, replacing the KeyEvents unit test
- gui press and back pulses never fired, because a release now cleared the press owners before the gui press that follows it arrived - synthesised key events on 26.3 passed the scancode as the keycode, so on-screen keyboard backspace still did nothing in edit boxes
- opening the controller config screen crashed, because the gesture slider listeners ran while the options were still being built - steam not running is logged as a one-line info message instead of an error
isXander
marked this pull request as ready for review
November 25, 2026 01:41
- includes a new example sourceset which builds a complete controlify addon mod that docs takes snippets from - includes integration testing for LED feedback - includes unit tests to check all data-driven files against their codecs - rename xbox_one namespace to xbox - remove slow_block event; switch to ambient driven event
📖 Documentation previewPreview: https://pr-1002-controlify.isxander.workers.dev Updated for |
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.
Controlify v4
Input Pipeline
The core reason for this rewrite is to migrate from controller state polling to an event-based pipeline approach.
Individual input events are sent by SDL and travel down Controlify's internal pipeline where it is then transformed, filtered, and processed through event stages such as
DeadzoneStageorSensorProcessorStageorInputDomainExpansionStage. Each stage does one logical thing and passes on to the next. This allows transformations to be composed functionally, rather than written procedurally.At the end of the pipeline comes the
PhysicalToLogicalStage, which statefully interprets physical events into logical ones. An example of a logical event might be a Tap, Hold, Release, etc. Controlify's internals can listen to the output of any event stage throughout the pipeline ad-hoc.ActionDispatcherlistens to logical events and is the source of Actions' channels' (see below for the Action API).GyroCalibratormonitors raw physical gyro and accel data and derives a bias calibration that is fed back into theSensorProcessorStage.This pipeline also runs every frame, where Controlify used to poll at 20tps. This should make everything feel a lot more responsive.
Action API
Replacing the Bindings API, the Actions system abstracts how a given action is triggered into 3 channels: pulses, latch, and continuous.
Replacing
binding.justPressed()would beaction.consumePulse(); the way pulses and latches and continuous channels are triggered is now data-driven. You define a gesture such as tap, long press, press, release, hold, etc. If configured to do so, a "leaf" gesture can be customised by the end-user in the controls tab. This allows users to map more distinct actions to their controllers at once, since a tap and a long press on the same button do not conflict.Actions can now also be bound to modifier chords, allowing way more inputs. Each action can also have up to 2 bindings.
Screen Operation (screenop) API, reimagined
Another big focus of Controlify v4 was expanding the scope and stability of the mod/addon API. The old screenop API was object-oriented, with a base
ScreenProcessorclass providing default screen behaviour and subclasses extending and overriding that behaviour. That coupled Controlify's internal screenop implementation with an API that all mods had to use. This left the API unstable between updates, causing modders to constantly update their compatibility. The API also just wasn't ergonomic to use anyway.The new API is made up of units of behaviour. A previous subclass of
ScreenProcessormay now be made up of multiple behaviours that implement an interface, rather than a class. It uses a functional programming concept called "continuation passing style," a common place to see this used is server middleware:Above is an example of a screen behaviour that was previously just one part of the base
ScreenProcessorimplementation. There is then a registry where you register a series of composed behaviours to a specific screen type, with a priority system so you can choose to not runnext.run()to pass off to the next behaviour.The same paradigm is now also used for the old
ComponentProcessor.The new Feedback API
This is one of the most exciting parts of Controlify v4. It replaces the previous Rumble API.
The Feedback API is responsible for driving rumble, HD haptics, and controller LEDs via the same system, better yet it's data-driven!
Feedback Effects are made up of tracks. A track could be either a rumble type, voice type, click type, or colour type.
{ "tracks": [ { "band": "low", "envelope": [[0, 1], [0.1, 1], [0.1, 0.8], [0.5, 0, "out_quad"]], "scale": {"param": "power", "from": [0, 6], "ease": "out_quad"} }, { "band": "high", "envelope": [[0, 1], [0.1, 1], [0.1, 0.2], [0.5, 0, "out_quad"]], "scale": {"param": "power", "from": [0, 6], "ease": "out_quad"} } ] }Effects can optionally source parameters from the Feedback Events that drive them. Events decide when an effect plays. Events can either be fired (impulse) or held (continuous).
Controlify provides an event that is held for the entire time
controlify:ambient. The existing Contextual API is then utilised with a new rule set to choose an effect based on what event is firing and all the usual in-game facts that drive Guides and Trigger Effects.{ "for": "controlify:ambient", "if": "controlify:has_hearts", "then": "controlify:heartbeat" }Because the Contextual API is so powerful, it allows resource pack creators and server admins to create unique experiences with this API without any coding experience or client-side mods.
Overhauled Gyro
Gyroscope support has been completely overhauled with a plethora of new settings and capabilities:
Overhauled settings screen
Gone is the three-tab setup. Settings have been reorganised into more tabs to make navigation more manageable.
Look API
Controlify v4 also adds a Look API. It allows addons to register new sources and scalers for what becomes look input. Controlify internally uses this to provide distinct sources for Gyro, Stick Look, Flick Stick.
An example of an addon using this API might be Zoomify, which would decrease sensitivity with a look scaler when zoomed in.
Rewritten controller management
The controller manager is an internal part of Controlify that is responsible for tracking what controllers are connected and now there's a pipeline, forwarding events to Controlify's drivers.
It has been split up into two parts: the controller manager and the controller backend. Previously,
SDLControllerManagerextendedAbstractControllerManager. NowControllerManageris a concrete class that physically tracks connected controllers, andControllerBackendcontrols it via its subclassSDLControllerBackend.A part of the main
Controlifyclass has also been separated intoControllerCoordinator.Full Valve Hardware support
Controlify v4 also now better supports both the Steam Controller and the Steam Deck. Gone is the old, broken "enhanced driver", everything works out of the box: gyro, touchpads, back buttons, HD haptics.
Controlify now interacts with the Steam API in order to prevent the Steam Client from emulating keyboard and mouse when Minecraft was not launched via a Steam shortcut.