Each MFDSplitView window now carries its display's physical button bank, placed as in the pod (addresses per vRIO CockpitLayout): a 4x2 red cluster around each MFD glass (anchors 0x2F/0x27/0x37 upper, 0x0F/0x07 lower, addresses descending row-major) and 6 amber buttons down each side of the map - Secondary 0x10-0x15 left, Screen 0x18-0x1D right; the remaining column addresses are Tesla relays, per the pod wiring, so they get no buttons. Buttons light from the lamp state the game commands: PadRIO grows a static active-instance hook (SetScreenButton/GetLampState); mouse press/release feeds PadRIO's desired-state sampling alongside pad and keyboard, and paint decodes the lamp byte (state1/state2 brightness, solid/slow/med/fast flash animated by tick). With real serial hardware (no PadRIO) the buttons draw dark and inert. Verified: map flank buttons light per the game's preset lamps, aligned with the labels the glass draws at its edges; MFD clusters render 4+4. Roadmap: queued the vRIO Dynamic Lighting RGB-keyboard lamp mirror as a polish-pass item. dist repacked. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
113 lines
2.6 KiB
C++
113 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include "..\munga\style.h"
|
|
|
|
//########################################################################
|
|
//############################ MFDSplitView ##############################
|
|
//########################################################################
|
|
//
|
|
// One desktop window showing a single cockpit display, used by SVGA16's
|
|
// split mode (L4MFDSPLIT=1). The pod hardware packed the five monochrome
|
|
// MFDs into the color channels of two video outputs and mounted the map
|
|
// display rotated; on a desktop each display gets its own window instead.
|
|
//
|
|
// Each window also carries its display's physical button bank, exactly
|
|
// as mounted in the pod (geometry per vRIO's CockpitLayout):
|
|
// - MFDs: a 4x2 cluster - 4 red buttons above the glass, 4 below,
|
|
// RIO addresses descending from the cluster anchor (top-left = hi).
|
|
// - The map ("secondary screen"): 6 amber buttons down each side -
|
|
// Secondary 0x10-0x15 on the left, Screen 0x18-0x1D on the right
|
|
// (the remaining column addresses are Tesla relays, not buttons).
|
|
// Buttons light from the lamp state the game commands (via PadRIO) and
|
|
// press/release RIO units with the mouse.
|
|
//
|
|
// SVGA16 fills Pixels() (32bpp top-down, sourceWidth x sourceHeight as
|
|
// passed - already swapped by the caller for the rotated map) and calls
|
|
// Repaint(). Closing a view window just hides it.
|
|
//
|
|
class MFDSplitView
|
|
{
|
|
public:
|
|
enum ButtonStyle
|
|
{
|
|
NoButtons = 0,
|
|
MFDStrips, // 4 above + 4 below, addresses descend from anchorA
|
|
SideColumns // 6 per side; anchorA = left base, anchorB = right base
|
|
};
|
|
|
|
MFDSplitView(
|
|
const char *title,
|
|
int source_width,
|
|
int source_height,
|
|
int display_width,
|
|
int display_height,
|
|
int x,
|
|
int y,
|
|
ButtonStyle button_style = NoButtons,
|
|
int anchorA = 0,
|
|
int anchorB = 0
|
|
);
|
|
|
|
~MFDSplitView();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
unsigned long *
|
|
Pixels()
|
|
{ return pixels; }
|
|
|
|
void
|
|
Repaint();
|
|
|
|
// Window-procedure callbacks (public for the registered WndProc)
|
|
void
|
|
Paint();
|
|
void
|
|
MouseDown(int x, int y);
|
|
void
|
|
MouseUp();
|
|
|
|
protected:
|
|
void
|
|
LayoutButtons(
|
|
ButtonStyle button_style,
|
|
int anchorA,
|
|
int anchorB,
|
|
int display_width,
|
|
int display_height,
|
|
int *client_width,
|
|
int *client_height
|
|
);
|
|
|
|
struct ScreenButton
|
|
{
|
|
int unit;
|
|
int x, y, w, h;
|
|
int amber; // 0 = red family, 1 = amber family
|
|
};
|
|
|
|
enum { maxButtons = 20 };
|
|
|
|
void
|
|
*window; // HWND
|
|
void
|
|
*blitHeader; // BITMAPINFOHEADER for StretchDIBits
|
|
unsigned long
|
|
*pixels;
|
|
int
|
|
sourceWidth,
|
|
sourceHeight;
|
|
|
|
int
|
|
displayX, displayY,
|
|
displayW, displayH;
|
|
|
|
ScreenButton
|
|
buttons[maxButtons];
|
|
int
|
|
buttonCount;
|
|
int
|
|
pressedIndex;
|
|
};
|