KEYBOARD LAMP MIRROR (L4KEYLIGHT). Ported from RP412, itself a port of vRIO's KeyboardLampMirror. Keys bound to a lamp address in bindings.txt glow with the panel palette through Windows Dynamic Lighting -- yellow for the map's side columns (0x10-0x1F), red for the rest -- flashing in step with the on-screen buttons (its LampLevel copy matches the FIXED BTLampBrightnessOf). Per-key boards light each bound key; zone-lit boards mirror the strongest lamp board-wide. All WinRT runs on a private worker thread: watcher, claim, and a 100 ms paint loop that repaints only on change. RP412's packing hazard does NOT transfer: it forces default struct packing there because its engine is /Zp1, which would break the WinRT ABI. BT411's BT_OPTS carries no /Zp, so only the dialect flags are needed -- /std:c++17 /permissive- per-file, since the project otherwise builds C++14 /permissive. The scalars-only interface is kept anyway so the isolation survives if packing is ever added. Wired in PadRIO: map built from bindings.keyBindings (ActionButton binds only, first-binding-wins per key), fed from PadRIO::SetLamp, stopped in the dtor (which hands the LEDs back to Windows). BT_KEYLIGHT=0 opts out; a machine without Dynamic Lighting logs once and stays dormant. Verified live: claimed this machine's 24-zone keyboard and mirrors 25 bound keys; BT_KEYLIGHT=0 and the pod profile produce zero keylight lines and run clean. SHIPPED CONTROLS REFERENCE. docs/CONTROLS.md carries the keyboard table plus the full 72-BUTTON POD MAP, grouped by the display each bank surrounds, with the coolant-valve detent warning (1-5-50-CLOSED, one press past max shuts the loop) and the jam/eject procedure. mkdist flattens it to ASCII as CONTROLS.txt at the zip root, the README's own idiom. players/README.txt gained pointers to it, to environ.ini, to -fit, and to the RGB mirror. KB: context/glass-cockpit.md and docs/GLASS_COCKPIT.md updated for the whole branch -- layout modes, L4RIOBANK and the under-glass rule, the letterbox fit and its ordering trap, player-tunable displays, the measured legend grid, the closed dead-button backlog, and this mirror. Verified: five-mode regression (surround/exploded/dock/pod/dev) boots and simulates with zero faults; mkdist writes a 5149-byte pure-ASCII CONTROLS.txt. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
54 lines
2.4 KiB
C
54 lines
2.4 KiB
C
//===========================================================================//
|
|
// File: l4keylight.h //
|
|
// Project: MUNGA Brick: RGB keyboard lamp mirror //
|
|
// Contents: Windows Dynamic Lighting bridge (vRIO's KeyboardLampMirror) //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
|
|
// PROPRIETARY AND CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#pragma once
|
|
|
|
//########################################################################
|
|
// Mirrors the game-commanded RIO lamp states onto per-key RGB keyboards
|
|
// through Windows Dynamic Lighting (the WinRT LampArray API), following
|
|
// vRIO's KeyboardLampMirror: keys bound to lamp addresses glow with the
|
|
// panel palette (red for the banks, yellow for the Secondary/Screen
|
|
// columns), flash modes blink at the panel's rates, other keys are
|
|
// blacked out so the keyboard reads as the button field. Zone-lit
|
|
// keyboards mirror the strongest lamp board-wide. Dynamic Lighting
|
|
// grants LED control to the FOREGROUND app - which is the game itself,
|
|
// so no Windows settings dance is needed.
|
|
//
|
|
// The implementation is C++/WinRT on a private worker thread, compiled
|
|
// with default struct packing (the engine builds /Zp1, which would
|
|
// break the WinRT ABI) - hence this interface is scalars only. All
|
|
// functions are safe to call when Dynamic Lighting is unavailable;
|
|
// failures log once and the mirror stays dormant.
|
|
//########################################################################
|
|
|
|
// Where the mirror's status lines go (the caller owns the sink).
|
|
void
|
|
KeyLight_SetLogger(void (*logger)(const char *line));
|
|
|
|
// The key map: parallel arrays of virtual keys, their RIO lamp
|
|
// addresses (0x00-0x47), and whether each paints yellow (Secondary /
|
|
// Screen columns) instead of red.
|
|
void
|
|
KeyLight_SetMap(
|
|
const int *virtual_keys,
|
|
const int *addresses,
|
|
const unsigned char *yellow,
|
|
int count
|
|
);
|
|
|
|
// Latest game-commanded lamp bytes (indexed by RIO lamp number).
|
|
void
|
|
KeyLight_UpdateLamps(const unsigned char *lamp_state, int count);
|
|
|
|
// Claim keyboards and start painting / release the LEDs to Windows.
|
|
void
|
|
KeyLight_Start();
|
|
void
|
|
KeyLight_Stop();
|