From 5b8c814029798df31b7a7356593af65263252001 Mon Sep 17 00:00:00 2001 From: Cyd Date: Thu, 16 Jul 2026 20:59:08 -0500 Subject: [PATCH] Cockpit: activate the RIO controls -- L4CONTROLS=PAD before the DEV default The single-window cockpit's on-screen RIO button banks + analog controls run on the PadRIO virtual-RIO surface, but L4MFDSPLIT set L4CONTROLS=PAD only AFTER the platform-profile block had already defaulted it to KEYBOARD -- so the guard saw it set and PAD never engaged. The log proved it: 'DEV (single window + keyboard)' + 'Mech has no controls mapping -- bring-up RIO fallback', no PadRIO, dark/inert buttons. Move the cockpit's PAD control default BEFORE the platform block so it wins over the DEV keyboard default (an explicit L4CONTROLS=RIO still overrides for a real serial board). Verified: cockpit now logs 'PadRIO: virtual RIO active', installs the 'L4' RIO mapping table via the PrimaryRIO path, and the mech drives -- throttle ramps 0.09->1.0 (speedDemand 5->61.5 u/s), stick turns (turnDemand=1 with the speed-vs-turn clamp). The on-screen buttons inject into the same live PadRIO surface. Co-Authored-By: Claude Fable 5 --- game/btl4main.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/game/btl4main.cpp b/game/btl4main.cpp index 521c468..dd83e4a 100644 --- a/game/btl4main.cpp +++ b/game/btl4main.cpp @@ -256,6 +256,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // `-platform pod` ATTEMPTS the path (FindBestAdapterIndices degrades to the // primary adapter) -- selectable for bring-up, not fully validated off-pod. // --------------------------------------------------------------------------- + // SINGLE-WINDOW COCKPIT (L4MFDSPLIT): the desktop cockpit's on-screen RIO + // button banks + analog controls run on the PadRIO virtual-RIO surface, so + // PAD is the cockpit's control DEFAULT -- established HERE, before the + // platform-profile block, so the DEV keyboard default (below) does not win + // (that left the RIO controls inert). An explicit L4CONTROLS still + // overrides (e.g. L4CONTROLS=RIO for a real serial board). + if (getenv("L4MFDSPLIT") != NULL && getenv("L4CONTROLS") == NULL) + putenv("L4CONTROLS=PAD"); + int gBTPlatformPod = 0; { const char *pe = getenv("BT_PLATFORM"); @@ -319,13 +328,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // 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"); - } + // window itself is sized to the 1920x1080 cockpit canvas below. (The PAD + // control default is set earlier, before the platform-profile block.) + if (getenv("L4MFDSPLIT") != NULL && getenv("L4GAUGE") == NULL) + putenv("L4GAUGE=640x480x16"); std::cout << "[boot] platform profile: " << (gBTPlatformPod ? "POD (RIO cockpit input; multi-surface gauges/MFDs via pod hardware or explicit L4GAUGE)"