diag(windows-nui): introspect game hid::Natal display manager (gamekdm.dll+0x3cf1b4) - display mask, per-stream enable bytes, buffered frame ptrs, NuiThread status
This commit is contained in:
1 parent
ba0061a562
commit
2857c2df3b
3 files changed
+735204
No files matched your search
@@ -19,6 +19,60 @@ VirtualKinectSensor* g_sensor = nullptr;
|
||||
CRITICAL_SECTION g_sensor_lock;
|
||||
INIT_ONCE g_sensor_lock_once = INIT_ONCE_STATIC_INIT;
|
||||
|
||||
// --- Diagnostic: read the game's own display-manager state directly. ---
|
||||
// The shim is loaded in gamekdm.dll's process, so it can inspect the game's
|
||||
// hid::Natal display manager to see why the camera panels never populate.
|
||||
// Decompile facts (image base 0x10000000):
|
||||
// *(gamekdm+0x3cf1b4) = manager (hid::Natal) pointer
|
||||
// manager[0x00] = NuiThread object pointer
|
||||
// manager[0x0c] = committed display-stream mask
|
||||
// manager[0x10] = desired display-stream mask (bit 0x4=depth, 0x2=color)
|
||||
// manager[0x14] = per-stream skip flags
|
||||
// manager[0x16c0]= depth display-enable byte (set when armed -> LockRect runs)
|
||||
// manager[0x1740]= color display-enable byte
|
||||
// NuiThread[0x28] = status (3=no sensor, 7=ready)
|
||||
// NuiThread[0x1598] = buffered depth frame ptr, +0x159c = color frame ptr
|
||||
bool SafeReadU32(uintptr_t addr, uint32_t* out) {
|
||||
if (addr == 0 || IsBadReadPtr(reinterpret_cast<const void*>(addr), 4)) {
|
||||
return false;
|
||||
}
|
||||
*out = *reinterpret_cast<const volatile uint32_t*>(addr);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DumpGameDisplayState() {
|
||||
HMODULE mod = GetModuleHandleA("gamekdm.dll");
|
||||
if (mod == nullptr) {
|
||||
ShimLog("game-introspect: gamekdm.dll not loaded");
|
||||
return;
|
||||
}
|
||||
const uintptr_t base = reinterpret_cast<uintptr_t>(mod);
|
||||
uint32_t mgr = 0;
|
||||
if (!SafeReadU32(base + 0x3cf1b4u, &mgr) || mgr == 0) {
|
||||
ShimLog("game-introspect: mgr ptr null/unreadable (base=0x%08X raw=0x%08X)",
|
||||
static_cast<uint32_t>(base), mgr);
|
||||
return;
|
||||
}
|
||||
uint32_t nui = 0, committed = 0, mask = 0, flags = 0;
|
||||
uint32_t en_depth = 0, en_color = 0, fp0 = 0, fp1 = 0, nui_status = 0;
|
||||
SafeReadU32(mgr + 0x00u, &nui);
|
||||
SafeReadU32(mgr + 0x0cu, &committed);
|
||||
SafeReadU32(mgr + 0x10u, &mask);
|
||||
SafeReadU32(mgr + 0x14u, &flags);
|
||||
SafeReadU32(mgr + 0x16c0u, &en_depth);
|
||||
SafeReadU32(mgr + 0x1740u, &en_color);
|
||||
if (nui != 0) {
|
||||
SafeReadU32(nui + 0x1598u, &fp0);
|
||||
SafeReadU32(nui + 0x159cu, &fp1);
|
||||
SafeReadU32(nui + 0x28u, &nui_status);
|
||||
}
|
||||
ShimLog("game-introspect: mgr=0x%08X nui=0x%08X mask(+10)=0x%X committed(+c)=0x%X "
|
||||
"flags(+14)=0x%X enDepth(+16c0)=0x%02X enColor(+1740)=0x%02X "
|
||||
"fp0(+1598)=0x%08X fp1=0x%08X nuiStatus(+28)=%u",
|
||||
mgr, nui, mask, committed, flags, en_depth & 0xFFu, en_color & 0xFFu,
|
||||
fp0, fp1, nui_status);
|
||||
}
|
||||
|
||||
BOOL CALLBACK InitSensorLock(PINIT_ONCE, PVOID, PVOID*) {
|
||||
InitializeCriticalSection(&g_sensor_lock);
|
||||
return TRUE;
|
||||
@@ -599,6 +653,7 @@ void VirtualKinectSensor::ProducerLoop() {
|
||||
? 1
|
||||
: 0,
|
||||
skeleton_enabled_ ? 1 : 0);
|
||||
DumpGameDisplayState();
|
||||
}
|
||||
if (!got) {
|
||||
src = SourceFrame{};
|
||||
|
||||
Reference in new issue
Block a user