Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
Fix EA launcher
NotProtonNot856c0ef995e7
diff --git a/.github/workflows/app.yml b/.github/workflows/app.ymlindex f820073..d060243 100644--- a/.github/workflows/app.yml+++ b/.github/workflows/app.yml@@ -103,6 +103,7 @@ jobs:make -s launch-shellmake -s envcheckmake -s buildcheck+ make -s routecheck- name: Run the Swift testsrun: make -s app-testsdiff --git a/Makefile b/Makefileindex 43e1ad5..e1c8da7 100644--- a/Makefile+++ b/Makefile@@ -61,7 +61,7 @@ DEPS := $(OBJS:.o=.d)tests-list overlay-shim overlay-shim-install overlay-shim-tests \overlay-shim-bench iconmaker icon \appinfo helpers-install ntdll-resolve bridge runcheck compatcheck \- compatsvc-check scriptcheck envcheck buildcheck launch-shell FORCE+ compatsvc-check scriptcheck envcheck buildcheck routecheck launch-shell FORCEAPP_PAYLOAD := app/Sources/NotProtonApp/Resources/payload@@ -96,6 +96,10 @@ buildcheck:@if [ ! -f dylib/tests/buildcheck.sh ]; then $(call SKIP,buildcheck,dylib/tests/buildcheck.sh); exit 0; fi; \sh dylib/tests/buildcheck.sh dylib/feats/compat_run.sh+routecheck:+ @if [ ! -f dylib/tests/routecheck.sh ]; then $(call SKIP,routecheck,dylib/tests/routecheck.sh); exit 0; fi; \+ sh dylib/tests/routecheck.sh dylib/feats/compat_run.sh+# runcheck owns compat_run.sh, whose warnings wait for a change that can move# the embedded __text baselineSCRIPTS := $(shell git ls-files '*.sh' 2>/dev/null | grep -v '^dylib/feats/compat_run\.sh$$')diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.shindex 908dc68..9939def 100755--- a/dylib/feats/compat_run.sh+++ b/dylib/feats/compat_run.sh@@ -112,8 +112,16 @@ case "$app_id" in ''|0) app_id=$(basename "$STEAM_COMPAT_DATA_PATH" 2>/dev/null)case "$app_id" in ''|*[!0-9]*) app_id=0 ;; esacecho "app_id=$app_id (STEAM_COMPAT_APP_ID=$STEAM_COMPAT_APP_ID)" >> "$log" 2>&1 || true-[ -n "$SteamAppId" ] || export SteamAppId="$app_id"-[ -n "$SteamGameId" ] || export SteamGameId="$app_id"+# Steam does not set SteamAppId or SteamGameId for helpers like the install-script+# evaluator. If they are set, SteamAPI_Init registers the helper as the running game so the+# real launch fails with AppError_16. Not applicable to non-Steam shortcuts, which come in+# as waitforexitandrun.+case "$verb" in+ waitforexitandrun)+ [ -n "$SteamAppId" ] || export SteamAppId="$app_id"+ [ -n "$SteamGameId" ] || export SteamGameId="$app_id"+ ;;+esacprefix_machine() {dll="$WINEPREFIX/drive_c/windows/system32/ntdll.dll"@@ -515,15 +523,28 @@ echo "launch_args=$launch_args" >> "$log" 2>&1 || trueecho "=== launching ($verb): $WINELOADER $* ===" >> "$log" 2>&1 || truetarget="$1"-case "$target" in- "$STEAM_COMPAT_INSTALL_PATH"/*) foreground=1 ;;+# A game can arrive as a URL with no install path to match, so the verb has to decide the route.+case "$verb" in+ waitforexitandrun) foreground=1 ;;*) foreground=0 ;;esac+shim_exe="C:\\Program Files (x86)\\Steam\\steam.exe"+if [ "$foreground" = 0 ]; then- echo "=== running helper on raw loader: $* ===" >> "$log" 2>&1 || true- "$WINELOADER" "$@" >> "$log" 2>&1- status=$?+ status=0 # set -e would exit before the status is read+ case "$verb" in+ # runinprefix is the one verb the Linux client keeps on the raw loader.+ runinprefix)+ echo "=== running helper on raw loader: $* ===" >> "$log" 2>&1 || true+ "$WINELOADER" "$@" >> "$log" 2>&1 || status=$?+ ;;+ *)+ # A helper target can be a URL, which steam.exe resolves.+ echo "=== running helper through the shim: $* ===" >> "$log" 2>&1 || true+ "$WINELOADER" "$shim_exe" "$@" >> "$log" 2>&1 || status=$?+ ;;+ esacecho "=== helper exited status=$status ===" >> "$log" 2>&1 || trueexit $statusfi@@ -765,8 +786,6 @@ terminate() {}trap terminate TERM INT HUP-shim_exe="C:\\Program Files (x86)\\Steam\\steam.exe"-game_cwd="$(pwd)"if [ -n "$STEAM_DYLD_INSERT_LIBRARIES" ]; thenecho "=== overlay injected from $STEAM_DYLD_INSERT_LIBRARIES ===" >> "$log" 2>&1 || truediff --git a/dylib/tests/routecheck.sh b/dylib/tests/routecheck.shnew file mode 100755index 0000000..0f59f98--- /dev/null+++ b/dylib/tests/routecheck.sh@@ -0,0 +1,95 @@+#!/bin/sh+# shellcheck disable=SC2016 # the sh -ec program expands its own variables+set -e+SRC="${1:-$(dirname "$0")/../feats/compat_run.sh}"+[ -f "$SRC" ] || { echo "routecheck: $SRC not present, skipped"; exit 0; }++body=$(sed -n '/^target="\$1"$/,/^fi$/p' "$SRC")+[ -n "$body" ] || { echo "FAIL: the launch routing not found in $SRC"; exit 1; }+case "$body" in+ *'case "$verb" in'*) ;;+ *) echo "FAIL: the routing no longer decides on the verb"; exit 1 ;;+esac++work=$(mktemp -d)+trap 'rm -rf "$work"' EXIT++cat > "$work/wine" <<'EOF'+#!/bin/sh+printf '%s\n' "$*" >> "$FAKE_CALLS"+exit "${FAKE_STATUS:-0}"+EOF+chmod +x "$work/wine"++fails=0+ok() { printf ' ok %s\n' "$1"; }+bad() { printf ' FAIL %s\n want [%s]\n got [%s]\n' "$1" "$2" "$3"; fails=$((fails + 1)); }+is() { if [ "$2" = "$3" ]; then ok "$1"; else bad "$1" "$2" "$3"; fi; }++shim='C:\Program Files (x86)\Steam\steam.exe'+url='steam2ea://launchgame/1222670?platform=steam&theme=ts4'++case_dir=""+route() {+ verb="$1"+ shift+ case_dir=$(mktemp -d "$work/case.XXXXXX")+ : > "$case_dir/calls"+ : > "$case_dir/log"+ env WINELOADER="$work/wine" STEAM_COMPAT_INSTALL_PATH=/g \+ FAKE_STATUS="${FAKE_STATUS:-0}" FAKE_CALLS="$case_dir/calls" \+ log="$case_dir/log" body="$body" verb="$verb" \+ sh -ec 'eval "$body"; echo "fell through foreground=$foreground"' \+ "$verb" "$@" > "$case_dir/out" 2>&1 || true+}+calls() { cat "$case_dir/calls"; }+out() { cat "$case_dir/out"; }+status() { sed -n 's/^=== helper exited status=\([0-9]*\) ===$/\1/p' "$case_dir/log"; }++echo "== the game goes to the window path, whatever shape the target has"+route waitforexitandrun /g/game.exe+is "an exe under the install path falls through" "fell through foreground=1" "$(out)"+is "and the loader is not called there" "" "$(calls)"+route waitforexitandrun "$url"+is "a protocol URL falls through too" "fell through foreground=1" "$(out)"+is "and the loader is not called there either" "" "$(calls)"++echo "== helpers go through the shim"+route run /c/legacycompat/iscriptevaluator.exe 'legacycompat\evaluatorscript_1222670.vdf'+is "run puts steam.exe in front of the helper" \+ "$shim /c/legacycompat/iscriptevaluator.exe legacycompat\\evaluatorscript_1222670.vdf" "$(calls)"+route run "$url"+is "a URL reaches the shim rather than the loader" "$shim $url" "$(calls)"++echo "== runinprefix keeps the raw loader"+route runinprefix /c/tool.exe --flag+is "no shim in front" "/c/tool.exe --flag" "$(calls)"++echo "== the helper's status is what Steam gets"+FAKE_STATUS=3 route run /c/helper.exe+FAKE_STATUS=0+is "a failing helper is logged with its status" 3 "$(status)"++echo "== a target with spaces stays one argument"+route run '/c/My Helper/helper.exe' '--opt=a b'+is "quoting survives the shim" "$shim /c/My Helper/helper.exe --opt=a b" "$(calls)"++echo "== only the game itself is given an app id"+ids=$(sed -n '/^app_id="\$STEAM_COMPAT_APP_ID"$/,/^esac$/p' "$SRC")+[ -n "$ids" ] || { echo "FAIL: the app id block not found in $SRC"; exit 1; }+gameid() {+ env -u SteamAppId -u SteamGameId verb="$1" STEAM_COMPAT_APP_ID=1222670 \+ log=/dev/null ids="$ids" \+ sh -ec 'eval "$ids"; echo "${SteamGameId:-unset}"'+}+is "the game is the game" 1222670 "$(gameid waitforexitandrun)"+is "a helper is not, or the shim reports it to Steam as a running app" \+ unset "$(gameid run)"+is "and neither is runinprefix" unset "$(gameid runinprefix)"++if [ "$fails" -eq 0 ]; then+ echo "==> routecheck: all assertions hold"+else+ echo "==> routecheck: $fails failed"+ exit 1+fi