# package.ps1 -- assemble the deployable pod zip from repo sources + a fresh # self-contained pod-launch publish. Output: \.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 -- optional: policy (2026-07-10) is a one-time MANUAL install # per cockpit; postinstall detects it and only warns when absent. if ($Npcap) { Copy-Item $Npcap (Join-Path $root 'deploy\npcap.exe'); Log "bundled Npcap -> deploy\npcap.exe" } else { Log "Npcap not bundled (manual-install policy; operator installs once per cockpit)" } 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)"