Files
RP412/tools/resbuild/README.md
T
CydandClaude Opus 5 8e2e00d8d3 The resource pipeline builds again
RPL4.RES is compiled from authored sources by RPL4TOOL -b, the original 1996
resource tool, which still builds in this tree. That pipeline did not work:
the tool aborted on the very first model, so the resource file could only be
consumed, never regenerated. Content could not be changed at all.

It died in PlugStream_FindEntryAndWriteObjectID resolving resource=
Translocation01 from AUDIO/PLYINT.SCP, a name defined in no file under
CONTENT/RP. The obvious suspect was the AWE32 soundbank path, since
AudioCard::LoadSBK is stubbed to return 1 by the Win32 port - but that is a
red herring. Supplying the banks changes nothing because nothing reads them
at build time. CreateStaticAudioStreamResource opens audio\static.scp, which
declares all 154 patch resources as plain text mapping each name to a bank
and patch number, and CONTENT/RP simply does not have that file. The sda4
developer drive does. Two more scripts included by 27 vehicles, VTVINT.SCP
and VTVEXT.SCP, were missing the same way. All three are kept in recovered/
because they are the keystone and are small.

No engine change was needed. The pipeline was missing content, not code.

build-res.ps1 assembles a build tree from the 4.10 content, those three
scripts, and the soundbanks and ~547 VIDEO files that RP412 ships complete
and the content tree does not. It never overwrites an authored file with a
shipped one, so archival content stays authoritative where it exists.

A model missing a skeleton is dropped SILENTLY - the tool logs and carries
on, producing a resource file with fewer models rather than failing. Check
the model count, which is why the script reports unresolved inputs.

-RestoreCutVehicles uncomments dark, blkspk and blktrn, three vehicles taken
out of the .bld after 4.10 shipped with their model ids left in place. All
three build clean and take the count from 42 to 45, exactly retail's, each
with its full subsystems, segments, damage zones and control mappings.

What this cannot do yet: eleven maps have no source. Five survive only on the
sda4 drive in a 1996 state older than retail, and otto, frstrm, burnt,
brewers, headoff and headmf are gone entirely - the .CAM cameras and .XST
existence boxes are here but the .MAP files are not. So a build from these
sources yields 45 models and zero maps against RP411's nine, and is not yet a
drop-in replacement for assets/RP411/RPL4.RES.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 17:12:00 -05:00

119 lines
4.9 KiB
Markdown

# Rebuilding RPL4.RES
`RPL4.RES` is Red Planet's resource file — every vehicle, map, model, damage
zone, control mapping and audio stream the game loads. It is *compiled* from
authored sources by `RPL4TOOL -b`, the original 1996 resource tool, which
still builds in this tree as `Release\RPL4TOOL.exe` (see `BUILD.md`).
Until now that pipeline did not work. `RPL4TOOL -b` aborted on the very first
model, so `assets/RP411/RPL4.RES` could only be consumed, never regenerated.
This folder makes it build again.
```powershell
# rebuild exactly what RP411 ships (minus the maps, see below)
powershell -ExecutionPolicy Bypass -File tools\resbuild\build-res.ps1
# ...plus the three vehicles that were cut after 4.10
powershell -ExecutionPolicy Bypass -File tools\resbuild\build-res.ps1 -RestoreCutVehicles
```
Output lands in `%TEMP%\rp412-resbuild\rpl4.res`. Inspect any resource file
with `Release\RPL4TOOL.exe -l <file>`; that listing is the acceptance test for
anything built here. **The result is not yet a drop-in replacement for
`assets/RP411/RPL4.RES`** — see *What is still missing*.
## Why it was broken
`RPL4TOOL -b` died in `PlugStream_FindEntryAndWriteObjectID` while building
`player.mod`'s audio stream, resolving `resource=Translocation01` from
`AUDIO/PLYINT.SCP`. That name is defined in no file in `CONTENT/RP`.
The first guess — that it needed the AWE32 soundbanks through
`AudioCard::LoadSBK`, which the Win32 port stubbed to `return 1` — was wrong.
Supplying the banks changes nothing, because nothing reads them at build time.
The real answer is `L4AudioResourceManager::CreateStaticAudioStreamResource`
(`MUNGA_L4/L4AUDRES.cpp`), which opens **`audio\static.scp`**. That file
declares all 154 of RP's patch resources as plain text:
```
[PatchLevelOfDetail]
bank_ID=2
patch_ID=29
name=Translocation01LOD1
...
[PatchResource]
audio_level_of_detail=0.0, Translocation01LOD1
name=Translocation01
```
Every model's audio script resolves its `resource=` names against those, so
without `static.scp` the first model aborts and no `.res` is ever written.
`CONTENT/RP/AUDIO` does not have it — but the sda4 developer drive does.
No engine change was needed. The pipeline was missing content, not code.
## What the build tree is made of
`build-res.ps1` assembles three sources, and never overwrites an authored file
with a shipped one — archival content stays authoritative where it exists.
| source | provides |
|---|---|
| `TeslaRel410\CONTENT\RP` | models, solids, gauge art, audio scripts, `RPL4.BLD` |
| `recovered\` (this folder) | `STATIC.SCP`, `VTVINT.SCP`, `VTVEXT.SCP` |
| `assets\RP411\` | `AUDIO1/2.RES` soundbanks, ~547 `VIDEO` files |
The three recovered scripts came from `TeslaRel410\sda4\RPDAVE\AUDIO` (identical
to `RPLIVE`) and are kept here because they are the keystone and are small.
`VTVINT.SCP` and `VTVEXT.SCP` are `[include]`d by 27 vehicle audio scripts and
are absent from `CONTENT/RP` as well.
The `VIDEO` gap is mostly `.SKL` skeletons — `MAN.SKL`, `BAN.SKL`, `BUN.SKL`,
`DUN.SKL` and their `S` variants. A model missing one logs
`video\<x>.skl is empty or missing!`, then `<model> has no Segments!`, and is
**silently dropped from the build** — the tool does not fail, it just produces
a resource file with fewer models. Always check the model count.
## What is still missing
**Eleven maps have no source in any tree.** The build reports each one and
carries on:
| map | source |
|---|---|
| `wise`, `yip`, `pain`, `blade`, `lyzlane` | only in `sda4\RPDAVE\MAPS` (1996 dev state, older than retail) |
| `otto`, `frstrm`, `burnt`, `brewers`, `headoff`, `headmf` | **nowhere** |
`CONTENT/RP/MAPS` has the `.CAM` camera files and `SOLIDS` has the `.XST`
existence boxes, but the `.MAP` files themselves are gone. So a build from
here produces 45 GameModels and **zero maps**, against RP411's 9. Until those
are recovered, this pipeline can rebuild vehicles but cannot replace the
shipped resource file.
## The three cut vehicles
`-RestoreCutVehicles` uncomments three lines in `RPL4.BLD` that were commented
out after 4.10 shipped, with their model IDs left in place:
```
//Armadillo Class
model=puck.mod /id:19
//model=dark.mod /id:56 <- dark puck
//Experimental Vehicles
//model=blktrn.mod /id:47 <- black tornado
//model=blkspk.mod /id:48 <- black speck
```
All three build clean, taking the model count from 42 to 45 — exactly retail's
count. Each gets its full resource set: GameModel, Model List, VideoModel,
Subsystems, Segments, DamageZones, ControlsMappings and GaugeImage.
Two caveats. `blktrn` has no audio script anywhere (`BLKTRN.SCP` is absent from
every tree) and no gauge block in `L4GAUGE.CFG`, so its cockpit panel has no
layout to select — `dark` and `blkspk` still have theirs. And nothing has been
verified in-game; building is not the same as playable.
See `docs/CONTROL-PRESETS.md` for what these vehicles carry and the preset
tables they shipped with.