Input remap: CONTROLS.MAP binding engine + XInput gamepad support

The pod's controls reach the game through the RIO serial board; on a
desktop that hardware is a keyboard shim of hardcoded GetAsyncKeyState
reads.  New binding engine (game/reconstructed/btinput.cpp) maps PC keys
and an XInput pad onto the authentic channels through a user-editable
file (content/CONTROLS.MAP, community-suggested grammar, corrected):

  key/pad -> button <addr>   real buttonGroup emissions, mirroring the
                             RIO convention exactly (press a+1 w/ mode
                             mask saved, release -a-1 w/ saved mask;
                             L4CTRL.cpp:2470-2520) -- aux/preset banks,
                             hotbox, panic, reverse thrust all reachable
  key/pad -> axis            Throttle rate (lever), pedals/JoystickX
                             deflect (turn/twist) into the existing
                             virtual-controls integrators (feel, gait
                             detent, spring-centering all unchanged)
  keypad pilot|external <n>  keyboardGroup key values ('0'-'F')
  pckey <char>               any authentic 1995 typed hotkey
  action <name>              port dev controls (view, all-stop, ...)

Keys claimed by a binding are SUPPRESSED from the legacy WM_CHAR/KEYUP
feed -- ends the historic double-dispatch ('w' drove AND selected pilot
0; F5's key-up value 0x74 aliased to the 't' hotkey; letter key-ups fed
the developer fake-event dispatcher).  Unbound keys keep their authentic
meaning.  The dual-use 'V' is split: V = view toggle, B = look behind.

Default profile = WASD classic (compiled-in twin; delete the file to
restore).  CONTROLS_NUMPAD.MAP ships the corrected community layout
(keypads are NOT buttons 0x50-0x6F -- that space doesn't exist; no
clickable cockpit exists so everything needs a binding; keyboard fire
buttons added; 0x36/0x37 are hotbox not 'config'; missiles moved off
Ctrl).  XInput loads dynamically (1_4 -> 9_1_0), disconnected-pad
probing rate-limited; pad sticks write the axes as absolute positions
(the spring is physical), triggers/buttons per the file.

Verified live: bindings load (43), W and NumPad8 drive (speedDemand 0 ->
61.5), X all-stop (spd -> 0), aux-bank emission (D1 -> [input] 0x2f
PRESS/release under the numpad profile), suppression both directions
(posted 'r' reaches [keych], posted 'w' swallowed), full-keyspace
WM_CHAR+WM_KEYUP fuzz x3 survived with sim advancing, XInput graceful
with no pad, 2-node relay session un-regressed (full ladder + UDP).
Pad-in-hand testing still needs a physical controller.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-18 13:09:36 -05:00
co-authored by Claude Fable 5
parent 0fcd0c3106
commit 980c9cd7e5
10 changed files with 1360 additions and 84 deletions
+14
View File
@@ -8,6 +8,15 @@
#include "..\munga\appmgr.h"
#include "dxutils.h"
//
// BT port (input remap): keys claimed by a CONTROLS.MAP binding are consumed
// by the binding engine (game/reconstructed/btinput.cpp) and must NOT also
// reach the key-command channel -- that was the historic double-dispatch
// ('w' drove AND selected pilot 0; F5's key-up value 0x74 aliased to the
// 't' hotkey). The symbol resolves from the game lib at the btl4 exe link.
//
extern "C" int BTInputSuppressKey(unsigned int key_value, int is_char);
// #define LOCAL_TEST
#if defined(LOCAL_TEST)
@@ -1527,6 +1536,11 @@ void
{
// swallowed: navigation key, not a character command
}
else if (BTInputSuppressKey((unsigned int)keyValue,
msg.message == WM_CHAR))
{
// swallowed: remapped by CONTROLS.MAP
}
else
{
keyboardGroup[KeyboardPC].ForceUpdate(&keyValue, mode_mask);