21 KiB
Spike - Windows/DEA behavior, bitness, and synthetic-depth skeletonization crux (todo 4)
STATUS: BLOCKED in the build environment (no Windows). This is the runbook to execute on the user's Windows box; the depth-fidelity crux remains UNPROVEN until Step 5 passes there.
This document was authored on a Linux/WSL2 host with no Windows, no DanceEvolution Arcade (DEA), and no Kinect for Windows SDK. Every active probe below (loading a pass-through logging
Kinect10.dllintogamekdm.dll, runningdumpbinongamekdm.dll, binding ausbip-winvirtual device againstkinectsensor.inf, and feeding synthetic depth to the real MS NUI runtime to capture skeleton output) requires the user's Windows box and was NOT executed here. No results in this file are observed; every result cell is a placeholder to be filled in on Windows. Do not treat any value below as captured.
Closes plan GAP-4 (Windows half + the Windows synthetic-depth skeletonization crux). Plan
todo 4; references .omo/design/architecture.md (Top risks A/B, Sequencing) and
.omo/design/nui-contracts.md §3.2 (init sequence), §5 (open questions this spike resolves).
Kill-gate summary (read this first)
Two things in this spike can HALT the whole project:
- Bitness (Step 2, risk B): if DEA /
gamekdm.dllis x86, the shipping Windows shim/driver must be x86. A 64-bit DLL will not load into a 32-bit game. This is project-ending if mismatched; it is cheap to settle and gates todo 1's arch selection and todos 12/14. - Synthetic-depth skeletonization (Step 5, risk D - the CRUX): if the real MS NUI runtime cannot produce a moving skeleton from our synthetic (no physical Kinect) articulated-depth replay, the whole device-level approach for Windows (and the Linux path when NiTE2 is absent) is invalid. If Step 5 fails: HALT and re-plan the depth model (e.g. a monocular-depth net feeding a denser, more Kinect-like depth map) before building waves 4-11.
Fill the Results ledger at the bottom as each step runs; the plan's acceptance criteria require each claim to be backed by a captured log line / archived output.
1. Prerequisites (install on the Windows box)
Target: a Windows 10/11 x64 machine (it can host both x86 and x64 game/driver code).
- Kinect for Windows Runtime + SDK v1.8 - both the Runtime and the Developer Toolkit/SDK:
- Kinect for Windows SDK v1.8 (
KinectSDK-v1.8-Setup.exe) - installsKinect10.dll(the real NUI runtime),kinectsensor.infand the WDF USB driver, and the headers (NuiApi.h,NuiImageCamera.h,NuiSkeleton.h) under%KINECTSDK10_DIR%\inc. - Kinect for Windows Developer Toolkit v1.8 (
KinectDeveloperToolkit-v1.8-Setup.exe) - ships the SkeletonBasics-D2D and KinectExplorer-D2D C++ samples used in Step 5. - Record the real
Kinect10.dllpath (typicallyC:\Windows\System32\Kinect10.dllfor x64 andC:\Windows\SysWOW64\Kinect10.dllfor x86; both are installed by the 1.8 setup). You will forward to this in Step 3.
- Kinect for Windows SDK v1.8 (
- spice2x - with the Kinect bypass option available (it defeats DEA's boot-time Kinect presence check; it does NOT provide gameplay data). Needed so DEA boots far enough to exercise the NUI gameplay path in Step 3.
- DanceEvolution Arcade (DEA) - the
gamekdm.dllgame module and its data (P3dro200 / spice2x install layout). Note the directory that containsgamekdm.dll; the logging shim is placed beside it in Step 3. - Build tools:
- Visual Studio 2022 (or 2019) with the Desktop development with C++ workload, including
the x86 and x64 MSVC toolsets and the Windows SDK (gives you
dumpbin.exe,cl.exe,link.exe, the Developer Command Prompt). MSVC is the authoritative toolchain for shim ABI. - Confirm
dumpbinis on PATH from a Developer Command Prompt for VS (x86 or x64 -dumpbinreads either arch regardless of the prompt).
- Visual Studio 2022 (or 2019) with the Desktop development with C++ workload, including
the x86 and x64 MSVC toolsets and the Windows SDK (gives you
- usbip-win (Steps 4-5) - the signed/test-signed
usbip-win(orusbip-win2) package with its virtual host-controller (VHCI) bus driver. Requires test-signing ON and/or Secure Boot OFF (see Step 4). A second machine or a Linux VM runs theusbipdserver that exports the synthetic device; or use the Windows-local stub server if the chosenusbip-winbuild ships one.
Pass/fail for this section: all five installed; dumpbin /? runs; the SkeletonBasics and
KinectExplorer samples build and launch (they will show "no Kinect" until Steps 4-5 attach a
virtual device); the real Kinect10.dll path(s) recorded for forwarding.
2. Bitness capture (risk B - settle first, it is cheap and project-defining)
From a Developer Command Prompt for VS in the DEA directory:
dumpbin /headers gamekdm.dll > %TEMP%\gamekdm_headers.txt
dumpbin /imports gamekdm.dll > %TEMP%\gamekdm_imports.txt
dumpbin /exports gamekdm.dll > %TEMP%\gamekdm_exports.txt
What to read and record:
- Architecture - in
gamekdm_headers.txt, theFILE HEADER VALUESlinemachine:14C machine (x86)-> DEA is 32-bit (the expected case - record "x86").8664 machine (x64)-> DEA is 64-bit (record "x64").- Also note the
magicinOPTIONAL HEADER VALUES(10B= PE32/x86,20B= PE32+/x64) as a cross-check.
- Kinect import surface - in
gamekdm_imports.txt, find theKinect10.dllimport block and record every imported symbol verbatim (e.g.NuiInitialize,NuiShutdown,NuiGetSensorCount,NuiCreateSensorByIndex/NuiCreateSensorById,NuiSkeletonTrackingEnable,NuiSkeletonGetNextFrame,NuiImageStreamOpen,NuiImageStreamGetNextFrame,NuiImageStreamReleaseFrame,NuiTransformSmooth, theNuiTransform*coordinate mappers, etc.). This exact list is the ABI surface the Step 3 forwarding shim must re-export and the surface the todo-14 clean-room fallbackKinect10.dllmust implement (no fewer exports than DEA imports,__stdcall/WINAPIdecoration matched bit-for-bit).- Note whether
Kinect10.dllis imported statically (named in the import table) or resolved dynamically viaLoadLibrary/GetProcAddress, or via COMCoCreateInstance(a CLSID, not a named import). If it is not in the static import table, Step 3's search-order shadowing may not fire - see the Step 3 failure branch.
- Note whether
Decision this step gates: the SHIPPING Windows architecture for todos 1, 12, 14. Per the plan,
scaffold both x86 and x64 but build the real driver/shim for whatever machine says here. DEA is
likely x86; if so, the entire Windows shim/driver chain is x86, and any x64 artifact is a smoke
build only.
Pass/fail: machine recorded (x86 vs x64) with the magic cross-check; the complete
Kinect10.dll import list archived; linkage style (static import vs dynamic vs COM) noted. All three
dumpbin output files saved under .omo/evidence/task-4-webcam-kinect-emulator.*.
3. Pass-through logging Kinect10.dll (risk A - learn DEA's exact NUI call pattern)
Goal: a drop-in Kinect10.dll placed beside gamekdm.dll that forwards every export to the real
Kinect10.dll and logs each call's name, arguments, flags, requested resolution, return code,
and which event handles DEA waits on - WITHOUT modifying the game binary. Reference
.omo/design/nui-contracts.md §3.2 for the init sequence you are trying to observe and §5 for the
open questions this log resolves.
3a. Build the forwarding shim (choose ONE technique)
Build it for the same arch as Step 2 (x86 if DEA is x86). MSVC authoritative.
- Technique A - linker export forwarding (simplest, no code for pure forwarding, but to log you
need stubs). For a logging shim, write a thin stub per imported export that logs then tail-calls
the real function. Load the real DLL by its full System32/SysWOW64 path at
DllMainDLL_PROCESS_ATTACH:Provide a// sketch - real project lives in tools/logging-shim/ static HMODULE g_real; // real Kinect10.dll BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID) { if (reason == DLL_PROCESS_ATTACH) { OpenLog("kinect10_shim.log"); g_real = LoadLibraryW(L"C:\\Windows\\SysWOW64\\Kinect10.dll"); // real one, full path Log("DllMain ATTACH, real=%p", g_real); } return TRUE; } // one stub per export from Step 2's import list, exact __stdcall decoration: extern "C" HRESULT __stdcall NuiInitialize(DWORD dwFlags) { Log("NuiInitialize flags=0x%08X", dwFlags); auto fn = (HRESULT(__stdcall*)(DWORD))GetProcAddress(g_real, "NuiInitialize"); HRESULT hr = fn(dwFlags); Log("NuiInitialize -> 0x%08X", hr); return hr; }.deffile listing exactly the exports DEA imports (from Step 2), each with the correct ordinal/decoration, sogamekdm.dllbinds to your stubs. For functions you do not need to inspect, you may still forward via the.defEXPORTS Name=RealModule.Namesyntax (pure forwarder, no log line). - Technique B - Microsoft Detours / MinHook inline-hooking the real
Kinect10.dllafter it loads. Heavier; use only if export-shadowing (Technique A) does not fire (see failure branch).
3b. Install and capture
- Copy the built
Kinect10.dll(logging shim) into the DEA directory besidegamekdm.dll. Back up / do not overwrite the systemKinect10.dll. - Boot DEA through spice2x with the Kinect bypass so it passes the boot presence check and reaches gameplay.
- Play/observe enough to enter a dance so DEA opens its streams and consumes skeleton frames.
- Capture
kinect10_shim.log.
3c. What to extract from the log (fills nui-contracts §3.2 / §5 open items)
Record, each backed by a log line:
DllMainattach fired (confirms the shim is the loaded module - risk C).NuiInitializeflags - exactdwFlags(e.g.USES_DEPTH_AND_PLAYER_INDEX | USES_COLOR | USES_SKELETON, or a subset). Settles which streams DEA actually gates on.NuiImageStreamOpencalls - for each:eImageType(depth / depth+player-index / color),eResolution(the exact enum - settles nui-contracts §5 open item 1: 640x480 vs 320x240 vs 80x60),dwImageFrameFlags,dwFrameLimit, and whether an event handle is passed.- Skeleton model -
NuiSkeletonTrackingEnableflags; and whether DEA uses the event model (waits on the skeleton event viaWaitForSingleObject/WaitForMultipleObjectsthenNuiSkeletonGetNextFrame) or polls (NuiSkeletonGetNextFrame(0)in a loop). Log thedwMillisecondsToWaitvalues. - Bone orientations - whether DEA calls
NuiSkeletonCalculateBoneOrientations(settles nui-contracts §5 open item 4). - Coordinate mappers - which
NuiTransform*/INuiCoordinateMappercalls DEA makes. - Return-code expectations - which HRESULTs DEA tolerates (e.g.
E_NUI_FRAME_NO_DATA,S_FALSE) vs. which make it drop the player.
Pass/fail: kinect10_shim.log shows the DllMain attach line AND a captured call sequence
through NuiInitialize -> stream opens -> skeleton frame consumption during actual gameplay. If you
got init flags, the opened streams + resolutions, and the skeleton-vs-poll model each from a log
line, this step passes.
Failure branch (risk C - shim not the loaded module): if DllMain never logs or DEA still binds
the system Kinect10.dll, the DLL search order was bypassed (fully-qualified LoadLibrary path,
SxS/manifest redirect, KnownDLLs, COM-by-CLSID activation, or a spice2x loader hook). Document how
the real DLL is being resolved (use Process Monitor to see the actual Kinect10.dll load path,
and Dependencies/dumpbin /dependents + the Step 2 linkage note). Workaround: switch to
Technique B (Detours/MinHook) hooking the resolved module, or - if COM-activated - register a proxy
CLSID. Record the resolution path and the workaround used.
4. usbip-win binding test (gates todo 12 - device-level path)
Goal: prove the real Windows Kinect stack (kinectsensor.inf driver + MS NUI runtime) will
enumerate and bind to a virtual USB device presenting the Kinect v1 identity and composite
topology, with no physical Kinect. This establishes what the MS driver requires beyond
libfreenect's Linux init (from todo 3).
4a. Enable virtual-device drivers
- Enable test-signing and/or disable Secure Boot so the (test-signed)
usbip-winVHCI bus driver loads:Reboot. (If Secure Boot blocks test-signing, disable Secure Boot in firmware first.) Record the exact signing posture used - the driver must be installed the same way on the user's real machine.bcdedit /set testsigning on - Install the
usbip-winVHCI driver (usbip.exe/usbipd+ the VHCI bus.inf) per its README.
4b. Present the synthetic Kinect device
- Stand up a
usbipserver exporting a synthetic composite device that advertises the Kinect v1 identity and interface topology captured by todo 3 (Linux spike):- VID/PID of the Kinect v1 sensor (the NUI camera;
045E:02AEfor the Kinect-for-Xbox camera interface - use the exact IDs the todo-3 descriptor capture recorded, including the audio/motor PIDs for the composite set). - The composite topology: camera + audio + motor interfaces as separate functions, matching the
descriptor set from todo 3.
kinectsensor.infbinds per-interface; a single flat interface will not match.
- VID/PID of the Kinect v1 sensor (the NUI camera;
usbip attachthe device into the Windows VHCI so it appears in the local USB tree.
4c. Verify binding
- Device Manager - the sensor appears and binds to the Kinect driver (no yellow-bang) under the
expected device class. Record the driver name and INF (
kinectsensor.inf). - MS NUI runtime enumerates it - run the Kinect SDK sample (KinectExplorer-D2D) or call
NuiGetSensorCount->>= 1, andNuiCreateSensorByIndex(0, ...)succeeds. (At this stage the streams may error because no frame data is being served yet - that is expected; Step 5 serves data.) - Record what the MS driver needs beyond libfreenect's Linux init - compare against todo 3's
capture: does the Windows driver perform/require a firmware upload handshake (Kinect v1's
audio firmware / the two-stage boot where the bootloader PID changes to the running PID)?
Additional control transfers, SET_CONFIGURATION, per-interface alt-settings, specific
power/
bmAttributesdescriptor fields, or isochronous endpoint descriptors the Linux stack tolerated but Windows demands? Capture Windows-side USB traffic with Wireshark + USBPcap while the driver binds and record every transfer the MS driver initiates that the Linux init did not.
Pass/fail: Device Manager shows the virtual sensor bound to kinectsensor.inf with no error AND
NuiGetSensorCount >= 1 / NuiCreateSensorByIndex succeeds against the virtual device. Record the
delta list (what MS requires beyond libfreenect). If binding fails, record the exact driver error /
USB request that failed - that is the todo-12 work item.
5. CRUX - synthetic-depth skeletonization on the real MS NUI runtime (hardware-free KILL-GATE)
This is the Windows half of the depth-fidelity kill-gate (nui-contracts risk D / plan "KILL-GATE"). It proves - with no physical Kinect - that the real MS NUI runtime can skeletonize our synthetic depth. If it fails, the device-level approach is invalid and the project must re-plan the depth model.
5a. Build a canned synthetic articulated-depth sequence
- Generate (offline, on any machine) a short looped sequence of synthetic depth frames in the
Kinect v1 packed format (
((depth_mm & 0x1FFF) << 3) | (playerIndex & 0x7), per nui-contracts §2.2) at the resolution Step 3 found DEA/the SDK requests (settle from Step 3; default 640x480 or 320x240 per nui-contracts §5 open item 1). The sequence must depict a moving articulated human silhouette - e.g. a figure raising and lowering both arms over ~2-3 seconds, looping - with:- a single filled, human-shaped, temporally-stable blob (largest connected component),
- body depth in ~800-4000mm, background = 0, player-index = 1 on the body (nui-contracts §2.4),
- enough articulation (arm/leg motion) that a working skeletonizer would output moving joints.
- Build it from nui-contracts §1/§2 rasterization (silhouette from a canned MediaPipe pose sequence, or a hand-authored rig) so it is representative of what the real pipeline will emit. Keep it deterministic and replayable (the record/replay harness, tools/record-replay).
5b. Replay it into the real MS NUI runtime via the virtual device
- Extend the Step 4 minimal virtual device so its camera/depth endpoint serves the canned synthetic depth sequence on the Kinect v1 iso/bulk framing (reuse the todo-3 stream framing), looping at ~30Hz. (Serve a static or black color frame if the SDK requires the color stream to be open.) No webcam, no MediaPipe live - a pure canned replay.
- Attach the device (Step 4). The MS NUI runtime now receives synthetic depth as if from a real sensor.
5c. Capture skeleton output from a Kinect SDK sample
- Run SkeletonBasics-D2D (or KinectExplorer-D2D) against the virtual device with skeleton
tracking enabled. These samples call the real
NuiSkeleton*pipeline - the MS runtime's internal skeletonizer - on the incoming depth. - Capture the skeleton output: record the rendered skeleton overlay (video capture of the
sample window) AND, better, log the
NUI_SKELETON_FRAMEjoint positions per frame from a small instrumented consumer (or the shim'sNuiSkeletonGetNextFramelog from Step 3) to a file.
5d. The exact pass/fail
- PASS if the real MS NUI runtime produces a TRACKED skeleton whose joints MOVE in correspondence with the synthetic sequence's articulation (e.g. the wrists/elbows rise and fall as the canned figure raises its arms), captured as joint-position logs and/or recorded overlay. This proves synthetic depth is skeletonizable and unblocks waves 4-11.
- FAIL if the runtime reports NO tracked skeleton, or an all-
NOT_TRACKED/frozen skeleton, or joints that do not follow the synthetic motion. In this case HALT and re-plan the depth model (the flat/billboard synthesis is insufficient for the MS skeletonizer - escalate to a monocular-depth network producing a denser, more sensor-like depth map) before building the mapping/synth/emitter waves. Do not claim the crux passed without captured moving-joint skeleton output. - If a real Kinect is available, additionally A/B real-sensor depth vs. the synthetic replay through the same sample to gauge how close the synthetic depth must be (scorer/skeletonizer z-sensitivity). Record the delta; it informs depthGain / depth-tier choices (nui-contracts §1.5, §2.3).
This is the gate. Nothing downstream on the device path is proven until this captures moving joints from synthetic depth on the real runtime.
6. Go/no-go per OS (fill after Steps 2-5 run on Windows)
| Decision | Determined by | Result (fill on Windows) |
|---|---|---|
| Shipping Windows arch (x86/x64) | Step 2 machine |
unset - run dumpbin |
| Device-level path viable (todo 12) | Step 4 binding + Step 5 crux | unset |
| NUI-shim fallback is PRIMARY or SECONDARY (todo 14) | Step 3 import surface + Step 5 crux | unset |
| Depth model OK, or HALT + re-plan | Step 5 crux PASS/FAIL | unset - CRUX UNPROVEN |
- Device path requires both Step 4 (binds) and Step 5 (crux passes). If Step 5 fails, the device path cannot prove IS-2 regardless of Step 4; HALT.
- The NUI-shim fallback (todo 14) is unconditionally in scope; this spike only sets whether it is the PRIMARY Windows path (if the device path is not viable) or the secondary surface. The shim proves playability (IS-3/IS-4) only - never IS-1/IS-2.
Results ledger (to be filled on the Windows box - empty here by design)
All cells below are UNSET; this environment cannot produce them.
- Step 2 bitness:
machine= _____ (x86 expected);magic= _____. - Step 2
Kinect10.dllimports: _____ (paste full list; archivegamekdm_imports.txt). - Step 2 linkage: static import / dynamic
LoadLibrary/ COM-CLSID = _____. - Step 3
DllMainattach: logged? _____ (shim is the loaded module Y/N; if N, resolution path). - Step 3
NuiInitializeflags: 0x_____ = _____. - Step 3 streams opened: type/resolution/flags per
NuiImageStreamOpen= _____. - Step 3 skeleton model: event / poll = _____;
NuiSkeletonCalculateBoneOrientationscalled? ___. - Step 4 binding: Device Manager bound to
kinectsensor.inf? _____;NuiGetSensorCount= ___. - Step 4 MS-vs-libfreenect delta: firmware upload / control transfers / power = _____.
- Step 5 CRUX: moving skeleton from synthetic depth? PASS / FAIL = _____ (attach capture).
- Signing posture used (Step 4): testsigning / Secure Boot = _____.
Evidence goes to .omo/evidence/task-4-webcam-kinect-emulator.* (dumpbin outputs, kinect10_shim.log,
USBPcap capture, Step 5 skeleton log + overlay recording).