Input: PadRIO -- play without the pod (L4CONTROLS=PAD), Workstream A.1

Ported from RP412: RIOBase split out of the serial RIO (L4RIO.h),
rioPointer is RIOBase* (L4CTRL.h), PAD token -> new PadRIO() speaking
the RIO surface from an XInput pad + keyboard (L4PADRIO/L4PADBINDINGS,
vRIO bindings.txt grammar, hot-plug), KeyLight RGB mirror TU
(BT412KEYLIGHT, /std:c++17 per-file).

BT-side fixes PadRIO forced into the open:
- Both keyboard input bridges (mech4.cpp, mechmppr.cpp BT_KEY_BRIDGE)
  stand down when a RIO device exists -- they overwrote the engine
  controls push every frame. M/X conveniences stay live.
- Mapper attribute chain OFF BY ONE (latent real-pod bug): the DOS
  chain below MechControlsMapper carried two base attributes, WinTesla
  carries one, and AttributeIndexSet::Find is positional -- the .CTL
  stick mapping wrote throttlePosition. Pad slot + binary-locked enum;
  gotcha ledgered (reconstruction-gotchas #11).

Verified: PAD throttle lever ramps + sticks, stick turns with the
authentic speed-vs-turn clamp (61.5 -> 22.0 u/s), mech drives; keyboard
fallback intact (BT_FORCE_THROTTLE harness). New diags: BT_CTRLMAP_LOG,
BT_STICK_LOG. (Phase 2 of docs/BT412-ROADMAP.md)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-14 08:16:33 -05:00
co-authored by Claude Fable 5
parent 55e4295dc3
commit fe97746a51
17 changed files with 2050 additions and 60 deletions
+38
View File
@@ -1,6 +1,8 @@
#include "mungal4.h"
#pragma hdrstop
#include "l4padrio.h"
#include "l4ctrl.h"
#include "l4keybd.h"
#include "l4app.h"
@@ -830,6 +832,19 @@ LBE4ControlsManager::LBE4ControlsManager():
joystickPointer = NULL;
}
}
else if (strcmpi(temp, "PAD") == 0)
{
//------------------------------------------------------
// Cockpit-less play: PadRIO speaks the RIO control
// surface from an XInput pad + the PC keyboard, so the
// full RIO mapper/lamp/button path runs unchanged.
//------------------------------------------------------
rioPointer = new PadRIO();
Check(rioPointer);
Register_Object(rioPointer);
flags.RIOExists = 1;
primaryControlType = LBE4ControlsManager::PrimaryRIO;
}
}
while (temp[0] != '\0');
}
@@ -1469,6 +1484,16 @@ void
stick.x = rioPointer->JoystickX;
stick.y = rioPointer->JoystickY;
{
// BT412 diagnostic (BT_STICK_LOG=1): trace the RIO stick push.
static const int s_stickLog = (getenv("BT_STICK_LOG") != 0);
if (s_stickLog && (stick.x != (Scalar)0 || stick.y != (Scalar)0))
{
DEBUG_STREAM << "[stick-push] x=" << (float)stick.x
<< " y=" << (float)stick.y << "\n" << std::flush;
}
}
Check(&joystickGroup[LBE4ControlsManager::JoystickPhysical]);
joystickGroup[LBE4ControlsManager::JoystickPhysical].Update(
&stick, mode_mask
@@ -2124,6 +2149,19 @@ void
if (mapping->mappingType == ControlsMapping::DirectMapping)
{
attribute = subsystem->GetAttributePointer(mapping->attributeID);
{
// BT412 diagnostic (BT_CTRLMAP_LOG=1): dump each streamed
// mapping as it installs -- group/element/attribute/mask.
static const int s_mapLog = (getenv("BT_CTRLMAP_LOG") != 0);
if (s_mapLog)
{
DEBUG_STREAM << "[ctrlmap] direct grp=" << (int)mapping->controlsGroup
<< " elem=" << element
<< " attrID=" << (int)mapping->attributeID
<< " mask=" << (unsigned)mode_mask
<< " ptr=" << attribute << "\n" << std::flush;
}
}
switch (mapping->controlsGroup)
{
case ScalarGroup: