vice city online: the bare online core

This commit is contained in:
CRTkafa 2026-11-17 14:27:34 +07:00
commit 2f98475c19
256 changed files with 144219 additions and 0 deletions

53
build.sh Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Builds the game engine from YOUR copy of reVC plus this repo.
#
# This repo does not contain reVC and does not say where to get it. Bring your own copy:
# ./build.sh /path/to/reVC a folder (a git checkout or plain files)
# ./build.sh https://host/reVC.git a git address you have the right to use
#
# Needs: bash, git, and Emscripten (emsdk) 6.0.13 or newer: EMSDK=/path/to/emsdk (default /opt/emsdk).
# Result: web/dist/revc.js, revc.wasm (+ the -jspi pair). Game data comes from your own copy of the game.
set -euo pipefail
ROOT=$(cd "$(dirname "$0")" && pwd)
BASE=$(cat "$ROOT/patches/REVC_BASE")
SRC=${1:-}
JOBS=${JOBS:-$(nproc 2>/dev/null || echo 8)}
[ -n "$SRC" ] || { sed -n '2,9p' "$0" | sed 's/^# \{0,1\}//'; exit 2; }
WORK="$ROOT/build/revc"
rm -rf "$WORK"; mkdir -p "$ROOT/build"
echo "== reVC from $SRC"
if [ -d "$SRC" ]; then
if [ -d "$SRC/.git" ]; then git clone -q "$SRC" "$WORK"; else cp -a "$SRC" "$WORK"; fi
else
git clone -q "$SRC" "$WORK"
fi
cd "$WORK"
if [ -d .git ] && git cat-file -e "$BASE^{commit}" 2>/dev/null; then
git -c advice.detachedHead=false checkout -q "$BASE"
APPLY=(git apply --3way --whitespace=nowarn)
echo "== at reVC $BASE"
else
echo "!! this copy is not a git checkout holding reVC $BASE: trying anyway, the patch may not fit"
[ -d .git ] || git init -q
APPLY=(git apply --whitespace=nowarn)
fi
echo "== our changes to reVC"
"${APPLY[@]}" "$ROOT/patches/revc.patch"
while IFS= read -r f; do [ -n "$f" ] && rm -rf -- "$f"; done < "$ROOT/patches/revc-removed.txt"
echo "== our own code"
for d in src vendor web tools gamefiles; do [ -d "$ROOT/$d" ] && cp -a "$ROOT/$d/." "$WORK/$d/"; done
echo "== engine ($JOBS jobs)"
# Both engines: the page gives browsers that switch stacks themselves (Chrome) revc-jspi, the others revc. The
# second build only links again.
bash tools/build-web.sh "$JOBS"
WEB_ASYNC=jspi bash tools/build-web.sh "$JOBS"
mkdir -p "$ROOT/web/dist"
# Everything the build put there: the engine, and the page when the build copies it in.
cp -a web/dist/. "$ROOT/web/dist/"
echo "== done: $ROOT/web/dist"
ls -la "$ROOT/web/dist" | grep revc