From 0dfeedb2a041baec34f5dc74993cadd0a114f2bd Mon Sep 17 00:00:00 2001 From: kinect-bot Date: Wed, 25 Nov 2026 23:50:07 -0500 Subject: [PATCH] tracker-native: restrict capture to 4:3 resolutions; 4:3 preview window (Kinect is native 4:3) --- tracker-native/src/win_main.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tracker-native/src/win_main.cpp b/tracker-native/src/win_main.cpp index 3b92975..298ca2c 100644 --- a/tracker-native/src/win_main.cpp +++ b/tracker-native/src/win_main.cpp @@ -217,7 +217,19 @@ void PopulateResolutions() { SendMessage(g_app.res_combo, CB_RESETCONTENT, 0, 0); const int sel = static_cast(SendMessage(g_app.device_combo, CB_GETCURSEL, 0, 0)); if (sel < 0 || sel >= static_cast(g_app.devices.size())) return; - g_app.resolutions = enumerate_resolutions(g_app.devices[sel].symbolic_link); + // Only expose 4:3 resolutions: the emulated Kinect is natively 4:3, so a 16:9 + // source would have to be stretched or letterboxed into the 4:3 depth/color + // frame, which misaligns the silhouette and skeleton in the game. + const auto all = enumerate_resolutions(g_app.devices[sel].symbolic_link); + g_app.resolutions.clear(); + for (const auto& r : all) { + if (r.height > 0 && r.width * 3 == r.height * 4) { + g_app.resolutions.push_back(r); + } + } + if (g_app.resolutions.empty()) { + g_app.resolutions = all; // camera offers no 4:3 mode; show all rather than nothing + } for (const auto& r : g_app.resolutions) { wchar_t buf[64]; wsprintfW(buf, L"%d x %d", r.width, r.height); @@ -411,8 +423,15 @@ int WINAPI wWinMain(HINSTANCE inst, HINSTANCE, PWSTR, int show) { wc.hbrBackground = reinterpret_cast(COLOR_WINDOW + 1); RegisterClassW(&wc); + // Size the client so the preview area (below the 44px control strip) is a + // 4:3 box: with 4:3-only capture the image fills it edge to edge, no bars. + const int kStripH = 44; + const int kPreviewW = 820; + RECT wr{0, 0, kPreviewW, kStripH + kPreviewW * 3 / 4}; + AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); g_app.main = CreateWindowW(L"KinectTrackerWnd", L"Kinect Tracker (native)", - WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 860, 560, + WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, + wr.right - wr.left, wr.bottom - wr.top, nullptr, nullptr, inst, nullptr); ShowWindow(g_app.main, show); UpdateWindow(g_app.main);