Splits the control surface the game consumes from the RIO board into RIOBase (8 virtuals + the five analog scalars); the serial RIO is now one implementation of it. Adds two new ones: - PadRIO (L4CONTROLS=PAD): in-process RIO speaking the full surface from an XInput controller + PC keyboard using vRIO's default profile (left stick/WASD = stick, triggers/Q,E = pedals, right stick Y/PgUp,PgDn = rate throttle that holds position, A/Space = trigger, B/R = reverse, dpad/arrows = hat, Start,Back/F1,F2 = config). Samples in GetNextEvent so button latency does not depend on the 15 s menu-time analog cadence; hot-plugs pads; L4PADFLIP=XY inverts stick axes; lamp commands land in lampState[] for the planned on-screen cockpit panel. The stock VTVRIOMapper/lamp/button path runs unchanged. - PlasmaScreen (L4PLASMA=SCREEN): the 128x32 plasma glass as a desktop window in plasma orange (L4PLASMASCALE, default x4), rendering the same Video8BitBuffered surface the gauge system always drew; no COM port. Verified in the sandbox with vRIO off and no serial devices: boots to a running mission, controller hot-detected, plasma window drawing live game content (score readout). BUILD.md 4 documents the desktop environ.ini and bindings; roadmap updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
94 lines
2.2 KiB
C++
94 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include "l4rio.h"
|
|
|
|
//########################################################################
|
|
//############################### PadRIO #################################
|
|
//########################################################################
|
|
//
|
|
// A cockpit-less RIO: synthesizes the RIOBase control surface from an
|
|
// XInput controller and the PC keyboard, following vRIO's default
|
|
// binding profile. Selected with L4CONTROLS=PAD.
|
|
//
|
|
// Left stick -> joystick X/Y [-1..1]
|
|
// Left/right trigger-> left/right pedal [0..1]
|
|
// Right stick Y -> throttle rate (position holds) [0..1]
|
|
// A / B -> joystick trigger / reverse thrust
|
|
// X / Y / LB / RB -> pinky / thumb-low / thumb-low / thumb-high
|
|
// DPad -> joystick hat
|
|
// Back / Start -> config buttons (AuxUpperRight2 / 1)
|
|
//
|
|
// Keyboard: WASD = stick deflect (spring-back), PgUp/PgDn = throttle,
|
|
// Q/E = pedals, Space = trigger, R = reverse, arrows = hat, F1/F2 =
|
|
// config buttons.
|
|
//
|
|
// Set L4PADFLIP to a string containing 'X' and/or 'Y' to invert the
|
|
// stick axes.
|
|
//
|
|
class PadRIO :
|
|
public RIOBase
|
|
{
|
|
public:
|
|
PadRIO();
|
|
~PadRIO();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
Logical
|
|
GetNextEvent(RIOEvent *destinationPointer);
|
|
|
|
void
|
|
RequestAnalogUpdate();
|
|
|
|
void
|
|
GeneralReset();
|
|
void
|
|
ResetThrottle();
|
|
|
|
void
|
|
SetLamp(int lampNumber, int state);
|
|
|
|
// Lamp state the game has commanded, indexed by RIO lamp number.
|
|
// A future on-screen panel reads this to light its buttons.
|
|
enum { lampCount = 64 };
|
|
unsigned char
|
|
lampState[lampCount];
|
|
|
|
protected:
|
|
void
|
|
PollInputs();
|
|
void
|
|
QueueEvent(const RIOEvent &an_event);
|
|
|
|
enum { queueSize = 64 };
|
|
enum { buttonUnits = 0x48 }; // through LastMappableButton
|
|
|
|
RIOEvent
|
|
eventQueue[queueSize];
|
|
int
|
|
queueHead, queueTail;
|
|
|
|
unsigned long
|
|
lastPollTick,
|
|
lastPadCheckTick;
|
|
int
|
|
padIndex; // connected XInput slot, -1 = none
|
|
Logical
|
|
padReported; // one-time connect/disconnect log flags
|
|
Logical
|
|
analogRequested;
|
|
|
|
unsigned char
|
|
buttonDown[buttonUnits];
|
|
|
|
Scalar
|
|
throttleAccum;
|
|
Logical
|
|
invertX, invertY;
|
|
|
|
Scalar
|
|
sentThrottle, sentLeftPedal, sentRightPedal,
|
|
sentJoystickX, sentJoystickY;
|
|
};
|