Cockpit: 1920x1080 single-window MFD arrangement (L4MFDSPLIT=1, RP412 layout)

The RP412 single-window cockpit, adapted to reuse BT's working D3D
surface compositor (DrawDevSurface) instead of RP's GDI child-window
panes -- same visual outcome, far lower risk (no L4VIDEO present-routing
rewrite):

- L4VB16.cpp: kBTCockpitSurfaces places the six instrument surfaces at
  RP412's exact 1920x1080 fractional positions (Heat=UL, Mfd2=UC,
  Comm=UR, Mfd1=LL, Mfd3=LR, radar=center-bottom portrait);
  BTDrawGaugeSurfaces parameterized by surface table; BTDrawCockpitPanel
  composites them over the full-window 3D as the pod bezels frame the
  viewscreen. Hooked in L4VIDEO before EndScene (L4MFDSPLIT-gated).
- btl4main.cpp: L4MFDSPLIT sizes the window to the 1920x1080 canvas
  (scaled to fit the work area; -res overrides) and wakes the gauge
  renderer (L4GAUGE) + PAD controls.

Fixed two more pre-existing latent gauge crashes that only fire when the
gauge renderer is woken off-pod (would hit the real pod too), previously
gated only on BT_DEV_GAUGES -- extended the safety nets to L4MFDSPLIT:
  * gauge.h: NULL gauge-attribute-source binds a static zero instead of
    AV'ing in GaugeConnectionDirectOf ctor (crashed building HeatSink
    cluster's VertTwoPartBar at ConfigureForModel).
  * GAUGE.cpp: SEH-guarded gauge Execute (disable a faulting gauge, not
    crash). GAUGREND.cpp: skip unresolved primitives + activate all MFD
    pages so every surface renders.

Verified: L4MFDSPLIT boots the cockpit; all six surfaces render framing
the 3D viewscreen; survives coolant-loop + gauge activation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-16 20:39:41 -05:00
co-authored by Claude Fable 5
parent 2bb9b602bb
commit 0c964c0ee7
5 changed files with 105 additions and 5 deletions
+36
View File
@@ -293,6 +293,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
if (getenv("BT_DEV_GAUGES") != NULL && getenv("L4GAUGE") == NULL)
putenv("L4GAUGE=640x480x16");
// SINGLE-WINDOW COCKPIT (L4MFDSPLIT=1, RP412's flag): the 3D viewscreen fills
// the window and the six instrument surfaces frame it (BTDrawCockpitPanel).
// Like the dev-gauge path it needs the gauge renderer awake (L4GAUGE); the
// window itself is sized to the 1920x1080 cockpit canvas below. PAD controls
// come along for the ride (a desktop cockpit has no serial RIO).
if (getenv("L4MFDSPLIT") != NULL)
{
if (getenv("L4GAUGE") == NULL) putenv("L4GAUGE=640x480x16");
if (getenv("L4CONTROLS") == NULL) putenv("L4CONTROLS=PAD");
}
std::cout << "[boot] platform profile: "
<< (gBTPlatformPod ? "POD (RIO cockpit input; multi-surface gauges/MFDs via pod hardware or explicit L4GAUGE)"
: "DEV (single window + keyboard)")
@@ -413,6 +424,31 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
}
}
// SINGLE-WINDOW COCKPIT (L4MFDSPLIT=1): default the window to the 1920x1080
// cockpit canvas (RP412), scaled DOWN uniformly to fit the monitor work area
// so the whole cockpit is visible. -res still overrides (use `-res 1920 1080`
// for native 1:1 pixels on a large display). The 3D backbuffer follows the
// window client size via the engine's own resize path.
if (getenv("L4MFDSPLIT") != NULL && (lpCmdLine == 0 || strstr(lpCmdLine, "-res") == 0))
{
int canvas_w = 1920, canvas_h = 1080;
RECT work = { 0, 0, canvas_w, canvas_h };
SystemParametersInfo(SPI_GETWORKAREA, 0, &work, 0);
int avail_w = work.right - work.left - 16; // leave room for chrome
int avail_h = work.bottom - work.top - 48;
int scale = 100;
if (avail_w < canvas_w || avail_h < canvas_h)
{
int fw = (avail_w * 100) / canvas_w;
int fh = (avail_h * 100) / canvas_h;
scale = (fw < fh) ? fw : fh;
if (scale < 25) scale = 25;
}
winW = (canvas_w * scale) / 100;
winH = (canvas_h * scale) / 100;
std::cout << "[cockpit] L4MFDSPLIT: 1920x1080 canvas at " << scale
<< "% -> window " << winW << "x" << winH << std::endl << std::flush;
}
// DOCK-BOTTOM (single-window gauges, 2026-07-12): under BT_DEV_GAUGES the
// gauge strip is APPENDED below the world view in THIS window (strip height
// = width x 480/1320, the panel's design aspect); BT_DEV_GAUGES_WINDOW=1