"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>
6.5 KiB
Running DEA + the tracker entirely on Linux, under Wine
This is a third path beyond the two in the README: DEA and the Kinect10.dll shim run
under Wine on Linux, but the tracker runs as a native Linux process, outside Wine.
Why not just run kinect-tracker.exe under Wine too
tracker-native/ captures the webcam through Windows Media Foundation
(MFEnumDeviceSources + IMFSourceReader). Wine's mf.dll has video-capture device
enumeration as a hard stub (confirmed directly in Wine's source,
dlls/mf/main.c::MFEnumDeviceSources):
if (IsEqualGUID(&source_type, &MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID))
{
FIXME("Not implemented for video capture devices.\n");
*ret_count = 0;
return S_OK;
}
It always reports zero devices - no camera ever shows up, and kinect-tracker.exe
null-derefs downstream of that empty list (the Unhandled page fault ... address 00006FFFFE9A8C34 crash you get running it under Wine is this). This isn't fixable from
our side; it's a gap in Wine's Media Foundation implementation.
The fix: bridge the already-verified Linux tracker through a real file
The shim's shared-memory region is normally an anonymous, Wine-private pagefile
section (CreateFileMappingW(INVALID_HANDLE_VALUE, ...)), invisible outside that one
Wine instance. The Python tracker (tracker/), which already has full native webcam
access (verified Linux path, docs/setup-linux.md), publishes through
multiprocessing.shared_memory, which on Linux is backed by a real file at
/dev/shm/<name>.
The shim now supports opening that real file directly as a file-backed mapping
(KINECT_SHIM_SHM_FILE env var, fallback/windows-nui/src/frame_source.cpp::open_file)
instead of the named anonymous section. Since Wine's default Z: drive maps the whole
host filesystem, /dev/shm/virtual_kinect_frames on Linux is Z:\dev\shm\virtual_kinect_frames
from inside Wine - so the Wine-hosted shim and the native-Linux tracker end up mapping the
exact same tmpfs file. No Wine camera support needed at all.
webcam --(V4L2)--> tracker/ (Python, native Linux process)
| writes multiprocessing.shared_memory "virtual_kinect_frames"
v
/dev/shm/virtual_kinect_frames (a real file, same on both sides)
^
| CreateFileW + file-backed CreateFileMappingW
Kinect10.dll shim (inside Wine, inside the DEA process) --> game
Steps
-
Build the shim (already done in this repo as of this change; rebuild if you pull newer source):
./fallback/windows-nui/build.shCopy
fallback/windows-nui/build/Kinect10-x86.dll(or-x64, matching DEA's bitness) into the DEAcontentsfolder next togamekdm.dll, asKinect10.dll- same asdocs/setup-windows.mdstep 2. -
Set up the Linux tracker environment per
docs/setup-linux.mdsteps 0-2 (with Nix,nix developdoes this in one shot - no venv, no manuallibGLESv2.so.2staging; without Nix, the uv/Python 3.12 venv path). You do not need the OpenNI2 steps (3-5) for this path - those are for the separate Linux/OpenNI2 target, not DEA. -
Confirm your Wine
Z:drive maps to/(the default):ls -la ~/.wine/dosdevices/z: # expect a symlink to /If it's remapped or you use a non-default
WINEPREFIX, adjust the path in step 5 accordingly (or add your ownZ:-equivalent drive mapping to/dev/shm). -
Run the Linux tracker. The shm name (
virtual_kinect_frames) is baked into the flake itself (kDefaultShmNameinflake.nix) and passed automatically - no flag needed:# with Nix: nix run .#tracker -- --source 0 --depth-size 640x480 # without Nix: export LD_LIBRARY_PATH="$HOME/.cache/kinect/gllibs:$LD_LIBRARY_PATH" # if needed tracker/.venv/bin/python -m tracker.tracker --source 0 \ --depth-size 640x480 --shm-name virtual_kinect_framesThis creates
/dev/shm/virtual_kinect_framesand keeps publishing live frames into it. -
Launch DEA with
KINECT_SHIM_SHM_FILE(and, once calibrated,KINECT_SHIM_CONFIG) set, pointing at those files through theZ:drive. Get the exact, ready-to-paste values - computed from the flake's own shm name and your$HOME, no manual path translation - with:nix run .#launch-optionsPlain Wine, set the same assignments before the command:
WINEPREFIX=/path/to/your/prefix \ KINECT_SHIM_SHM_FILE='Z:\dev\shm\virtual_kinect_frames' \ wine spice2x.exe # (or however you normally launch it)Steam Proton (add spice2x/DEA as a non-Steam game, force a Proton version in Properties -> Compatibility): paste
nix run .#launch-options's output line into Properties -> General -> Launch Options as-is (it already ends in%command%).The shim reads
KINECT_SHIM_SHM_FILEonce atNuiInitializeand, when set, opens that path as a file-backed mapping instead of looking for the named Wine section. Checkkinect_shim.logfor ashm-file='...' open=1line to confirm it attached. -
Calibrate the cursor - required on Linux, there is no built-in default that fits every camera. With the tracker set up, run:
nix run .#tracker -- --calibrate --source 0and raise your right arm as prompted; it writes to the same path
nix run .#launch-optionsalready put inKINECT_SHIM_CONFIGabove, so no further coordination is needed - just relaunch. Seedocs/calibration.mdfor the full guide and the exact env var to set. Everything downstream works the same as the Windows path - the shim doesn't care whether the bytes came from a Windows tracker or this Linux one, only that the contract layout matches (it's#pragma pack(1)and already cross-checked against the Python struct by the core test suite).
If it still doesn't attach
kinect_shim.logshowsshm-file='...' open=0 (err=2): file not found - the tracker isn't running yet, the--shm-namedoesn't match the path inKINECT_SHIM_SHM_FILE, or yourZ:drive doesn't map where you think. Runwinepath -w /dev/shm/virtual_kinect_framesfrom inside the prefix to get the exact Windows-side path Wine expects.- The shim attaches but the game shows no skeleton: this is the same validity/tracking
pipeline as the Windows path - see
docs/troubleshooting.mdanddocs/game-internals.md. Nothing about the file-backed bridge changes that logic; it's purely a transport swap.