Commit Graph
3 Commits
Author SHA1 Message Date
kinect-botandsisyphus-dev-ai ce877a6076 feat(build): bake the shm name into the flake, add nix run .#launch-options
"just put the shm in the nix flake" - the shm name (virtual_kinect_frames)
was only a CLI default inside tracker.py's argparse, invisible from
flake.nix; the user had to retype --shm-name, and separately hand-compute
the Z: drive path translation (/dev/shm/... -> Z:\dev\shm\...) for every
KINECT_SHIM_SHM_FILE/KINECT_SHIM_CONFIG launch-option value.

flake.nix now defines kDefaultShmName once and passes --shm-name explicitly
from the tracker app, so the shm name genuinely lives in the flake instead
of only matching the tracker's own default by coincidence. Added a new
nix run .#launch-options app that computes and prints the exact, ready-to-
paste Steam Launch Options line (KINECT_SHIM_SHM_FILE + KINECT_SHIM_CONFIG,
both Wine Z:-path-translated from the real /dev/shm path and $HOME) - no
more manual path arithmetic. Verified the path-translation logic (POSIX ->
Z:\... with slashes flipped) against the exact script content by running it
standalone, producing Z:\dev\shm\virtual_kinect_frames and
Z:\home\<user>\.config\VirtualKinect\calibration.cfg as expected.

docs/linux-wine.md updated to point at nix run .#launch-options instead of
having the reader compute the Z: paths by hand, and to drop the now-
redundant --shm-name flag from the Nix tracker invocation example.

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
2026-11-30 12:57:42 -05:00
kinect-botandsisyphus-dev-ai c08bc922b6 feat(tracker): add Linux cursor calibration, matching the Windows flow exactly
"the cursor scaling is still wrong, make it like the windows one" - the
Linux tracker had no way to calibrate at all. The in-game cursor's arm-reach
gains (default 3.2/2.6) were tuned specifically for the native Windows
tracker's camera/pose characteristics via its "Calibrate cursor" button
(core/calibration.h's derive_arm_gains); Linux users were stuck on that
default regardless of their own camera/body, with no equivalent tool.

tracker/calibration.py is a byte-for-byte port of core/calibration.h's
arm-gain derivation (mean(|reach|) -> target/mean, clamped [1,6]) and the
calibration.cfg text format load_config()/save_config() share, so a config
written by either side is read identically by the shim - not a
reimplementation that happens to produce similar numbers, the same formula
and the same wire format, verified against tests/test_calibration.cpp's own
cases (averaging, diagonal-gesture success, horizontal-only rejection,
clamp-to-min, save/reload round-trip) ported 1:1 into
tests/test_calibration_py.py - 6/6 passing, plus the existing tracker suite
still 11/11.

tracker.py gets a --calibrate mode (calibrate_cursor()): mirrors each frame
for pose inference exactly like the main loop, computes Kinect joints with
mirror=False, and reads HAND_LEFT (index 7) minus SHOULDER_LEFT (index 4) -
the slots the player's actual right arm lands in post-mirror, pre-shim-swap,
matching exactly where win_main.cpp's CalibrateCursor() reads
skeleton.joints[7]/[4] (verified by reading that function directly). Usage:
nix run .#tracker -- --calibrate --source 0.

docs/calibration.md and docs/linux-wine.md document the Linux flow, the
Linux default config path (no %LOCALAPPDATA% equivalent - XDG config dir),
and that KINECT_SHIM_CONFIG must be set explicitly in both the calibration
tool's environment and the game's launch options (Wine or Proton) so they
agree on one file - the same pattern already established for
KINECT_SHIM_SHM_FILE.

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
2026-11-30 12:53:45 -05:00
kinect-botandsisyphus-dev-ai 2ea8fc4aa6 feat(shim): bridge the Wine-hosted shim to the native Linux tracker via a file-backed shared-memory mapping
Wine mf.dll stubs out MFEnumDeviceSources for video capture (confirmed in
Wine upstream source), so tracker-native/kinect-tracker.exe always sees zero
cameras and null-derefs when run under Wine. Rather than chase that Wine
limitation, let the already-verified native-Linux Python tracker (tracker/,
full V4L2 access) feed the Wine-hosted shim directly.

FrameSource gains open_file() (CreateFileW + file-backed CreateFileMappingW
+ MapViewOfFile), selected via a new KINECT_SHIM_SHM_FILE env var checked
first in VirtualKinectSensor::Initialize, falling back to the existing
anonymous named-section path when unset. The Linux tracker publishes through
multiprocessing.shared_memory, which on Linux is backed by a real file at
/dev/shm/<name>; through Wines default Z: drive that is reachable from
inside Wine as Z:\dev\shm\<name>, so both sides map the same tmpfs file
with no Wine camera support needed at all.

Builds clean for both x86/x64 (fallback/windows-nui/build.sh). New runbook
in docs/linux-wine.md; linked from README and docs/troubleshooting.md.

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
2026-11-30 10:00:06 -05:00