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>
5.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, pointing it at a shm name you'll reuse below:
# with Nix: nix run .#tracker -- --source 0 --depth-size 640x480 --shm-name virtual_kinect_frames # 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 under Wine with
KINECT_SHIM_SHM_FILEset, pointing at that same file through theZ:drive:WINEPREFIX=/path/to/your/prefix \ KINECT_SHIM_SHM_FILE='Z:\dev\shm\virtual_kinect_frames' \ wine spice2x.exe # (or however you normally launch it)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. -
Calibration (
docs/calibration.md) and 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.