Reverse thrust was dead on the desktop (user report): wire the 0x3F throttle-handle button

LALT -> button 0x3F was bound in both binding layers and PadRIO pushed the RIO
ButtonPressed event correctly, but nothing ever set the mapper's ReverseThrust:

 - the authentic route is BTL4.RES 'L4' streamed record [2] (Button Throttle1
   0x3F -> attr 6 ReverseThrust@0x124), but our streamed BUTTON mappings are
   not consumed at all -- MechControlsMapper::AddOrErase is still the
   unreconstructed Fail stub, so the event never reaches the attribute;
 - the ONLY writer of reverseThrust was the keyboard bridge's
   'key_throttle < 0' test, which is bypassed whenever a RIO is operational
   (the pad RIO always is, so the bridge is OFF on the desktop) AND is
   unreachable regardless, because L4PADRIO clamps the Throttle channel to
   [0,1].  Net: Alt did nothing and the flag was re-zeroed every frame.

FIX: publish the 0x3F hold state from PadRIO::EmitButton -- the one chokepoint
every desktop source funnels through (keyboard, gamepad, DirectInput joystick,
glass-panel clicks via SetScreenButton) -- and apply it in InterpretControls
gated on BTPadRIOActive() so real pod hardware is untouched (there the streamed
mapping owns the flag).  Marked [T3]; delete once streamed button mappings land.
Reverse is a HOLD (manual: hold the red throttle button, release = forward).

Verified with scratchpad/revtest.py (keybd_event injection, BT_KEY_NOFOCUS):
forward = rev=0 dmd +61.501; LALT held = rev=1 dmd -61.501; release edge logged.

KB: pod-hardware.md now records the streamed-button-mapping gap + this seam.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0166KTsC7ADm7VXEi1HF1jNg
This commit is contained in:
arcattack
2026-07-24 19:19:21 -05:00
co-authored by Claude Opus 5
parent 6c3fca2f67
commit 23229e573e
5 changed files with 198 additions and 1 deletions
+36
View File
@@ -28,6 +28,14 @@ PadRIO *PadRIO::activeInstance = NULL;
//
int gBTPadViewToggleEdges = 0;
//
// REVERSE THRUST hold state (the pod's throttle-handle button, unit 0x3F --
// bound to LALT on the keyboard). Set in EmitButton, the single chokepoint all
// input sources share; consumed by MechControlsMapper::InterpretControls's
// desktop bridge, which owns `reverseThrust` (mapper attr 6 @0x124) every frame.
//
int gBTReverseHeld = 0;
//
// The desktop per-MFD preset-page cycle edges (J/K/L -> Mfd1/2/3), consumed
// by L4MechControlsMapper::InterpretControls (btl4mppr.cpp step 3b -- the
@@ -332,6 +340,24 @@ void
void
PadRIO::EmitButton(int address, int pressed)
{
//
// REVERSE THRUST (the red button on the pod's throttle HANDLE, unit 0x3F).
// BTL4.RES's "L4" streamed record [2] maps `Button Throttle1 (0x3F)` to the
// mapper's attr 6 `ReverseThrust@0x124`, and the 1995 manual is explicit that
// you HOLD it (release = forward) -- see context/pod-hardware.md. Publish the
// hold state here, at the ONE chokepoint every source funnels through
// (keyboard bindings, gamepad, DirectInput joystick, and glass-panel clicks
// via SetScreenButton), so the desktop bridge can honour the button exactly
// like the pod's RIO board did.
//
if (address == 0x3F)
{
gBTReverseHeld = pressed ? 1 : 0;
if (getenv("BT_PAD_LOG"))
DEBUG_STREAM << "[padwrite] reverse button 0x3F "
<< (pressed ? "HELD" : "released") << "\n" << std::flush;
}
RIOEvent event;
event.Type = pressed ? ButtonPressedEvent : ButtonReleasedEvent;
event.Data.Unit = address;
@@ -1053,6 +1079,16 @@ void
activeInstance->EmitButton(unit, pressed);
}
//
// Is the desktop PAD RIO the live input device? (On real pod hardware the RIO
// is the serial Ranger board and this is 0, so pod behaviour is never altered by
// the desktop-only seams that consult it.)
//
int BTPadRIOActive(void)
{
return PadRIO::HasActiveInstance();
}
int
PadRIO::GetLampState(int unit)
{
+8
View File
@@ -158,4 +158,12 @@ protected:
static PadRIO
*activeInstance;
public:
//
// Is the desktop pad RIO the live input device? (0 on real pod hardware,
// whose RIO is the serial Ranger board -- see BTPadRIOActive.)
//
static int
HasActiveInstance() { return activeInstance != 0; }
};