Files
RP412/MUNGA_L4/L4PADBINDINGS.h
T
CydandClaude Fable 5 b0def79de2 Rebindable input: vRIO bindings profile ported, full board coverage
PadRIO now loads bindings.txt (vRIO profile grammar: key/pad/padaxis
lines with toggle, deflect/rate, invert/deadzone options) written
self-documenting with the full default layout on first run. The
default is vRIO board-complete map - number and letter rows are the
MFD banks as printed on the panel, F-keys the secondary/screen
columns, numpad the pilot keypad (0x50-0x5F delivered as arcade RIO
KeyEvents, a new PadRIO capability), Space/arrows the joystick
column - with the desktop driving keys carved out: WASD stick, Q/E
pedals, PgUp/PgDn throttle, B reverse (vRIO gap key; R returns to
its bank). Pad bindings unchanged in spirit, plus Panic on LB and
config on Start/Back; axis signs are encoded in the profile now, so
L4PADFLIP flips on top of it.

Default profile parses with zero rejected lines (68 key buttons, 8
key axes, 12 pad buttons, 5 pad axes); single-player cycle and the
key-bomb tests stay green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 10:18:36 -05:00

117 lines
3.1 KiB
C

//===========================================================================//
// File: l4padbindings.h //
// Project: MUNGA Brick: PadRIO binding profiles //
// Contents: The rebindable input profile (vRIO bindings format) //
//---------------------------------------------------------------------------//
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
// PROPRIETARY AND CONFIDENTIAL //
//===========================================================================//
#pragma once
#include "..\munga\style.h"
//########################################################################
// The bindings file (vRIO's format, shared grammar):
//
// key <name> button <addr> [toggle]
// key <name> axis <axis> deflect <n> | rate <n>
// pad <button> button <addr> [toggle]
// padaxis <src> axis <axis> [invert] [deadzone <d>] [rate <n>]
//
// <addr> is a RIO input address: lamp buttons 0x00-0x47, internal
// keypad 0x50-0x5F, external keypad 0x60-0x6F. Loaded from
// bindings.txt beside the exe; written there (self-documenting, with
// the full default profile) on first run. Bad lines are logged and
// skipped, good lines always win.
//########################################################################
enum PadBindRioAxis
{
BindAxisThrottle = 0,
BindAxisLeftPedal,
BindAxisRightPedal,
BindAxisJoystickY,
BindAxisJoystickX,
BindAxisCount
};
enum PadBindKeyMode
{
BindKeyDeflect = 0, // hold at value while down, spring back
BindKeyRate // walk by value/second while down, position holds
};
enum PadBindPadAxis
{
BindPadLeftStickX = 0,
BindPadLeftStickY,
BindPadRightStickX,
BindPadRightStickY,
BindPadLeftTrigger,
BindPadRightTrigger,
BindPadAxisCount
};
struct PadKeyButtonBinding
{
int virtualKey;
int address; // 0x00-0x47 button, 0x50-0x6F keypad
Logical toggle;
// runtime edge/latch state
Logical wasDown;
Logical latched;
};
struct PadKeyAxisBinding
{
int virtualKey;
int axis; // PadBindRioAxis
int mode; // PadBindKeyMode
Scalar value;
};
struct PadPadButtonBinding
{
unsigned short padMask; // XINPUT_GAMEPAD_*
int address;
Logical toggle;
Logical wasDown;
Logical latched;
};
struct PadPadAxisBinding
{
int source; // PadBindPadAxis
int axis; // PadBindRioAxis
Logical invert;
Scalar deadzone; // normalized 0..1
Scalar rate; // 0 = direct position, >0 = speed integrate
};
struct PadBindingProfile
{
enum
{
maxKeyButtons = 128,
maxKeyAxes = 32,
maxPadButtons = 32,
maxPadAxes = 16
};
PadKeyButtonBinding keyButtons[maxKeyButtons];
int keyButtonCount;
PadKeyAxisBinding keyAxes[maxKeyAxes];
int keyAxisCount;
PadPadButtonBinding padButtons[maxPadButtons];
int padButtonCount;
PadPadAxisBinding padAxes[maxPadAxes];
int padAxisCount;
};
// Load bindings.txt from the working directory into the profile,
// writing the default profile file first when absent. Errors go to
// the debug log with line numbers.
void
PadBindings_Load(PadBindingProfile *profile);