Files
DroidDeck/tools/packs/build.sh
T
K11MCH1andMaxsTechReview 367151be2c fix(epic): start parent-checking Epic titles under an EpicGamesLauncher.exe stand-in and stage their Rockstar SDK (#2932)
* fix(epic): start Epic titles that check their parent under an EpicGamesLauncher.exe stand-in

Rockstar's launcher only accepts an Epic copy of GTA V when a process
named EpicGamesLauncher.exe started it. DroidDeck's Epic client is a
Linux program, so the launcher logged "Epic Games Launcher not detected
as parent process", failed to relaunch through Epic and showed the game
as unowned.

- tools/epic-launcher: a small Windows EpicGamesLauncher.exe that starts
  the game with the rest of its own command line, unchanged, waits for
  it and returns its exit code. It ships as the epic add-on pack.
- The Epic .droiddeck-launch.bat runs the game through it for Epic
  titles known to need it (GTA V, GTA V Enhanced, RDR2, RDR, GTA SA DE,
  Returnal, Phantom Blade: Executioners), or for any Epic game whose
  per-game environment sets DD_EPIC_PARENT=1; DD_EPIC_PARENT=0 turns it
  off. Those titles also start without Steam's SteamAppId. Without the
  staged stand-in the game starts directly, as before.
- Steam launch options now reach Epic games (%*).
- The launch hook fetches the pack when such a title finds it missing.
- Rockstar's launcher found no Social Club SDK in the prefix and ran
  Social-Club-Setup.exe /silent, which never exits under Wine. For Epic
  titles that carry a Rockstar SDK installer, the hook now extracts the
  SDK from the launcher's own Redistributables copy (the version the
  launcher compares against) or, before the launcher is installed, from
  the game's copy, and registers it. It re-extracts when that installer
  changes and leaves the Rockstar Games Launcher key alone, so PlayGTAV
  still installs the launcher on first start.

* fix(epic): fetch the parent stand-in exactly when the game will use it; keep Cargo output out of source digests

The launch hook runs before droiddeck-game-env applies per-game
variables, so it now resolves DD_EPIC_PARENT through
droiddeck-game-env's own apply_config and game_id: an unlisted title
with DD_EPIC_PARENT=1 fetches the pack, a listed title with
DD_EPIC_PARENT=0 no longer waits for it.

runtime_inputs no longer hashes the target directory beside a Cargo.toml
under its source paths, so a local cargo build of a Windows helper does
not fail verify(). tools/epic-launcher gets the same .gitignore as the
other helpers.

* fix(epic): a DD_EPIC_PARENT in the game's sidecar env decides the stand-in fetch too

The .bat sets the sidecar's env before it reads DD_EPIC_PARENT, so that
value overrides the game environment there; the launch hook now gives it
the same precedence when deciding whether to fetch the pack.

* test(epic): keep an inherited DD_EPIC_PARENT out of the launch hook tests

---------

Co-authored-by: MaxsTechReview <maxjividen@gmail.com>
2026-11-21 09:56:31 +09:00

109 lines
5.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
here=$(cd "$(dirname "$0")" && pwd)
repo=$(cd "$here/../.." && pwd)
out=${1:?usage: build.sh <out-dir>}
mkdir -p "$out"
out=$(cd "$out" && pwd)
linuxfs="$repo/app/src/main/assets/linuxfs/usr/local/lib"
# shellcheck source=tracking/release.env
source "$here/tracking/release.env"
# shellcheck source=butler/release.env
source "$here/butler/release.env"
# shellcheck source=zstd/release.env
source "$here/zstd/release.env"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
sha256() { if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi; }
fetch() {
bash "$here/fetch-verified.sh" "$@"
}
zstd_version() { "$1" -V 2>/dev/null | sed -n 's/.* v\([0-9][0-9.]*\),.*/\1/p'; }
zstd=$(command -v zstd || true)
if [ -z "$zstd" ] || [ "$(zstd_version "$zstd")" != "$ZSTD_VERSION" ]; then
zstd="${DROIDDECK_PACK_CACHE:-"$HOME/.cache/droiddeck-pack-inputs"}/zstd-$ZSTD_VERSION/zstd"
if [ ! -x "$zstd" ] || [ "$(zstd_version "$zstd")" != "$ZSTD_VERSION" ]; then
fetch "https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz" \
"$ZSTD_SHA256" "$work/zstd.tar.gz"
tar -xzf "$work/zstd.tar.gz" -C "$work"
make -s -C "$work/zstd-$ZSTD_VERSION" -j"$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)" zstd-release >/dev/null
mkdir -p "$(dirname "$zstd")"
install -m755 "$work/zstd-$ZSTD_VERSION/programs/zstd" "$zstd.part.$$"
mv -f "$zstd.part.$$" "$zstd"
fi
fi
[ "$(zstd_version "$zstd")" = "$ZSTD_VERSION" ] || { echo "packs need zstd $ZSTD_VERSION, $zstd is not it" >&2; exit 1; }
pack() {
local name=$1 src=$2
shift 2
for required in "$@"; do
[ -f "$src/$required" ] || { echo "$name pack: $src/$required is missing" >&2; exit 1; }
done
python3 -I - "$src" "$work/$name.tar" <<'EOF'
import os, sys, tarfile
src, dest = sys.argv[1], sys.argv[2]
files = []
for base, dirs, names in os.walk(src):
dirs.sort()
for name in names:
path = os.path.join(base, name)
if os.path.islink(path) or not os.path.isfile(path):
sys.exit(f"{path}: only regular files can be packed")
files.append(os.path.relpath(path, src))
with tarfile.open(dest, "w", format=tarfile.USTAR_FORMAT) as tar:
for rel in sorted(files):
path = os.path.join(src, rel)
info = tar.gettarinfo(path, arcname=rel)
info.mtime, info.uid, info.gid, info.uname, info.gname = 0, 0, 0, "", ""
info.mode = 0o755 if os.stat(path).st_mode & 0o111 else 0o644
with open(path, "rb") as f:
tar.addfile(info, f)
EOF
"$zstd" -q -19 -f "$work/$name.tar" -o "$out/$name.tar.zst"
echo "$name $(sha256 "$out/$name.tar.zst") $(wc -c < "$out/$name.tar.zst" | tr -d ' ')"
}
mkdir "$work/tracking"
fetch "https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task" \
fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1 "$work/tracking/hand_landmarker.task"
fetch "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task" \
59929e1d1ee95287735ddd833b19cf4ac46d29bc7afddbbf6753c459690d574a "$work/tracking/pose_landmarker_lite.task"
cp "$here/tracking/hand_landmarker_lite.task" "$work/tracking/"
[ "$(sha256 "$work/tracking/hand_landmarker_lite.task")" = 173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8 ] || {
echo "checksum mismatch for hand_landmarker_lite.task" >&2; exit 1; }
fetch "https://repo1.maven.org/maven2/org/opencv/opencv/${OPENCV_VERSION}/opencv-${OPENCV_VERSION}.aar" \
"$OPENCV_AAR_SHA256" "$work/opencv.aar"
fetch "https://dl.google.com/dl/android/maven2/com/google/mediapipe/tasks-core/${MEDIAPIPE_VERSION}/tasks-core-${MEDIAPIPE_VERSION}.aar" \
"$MEDIAPIPE_AAR_SHA256" "$work/tasks-core.aar"
unzip -q -j "$work/opencv.aar" jni/arm64-v8a/libopencv_java4.so -d "$work/tracking"
unzip -q -j "$work/tasks-core.aar" jni/arm64-v8a/libmediapipe_tasks_jni.so -d "$work/tracking"
chmod 0644 "$work/tracking"/*
mkdir "$work/proot"
install -m755 "$repo/app/src/main/jniLibs/arm64-v8a/libproot.so" "$repo/app/src/main/jniLibs/arm64-v8a/libproot-loader.so" "$work/proot/"
pack proot "$work/proot" libproot.so libproot-loader.so
pack directaudio "$repo/app/src/main/assets/directaudio" \
linux-wine11/version.txt linux-wine11-systhread/version.txt
pack tracking "$work/tracking" hand_landmarker.task hand_landmarker_lite.task pose_landmarker_lite.task \
libopencv_java4.so libmediapipe_tasks_jni.so
pack xbox "$linuxfs/droiddeck-xbox" version xodus-cli xodus-service
pack comet "$linuxfs/droiddeck-comet" version comet
pack powervr "$repo/app/src/main/assets/hybris" runtime.tzst version.txt
[ ! -f "$linuxfs/droiddeck-ubisoft/droiddeck-upc.exe" ] || pack ubisoft "$linuxfs/droiddeck-ubisoft" droiddeck-upc.exe
[ ! -f "$linuxfs/droiddeck-rockstar/Launcher64.exe" ] || pack rockstar "$linuxfs/droiddeck-rockstar" Launcher32.exe Launcher64.exe
[ ! -f "$linuxfs/droiddeck-dirt/ws2_32.dll" ] || pack dirt "$linuxfs/droiddeck-dirt" ws2_32.dll
[ ! -f "$linuxfs/droiddeck-epic/EpicGamesLauncher.exe" ] || pack epic "$linuxfs/droiddeck-epic" EpicGamesLauncher.exe
mkdir "$work/butler"
fetch "https://broth.itch.zone/butler/linux-arm64/${BUTLER_VERSION}/archive/default" \
"$BUTLER_ZIP_SHA256" "$work/butler.zip"
unzip -q -j "$work/butler.zip" butler 7z.so libc7zip.so -d "$work/butler"
printf '%s\n' "$BUTLER_VERSION" > "$work/butler/version"
pack butler "$work/butler" version butler 7z.so libc7zip.so