diff --git a/fallback/windows-nui/src/sensor.cpp b/fallback/windows-nui/src/sensor.cpp index 9ed8a4d..0a2369f 100644 --- a/fallback/windows-nui/src/sensor.cpp +++ b/fallback/windows-nui/src/sensor.cpp @@ -476,7 +476,19 @@ HRESULT VirtualKinectSensor::ImageStreamGetNextFrame( if (is_new) { stream->last_delivered_frame_number = frame_no; stream->outstanding = true; - *ppcImageFrame = &stream->frames[stream->latest_index]; + // DEA's HidNatalNuiThread uses a by-VALUE NUI_IMAGE_FRAME ABI, not the + // standard "runtime returns a pointer" one. Verified from gamekdm.dll + // disasm: NuiThread::updateStream (FUN_1000f400) passes the address of a + // 40-byte (sizeof NUI_IMAGE_FRAME) buffer at this+0xad8 as ppcImageFrame + // and stores that same address as its outstanding-frame marker; + // NuiThread::updateFrame (FUN_1000f0a0) then copies 0x28 bytes straight + // from that buffer (single deref) into the display slot and the renderer + // reads pFrameTexture/dwFrameNumber from it. Writing only a 4-byte pointer + // here left dwFrameNumber/pFrameTexture zero, so the game never locked a + // texture (no picture). Copy the frame struct into the caller's buffer. + std::memcpy(reinterpret_cast(ppcImageFrame), + &stream->frames[stream->latest_index], + sizeof(NUI_IMAGE_FRAME)); } LeaveCriticalSection(&lock_);