option(BT412 ... ON) gates the steamification layer for the merge-back into BT411, so the unified repo serves both fronts: - Default (BT412=ON): pod/dev game + PadRIO / plasma / front end / lobby -- all runtime-gated, so a -egg/-net launch still behaves as 4.11. - Pod-minimal (-DBT412=OFF, build-pod/): compiles OUT L4PADRIO, L4PADBINDINGS, L4KEYLIGHT, L4PLASMASCREEN, L4STEAMTRANSPORT, btl4fe, btl4console, btl4lobby. Seam sites carry #ifdef BT412: L4CTRL.cpp PAD token (log + ignore), L4GREND.cpp L4PLASMA=SCREEN (log + ignore), L4VB16.cpp (inert PadRIO stub -- call sites identical in both flavors), btl4main.cpp (front-end/marshal/lobby blocks out; zero-arg launch = 4.11 behavior). - The NetTransport seam ALWAYS compiles -- it is the wire for both flavors (WinsockNetTransport, verified byte-identical to the pre-seam arcade path). - BT412_STEAM now requires BT412 (configure-time FATAL_ERROR; negative-tested). Verified: OFF -- clean v143 link, solo DEV.EGG mission runs (31 subsystems tick, gait, targeting). ON -- zero-arg launch engages the front-end menu. STEAM -- links clean, ships steam_api.dll. Also: README/context docs for the flavors + the merge-back; corrected the stale Phase 3b DEFERRED note (the single-window cockpit landed 07-16) and the README's leftover 0xBD3 valve-gate claim (it is a damage/explosion hub). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5.8 KiB
id, title, status, source_sections, related_topics, key_terms
| id | title | status | source_sections | related_topics | key_terms | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| build-and-run | Build / Run / Debug — recipe, repo layout, env gates | established | PROGRESS_LOG.md §10a, §10a-bis; README.md |
|
|
Build / Run / Debug
The one top-level CMakeLists.txt builds munga_engine (engine) + bt410_l4 (reconstructed BT
game lib) + btl4.exe. Full recipe + repo-layout map: docs/PROGRESS_LOG.md §10a / §10a-bis +
README.md. Env-gate table: decomp-reference §6.
Build (Win32 / VS2022 BuildTools — the DXSDK link libs are Lib/x86)
# configure once (BT412 toolchain of record, moved from VS2019/v142 at the 4.12 fork):
cmake -S . -B build -G "Visual Studio 17 2022" -A Win32 \
-DCMAKE_GENERATOR_INSTANCE="C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools"
# build:
cmake --build build --config Debug
Build flavors — the BT412 compile gate (2026-07-17, merge-back into BT411)
One tree builds both lines; option(BT412 ... ON) gates the steamification layer. [T2]
- Default (
BT412=ON) — pod/dev game + PadRIO/plasma/front end/lobby (all runtime-gated; a-egg/-netlaunch behaves as 4.11). Compile definitionBT412set on all 3 targets. - Pod-minimal (
-DBT412=OFF, dirbuild-pod/) — compiles OUTL4PADRIO,L4PADBINDINGS,L4KEYLIGHT,L4PLASMASCREEN,L4STEAMTRANSPORT,btl4fe,btl4console,btl4lobby. Seam sites carry#ifdef BT412:L4CTRL.cppPAD token (log + ignore),L4GREND.cppL4PLASMA=SCREEN(log + ignore),L4VB16.cpp(inertPadRIOstub struct — call sites identical in both flavors),btl4main.cpp(front-end/marshal/lobby blocks compile out; zero-arg launch = 4.11 behavior). The NetTransport seam always compiles — it is the wire for both flavors (WinsockNetTransportverified byte-identical to pre-seam arcade behavior). Verified: clean v143 link (no unresolved), solo-egg DEV.EGGruns (31 subsystems tick, gait, targeting). - Steam (
-DBT412_STEAM=ON, dirbuild-steam/) — requiresBT412=ON(configure-timeFATAL_ERRORotherwise; negative-tested). - Links DXSDK d3d9/d3dx9/dinput8 + OpenAL/libsndfile (
engine/lib/). DXSDK June 2010 atC:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\(overridable-DDXSDK). [T2] - Linker uses
/FORCE:MULTIPLE— tolerates the ~124 header-defined-global LNK2005s.UNRESOLVEDis gone (BT412, 2026-07-14): the v143 linker refuses to emit an image with unresolved externals even under/FORCE, so the dead offline-tool ladders inmech3.cpp(Mech::CreateSubsystemStream/Mech::SubsystemDefaultData— never called at runtime) are compiled out behindBT412_OFFLINE_TOOLS(default off). A genuinely unresolved symbol is now a hard LINK ERROR, not a hidden runtime AV — the reconstruction-gotchas §6 hazard class is retired for the exe link. No other source changes were needed for v143 (verified: clean build, solo DEV.EGG run, two-instance loopback MP with replication). [T2] - Editing an
engine/file rebuilds the engine lib automatically (one project). A NEW member on aDPLRenderer/d3d_OBJECTclass needs the game objs that embed its layout recompiled — delete stale objs if layout-mismatch corruption appears. [T2] - ⚠ Kill the running exe before rebuilding (
taskkill //F //IM btl4.exe) or you get LNK1104.
Run
run\run.cmd [EGG] # default DEV.EGG; cd's to content\ and runs btl4.exe -egg <EGG>
- cwd MUST be
content\— the engine resolvesBTL4.RES,VIDEO\,BTDPL.INI, eggs relative to cwd (theloadTablesgotcha:L4VIDEO.cpp:849fopen("VIDEO\\REPLACEMATS.tbl")is relative + unchecked → fread on NULL if cwd is wrong). Logs tobtl4.logincontent\(orBT_LOG=<file>). [T2] - 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'svehicle=(bhk1/madcat/…). The code path is mech-agnostic (verified — Mad Cat booted + fought with zero code changes). [T2]
Debug (cdb x86)
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe". Pattern for a faulting stack (cwd
= content): -g -c ".lines;sxe av;g;kp 24;q" with BT_ASSERT_TO_DEBUGGER=1. Debug CRT fills fresh
heap 0xCDCDCDCD (uninit) + freed 0xFEEEFEEE — invaluable for "was this ever constructed?".
BT_HEAPCHECK=1 = whole-heap validation every alloc/free (O(n²) at mission load — SLOW). To attach
to a frozen abort dialog: cdb -p <pid> -c ".lines;~*kp 30;q". [T2]
Repo layout (bt411)
engine/MUNGA/+engine/MUNGA_L4/— the shared 2007 MUNGA engine + Win32/D3D9 HAL (carries our BT render/loader work: bgfload/L4D3D/L4VIDEO + the image codec).engine/shim/(ATL),engine/lib/(OpenAL/libsndfile),engine/rp/(RP headers the audio HAL includes).game/reconstructed/— the reconstructed BT source (the bulk).game/original/BT/+BT_L4/— surviving original BT.cpp+ all BT headers (the include path).game/fwd/— ~186 forwarding shims (#include <EXPLODE.hpp>→../../engine/MUNGA/<NAME>.h).game/btl4main.cpp— the WinMain launcher.content/— the runtime tree (BTL4.RES, VIDEO/, GAUGE/, AUDIO/, eggs, BTDPL.INI). Run cwd.reference/decomp/— the raw Ghidra pseudocode (all/part_*.c) — the source-of-truth.docs/— the detailed ledgers (incl.PROGRESS_LOG.md, the full pre-restructure CLAUDE.md).tools/— btconsole.py, disas2.py, map/res scanners.context/— this knowledge base.
Key Relationships
- Base: wintesla-port (the engine build recipe).
- Verify loop: reconstruction-method; env gates: decomp-reference §6.