diff --git a/.gitignore b/.gitignore index 95c5335..3eadb37 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,9 @@ Thumbs.db desktop.ini .DS_Store +# Packaged runnable game (pack-dist.ps1 output) +/dist/ + # Local cockpit-launcher experiments — deliberately untracked assets/RP411/startrp-800x600.bat assets/RP411/startrp-800x600.ps1 diff --git a/BUILD.md b/BUILD.md index 4b33782..28be5dc 100644 --- a/BUILD.md +++ b/BUILD.md @@ -50,6 +50,11 @@ The solution is [WinTesla.sln](WinTesla.sln) with four v143 projects: Build order is resolved by `ProjectReference` (RP_L4 and RPL4TOOL both reference Munga_L4). +**Packaging:** [pack-dist.ps1](pack-dist.ps1) assembles a runnable game into +`dist\` (exe + PDB, game data, OpenAL/libsndfile runtimes, desktop +`environ.ini`, `start-windowed.bat`, README). Pass `-Zip` to also produce +`dist\RedPlanet412-prototype.zip` for handing to someone else. + ## 3. VS2022 migration notes (what changed and why) Settings preserved from the VC9 projects: **`/Zp1` struct packing** in Munga_L4 diff --git a/pack-dist.ps1 b/pack-dist.ps1 new file mode 100644 index 0000000..753accc --- /dev/null +++ b/pack-dist.ps1 @@ -0,0 +1,116 @@ +# ============================================================================ +# pack-dist.ps1 — assemble a runnable Red Planet 4.12 package into dist\ +# ============================================================================ +# +# Collects everything the game needs at run time: +# - Release\rpl4opt.exe (+ .pdb for crash debugging) +# - game data from assets\RP411 (AUDIO, GAUGE, VIDEO, INIs, RPL4.RES, +# TEST.EGG) — but not the arcade launch scripts or the old 4.10 exe +# - libsndfile-1.dll beside the exe; OpenAL32.dll copied from the system +# when installed, with oalinst.exe included as the fallback installer +# - a desktop environ.ini (PAD;KEYBOARD controls, on-screen plasma) +# - start-windowed.bat and a README +# +# Usage: powershell -ExecutionPolicy Bypass -File pack-dist.ps1 [-Zip] +# +param( + [switch]$Zip +) + +$ErrorActionPreference = 'Stop' +$root = Split-Path -Parent $MyInvocation.MyCommand.Path +$dist = Join-Path $root 'dist' +$assets = Join-Path $root 'assets\RP411' +$exe = Join-Path $root 'Release\rpl4opt.exe' + +if (-not (Test-Path $exe)) { + throw "Release\rpl4opt.exe not found - build first (see BUILD.md 2)." +} + +Write-Host "Packing into $dist" +if (Test-Path $dist) { Remove-Item -Recurse -Force $dist } +New-Item -ItemType Directory -Force "$dist\SPOOLS" | Out-Null + +# --- game binary ----------------------------------------------------------- +Copy-Item $exe $dist +$pdb = Join-Path $root 'Release\rpl4opt.pdb' +if (Test-Path $pdb) { Copy-Item $pdb $dist } + +# --- game data ------------------------------------------------------------- +foreach ($dir in 'AUDIO', 'GAUGE', 'VIDEO') { + Write-Host " copying $dir..." + Copy-Item -Recurse (Join-Path $assets $dir) $dist +} +foreach ($file in 'RPDPL.INI', 'JOYSTICK.INI', 'RPL4.RES', 'TEST.EGG', + 'libsndfile-1.dll', 'oalinst.exe') { + Copy-Item (Join-Path $assets $file) $dist +} + +# --- OpenAL runtime -------------------------------------------------------- +# The exe links OpenAL32.dll (32-bit). Prefer shipping the already-installed +# runtime beside the exe; oalinst.exe covers machines where that misses. +$openal = "$env:WINDIR\SysWOW64\OpenAL32.dll" +if (-not (Test-Path $openal)) { $openal = "$env:WINDIR\System32\OpenAL32.dll" } +if (Test-Path $openal) { + Copy-Item $openal $dist + $wrap = Join-Path (Split-Path $openal) 'wrap_oal.dll' + if (Test-Path $wrap) { Copy-Item $wrap $dist } + Write-Host " OpenAL runtime copied from $(Split-Path $openal)" +} else { + Write-Warning "OpenAL32.dll not found on this system - dist relies on oalinst.exe" +} + +# --- desktop configuration ------------------------------------------------- +Set-Content -Path "$dist\environ.ini" -Encoding ascii -Value @" +L4CONTROLS=PAD;KEYBOARD +DPLARG=1 +L4DPLCFG=RPDPL.INI +L4GAUGE=640x480x16 +L4PLASMA=SCREEN +TARGETFPS=60 +"@ + +Set-Content -Path "$dist\start-windowed.bat" -Encoding ascii -Value @" +@echo off +rem Red Planet 4.12 - desktop prototype (windowed, local test mission) +cd /d "%~dp0" +start rpl4opt.exe -windowed -res 800 600 -egg TEST.EGG +"@ + +Set-Content -Path "$dist\README.txt" -Encoding ascii -Value @" +Red Planet 4.12 - desktop prototype +=================================== + +Run start-windowed.bat (or: rpl4opt.exe -windowed -res 800 600 -egg TEST.EGG). +No cockpit hardware needed. If there is no sound, run oalinst.exe once. + +Controls (XInput controller and/or keyboard): + + Left stick / WASD joystick + LT / RT or Q / E left / right pedal + Right stick Y, PgUp/PgDn throttle (holds position) + A / Space joystick trigger + B / R reverse thrust + DPad / arrow keys joystick hat (look) + Start,Back / F1,F2 config buttons + +The "Plasma Display" window is the pod's plasma glass. Closing it just +hides it. environ.ini options: L4PADFLIP=XY inverts the stick axes, +L4PLASMASCALE=n sets the plasma pixel size (default 4). + +Known prototype notes: pods race untextured (the player1-8 skins come +from the presets system, not shipped data), and text drawn on the plasma +glass may appear rotated. + +Source: https://gitea.mysticmachines.com/VWE/RP412 +"@ + +# --- summary / optional zip ------------------------------------------------ +$size = (Get-ChildItem $dist -Recurse | Measure-Object Length -Sum).Sum +Write-Host ("dist ready: {0:N1} MB" -f ($size / 1MB)) + +if ($Zip) { + $zipPath = Join-Path $root 'dist\RedPlanet412-prototype.zip' + Write-Host "zipping to $zipPath..." + Compress-Archive -Path "$dist\*" -DestinationPath $zipPath -Force +}