diff --git a/engine/MUNGA_L4/L4VIDEO.cpp b/engine/MUNGA_L4/L4VIDEO.cpp index 58a3083..43ddfb9 100644 --- a/engine/MUNGA_L4/L4VIDEO.cpp +++ b/engine/MUNGA_L4/L4VIDEO.cpp @@ -3490,8 +3490,30 @@ DPLRenderer::DPLRenderer( // while the cockpit-surround window is sized independently -- pinning to them // would shrink the backbuffer and break the composite.) // + // + // COCKPIT SURROUND: the backbuffer IS THE CANVAS, whatever the window + // happens to be (2026-07-26). Everything downstream assumes it -- + // BTApplyWorldViewport and BTDrawCockpitPanels lay out from the + // BACKBUFFER size, while the letterbox and the mouse hit-test map + // through gBTCockpitCanvasW/H. Pinning to the client instead is fine + // only while client == canvas, which is true for a normal boot and + // FALSE for -fit: the window is the whole monitor before the device + // exists, so the backbuffer came out 3440x1440 against a 1452x1059 + // canvas. Field report: tiny MFDs hugging the corners, an over-wide + // world view, the scene squashed horizontally as Present scaled the + // oversized backbuffer into the letterbox -- and, unseen, every button + // hit-tested in a different space from the one it was drawn in (the + // exact #50 divergence the note above warns about). + // + extern int gBTGaugeCockpit; + extern int gBTCockpitCanvasW, gBTCockpitCanvasH; RECT rc; - if (hWnd != NULL && GetClientRect(hWnd, &rc) + if (gBTGaugeCockpit && gBTCockpitCanvasW > 0 && gBTCockpitCanvasH > 0) + { + mPresentParams.BackBufferWidth = (UINT)gBTCockpitCanvasW; + mPresentParams.BackBufferHeight = (UINT)gBTCockpitCanvasH; + } + else if (hWnd != NULL && GetClientRect(hWnd, &rc) && rc.right > rc.left && rc.bottom > rc.top) { mPresentParams.BackBufferWidth = (UINT)(rc.right - rc.left);