Open-source game technology
TiP-Recomp input layer
Adding mouse input was not a key-binding task. The recompilation runtime, guest memory, camera propagation, window focus, and platform APIs all had to agree.
Problem
The original controller-oriented camera and the host input runtime did not expose a reliable path for PC-native mouse look and zoom.
Engineering approach
- Implement Win32 raw-input capture with a cross-platform listener fallback.
- Reverse the camera state propagation and write both stored and rendered values without breaking controller input.
- Handle cursor confinement, focus changes, configuration, and shutdown cleanup as part of the feature lifecycle.
Outcome
- The contribution was reviewed and merged upstream as a seven-file systems change.
- Follow-up contributions expanded input ownership and focus behavior instead of leaving the first patch isolated.
The hardest problem
Give a controller-era Xbox 360 camera real PC mouse look inside a static recompilation.
Camera state flows through guest memory in a fixed order: writing only the rendered value lets the game overwrite the mouse every frame, writing only the stored value changes nothing visible, and the controller path had to keep working untouched.
Reverse the propagation chain to find every write point, feed raw-input deltas into both the stored and rendered state, and treat cursor confinement, focus loss, and shutdown cleanup as part of the feature, not afterthoughts.
How I worked through it
The input side had its own platform split: Win32 raw input gives unaccelerated deltas on Windows, but the port also targets Linux, so a cross-platform listener fallback carries the same events, with wheel zoom routed through the same camera path instead of a separate hack.
Upstream review shaped the result as much as the code did: the merged change spans seven files because the maintainers asked for the input layer to live in the runtime's structure, not as a bolted-on patch, and follow-up PRs extended ownership and focus behavior on the same terms.
Technologies
- C++
- Win32 Raw Input
- Static recompilation
- Reverse engineering
- CMake
- SDL