build(steam): stage steam_api64.dll beside the exe — one file, not the whole SDK

The SDK zip is 24 MB of headers, examples and tools we never build. The runtime
dependency is one native library, so scripts/steam-sdk.sh extracts exactly
sdk/redistributable_bin/win64/steam_api64.dll into steam/ (gitignored, like ffmpeg/ —
the script is the audit trail) and writes steam_appid.txt = 480, Valve's Spacewar app,
so SteamAPI.Init() resolves an app id locally before LlamaCasty has one of its own.

Two csproj details that would have cost a debugging session:
- Link="steam_api64.dll" puts it BESIDE the exe; without Link, None items keep their
  relative path and it lands in steam/, where the loader does not look.
- ExcludeFromSingleFile, for the same reason ffmpeg needed it: a native DLL otherwise
  gets swallowed into the single-file bundle and cannot be loaded at runtime.

steam_appid.txt is Debug-only — Valve's guidance is not to ship it — and the publish
output confirms it: dll present at the root, no appid file, exe still 127 MB (proof the
DLL was not bundled).

Also queued, as asked: preview undo (Ctrl+Z / Ctrl+Shift+Z) in edit mode, noted as the
partner to the defaults-vs-current split — undo covers the slip, defaults cover the mess.
This commit is contained in:
2026-11-01 07:23:29 -08:00
parent 27fc6fb507
commit 1fe84be64a
5 changed files with 71 additions and 3 deletions
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# steam-sdk.sh — extract the one file the app needs from the Steamworks SDK, and stage the
# local-only app id.
#
# Why not unzip the whole SDK: it is ~24 MB of C++ headers, examples and tools we never build.
# The runtime dependency is exactly one native library, and the release tooling (ContentBuilder)
# is only needed on the machine that uploads a depot.
#
# ./scripts/steam-sdk.sh ~/Downloads/steamworks_sdk_165.zip
#
# steam_api64.dll is Valve's redistributable — shipping it beside a Steam-published exe is
# permitted by the Steamworks terms. It is NOT committed: steam/ is gitignored, like ffmpeg/.
set -euo pipefail
ZIP="${1:-$HOME/Downloads/steamworks_sdk_165.zip}"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
[ -f "$ZIP" ] || { echo "❌ SDK zip not found: $ZIP" >&2; echo " Download it from partner.steamgames.com/downloads/steamworks_sdk.zip while signed in." >&2; exit 1; }
mkdir -p "$ROOT/steam"
python3 - "$ZIP" "$ROOT" <<'PY'
import sys, zipfile, pathlib
zip_path, root = sys.argv[1], pathlib.Path(sys.argv[2])
want = "sdk/redistributable_bin/win64/steam_api64.dll"
dest = root / "steam" / "steam_api64.dll"
with zipfile.ZipFile(zip_path) as z:
with z.open(want) as src, open(dest, "wb") as out:
out.write(src.read())
print(f"✓ {dest.relative_to(root)} ({dest.stat().st_size // 1024} KB)")
PY
# steam_appid.txt is a LOCAL TESTING affordance: it lets SteamAPI.Init() resolve an app id
# without going through the Steam client. 480 is Valve's public Spacewar test app, so the app
# can be exercised before LlamaCasty has an app id of its own. It is Debug-only in the csproj
# and must never ship in a depot — Valve's guidance is to remove it from release builds.
printf '480\n' > "$ROOT/steam/steam_appid.txt"
echo "✓ steam/steam_appid.txt = 480 (Spacewar, local Debug testing only)"
echo ""
echo "Next: the entitlement seam (IEntitlement + SteamApps.BIsDlcInstalled)."