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(run): stop a launch whose prefix Wine did not finish and say why
raymondchinscb8ac12acfbc
diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.shindex 8823932..d203c41 100755--- a/dylib/feats/compat_run.sh+++ b/dylib/feats/compat_run.sh@@ -1330,6 +1330,23 @@ note_prefix_volume() {notify_user "This Steam library is not on APFS" "It is formatted $fs. Games run from it may hang or fail to start. Move the game to a library on an APFS drive for the best results."}+# Without C:\windows\system32 Wine stops at "could not load kernel32.dll" and the game quits+# with no window. exFAT and FAT have no symbolic links, so dosdevices/c: cannot exist there.+refuse_broken_prefix() {+ [ ! -f "$WINEPREFIX/dosdevices/c:/windows/system32/kernel32.dll" ] || return 0+ vol=$(volume_type "$STEAM_COMPAT_DATA_PATH") || vol=""+ fs=${vol%% *}+ echo "=== the prefix has no C:\\windows\\system32\\kernel32.dll, Wine did not finish building it ===" \+ >> "$log" 2>&1 || true+ case "$fs" in+ exfat|msdos|ntfs)+ show_alert "This Steam library cannot hold the game's prefix" "It is formatted $fs, which has no symbolic links, so Wine cannot set up the game here. Move the game to a library on an APFS drive." ;;+ *)+ show_alert "The game's prefix could not be set up" "Wine did not finish building it. Rebuild the prefix in Bridgeplay, then launch again. bridgeplay-run.log has the details." ;;+ esac+ return 1+}+# Steam keeps a game's prefix in the library that holds the game, so a game moved to another# library starts over with an empty one: saves and launcher sign-ins kept only in the old# prefix seem lost. Names the old one when a new prefix is about to be built.@@ -2192,6 +2209,8 @@ if [ -n "$STEAM_COMPAT_DATA_PATH" ]; then# A prefix that Wine built just now only has dosdevices from this point on.stage_step="game drive"map_game_drive+ stage_step="prefix check"+ refuse_broken_prefix || exit 1fistage_step="graphics backend"diff --git a/dylib/tests/prefixnotecheck.sh b/dylib/tests/prefixnotecheck.shindex 81b140f..3ba6c28 100755--- a/dylib/tests/prefixnotecheck.sh+++ b/dylib/tests/prefixnotecheck.sh@@ -1,20 +1,22 @@#!/bin/sh# A new prefix names an older one for the same game in another Steam library, and every run-# logs the file system of the library holding the prefix.+# logs the file system of the library holding the prefix. A prefix Wine did not finish stops the launch.# shellcheck disable=SC2016 # the sh -ec program expands its own variablesset -eSRC="${1:-$(dirname "$0")/../feats/compat_run.sh}"[ -f "$SRC" ] || { echo "prefixnotecheck: $SRC not present, skipped"; exit 0; }-body=$(sed -n '/^volume_type() {/,/^}/p;/^note_prefix_volume() {/,/^}/p;/^steam_libraries() {/,/^}/p;/^note_other_prefixes() {/,/^}/p' "$SRC")+body=$(sed -n '/^volume_type() {/,/^}/p;/^note_prefix_volume() {/,/^}/p;/^steam_libraries() {/,/^}/p;/^note_other_prefixes() {/,/^}/p;/^refuse_broken_prefix() {/,/^}/p' "$SRC")case "$body" in- *note_prefix_volume*note_other_prefixes*) ;;+ *note_prefix_volume*refuse_broken_prefix*note_other_prefixes*) ;;*) echo "FAIL: the prefix notes were not found in $SRC"; exit 1 ;;esacbody="$body"'-notify_user() { printf "%s|%s\n" "$1" "$2" >> "$notes"; }'+notify_user() { printf "%s|%s\n" "$1" "$2" >> "$notes"; }+show_alert() { printf "%s|%s\n" "$1" "$2" >> "$notes"; }'-work=$(cd "$(mktemp -d)" && pwd -P)+# a failed mktemp must not leave work at the current folder, which the trap deletes+work=$(mktemp -d) && work=$(cd "$work" && pwd -P) || exit 1trap 'rm -rf "$work"' EXITfails=0@@ -88,6 +90,29 @@ run 1 ""has "an unknown file system is logged" "volume: compatdata on unknown" "$work/log"is "an unknown file system does not notify" "" "$(cat "$work/notes")"+echo "== a prefix Wine did not finish"+pfx="$two/steamapps/compatdata/42/pfx"+check_prefix() { # check_prefix FS: prints the exit status+ : > "$work/log"+ : > "$work/notes"+ env log="$work/log" notes="$work/notes" body="$body" fs="$1" WINEPREFIX="$pfx" \+ STEAM_COMPAT_DATA_PATH="$two/steamapps/compatdata/42" \+ sh -c 'eval "$body"; volume_type() { [ -z "$fs" ] || echo "$fs /Volumes/Drive"; }+ refuse_broken_prefix; echo $?'+}+is "no dosdevices stops the launch" 1 "$(check_prefix apfs)"+has "it is logged" "Wine did not finish building it" "$work/log"+has "the player is told to rebuild" "The game's prefix could not be set up|Wine did not finish building it. Rebuild the prefix" "$work/notes"+is "exFAT stops the launch" 1 "$(check_prefix exfat)"+has "exFAT names the file system" "This Steam library cannot hold the game's prefix|It is formatted exfat" "$work/notes"+mkdir -p "$pfx/drive_c/windows/system32" "$pfx/dosdevices"+ln -s ../drive_c "$pfx/dosdevices/c:"+is "C: without kernel32.dll stops the launch" 1 "$(check_prefix apfs)"+: > "$pfx/drive_c/windows/system32/kernel32.dll"+is "a finished prefix launches" 0 "$(check_prefix apfs)"+is "a finished prefix says nothing" "" "$(cat "$work/notes" "$work/log")"+rm -rf "$pfx/dosdevices" "$pfx/drive_c"+echo "== the real mount table"real=$(env body="$body" sh -ec 'eval "$body"; volume_type /')case "$real" in apfs\ /*|hfs\ /*) ok "/ is read as \"$real\"" ;; *) bad "/ reads as a file system and mount point" "apfs /" "$real" ;; esac