Repository navigation
Save simple button mappings per port - #414
Conversation
The F10 bar's simple mapping UI persisted one shared [controller] binding set: rebinding on any port overwrote it, and the next launch applied the last writer's layout to every port (issue patchzyy#404). The expression system (expr_<port+1>_<control>) was already per-port; the simple mapping path now matches it. Bindings now persist as [controller] "<key>_<port+1>" (a_1 .. right_4). Every write site (rebind capture, threshold slider, GameCube restore, layout presets) saves the port it edits, and ApplyConfiguredMappings reads the port's own binding first. The old shared keys stay as the fallback for ports never rebound, so existing configs keep behaving exactly as before until a port is individually reconfigured. Fixes patchzyy#404
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Fixes #404.
What
The F10 controller tab's simple mapping UI now persists bindings per port, as
[controller]<key>_<port+1>keys (a_1..right_4), matching how the expression system (expr_<port+1>_<control>) already works.Every persistence site saves the port it edits:
CompleteRebind, already knewcapture.port)writeBindinginDrawGamepadMapping)ApplyConfiguredMappingsreads the port's own binding first via the newPortControllerButton(port, index).The old shared keys (
[controller] a,b, ...) remain as the fallback for ports that were never rebound individually, so an existing config keeps applying to every port exactly as before until a port is actually reconfigured on top of it. There is deliberately no migration: single-player setups are unchanged, and multiplayer setups converge port by port as each player rebinds.Why
Reported in #404: two players (e.g. over Parsec), player 2 rebinds after player 1, and on next launch both ports use player 2's layout, because there was only one shared binding set and the last writer won.
Testing
runtime_config_tests.cppcases: per-port keys parse into the right slots;a_0,a_5,a_x, non-string values, and unknown button names are rejected; shared and per-port keys stay separate;PortControllerButtonKeylayout (including out-of-range port/index returning empty).static_assert(RuntimeConfigFile::kControllerPortCount == PAD_MAX_CONTROLLERS)keeps the config side honest against the pad layer.MKW_PLATFORM_TESTS_ONLY): 12/12 pass on macOS arm64.mkw_macos_native_compile(coverssettings_overlay.cpp) locally on macOS arm64.I do not have a usable game dump on this machine, so runtime behavior is verified by the config-layer tests and code reading, not by an in-game run; happy to adjust if a reviewer sees something off in the overlay paths.
Summary by CodeRabbit