Darner native mouse look, keyboard driving, Streamline FG backend and Linux/Proton support #89

Closed
github-bot wants to merge 2 commits from github-bot/gh-89 into main AGit
Owner

@⁠r32601366 on GitHub · 2026-12-05 18:03 UTC · original
r32601366:larp-common → main · +4373 −67 · 28 files · 2 commits · closed without merging

Summary

This brings over features from Darner (also GPL) that make larp playable with mouse and keyboard and with frame generation on Linux/Proton:

  • Native mouse look (crates/larp-hle/src/mousehook.rs): a 1:1 camera hook on the title's look-input consumer (look_pull), ported from Darner's mousehook.rs. It checks bytes before patching and is refused on any other build. It is on by default; LARP_NATIVE_MOUSE=0 turns it off. F7 releases or takes back the mouse capture. The camera is not moved in menus, pause, the map, the F10 menu or while pipelines compile.
  • Keyboard driving and Darner's default layout: W/S drive the triggers when the player is in the driver's seat (seat read from the title state, as Darner does). bindings.ini sets the keys (LARP_BINDINGS; the default is bindings.ini.default).
  • F8 vehicle camera auto-center toggle, a hook ported from Darner. Auto-center is off by default, as in Darner.
  • Streamline frame generation and Reflex backend (crates/larp-gpu/src/slfg*): LARP_FG_BACKEND=streamline|ngx. The default is streamline under Wine and ngx elsewhere. Under Proton the NGX DLSS-G path created the feature but no generated frames reached the screen; Streamline works.
  • Linux/Proton: a linux/ folder (setup.sh, run.sh, README with step-by-step setup), pipeline workers with a larger stack and thread priority rights that Wine accepts, a preload mode (LARP_PRELOAD=1), and the per-second frame generation stats moved out of the diagnostics-only build.

How it fits with upstream's mouse support

When the native hook is active (the default on the known build), gameinput::mouse::handle_window_message is skipped and the mouse never drives the right stick, so there is one capture and one camera. When the hook is off (LARP_NATIVE_MOUSE=0, or an unknown build), upstream's controls.ini / LARP_CONTROLS path is unchanged. DualSense code is untouched.

Testing

  • Cross-built with llvm-mingw for x86_64-pc-windows-gnullvm (RUSTFLAGS="-C link-arg=-luuid"). No errors.
  • Played on Linux (CachyOS, RTX 5070 Ti, Proton-CachyOS, our vkd3d-proton build) on the version of this work based on the CNF package source: mouse look, keyboard driving and Streamline frame generation work. Almost no stutter, about 30 fps steady with frame generation.
  • This rebase onto 0f03265a was start-tested only, not played: Streamline FG and Reflex load, and both the look hook and the auto-center hook are placed.
  • Not tested on Windows. The Wine-specific defaults only apply under Wine.

Notes

  • LARP_MOUSE_SENS means radians per count for the native hook (default 0.0015) and a multiplier for upstream's path. Only one path is active at a time.
  • The map mouse drag/zoom port is incomplete (unused constants remain). The native hook does not move the camera on the map.
**@⁠r32601366** on GitHub · 2026-12-05 18:03 UTC · [original](https://github.com/gamingwithhomie/larp/pull/89) `r32601366:larp-common` → `main` · +4373 −67 · 28 files · 2 commits · closed without merging ## Summary This brings over features from Darner (also GPL) that make larp playable with mouse and keyboard and with frame generation on Linux/Proton: - **Native mouse look** (`crates/larp-hle/src/mousehook.rs`): a 1:1 camera hook on the title's look-input consumer (`look_pull`), ported from Darner's `mousehook.rs`. It checks bytes before patching and is refused on any other build. It is on by default; `LARP_NATIVE_MOUSE=0` turns it off. F7 releases or takes back the mouse capture. The camera is not moved in menus, pause, the map, the F10 menu or while pipelines compile. - **Keyboard driving and Darner's default layout**: W/S drive the triggers when the player is in the driver's seat (seat read from the title state, as Darner does). `bindings.ini` sets the keys (`LARP_BINDINGS`; the default is `bindings.ini.default`). - **F8 vehicle camera auto-center toggle**, a hook ported from Darner. Auto-center is off by default, as in Darner. - **Streamline frame generation and Reflex backend** (`crates/larp-gpu/src/slfg*`): `LARP_FG_BACKEND=streamline|ngx`. The default is `streamline` under Wine and `ngx` elsewhere. Under Proton the NGX DLSS-G path created the feature but no generated frames reached the screen; Streamline works. - **Linux/Proton**: a `linux/` folder (`setup.sh`, `run.sh`, README with step-by-step setup), pipeline workers with a larger stack and thread priority rights that Wine accepts, a preload mode (`LARP_PRELOAD=1`), and the per-second frame generation stats moved out of the diagnostics-only build. ### How it fits with upstream's mouse support When the native hook is active (the default on the known build), `gameinput::mouse::handle_window_message` is skipped and the mouse never drives the right stick, so there is one capture and one camera. When the hook is off (`LARP_NATIVE_MOUSE=0`, or an unknown build), upstream's `controls.ini` / `LARP_CONTROLS` path is unchanged. DualSense code is untouched. ## Testing - Cross-built with llvm-mingw for `x86_64-pc-windows-gnullvm` (`RUSTFLAGS="-C link-arg=-luuid"`). No errors. - Played on Linux (CachyOS, RTX 5070 Ti, Proton-CachyOS, our vkd3d-proton build) on the version of this work based on the CNF package source: mouse look, keyboard driving and Streamline frame generation work. Almost no stutter, about 30 fps steady with frame generation. - This rebase onto 0f03265a was start-tested only, not played: Streamline FG and Reflex load, and both the look hook and the auto-center hook are placed. - Not tested on Windows. The Wine-specific defaults only apply under Wine. ## Notes - `LARP_MOUSE_SENS` means radians per count for the native hook (default 0.0015) and a multiplier for upstream's path. Only one path is active at a time. - The map mouse drag/zoom port is incomplete (unused constants remain). The native hook does not move the camera on the map.
Rebase of our larp-common tree onto upstream larp 0f03265a.

- Native mouse look hook (mousehook.rs, Darner-style, LARP_NATIVE_MOUSE,
  default on): drives the camera itself; F7 capture toggle, F8 vehicle
  auto-center bypass. While it is active upstream's Mouse & Keyboard
  (gameinput/mouse.rs: raw input to the right stick, its own capture) is
  bypassed in the window procedure and for the stand-in pad, so only one
  camera source and one keyboard-to-pad mapping apply.
- Keyboard stand-in pad: bindings.ini (crate::bindings) or the built-in
  Darner layout, letters by position, WASD gas/brake at the wheel.
  Without the native mouse upstream's controls.ini mnk path serves
  (LARP_CONTROLS=auto|mnk); LARP_CONTROLS=pad leaves the mouse alone.
- Streamline frame generation backend (larp-gpu slfg), swap chain made
  through its proxy when ready.
- Linux/Proton fixes, preload, linux/ guide, README link.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 18:09:14 +00:00
Author
Owner

@⁠Kassadd on GitHub · 2026-12-05 18:11 UTC · original · edited 2026-12-05 18:13 UTC

linux/setup.sh installs a prebuilt larp-common.exe from an external release — is that meant to stay?

It fetches larp-common.exe (85 MB), libc++.dll, libunwind.dll, a patched vkd3d (d3d12*.dll) and the replacement shaders from .../larp-common/releases/download/v0.2, with no pinned SHA-256. The only guard is head -c 512 | grep -qi '<html' — that catches a sign-in page, not a replaced file. So the PR is reviewed as source, but the binary users run is not the one that was reviewed, and it stops matching main after the next commit.

Everything else here builds from source (cargo build --release -p larp), and vkd3d-proton-patches.diff in the release is already auditable. The 85 MB .exe is the odd one out.

Could setup.sh take the exe instead of fetching it (LARP_COMMON_EXE=...)? #23's linux/build.sh builds this tree in ~48 s with cargo-xwin and pins hashes, and the two linux/ folders would stop fighting over run.sh/setup.sh.

Also: setup.sh never installs d3dcompiler_47; without it host ray tracing does not come up (E5005: Method 'Load4' is not defined).

Stopgap while the build path settles, or the intended install method?

**@⁠Kassadd** on GitHub · 2026-12-05 18:11 UTC · [original](https://github.com/gamingwithhomie/larp/pull/89#issuecomment-7442914871) · edited 2026-12-05 18:13 UTC **`linux/setup.sh` installs a prebuilt `larp-common.exe` from an external release — is that meant to stay?** It fetches `larp-common.exe` (85 MB), `libc++.dll`, `libunwind.dll`, a patched vkd3d (`d3d12*.dll`) and the replacement shaders from `.../larp-common/releases/download/v0.2`, with **no pinned SHA-256**. The only guard is `head -c 512 | grep -qi '<html'` — that catches a sign-in page, not a replaced file. So the PR is reviewed as source, but the binary users run is not the one that was reviewed, and it stops matching `main` after the next commit. Everything else here builds from source (`cargo build --release -p larp`), and `vkd3d-proton-patches.diff` in the release is already auditable. The 85 MB `.exe` is the odd one out. Could `setup.sh` take the exe instead of fetching it (`LARP_COMMON_EXE=...`)? #23's `linux/build.sh` builds this tree in ~48 s with cargo-xwin and pins hashes, and the two `linux/` folders would stop fighting over `run.sh`/`setup.sh`. Also: `setup.sh` never installs `d3dcompiler_47`; without it host ray tracing does not come up (`E5005: Method 'Load4' is not defined`). Stopgap while the build path settles, or the intended install method?
Author
Owner

@⁠r32601366 on GitHub · 2026-12-05 18:47 UTC · original

Thanks, all good points. Addressed in 82b3aad:

  • Pinned hashes: linux/assets-v0.2.sha256 holds the SHA-256 of every release asset (exe, libc++.dll, libunwind.dll, d3d12*.dll, shader-replace.zip). setup.sh checks each download against it and stops on any mismatch. The <html check stays only to give a clear message when a server answers with a sign-in page.
  • Bring your own exe: LARP_COMMON_EXE=/path/to/larp.exe ./setup.sh ... skips the exe download, and takes libc++.dll/libunwind.dll from beside it when present. ./setup.sh --build builds this tree with cargo (x86_64-pc-windows-gnullvm, llvm-mingw) and installs that. The prebuilt exe is now only the default for people without a toolchain.
  • d3dcompiler_47: setup.sh now installs it into the install's own prefix with winetricks through umu (--no-d3dcompiler to skip). Checked on a fresh prefix: system32/d3dcompiler_47.dll is in place, with a native override.

Both paths, the pinned download and LARP_COMMON_EXE, were run end to end on a clean folder.

On #23: agreed that two linux/ folders shouldn't compete. I'm happy to rebase onto #23 once it lands. I'd keep its build.sh (cargo-xwin, pinned hashes) as the one build path and reduce this PR's linux/ to what #23 doesn't cover: the Streamline download and the LARP_FG_BACKEND/native mouse defaults in the launcher. Or I can split linux/ out of this PR entirely if you'd rather review the input/FG code on its own. Which do you prefer?

**@⁠r32601366** on GitHub · 2026-12-05 18:47 UTC · [original](https://github.com/gamingwithhomie/larp/pull/89#issuecomment-7443439966) Thanks, all good points. Addressed in 82b3aad: - **Pinned hashes:** `linux/assets-v0.2.sha256` holds the SHA-256 of every release asset (exe, `libc++.dll`, `libunwind.dll`, `d3d12*.dll`, `shader-replace.zip`). `setup.sh` checks each download against it and stops on any mismatch. The `<html` check stays only to give a clear message when a server answers with a sign-in page. - **Bring your own exe:** `LARP_COMMON_EXE=/path/to/larp.exe ./setup.sh ...` skips the exe download, and takes `libc++.dll`/`libunwind.dll` from beside it when present. `./setup.sh --build` builds this tree with cargo (`x86_64-pc-windows-gnullvm`, llvm-mingw) and installs that. The prebuilt exe is now only the default for people without a toolchain. - **d3dcompiler_47:** `setup.sh` now installs it into the install's own prefix with winetricks through umu (`--no-d3dcompiler` to skip). Checked on a fresh prefix: `system32/d3dcompiler_47.dll` is in place, with a native override. Both paths, the pinned download and `LARP_COMMON_EXE`, were run end to end on a clean folder. On #23: agreed that two `linux/` folders shouldn't compete. I'm happy to rebase onto #23 once it lands. I'd keep its `build.sh` (cargo-xwin, pinned hashes) as the one build path and reduce this PR's `linux/` to what #23 doesn't cover: the Streamline download and the `LARP_FG_BACKEND`/native mouse defaults in the launcher. Or I can split `linux/` out of this PR entirely if you'd rather review the input/FG code on its own. Which do you prefer?
Author
Owner

@⁠gamingwithhomie on GitHub · 2026-12-05 18:50 UTC · original

Reviewed in detail - thank you, theres a lot of good work here (Streamline ABI layout tests, Authenticode check on the interposer, BLAKE3+byte-checked hooks). Holding merge as a single PR:

  1. Default-on behavior changes: native mouse replaces the current mouse->right-stick path by default, the vehicle auto-center bypass is default-on, and Streamline becomes the default FG backend under Wine (slfg::init runs at device creation even if FG is never enabled). Four features are bundled, three change defaults.
  2. Dead map code: MAP_DRAG_OK/MAP_ZOOM_OK/MAP_RAYCAST_OK/MAP_HELPERS_OK are loaded but never stored true anywhere, and window_message has two WM_MOUSEWHEEL arms (first shadows the map-wheel arm) - as shipped, map drag/zoom doesnt actually work. Compare #78, which stores them at install.
  3. Conflicts: hard add/add conflict with #46 on crates/larp-hle/src/mousehook.rs (same look_pull, two designs - one must be chosen), semantic conflict with #78 (same map hooks; second installer fails its byte check and silently disables), F7 collision with #86.
  4. linux/setup.sh downloads executables with no checksum/signature verification.

Suggested split: (a) Streamline FG with an explicit opt-in, (b) Linux scripts + Wine fixes, (c) native mouse behind LARP_NATIVE_MOUSE=1 after choosing between this and #46s design, with the map code fixed or dropped. Thank you!

**@⁠gamingwithhomie** on GitHub · 2026-12-05 18:50 UTC · [original](https://github.com/gamingwithhomie/larp/pull/89#issuecomment-7443483993) Reviewed in detail - thank you, theres a lot of good work here (Streamline ABI layout tests, Authenticode check on the interposer, BLAKE3+byte-checked hooks). **Holding merge as a single PR:** 1. **Default-on behavior changes:** native mouse replaces the current mouse->right-stick path by default, the vehicle auto-center bypass is default-on, and Streamline becomes the default FG backend under Wine (`slfg::init` runs at device creation even if FG is never enabled). Four features are bundled, three change defaults. 2. **Dead map code:** `MAP_DRAG_OK`/`MAP_ZOOM_OK`/`MAP_RAYCAST_OK`/`MAP_HELPERS_OK` are loaded but never stored `true` anywhere, and `window_message` has two `WM_MOUSEWHEEL` arms (first shadows the map-wheel arm) - as shipped, map drag/zoom doesnt actually work. Compare #78, which stores them at install. 3. **Conflicts:** hard add/add conflict with #46 on `crates/larp-hle/src/mousehook.rs` (same `look_pull`, two designs - one must be chosen), semantic conflict with #78 (same map hooks; second installer fails its byte check and silently disables), F7 collision with #86. 4. `linux/setup.sh` downloads executables with no checksum/signature verification. Suggested split: (a) Streamline FG with an explicit opt-in, (b) Linux scripts + Wine fixes, (c) native mouse behind `LARP_NATIVE_MOUSE=1` after choosing between this and #46s design, with the map code fixed or dropped. Thank you!
github-bot closed this pull request 2026-12-05 19:26:44 +00:00
Author
Owner

@⁠r32601366 on GitHub · 2026-12-05 19:23 UTC · original

Thanks for the detailed review. Split as suggested, each on current main:

  • #133 Streamline FG / Reflex backend: explicit opt-in (LARP_FG_BACKEND=streamline). Without it slfg::init is never called and nothing of Streamline is loaded. The default stays ngx everywhere, Wine included. The Darner-specific default folder is dropped.
  • #135 Wine fixes only (worker stack, hot guard blocks, no reserved buffers under Wine) plus an opt-in preload. No linux/ folder and no prebuilt exe download: #23 covers build/setup/run.
  • #134 Keyboard driving and the vehicle auto-center switch, both opt-in, on top of #46's direct mouse camera (already merged, so there's no second look_pull hook). The map code is dropped (that's #78's), and no F7 or other hotkey is used.

Closing this one in favour of those three.

**@⁠r32601366** on GitHub · 2026-12-05 19:23 UTC · [original](https://github.com/gamingwithhomie/larp/pull/89#issuecomment-7443954148) Thanks for the detailed review. Split as suggested, each on current main: - #133 Streamline FG / Reflex backend: explicit opt-in (`LARP_FG_BACKEND=streamline`). Without it `slfg::init` is never called and nothing of Streamline is loaded. The default stays ngx everywhere, Wine included. The Darner-specific default folder is dropped. - #135 Wine fixes only (worker stack, hot guard blocks, no reserved buffers under Wine) plus an opt-in preload. No `linux/` folder and no prebuilt exe download: #23 covers build/setup/run. - #134 Keyboard driving and the vehicle auto-center switch, both opt-in, on top of #46's direct mouse camera (already merged, so there's no second `look_pull` hook). The map code is dropped (that's #78's), and no F7 or other hotkey is used. Closing this one in favour of those three.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.