Files
kinect/docs/setup-windows.md
T
kinect-bot 39876fa97b
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
ci / Python root tests (pytest, no tracker deps) (push) Canceled after 0s
ci / Python tracker (pytest, tracker/.venv) (push) Canceled after 0s
docs(setup): README + linux/windows setup + calibration/troubleshooting + packaging (wave 11; todo 18 done)
2026-11-25 06:10:54 -05:00

190 lines
9.2 KiB
Markdown

# Windows setup guide
This covers the two Windows surfaces for the webcam-driven virtual Kinect v1 and how to run
DanceEvolution Arcade (DEA) against them.
> **Honesty note.** This project was built on a Linux/WSL2 host with no Windows and no Windows
> Driver Kit. Every runtime step in this guide is marked `[~]` where it was **not executed in the
> build environment**. The cross-compiled artifacts (`fallback/windows-nui/build/Kinect10-x86.dll`
> and `-x64.dll`) are real PE images with an audited export table, but no step below that loads a
> DLL into the MS NUI runtime, binds a driver, or launches DEA has been verified here. These are
> the acceptance surface for plan todos 12/13 and the F5 playability proof on your Windows box.
## What you must supply (never bundled here)
This repository links only. It never redistributes Microsoft or game assets. You install:
- **Kinect for Windows Runtime + SDK v1.8** (provides the real `Kinect10.dll`, the Kinect USB
driver `kinectsensor.inf`, and the SDK headers). Official download:
<https://www.microsoft.com/en-us/download/details.aspx?id=40278>
- **Kinect for Windows Developer Toolkit v1.8** (ships the `SkeletonBasics-D2D` and
`KinectExplorer-D2D` samples used to confirm enumeration):
<https://www.microsoft.com/en-us/download/details.aspx?id=40276>
- **DanceEvolution Arcade** (`gamekdm.dll` + data) and **spice2x** with its Kinect-bypass option,
per your P3dro200 install. These are not provided here.
## Two Windows paths
| Path | What it proves | Status |
| --- | --- | --- |
| **Device-level** (usbip-win VHCI + MS Kinect driver) | IS-1 (OS enumerates a Kinect) + IS-2 (real MS NUI skeletonizes synthetic depth) | `[~]` unverified: needs Windows + a USB/IP client. This is the authoritative path. |
| **Kinect10.dll NUI shim** (`fallback/windows-nui/`) | IS-3 / IS-4 (the game shows the player and scores) only. It does **not** satisfy IS-1 or IS-2. | DLLs built + export-audited on Linux; runtime load `[~]` unverified. |
The device path is primary. The shim is the independent escape hatch if the device path cannot be
made to bind. Do not report IS-1/IS-2 as proven from the shim.
---
## Path A: device-level (usbip-win) `[~]`
### A1. Run the emitter (on any Linux/WSL2 box reachable over TCP)
The USB/IP server is OS-agnostic and already built + socket-verified on Linux. The Windows side
adds no device logic; it just attaches a VHCI client across TCP (loopback if co-located).
```sh
cmake -S attach/linux -B attach/linux/build && cmake --build attach/linux/build
./attach/linux/build/kinect_attach serve --port 3240 # exports 1-1 camera, 1-2 audio, 1-3 motor
```
For a real session the emitter is fed by the tracker/synth pipeline (see `docs/setup-linux.md`);
standalone `serve` uses a placeholder frame source, which is enough to prove binding/enumeration.
### A2. Install a USB/IP VHCI client on Windows
Two prebuilt clients work. Scripts for both live in `attach/windows/scripts/` (run from an
elevated PowerShell).
- **usbip-win2 (vadimgrn), recommended.** Attestation/WHLK-signed UDE driver, usually needs no
test-signing and no Secure Boot change. MSI from
<https://github.com/vadimgrn/usbip-win2/releases>. Requires Windows 10 1903+.
```powershell
cd attach\windows\scripts
.\Install-UsbIpWin.ps1 -Client usbip-win2 -InstallerPath C:\path\to\USBip-<ver>.x64.msi
.\Attach-Kinect.ps1 # attaches busids 1-1, 1-2, 1-3
.\Verify-KinectDevice.ps1 # confirms the three PIDs bound to the MS Kinect driver
```
- **usbip-win (cezanne), legacy fallback.** Test-signed driver. Requires the test-signing posture
below. Release zip from <https://github.com/cezanne/usbip-win/releases>.
### A3. Test-signing posture (legacy client, or any unsigned driver) `[~]`
Windows x64 enforces driver signing. A self-built or test-signed VHCI driver loads only when the
box is in test-signing mode, trusts the test certificate, and has Secure Boot off. This is a
**personal-use development posture, not production.**
```powershell
cd attach\windows\scripts
# 1. Turn Secure Boot OFF in UEFI firmware first. Then:
.\Enable-TestSigning.ps1 -PfxPath C:\path\to\usbip-win-<ver>\usbip_test.pfx
# runs: bcdedit /set testsigning on
# warns if Secure Boot is still on; imports usbip_test.pfx (password: usbip)
# into LocalMachine Root AND TrustedPublisher. REBOOT after this.
# 2. Install the test-signed VHCI driver, then attach + verify.
.\Install-UsbIpWin.ps1 -Client usbip-win -PackageDir C:\path\to\usbip-win-<ver>
.\Attach-Kinect.ps1
.\Verify-KinectDevice.ps1
```
Facts to expect:
- **`bcdedit /set testsigning on`** is the command that relaxes signature enforcement.
- **Secure Boot must be OFF**, or firmware re-enforces the same policy and the driver will not load.
- **A "Test Mode Windows <build>" desktop watermark** appears in the lower-right after a reboot.
It is expected and harmless; it does not affect gameplay.
- **spice2x anti-tamper interaction:** test-signing and injected DLLs can trip DEA/spice2x
integrity checks. Use spice2x's Kinect-bypass option (it clears the boot-time Kinect presence
check only; it provides no gameplay data), and if the game refuses to boot under test mode,
confirm spice2x is configured to tolerate the virtual device before assuming the driver failed.
### A4. Pass criteria for the device path
1. Device Manager shows the three Kinect devices (`VID_045E&PID_02AE` camera, `PID_02AD` audio,
`PID_02B0` motor) bound to the **Microsoft Kinect driver** (`kinect*.inf`), no yellow-bang. If
`Verify-KinectDevice.ps1` reports the service/INF as `usbip*`, the VHCI stub attached but the MS
driver did not match the descriptors; confirm the 1.8 runtime is installed.
2. The NUI runtime enumerates it: `KinectExplorer-D2D` lists the sensor, or `SkeletonBasics-D2D`
opens it; equivalently `NuiGetSensorCount() >= 1`.
Capture a Device Manager screenshot + the KinectExplorer window to
`.omo/evidence/task-12-webcam-kinect-emulator.*`.
### A5. Teardown
```powershell
.\Detach-Kinect.ps1 -All
.\Disable-TestSigning.ps1 # legacy client only; reboot; re-enable Secure Boot
```
The one open risk on this path is isochronous camera framing: the shared server models the ISO IN
endpoints as single packets without the USB/IP `iso_packet_descriptor` array. Whether the Windows
VHCI + MS Kinect driver accept that simplification is the question todo 13 resolves. If rejected,
the fix extends the shared `core/` + `attach/linux` ISO path (reused by Windows for free), not a
Windows-only change. See `attach/windows/docs/approach.md` for the full analysis.
---
## Path B: Kinect10.dll NUI shim `[~]`
The clean-room shim is a drop-in `Kinect10.dll` that feeds skeleton/depth to the game directly from
the shared core engine. It proves playability (IS-3/IS-4), not enumeration.
### B1. Pick the right architecture
DEA/`gamekdm.dll` is likely x86 (32-bit). Confirm from a Developer Command Prompt:
```
dumpbin /headers gamekdm.dll # FILE HEADER machine: 14C = x86, 8664 = x64
```
A 64-bit DLL will not load into a 32-bit game. Use the matching artifact:
`fallback/windows-nui/build/Kinect10-x86.dll` or `Kinect10-x64.dll`.
### B2. Install the shim
1. Back up (do not overwrite) the system `Kinect10.dll`.
2. Copy the matching built DLL into the DEA directory **beside `gamekdm.dll`**, renamed to
`Kinect10.dll`.
3. Start the tracker so it publishes frames into the named shared-memory region the shim reads.
The shim opens the region named by `KINECT_SHIM_SHM` (default `kinect_virtual_frames`); the
tracker must publish under the same name. When the region is absent the shim still ticks at
30 Hz and reports a no-player frame, so the game never hangs.
4. Boot DEA through spice2x with the Kinect bypass and enter a dance.
The exported surface is a 21-function superset of the minimum DEA imports. Confirm against DEA's
real import list with `dumpbin /imports gamekdm.dll`; if the spike reveals an extra symbol, add it
to `fallback/windows-nui/Kinect10.def` and a stub in `src/exports.cpp` and rebuild. See
`fallback/windows-nui/README.md`.
### B3. Building the shim from source
The repo ships prebuilt `Kinect10-x86.dll` / `-x64.dll`. To rebuild (MSVC is authoritative; MinGW
cross is a smoke signal):
```sh
cd fallback/windows-nui && bash build.sh # cross-build both arches on Linux
# or, on Windows with MSVC:
cmake -S . -B build-x86 -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw-x86.cmake && cmake --build build-x86
```
---
## DEA configuration (per P3dro200)
1. Install Kinect for Windows Runtime + SDK v1.8 and the Developer Toolkit v1.8.
2. Install DEA and spice2x per the P3dro200 layout; enable spice2x's **Kinect bypass** so the game
clears its boot-time Kinect presence check.
3. Choose one path: attach the device (Path A) so the MS NUI runtime enumerates a real Kinect, or
drop the matching `Kinect10.dll` shim beside `gamekdm.dll` (Path B).
4. Start the tracker (webcam + MediaPipe) so synthetic frames are flowing before launching DEA.
5. Launch DEA through spice2x, calibrate once (see `docs/calibration.md`), and confirm the player
silhouette appears and moves track. Record the gameplay proof to
`.omo/evidence/task-13-webcam-kinect-emulator.*`.
If the player silhouette is mirrored, moves invert, or the player drops out, see
`docs/troubleshooting.md`.