diff --git a/docs/RP412-LINUX.md b/docs/RP412-LINUX.md index 728ac86..6f37c7a 100644 --- a/docs/RP412-LINUX.md +++ b/docs/RP412-LINUX.md @@ -121,6 +121,13 @@ is genuinely required; Steam installs it as a depot prerequisite.) calls (texture format conversion at load — shipping textures in device format skips it) and 150 `OptimizeInplace` calls (the `.X` loader; baking meshes to an in-house format at build time would retire the `.X` dependency). +- **Swap Creative's OpenAL for OpenAL Soft** — the same shape of bug as the + `d3dx9_43.dll` one above: `pack-dist.ps1` copies `OpenAL32.dll` out of the + build machine's `SysWOW64`, and what ships is Creative's 2009 router + + `wrap_oal.dll` + a 791 KB installer. Bundling OpenAL Soft instead means the + same implementation runs on Windows and Linux. Scoped in + [RP412-UNIFIED-BUILD.md](RP412-UNIFIED-BUILD.md) — near-term, independent of + the port. - **The native port** is scoped separately in [RP412-UNIFIED-BUILD.md](RP412-UNIFIED-BUILD.md) (proposal, not scheduled). Its survey supersedes several figures in §1 and §3 below — notably that diff --git a/docs/RP412-UNIFIED-BUILD.md b/docs/RP412-UNIFIED-BUILD.md index f48f5de..597ca9f 100644 --- a/docs/RP412-UNIFIED-BUILD.md +++ b/docs/RP412-UNIFIED-BUILD.md @@ -12,6 +12,61 @@ tree producing a native binary on both platforms — and exists because the question "what would that actually take?" deserved a real answer rather than a guess. +## Do this one now, independent of the plan + +**Swap Creative's OpenAL for OpenAL Soft.** This is not port work. It is the +same shape of problem as the `d3dx9_43.dll` bug found on 2026-08-14 — a runtime +dependency the build machine quietly satisfies — and it is worth fixing on +Windows whether or not any of the phases below ever run. + +What ships today is Creative's 2009-era stack: `OpenAL32.dll` v6.14 is only a +**router** that dispatches to `wrap_oal.dll` v2.2.0.5 (the real implementation), +with `oalinst.exe` (791 KB) bundled as a fallback installer. Worse, +`pack-dist.ps1` copies `OpenAL32.dll` **out of the build machine's `SysWOW64`**, +so the audio stack that ships is whatever happened to be installed on the +machine that packed it. The router architecture exists so multiple vendors' +implementations could coexist, which stopped mattering fifteen years ago. + +The work: + +- Bundle **OpenAL Soft** — ship its `soft_oal.dll` renamed to `OpenAL32.dll`, + vendored in the repo like `steam_api.dll` is, not copied from the system. +- Delete `wrap_oal.dll` and `oalinst.exe` from `dist\` and from + `pack-dist.ps1`; drop the "copy from `SysWOW64` if present" branch. Net + ~1.2 MB smaller. +- Replace the vendored Creative headers in `MUNGA_L4\openal\` with OpenAL + Soft's. Only `al.h`, `alc.h` and `efx.h` are ever included (11 sites across + 10 files) — `efx-creative.h`, `EFX-Util.h` and `xram.h` are referenced by + **nothing** and can simply go. +- Replace `lib\OpenAL32.lib` with OpenAL Soft's import library. + +Why it is worth doing on its own merits: + +- **The same implementation then runs on both platforms**, since Linux distros + ship OpenAL Soft as `libopenal.so`. Audio bugs reproduce across platforms + instead of being "works on my Windows." +- It removes the **only `__declspec` in the entire tree**, which lives in + Creative's `al.h`. +- It ends the silent dependency on the packing machine's system state. + +Licensing is unremarkable: OpenAL Soft is LGPL, and shipping it as a separate, +dynamically-linked DLL is the standard compliant arrangement for a closed-source +game. + +*Verify: audio plays in a mission; EFX reverb still engages (`EFX_Available()` +in `L4AUDEFX.cpp` — it probes `ALC_EXT_EFX` and degrades silently, so confirm +the log does **not** say "filters and reverb inert"); the two-pod harness +passes; `dist\` contains no `wrap_oal.dll` or `oalinst.exe`.* + +**What this does *not* do: remove OpenAL.** The API is cross-platform and is +precisely why audio barely features in the phases below — all ~91 call sites +compile unchanged against `libopenal.so`. Dropping OpenAL entirely is possible +in principle (the game disables OpenAL's own attenuation and Doppler, does its +own 3D math, and never streams — it is using OpenAL as little more than a +mixer) but would mean reimplementing EFX reverb and rewriting ~91 working call +sites to remove a dependency that causes no portability problem. Not +recommended. + ## The four decisions this plan assumes Taken 2026-08-14. Changing any of them changes the plan's shape.