Files
LlamaCasty/scripts/steam-sdk.sh
T
gramps ff5e8d94ae feat(entitlement): pivot to paid app ownership
Check Steam ownership of the paid app with BIsSubscribedApp; keep Debug fake ownership out of Release. Ref: https://partner.steamgames.com/doc/api/ISteamApps#BIsSubscribedApp
2026-11-02 09:18:03 -08:00

76 lines
3.1 KiB
Bash

#!/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
# ./scripts/steam-sdk.sh ~/Downloads/steamworks_sdk_165.zip --contentbuilder
#
# --contentbuilder also extracts sdk/tools/ContentBuilder into steam/contentbuilder/ — that is
# the release tooling (steamcmd + the app_build/depot vdf templates). It is a separate opt-in
# because it is only needed on the machine that uploads a depot, and it is ~12 MB of binaries.
#
# 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}"
WANT_CONTENTBUILDER="${2:-}"
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)"
if [ "$WANT_CONTENTBUILDER" = "--contentbuilder" ]; then
python3 - "$ZIP" "$ROOT" <<'PY'
import sys, zipfile, pathlib
zip_path, root = sys.argv[1], pathlib.Path(sys.argv[2])
prefix = "sdk/tools/ContentBuilder/"
dest = root / "steam" / "contentbuilder"
count = 0
with zipfile.ZipFile(zip_path) as z:
for name in z.namelist():
if not name.startswith(prefix) or name.endswith("/"):
continue
target = dest / name[len(prefix):]
target.parent.mkdir(parents=True, exist_ok=True)
with z.open(name) as src, open(target, "wb") as out:
out.write(src.read())
count += 1
print(f"✓ steam/contentbuilder/ ({count} files)")
print(" Windows upload: steam/contentbuilder/builder/steamcmd.exe +login <user> +run_app_build <vdf>")
PY
fi
echo ""
echo "Next: configure the paid Steam App ID for IEntitlement (SteamApps.BIsSubscribedApp)."