Expand description
Functional helpers to convert a DInput->XInput YAML mapping into an XInput-like state.
- Pure functions; no hidden global state
- YAML schema matches the one produced by
dinput_mapper - Comments are in English by request
Modules§
- XButtons
- XInput button bit flags (matches Windows XINPUT header values)
Structs§
- Axes
- Axis
- Buttons
- Device
- Dpad
- Mapping
Yaml - Trigger
Def - Triggers
- XInput
State - Minimal XInput-like state we produce.
Enums§
- Load
Error - Distinguish IO vs YAML parse errors for file loading.
Functions§
- apply_
anti_ deadzone_ i16 - Optionally apply anti-deadzone (minimum magnitude).
antiin [0..=32767]. - apply_
deadzone_ i16 - Apply a centered deadzone on an i16 axis.
deadzonein [0..=32767]. Values within [-deadzone..deadzone] -> 0. Outside, linearly re-scale to full range to preserve reach. - apply_
radial_ deadzone - Radial deadzone for a stick.
deadzonein [0..=32767]. - autorepeat_
fire - Auto-repeat helper: when a bit is held, fires at (first_delay_ms then repeat_rate_ms).
- button_
edges - Compute edge masks between previous and current buttons.
- debounce_
bit - Debounce mask: require a stable
hold_countframes before accepting changes. - map_
report_ to_ xinput - Convert a raw HID input report to an XInput-like state using the mapping. This is a pure function: output depends only on (mapping, report).
- merge_
masks - Merge a list of masks (e.g., macro/extra layers) into one via OR.
- parse_
mapping_ yaml_ file - Parse YAML file content into MappingYaml.
Returns
LoadErrorto separate IO and YAML failures. - parse_
mapping_ yaml_ str - Parse YAML string into MappingYaml.
- postprocess_
stick - Compose helpers for a typical stick pipeline.
- remap_
buttons - Build a new mask by applying a remap table (source->dest). Missing sources are ignored.
remap: list of (src_mask_bit, dst_mask_bit). - set_bit
- Set/clear/toggle helpers
- square_
to_ circle - Convert square stick into circular region while preserving direction.
- toggle_
bit - trigger_
pressed - Trigger thresholding: turn trigger value [0..255] into boolean press.