KB: record the cwd landmine + why the folder layout differs from RP/4.10

The 1995 pod and RP411/RP412 ship ONE folder (BTL4OPT.EXE sits beside BTL4.RES
to this day, in content\); BT411's build\Release + content\ split is an artifact
of mkdist zipping tracked repo paths, not a decision -- and it is the reason
this class of bug exists here and nowhere else.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-26 02:42:32 -05:00
co-authored by Claude Opus 5
parent 8408165d92
commit 78a98dafc7
+17
View File
@@ -39,6 +39,23 @@ run\run.cmd [EGG] # default DEV.EGG; cd's to content\ and runs btl4.exe -eg
- **cwd MUST be `content\`** — the engine resolves `BTL4.RES`, `VIDEO\`, `BTDPL.INI`, eggs relative
to cwd (the `loadTables` gotcha: `L4VIDEO.cpp:849` `fopen("VIDEO\\REPLACEMATS.tbl")` is relative +
unchecked → fread on NULL if cwd is wrong). Logs to `btl4.log` in `content\` (or `BT_LOG=<file>`). [T2]
**Since 2026-07-26 the exe enforces this itself** (`BTEnsureContentDirectory`, btl4main.cpp): if
cwd has no `BTL4.RES` it probes from the exe's own directory (`..\..\content` for the shipped
layout, plus flattened / in-content cases) and `SetCurrentDirectory`s there, before the log file
opens. The boot line says so when it had to look. ⚠ **The landmine it defuses** (field report):
a bare `btl4.exe` launch from `build\Release` found no resources ("Resource file btl4.res
v1.0.0.0 is obsolete!"), wrote a stray `bindings.txt`/`environ.ini`/`btl4.log` NEXT TO THE EXE —
so the player's real ones in `content\` looked like they were never created — and killed the
mission generation the menu launched (the child inherits the parent's cwd). Invisible for years
because every launcher `cd`s to `content\` first; it became reachable once glass became the
desktop default and a zero-arg launch started opening the menu.
- **Why this is a BT411-only hazard [T1].** The 1995 pod shipped ONE folder — `BTL4OPT.EXE` sits
next to `BTL4.RES`/`VIDEO\`/`GAUGE\`/`AUDIO\` (it is still there in `content\`) — and RP411/RP412
keep that shape (`pack-dist.ps1` copies the exe and every asset dir into one dist root). BT411's
two-folder split (`build\Release\btl4.exe` + `content\`) is not a design decision: `mkdist.py`
zips TRACKED REPO PATHS verbatim, so the dist inherited the repo's developer layout. In the
authentic single-folder shape cwd is right by construction and a double-click just works, which
is why the other games never hit this.
- Interactive: **WASD** drive; weapon groups (keyboard, task #43) **1/Space** = lasers, **2** =
PPCs, **3/Ctrl** = missiles; **X** all-stop; **V** cockpit/chase view. Default egg = `DEV.EGG`
(map=grass, time=day). Swap mech via the egg's `vehicle=` — **ALL 18 ModelList names