Mod Menu input-capture research
Target: Planet Crafter 2.008, tested Assembly-CSharp MVID 520dcd8f-2c13-4a99-b871-44c7ad40bcc1.
This note records why CMAPI Mod Menu 0.2.2 suppresses game controls through the game's Input System surfaces instead of relying on cursor state, Time.timeScale, or a guessed Unity component toggle.
Verified game surface
The full-game assembly contains SpaceCraft.PlayerInputDispatcher. Its current Input System asset member is _inputMap; the older prologue surface used the public name inputMap. The dispatcher owns the callbacks and continuous reads for movement, look, run, jump, action, construction, inventory, Escape, UI, feedback, map, photo mode, and wishlist/store actions.
Cursor unlocking alone does not stop those callbacks. Disabling the MonoBehaviour alone is also insufficient because action callbacks may remain subscribed to an enabled InputActionMap.
The pause and other Unity UI screens also receive mouse/controller submit events through UIInputController's separate InputSystemUIInputModule. Disabling only PlayerInputDispatcher therefore still permits a click to activate a button behind CMAPI's IMGUI window.
GamepadConfig additionally holds direct navigate, submit, click, and back InputActionReference callbacks used by game windows. Those action assets must be captured too; disabling only the EventSystem module does not silence a direct Back callback.
CMAPI contract
When the optional overlay is shown, CMAPI:
- resolves
PlayerInputDispatcherfromAssembly-CSharp; - reads
_inputMap, withinputMapand member-type discovery as compatibility fallbacks; - snapshots each action map which is currently enabled;
- adds action assets referenced by
GamepadConfigto the captured map set; - snapshots and disables the game's separate EventSystem UI input module;
- disables those surfaces before accepting menu interaction;
- polls raw
KeyboardandGamepaddevices plus IMGUI mouse events for CMAPI; and - restores only the recorded maps/UI state on hide, uninjection, component disable, destruction, or failure.
CMAPI rescans at a bounded interval while visible so a dispatcher or UI module replaced by a world/session transition cannot silently restore background input.
If no local dispatcher/asset exists, or reflection/action-map access fails, capture restores anything already changed and the overlay stays hidden. This is a fail-closed UI rule: a menu without reliable input ownership is not usable.
Toggle-key collisions
Before the overlay opens, CMAPI compares the configured keyboard key with effective bindings on the discovered game action assets. A collision selects the first unbound candidate for that session and reports the conflicting action and active fallback. Existing F8/F9 defaults migrate to Insert because those keys have already collided with feedback and store/wishlist behavior in testing.
The controller toggle is a held L3+R3 chord. View+Menu is intentionally not used because Steam reserves that combination for its overlay on common layouts.
Scope
Input capture stops player and game-UI controls. It does not set Time.timeScale, stop simulation, or pause a multiplayer host. Trainer actions remain host-authorized and continue to use the canonical CMAPI command path.