Input System Utils
Utilities for analyzing and re-formatting input map JSON files. Prints binding statistics and resaves all inputmap files with consistent formatting and sorting.
Utilities for analyzing and re-formatting input map JSON files. Prints binding statistics and resaves all inputmap files with consistent formatting and sorting.
Overview
util_inputSystemUtils provides two main tools: printStats() dumps statistics about input bindings across all inputmap files, and resave() reformats every inputmap JSON with consistent sorting, vendor name resolution, and custom pretty-printing.
Extension path: lua/ge/extensions/util/inputSystemUtils.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
printStats | () | Prints total binding count and top 20 most-used actions. |
resave | () | Resaves all inputmap JSON files with consistent formatting. |
Internals
printStats
- Scans all
*.jsonfiles containinginputmaps/in the path. - Counts total bindings and per-action usage.
- Prints the top 20 most-used actions sorted by frequency.
resave
For each inputmap JSON file:
- VID/PID resolution: Extracts vendor/product IDs from
vidpidfield or filename. - Vendor name lookup: Uses
vendorNames.jsonto resolve vendor names. - Binding sorting: Bindings are sorted by
control(natural sort), then byaction. - Custom JSON encoding: Uses
jsonPrettyEncoderCustomwith:- Key weight ordering:
controlfirst (10), default (50),bindingslast (99). - Folding callback: Collapses small tables (< 4 items) under
/bindings/.
- Key weight ordering:
- Only writes if content changed.
Natural Sort
Uses zero-padded number comparison for natural sorting:
"axis1" < "axis2" < "axis11" -- instead of "axis1" < "axis11" < "axis2"VID/PID Validation
isValidVIdPId() checks that the string is exactly 8 hex characters. Invalid IDs are cleared.
How It Works
- Call
printStats()to see binding statistics. - Call
resave()to reformat all inputmap files in-place. - Files that are already correctly formatted are skipped.
Lua Examples
-- Print input binding statistics
extensions.util_inputSystemUtils.printStats()
-- Output:
-- 1523 total bindings
-- top 20 actions:
-- * steering - 45
-- * throttle - 42
-- * brake - 41
-- ...
-- Resave all inputmap files with consistent formatting
extensions.util_inputSystemUtils.resave()Additional Exports
M.printStats- (undocumented)M.resave- (undocumented)
Ground Model Debug
ImGui-based debug tool for visualizing and editing ground model physics properties in real time.
Instanced Line Render Demo
Demo extension showcasing the instanced line and dot rendering API. Features an N-body gravity simulation, grid drawing, sine waves, edge tests, and traffic signal visualization.