launch_live.ps1: -Explode puts the cockpit VDB windows on the secondary display

Adds -Explode: the pentapus cockpit instruments (radar + 5 mono MFDs, the VDB
video-splitter decode) render on the SECONDARY monitor while the reconstructed
i860+GPU 3D renderer stays the main out-the-window view on the primary. The
window rects auto-fit to whatever the non-primary display is (detected via
System.Windows.Forms.Screen, so it survives a monitor rearrange), scaled to
~0.6 and offset into that display's virtual-desktop region; the DOSBox SVGA
screen parks clear of the cluster.

The cockpit windows live in vpxlog's rt_main thread, which only starts under
VPX_RENDER=1 -- the same flag whose DOSBox-thread scene-graph decode previously
stalled wire delivery (fixed earlier by removing it). Feared this would bite
again; MEASURED and it does NOT: with VPX_EXPLODE + VPX_NOMAIN the heavy main-
window 3D render (rt_draw, gated on the main window existing) is skipped, so
rt_main only does the cheap per-tick MFD/radar blits and the DOSBox thread keeps
up. Live-verified: all 6 cockpit windows placed on the secondary (DISPLAY1),
renderer on the primary, wire advancing normally to cmd 23k+ (no command-8
stall), frames flowing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-20 11:25:47 -05:00
co-authored by Claude Opus 4.8
parent 11680bcb3e
commit 20dd8440d3
+57 -5
View File
@@ -17,15 +17,57 @@ param(
[switch]$Sound,
[switch]$PodOnly,
[switch]$Present, # live_render window (pygame)
[string]$Pin # pre-load the full texture set from this
[string]$Pin, # pre-load the full texture set from this
# .fifodump (bit-identical to offline;
# avoids grey/incomplete early textures
# while the live mission is still
# uploading them incrementally)
[switch]$Explode # pentapus cockpit instruments (radar +
# 5 mono MFDs, VDB decode) on the
# SECONDARY display; our 3D renderer
# stays the main view on the primary.
# NOTE: needs VPX_RENDER=1 (the cockpit
# windows live in the same thread as
# Dave's native render) -> re-adds the
# DOSBox-thread scene-graph decode that
# previously stalled wire delivery;
# measured below, revert if it bites.
)
$ErrorActionPreference = 'Stop'
New-Item -ItemType Directory -Force $Work | Out-Null
# --- exploded cockpit layout on the SECONDARY display -----------------------
# The pentapus's default layout is ~1980px wide; auto-fit it onto whatever the
# non-primary screen is (detected here, so it survives a monitor rearrange).
function Get-ExplodeEnv {
Add-Type -AssemblyName System.Windows.Forms
$screens = [System.Windows.Forms.Screen]::AllScreens
$sec = $screens | Where-Object { -not $_.Primary } | Select-Object -First 1
if (-not $sec) { $sec = $screens[0] } # single-monitor fallback
$b = $sec.Bounds
Write-Host ("exploded view -> secondary '{0}' {1}x{2} @ ({3},{4})" -f `
$sec.DeviceName, $b.Width, $b.Height, $b.X, $b.Y)
# local layout (fits ~1120x820) then offset onto the secondary; radar is
# portrait. g: 0=radar 5=LL 6=LR 7=UR 8=UC 9=UL (7/9 swapped per the pod).
$m = 384; $n = 288 # MFD w,h (0.6 scale of 640x480)
$rw = 288; $rh = 384 # radar w,h (portrait)
$x0 = $b.X + 20; $y0 = $b.Y + 20
$col = @($x0, ($x0 + $m + 16), ($x0 + 2*($m + 16))) # 3 columns
$rowU = $y0; $rowL = $y0 + $n + 16
$rect = { param($x,$y,$w,$h) "$x,$y,$w,$h" }
$e = @{}
$e['VPX_WIN9'] = & $rect $col[0] $rowU $m $n # upper-left
$e['VPX_WIN8'] = & $rect $col[1] $rowU $m $n # upper-center
$e['VPX_WIN7'] = & $rect $col[2] $rowU $m $n # upper-right
$e['VPX_WIN5'] = & $rect $col[0] $rowL $m $n # lower-left
$e['VPX_WIN0'] = & $rect ($col[1] + [int](($m-$rw)/2)) ($rowL - 20) $rw $rh # radar center
$e['VPX_WIN6'] = & $rect $col[2] $rowL $m $n # lower-right
# park the DOSBox SVGA screen at the bottom-right of the secondary, clear
# of the cockpit cluster (it parks centered under this VPX_MAIN slot).
$e['VPX_MAIN'] = & $rect ($b.X + $b.Width - 360) ($b.Y + $b.Height - 520) 320 8
return $e
}
# stop a previous pod (the fifodump + socket are exclusive)
$pidfile = "$Work\pod_pid.txt"
if (Test-Path $pidfile) {
@@ -41,10 +83,20 @@ $env:VPX_NOMAIN = '1' # no native Division window
$env:VPX_CLEAR = '0,0,0'
$env:VPX_FIFODUMP = "$Work\live.fifodump" # archival copy alongside the socket
$env:VPX_FIFOSOCK = "$Port" # the live tee our renderer rides
# VPX_RENDER intentionally NOT set: that starts Dave's native GL render thread
# (rt_main) inside dosbox-x itself -- redundant with (and contends against) our
# own reconstructed renderer riding the FIFOSOCK tee.
Remove-Item Env:VPX_RENDER, Env:VPX_EXPLODE -ErrorAction SilentlyContinue # no native renderer, no pentapus
# By default VPX_RENDER/VPX_EXPLODE are OFF: VPX_RENDER starts rt_main inside
# dosbox-x, whose DOSBox-thread scene-graph decode contends with (and stalls)
# our FIFOSOCK-fed renderer. -Explode opts back in to get the cockpit VDB
# windows (radar + MFDs), which live in that same thread -- accepting the
# tradeoff, and positioning those windows on the secondary display.
Remove-Item Env:VPX_RENDER, Env:VPX_EXPLODE -ErrorAction SilentlyContinue
foreach ($v in 'VPX_MAIN','VPX_WIN0','VPX_WIN5','VPX_WIN6','VPX_WIN7','VPX_WIN8','VPX_WIN9') {
Remove-Item "Env:$v" -ErrorAction SilentlyContinue
}
if ($Explode) {
$env:VPX_EXPLODE = '1'
$env:VPX_RENDER = '1' # required: cockpit windows are in rt_main
(Get-ExplodeEnv).GetEnumerator() | ForEach-Object { Set-Item "Env:$($_.Key)" $_.Value }
}
if ($Sound) {
$env:VWE_AWE32 = '1'
$env:VWE_AWE_ROM = (Resolve-Path "$PSScriptRoot\..\roms\awe32.raw").Path