138 lines
11 KiB
Markdown
138 lines
11 KiB
Markdown
# Phase 03 — BT 4.10 literal-source manifest (2026-07-18)
|
|
|
|
**Goal:** kick off the literal 4.10 source-tree reconstruction (the archival-grade artifact,
|
|
distinct from the WinTesla-hosted port) by measuring the mountain: attribute every function in
|
|
`BTL4OPT.EXE` to its original translation unit, with sizes and evidence tiers.
|
|
|
|
**Deliverables:** `tools/manifest410.py` → `reference/BT410_SOURCE_MANIFEST.md` + `.json`.
|
|
|
|
## Method (3 linker invariants + DP)
|
|
1. **TU census + link order = the surviving makefiles** (`game/original/BT/BT.MAK` — 36 bt.lib
|
|
TUs; `BT_L4/BTL4.MAK` — 13 btl4.lib TUs + `btl4.obj`). Toolchain identified from the same
|
|
files: **Borland (BCC/tasm32/tlib/tlink32)**, Phar Lap TNT target. The tlink32 response file
|
|
fixes the lib order: startup + btl4.obj, l4stub, stub, munga, mungal4, libdpl, **bt.lib,
|
|
btl4.lib**, RTL — so the BT game code is the LAST game region before the Borland RTL.
|
|
2. **Code anchors:** Fail() call sites carry `d:\tesla_bt\...` path strings + LINE numbers;
|
|
resolved via `section_dump.txt` (release build ⇒ only ~225 such anchors image-wide) plus 24
|
|
CLASSMAP-verified seed addresses ([T1]).
|
|
3. **Data-cluster affinity:** each OBJ's literals/vtables/statics are laid out per-section in
|
|
the same link order as its code, so a function's `DAT_`/`PTR_FUN_`/`s_` refs vote for its TU
|
|
(shared globals — VAs claimed by >1 anchored TU — are blacklisted; `.bss` handled as a
|
|
virtual section above the dumped DATA). The port's `@address` annotations in name-matched
|
|
`game/reconstructed/*` files add soft votes.
|
|
4. **Monotone DP:** within the BT region the TU-label sequence must be non-decreasing in link
|
|
order; a dynamic program picks the anchor-respecting monotone labeling that maximizes
|
|
affinity. Region totals are exact under the sentinels (first BT anchor @49b54c … RTL
|
|
@4d4b58) even where an individual boundary is soft.
|
|
|
|
## Result (the mountain, measured)
|
|
- **BT region = 917 functions / ~230 KB code** (bt.lib 482 fn / 153 KB; btl4.lib 435 fn / 76 KB),
|
|
out of 6267 functions in the image (the rest = engine libs whose source SURVIVES, + RTL).
|
|
- **Validation:** every DP extent with independent ground truth matched — btl4gaug
|
|
`4c2f94-4c6798` (CLASSMAP's own TU extent), btl4mssn starting exactly at the BTL4Mission ctor
|
|
`4d2be0`, heat `4ad760-4afbe0`, mechmppr/powersub/gyro/torso seeds all interior. Link-order
|
|
monotonicity holds with zero violations.
|
|
- **17 TUs remain un-localized** (folded into a neighbor's range — no anchor evidence): mechdmg
|
|
was recovered, but gnrator, ppc, mislanch, gauss, btteam, btreg, btcnsl, bttool, btl4mode,
|
|
btl4galm, btl4arnd etc. show `—`; 8 of those survive as full `.cpp` so localization is
|
|
optional. The rest need one anchor each (a ctor identified in CLASSMAP terms).
|
|
|
|
## New leads / corrections found en route
|
|
- **The `.TCP` files are TEST-CLASS implementation files** (the debug-build TestClass /
|
|
self-test bodies — cf. L4APP.TCP's L4TestApplication, EMITTER.TCP's "Testing Emitter").
|
|
They still carry SOME real shipped-code bodies (HEAT.TCP: HeatableSubsystem::
|
|
ResetToInitialState), so they're minor partial survivors, not template glue and not full
|
|
implementations. 7 TUs have them: heat, gnrator, emitter, projweap, ammobin, projtile,
|
|
missile. [T1]
|
|
- **Searchlight/ThermalSight code sits in the `hud.cpp` TU span** (`4b77bc-4b8a8c` contains
|
|
@4b841c/@4b85f0/@4b860c), NOT sensor.cpp as the port's `searchlight.cpp` filename implies.
|
|
[T3 — DP boundary, no direct anchor; verify before relying on it]
|
|
- **Negative sweep:** `TeslaRel410/sda4` (dev-drive dump) and `TeslaRel410/CODE` contain NO BT
|
|
game `.cpp` (sda4 = pod runtime drive: DPL3 tools, BRIEF, game installs). The PVCS install on
|
|
sda4 gives the archive naming convention: **`.CPV`/`.HPV`/`.TCV` = the grep targets for any
|
|
future drive dump**. `TeslaRel410/BORLAND/` is an empty placeholder — the period toolchain is
|
|
NOT yet archived (needed for any byte-match verification).
|
|
|
|
## Next steps (the literal-tree project)
|
|
1. Localize the 9 missing-and-unlocalized TUs (one CLASSMAP-grade anchor each).
|
|
2. ✅ Tree home CREATED (2026-07-18): `TeslaRel410/restoration/source410/` (README with
|
|
provenance rules; reconstructions NEVER mix into `CODE/`; per-file `.NOTES.md` sidecars).
|
|
3. Per-TU re-hosting passes: `game/reconstructed/<tu>.cpp` (WinTesla APIs, port accommodations)
|
|
→ `source410/<tu>.CPP` (1995 MUNGA APIs, binary-true layouts, house style from the
|
|
surviving BTMSSN.CPP/PPC.CPP + RP analogs), assert lines at their recorded positions.
|
|
**✅ PILOT DONE: `source410/BT_L4/BTL4APP.CPP`** — 12/12 functions, every decomp constant
|
|
resolved to a named 1995 expression (ApplicationID BTL4=1 — and an unreleased **BTW4**
|
|
enum slot!; ModeInitial=0x50421; AddModeMask inlines byte-exact; IOType 2/4;
|
|
ModeAlwaysActive=-1; video 5-tuple from RPL4VID/RENDERER.HPP), and the binary's
|
|
`BTL4APP.CPP:400` Fail lands on line 400 EXACTLY. Sidecar: BTL4APP.NOTES.md.
|
|
Port fallout: BT411's btl4app.cpp maps the video-renderer ctor's two globals to the
|
|
WRONG positions (rate/complexity, not interest args) — benign in the port (its own
|
|
renderer signature differs) but back-port the correction when touching btl4vid.
|
|
4. ✅ **TOOLCHAIN IN HAND (2026-07-19).** User supplied BC++ 4.5 and 4.52 installs; **4.52
|
|
chosen by BYTE-MATCH** (archive `CODE/RP/CW32.LIB` ≡ 4.52's, ≠ 4.5's) and moved to
|
|
`TeslaRel410/BORLAND/BC45/` (4.5 CD disposed per user). BCC32/TLINK32/TLIB/MAKE run NATIVELY
|
|
on Win11; hello-world compiled+linked+ran. `CODE/BT/OPT.MAK` = the shipped binary's exact
|
|
flag recipe (bcc32, NOT bcc32i; `-5 -a4 ... -O2` set; `DEBUG_STREAM=cout`; PCH `btopt.csm`);
|
|
extender = **Borland PowerPack DPMI32** (corrects the old "Phar Lap TNT" label). Compile
|
|
bootstrap of ORIGINAL BTL4MODE.CPP: parses deep with include order `CODE/BT/* over CODE/RP/*`
|
|
+ `-DNO_PRECOMPILED_HEADERS`, stops at missing `vdata.hpp` (nowhere in the 1995 archive; the
|
|
drifted WinTesla `VDATA.h` lives in BT412/engine — back-dating basis). Remaining toolchain
|
|
gap: TASM32 (separate product; JOYSTICK.ASM only).
|
|
**Route A is CLOSED** (2026-07-19, user: Nick holds nothing further) — this route is the
|
|
only route, which upgrades the engine-closure backfill to the critical path.
|
|
5. ✅ **FIRST 1995 COMPILES (2026-07-19).** `source410/MUNGA/VDATA.HPP` back-dated from BT412's
|
|
drifted `VDATA.h` (guard/include restyle; ClassID numbering decomp-verified: 0xF/0x45/0xBB9;
|
|
the surviving `VDATA.CPP` confirms the method set) — and with that ONE backfill the ORIGINAL
|
|
**BTL4MODE.CPP and BTMSSN.CPP compile CLEAN** under BC4.52 + the authentic OPT.MAK flags
|
|
(include order CODE/BT over CODE/RP over source410/MUNGA, `-DNO_PRECOMPILED_HEADERS`).
|
|
Per-TU compile is now the standard verification. Next closure gaps mapped by probe: the SOS
|
|
include dir (path-only), `rotation.hpp`/`audrend.hpp` (BT412 back-dates), `btplayer.hpp`/
|
|
`mech.hpp` (1995-form reconstructions). Recipe recorded in source410/README.
|
|
6. ✅ **CLOSURE CAMPAIGN round 1 (2026-07-19 cont.): 3 original TUs green** (BTMSSN, BTL4MODE,
|
|
BTL4ARND — btl4arnd.obj 9,814 b). Tooling: `source410/backdate.py` (mechanical WinTesla→1995
|
|
header back-dating: guards, include rewrite, std::/true/false/bool de-modernizing) +
|
|
`source410/compile410.sh --sweep` (the one-command verification scoreboard). Backfills:
|
|
VDATA/ROTATION/VECTOR2D/AUDREND compile-proven, APP parses, LAMP pending gaugrend
|
|
(BACKFILLS.NOTES.md). KEY METHOD FINDING: **the period compiler is the drift detector** —
|
|
BC4.52 rejected the OpenAL-era `ReleaseSourceSet` virtual in AUDREND (zero 1995 references;
|
|
removed = vtable now matches period truth) and every post-1994 construct in the donors.
|
|
Remaining original-TU blockers, all named: btcnsl.hpp, btscnrl.hpp, btplayer.hpp,
|
|
emitter.hpp, gaugrend.hpp, btl4mppr.hpp (the last also gates the BTL4APP pilot's compile).
|
|
7. ✅ **Round 2 (2026-07-19 cont.): 6 of 10 surviving originals GREEN** (+BTCNSL, BTSCNRL,
|
|
BTTEAM via reconstructed BTCNSL.HPP/BTSCNRL.HPP; +GAUGREND/GAUGE back-dates closed the
|
|
BTTOOL gauge chain). **DISCOVERY: the BT→console wire message IDs, recovered from the
|
|
binary's ctors [T1]: Killed=9 (@4c18f4), Damaged=10 (@4c1944, 7-field payload order
|
|
matches the surviving CPP), ScoreUpdate=13 (@4c191c), DeathWithoutHonor=15 (@4c198c);
|
|
TeamScore ctor is NOT in the image — ID guessed 12 [T4], verify live.** This answers the
|
|
TeslaSuite console-port spec's open item ("confirm BT's in-match message set") —
|
|
cross-pollinate when next touching that repo. BTTEAM compiling against the new header =
|
|
a surviving consumer validating the TeamScore ctor signature. Everything left (BTREG,
|
|
GAUSS, PPC, BTTOOL, the BTL4APP pilot) gates on ONE work package: the mech-family headers
|
|
in 1995 form (mech/mechsub/mechmppr/btl4mppr/emitter/btplayer .hpp) — layout-sensitive,
|
|
reconstruct against CLASSMAP/decomp offsets.
|
|
8. **Round-3 STRATEGIC FINDING (2026-07-19): MECH.HPP is the capstone, not a prerequisite.**
|
|
Full read of the port's mech.hpp (1,223 lines): it is a hybrid — 1995 skeleton + Recon
|
|
proxies (ReconChain/BTVal/ReconSeq...) + port-only members (MP mirrors, audio-fidelity
|
|
rings, collision-economy guards) + members relocated for the 2007 engine — and regions of
|
|
the 0x854-byte binary object are still UNMAPPED (owned by the not-yet-reconstructed
|
|
mech2-4 slices). The literal MECH.HPP must GROW with the mech TU reconstructions (staged
|
|
interface + `reserved[]` filler, tightened per TU), exactly as the original grew.
|
|
Dependent headers ship with their TUs; the corrected order is in source410/README.
|
|
BTREG.CPP scope note: it includes the ENTIRE game-header world (mech/projtile/missile/
|
|
btplayer/btteam/btmssn + engine director/hostmgr/app) — it is the closure's natural FINAL
|
|
integration test: BTREG.CPP compiling green = the header-reconstruction milestone itself.
|
|
9. ✅✅ **THE MILESTONE (2026-07-19, same session): THE WHOLE 4.10 TREE COMPILES — 11/11.**
|
|
All 10 surviving originals + the reconstructed BTL4APP.CPP pilot build clean under BC4.52
|
|
with the authentic OPT flags (btl4app.obj 18.5KB; PCH gate retired — bt.hpp/mungal4.hpp
|
|
pull their full include sets; DPL SDK roots on the include line). Route: layout_probe
|
|
pinned the base boundary (JointedMover 0x328; 3/3 alloc-size validation) → 13 STAGED
|
|
headers ([T3] reserved[]-parked layouts, interfaces PROVEN by the surviving consumers:
|
|
PPC/GAUSS pin Emitter, BTREG pins BTPlayer::MakeMessage 10-arg + BTCameraDirector,
|
|
BTTOOL pins the 7 Mech::Create* statics, the pilot pins the mapper ctors) →
|
|
compile-fix loop to green. En route: BTPlayer__MakeMessage = Player's 8-arg base +
|
|
roleName/teamName CStrings [T1 via BTREG]; DPLRenderer lives in l4video.hpp;
|
|
ApplicationManager::GetFrameRate() = the audio-rate source (APPMGR.HPP:22).
|
|
Evidence ledger: source410/BT/STAGED-HEADERS.NOTES.md. REMAINING for a LINKABLE
|
|
btl4opt: the ~40 missing TU BODIES (917 fn manifest) — the header skeleton they grow
|
|
into now exists and compiles.
|