Files
TeslaRel410/emulator/deploy/package.ps1
T
CydandClaude Opus 4.8 e65ff3f8d7 Deploy: RP loops (no single-shot) + confirm DOSBox needs no bundled DLLs
- net-boot/loop_rp.bat: GO.BAT-style netnub loop for RP (mirror of loop.bat,
  retargeted to rpl4opt). deploy/net_rp.conf.tmpl now calls it instead of the
  single-shot netnub + DOS pause -- the deployable runs in a loop until the
  supervisor kills DOSBox (per operator: no single-shot in the product).
- DLL closure resolved: dosbox-x.exe is a 182MB STATIC build -- import table is
  only Windows system DLLs, delay-import table empty, libpng/SDL/zlib embedded.
  Nothing to bundle; wpcap.dll comes from the Npcap install. package.ps1's "no
  DLLs" case is now informational, and the plan/README note the static build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 12:06:49 -05:00

97 lines
4.7 KiB
PowerShell

# package.ps1 -- assemble the deployable pod zip from repo sources + a fresh
# self-contained pod-launch publish. Output: <OutDir>\<PackageName>.zip whose
# ROOT holds postinstall.bat + the single package folder (extract to C:\games).
# See README.md for the tree. Externally-procured pieces (Npcap, frozen renderer)
# are bundled only if their paths are passed; otherwise they're flagged missing.
param(
[string]$PackageName = "TeslaPod410",
[string]$OutDir,
[string]$Npcap, # bundled Npcap silent installer -> deploy\npcap.exe
[string]$Renderer, # frozen renderer exe -> renderer.exe
[string]$VcRedist, # optional VC++ runtime -> deploy\vc_redist.x64.exe
[switch]$NoContent, # skip ALPHA_1 + net-boot (fast structural test)
[switch]$SkipBuild # reuse the last pod-launch publish
)
$ErrorActionPreference = 'Stop'
function Log($m) { Write-Host "[package] $m" }
function Warn($m) { Write-Warning "[package] $m" }
$Repo = (Resolve-Path "$PSScriptRoot\..\..").Path
$Emu = Join-Path $Repo 'emulator'
if (-not $OutDir) { $OutDir = Join-Path $Emu 'dist' }
New-Item -ItemType Directory -Force $OutDir | Out-Null
# --- 1. build pod-launch.exe (self-contained single-file, no runtime needed) --
$plProj = Join-Path $Emu 'pod-launch\pod-launch.csproj'
$plOut = Join-Path $Emu 'pod-launch\bin\pkg'
if (-not $SkipBuild) {
Log "publishing pod-launch (self-contained win-x64)..."
dotnet publish $plProj -c Release -r win-x64 --self-contained true `
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true `
-o $plOut | Out-Null
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed" }
}
$podLaunch = Join-Path $plOut 'pod-launch.exe'
if (-not (Test-Path $podLaunch)) { throw "pod-launch.exe not found at $podLaunch" }
# --- 2. stage the tree --------------------------------------------------------
$stage = Join-Path $OutDir '_stage'
if (Test-Path $stage) { Remove-Item $stage -Recurse -Force }
$root = Join-Path $stage $PackageName
New-Item -ItemType Directory -Force (Join-Path $root 'deploy') | Out-Null
New-Item -ItemType Directory -Force (Join-Path $root 'roms') | Out-Null
# postinstall.bat -> zip ROOT (beside the package folder)
Copy-Item (Join-Path $Emu 'deploy\postinstall.bat') $stage
# supervisor
Copy-Item $podLaunch $root
# DOSBox-X + its DLLs
$dbDir = Join-Path $Emu 'src\src'
Copy-Item (Join-Path $dbDir 'dosbox-x.exe') $root
# The build is statically linked (imports only Windows system DLLs; empty
# delay-import table). No MinGW/SDL DLLs to bundle. wpcap.dll is provided by the
# Npcap install. Copy any DLLs that DO sit beside the exe, just in case.
$dlls = Get-ChildItem (Join-Path $dbDir '*.dll') -ErrorAction SilentlyContinue
if ($dlls) { $dlls | ForEach-Object { Copy-Item $_.FullName $root } ; Log "copied $($dlls.Count) DLL(s) beside dosbox-x.exe" }
else { Log "no DLLs beside dosbox-x.exe (static build -- only Windows system DLLs + Npcap's wpcap needed)" }
# conf templates + configure.ps1
Copy-Item (Join-Path $Emu 'deploy\net_loop.conf.tmpl') $root
Copy-Item (Join-Path $Emu 'deploy\net_rp.conf.tmpl') $root
Copy-Item (Join-Path $Emu 'deploy\configure.ps1') (Join-Path $root 'deploy')
# AWE32 ROM
Copy-Item (Join-Path $Emu 'roms\awe32.raw') (Join-Path $root 'roms')
# game content + packet drivers (large)
if ($NoContent) {
Warn "-NoContent: skipping ALPHA_1 + net-boot (structural test only, NOT installable)"
} else {
Log "copying ALPHA_1 game content (large)..."
Copy-Item (Join-Path $Repo 'ALPHA_1') $root -Recurse
Copy-Item (Join-Path $Emu 'net-boot') $root -Recurse
}
# renderer (frozen exe) -- else flagged
if ($Renderer) { Copy-Item $Renderer (Join-Path $root 'renderer.exe'); Log "bundled renderer -> renderer.exe" }
else { Warn "no -Renderer: renderer NOT bundled (freeze pending). pod-launch needs --renderer or a bundled render-bridge at runtime." }
# Npcap installer -- else flagged
if ($Npcap) { Copy-Item $Npcap (Join-Path $root 'deploy\npcap.exe'); Log "bundled Npcap -> deploy\npcap.exe" }
else { Warn "no -Npcap: installer NOT bundled. postinstall will warn + the pcap bridge won't work until Npcap is present." }
if ($VcRedist) { Copy-Item $VcRedist (Join-Path $root 'deploy\vc_redist.x64.exe'); Log "bundled VC++ runtime" }
# --- 3. zip -------------------------------------------------------------------
$zip = Join-Path $OutDir "$PackageName.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Log "compressing -> $zip"
Compress-Archive -Path (Join-Path $stage '*') -DestinationPath $zip
Remove-Item $stage -Recurse -Force
$size = "{0:N1} MB" -f ((Get-Item $zip).Length / 1MB)
Log "DONE: $zip ($size)"
Log "zip root = postinstall.bat + $PackageName\ (TeslaLauncher extracts to C:\games, runs postinstall.bat elevated)"