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>
113 lines
5.5 KiB
Markdown
113 lines
5.5 KiB
Markdown
# 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`):
|
|
|
|
```c
|
|
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
|
|
|
|
1. **Build the shim** (already done in this repo as of this change; rebuild if you pull
|
|
newer source):
|
|
```sh
|
|
./fallback/windows-nui/build.sh
|
|
```
|
|
Copy `fallback/windows-nui/build/Kinect10-x86.dll` (or `-x64`, matching DEA's bitness)
|
|
into the DEA `contents` folder next to `gamekdm.dll`, as `Kinect10.dll` - same as
|
|
`docs/setup-windows.md` step 2.
|
|
|
|
2. **Set up the Linux tracker environment** per `docs/setup-linux.md` steps 0-2 (with Nix,
|
|
`nix develop` does this in one shot - no venv, no manual `libGLESv2.so.2` staging; 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.
|
|
|
|
3. **Confirm your Wine `Z:` drive maps to `/`** (the default):
|
|
```sh
|
|
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 own `Z:`-equivalent drive mapping to `/dev/shm`).
|
|
|
|
4. **Run the Linux tracker**, pointing it at a shm name you'll reuse below:
|
|
```sh
|
|
# 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_frames
|
|
```
|
|
This creates `/dev/shm/virtual_kinect_frames` and keeps publishing live frames into it.
|
|
|
|
5. **Launch DEA under Wine with `KINECT_SHIM_SHM_FILE` set**, pointing at that same file
|
|
through the `Z:` drive:
|
|
```sh
|
|
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_FILE` once at `NuiInitialize` and, when set, opens that
|
|
path as a file-backed mapping instead of looking for the named Wine section. Check
|
|
`kinect_shim.log` for a `shm-file='...' open=1` line to confirm it attached.
|
|
|
|
6. 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.log` shows `shm-file='...' open=0 (err=2)`: file not found - the tracker
|
|
isn't running yet, the `--shm-name` doesn't match the path in `KINECT_SHIM_SHM_FILE`, or
|
|
your `Z:` drive doesn't map where you think. Run `winepath -w /dev/shm/virtual_kinect_frames`
|
|
from 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.md` and `docs/game-internals.md`.
|
|
Nothing about the file-backed bridge changes that logic; it's purely a transport swap.
|