Input Bindings
Manages input device bindings: reads default + custom bindings from disk, applies diffs, sends to the engine's ActionMap system, handles force feedback (FFB) configuration, device hot-plug, multiseat
Manages input device bindings: reads default + custom bindings from disk, applies diffs, sends to the engine's ActionMap system, handles force feedback (FFB) configuration, device hot-plug, multiseat player assignment, and menu action map toggling.
Public API - Bindings
| Function | Signature | Description |
|---|---|---|
M.resetBindings | (desiredDevName?) | Resets custom bindings to defaults. If nil, resets all devices. |
M.saveBindingsToDisk | (data) | Saves modified bindings from UI. Computes diff against defaults, writes .diff files per device and vehicle. |
M.notifyUI | (reason?) | Sends current bindings, actions, and categories to UI via InputBindingsChanged. |
M.getControlForAction | (actionName) → string|nil | Returns the control name bound to the given action. |
M.getUsedBindingsFiles | () → table | Returns list of all binding files read during the last reload. |
M.enableCustomModifier | (player, enabled, modifier) | Enables/disables a custom input modifier for a player. |
M.getRecentDevices | () → table | Returns devices sorted by recent activity. |
M.menuActive | (enabled) | Deprecated. Logs error and calls setMenuActionMapEnabled. Use setMenuActionMapEnabled instead. |
Public API - Menu Actions
| Function | Signature | Description |
|---|---|---|
M.setMenuActionMapEnabled | (enabled) | Enables/disables the Menu ActionMap and all MenuIndependent action maps. |
M.getMenuActionMapEnabled | () → bool | Returns whether menu action maps are active. |
M.setMenuActionEnabled | (enabled, actionName?, actionMapName?) | Enables/disables a specific menu-related action map. |
Public API - Players
| Function | Signature | Description |
|---|---|---|
M.getAssignedPlayers | () → table | Returns device→player assignment map. |
M.setPlayerToDevice | (devname, player) | Manually assigns a player to a device and reloads bindings. |
Module Fields
| Field | Type | Description |
|---|---|---|
M.devices | table | Currently plugged devices: devname → {guid, productName, pidvid}. |
M.bindings | table | Current binding data per device. |
M.assignedPlayers | table | devname → player mapping. |
M.isMenuActive | bool | Whether menu action maps are enabled. |
M.autoAssignPlayersToDevices | bool | Auto-assign players via core_multiseat (default true). |
Binding File Format
Bindings are stored as JSON with a layered system:
- Base files (
.json) - shipped defaults per device type/pidvid. - Diff files (
.diff) - user customizations (added/modified/removed bindings). - Vehicle-specific - stored under
settings/inputmaps/{vehicleName}/.
FFB Configuration
| Function | Signature | Description |
|---|---|---|
Internal: getFFBConfig(veh) | → table | Returns FFB config for steering, accelerate, and brake actions. |
Internal: notifyFFB() | Pushes FFB config to all vehicles via hydros.onFFBConfigChanged. |
Hooks
| Function | Description |
|---|---|
M.onFirstUpdate | Initial device scan, player assignment, and binding load. |
M.onVehicleSwitched | Reloads bindings for new vehicle's specific actions. |
M.onVehicleSpawned | Reloads bindings. |
M.onDeviceChanged | Updates device list, reassigns players, reloads bindings. |
M.onFileChanged | Reloads on inputmap or action file changes. |
M.onSettingsChanged | Reloads on multiseat setting change. |
M.onUIStateTriggered | Toggles menu action map based on UI state stack. |
M.updateGFX | Handles walking-mode ActionMap disable and deferred file-change reload. |
M.onExtensionLoaded | Called on ExtensionLoaded event |
M.onRecentDevicesChanged | Called on RecentDevicesChanged event |
M.dependencies | Table. Required extensions: {'core_input_actions', 'core_input_categories', 'core_multiseat', 'tech_license', 'core_versionUpdate'} |
Module State
| Variable | Type | Default |
|---|---|---|
dependencies | table | { "core_input_actions", "core_input_categories"... |
Usage Example
-- Reset all bindings to defaults
core_input_bindings.resetBindings()
-- Check what control is bound to steering
local control = core_input_bindings.getControlForAction("steering")
log('I', '', 'Steering bound to: ' .. tostring(control))
-- Toggle menu action map
core_input_bindings.setMenuActionMapEnabled(true)Key Internals
- Device detection uses
WinInput.getRegisteredDevices(). - FFB response curves can be loaded from
.lut,.log,.fcm,.csvfiles. - Binding diff system preserves only user changes, not full binding sets.
- SCE Pad (PlayStation) controller migration from old GUID-based files to unified
sce_pad_standard.diff.
See Also
- Input Action Filter - Related reference
- Input Actions - Related reference
- Input Categories - Related reference
- Core Systems Guide - Guide
Input Actions
Loads and manages input action definitions from JSON files. Actions define what happens when an input binding triggers (key press, axis movement, etc.), including the command context (vehicle Lua, GE
Input Categories
Static lookup table defining input binding categories for the controls options UI. Each category has a display order, icon, and localization title.