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
Fixes Prey
NotProtonNotd0a0e45a619b
diff --git a/app/Sources/NotProtonApp/Model/Uninstall.swift b/app/Sources/NotProtonApp/Model/Uninstall.swiftindex 729945e..33aef3b 100644--- a/app/Sources/NotProtonApp/Model/Uninstall.swift+++ b/app/Sources/NotProtonApp/Model/Uninstall.swift@@ -68,9 +68,10 @@ enum Uninstall {}report(.removing)- let removed = try remove(+ var removed = try remove(legacyCompat: legacyCompat, compatTools: compatTools, directories: directories)+ removed += try removeSteamDLLLinks(to: legacyCompat, in: libraries)let templateFailures = RunnerInstaller.removePrefixTemplates(keeping: [], libraries: libraries, removingFolder: true)if !templateFailures.isEmpty {@@ -130,4 +131,19 @@ enum Uninstall {}return removed}++ // Links the run script made point at legacycompat. Anything else at that name is left alone.+ static func removeSteamDLLLinks(to legacyCompat: URL, in libraries: [SteamLibrary]) throws -> [String] {+ let files = FileManager.default+ let target = legacyCompat.appending(path: "Steam.dll").path(percentEncoded: false)+ var removed: [String] = []+ for library in libraries {+ let link = library.steamapps.appending(path: "common/Steam.dll")+ let path = link.path(percentEncoded: false)+ guard (try? files.destinationOfSymbolicLink(atPath: path)) == target else { continue }+ try WriteRefused.catching(path) { try files.removeItem(at: link) }+ removed.append(link.lastPathComponent)+ }+ return removed+ }}diff --git a/app/Tests/NotProtonAppTests/UninstallTests.swift b/app/Tests/NotProtonAppTests/UninstallTests.swiftindex 4e7303c..bef984b 100644--- a/app/Tests/NotProtonAppTests/UninstallTests.swift+++ b/app/Tests/NotProtonAppTests/UninstallTests.swift@@ -383,6 +383,45 @@ struct UninstallTests {#expect(FileManager.default.fileExists(atPath: library.compatdata.appending(path: ".notproton-template.lock").path))}+ @Test("Uninstall removes the Steam.dll links it made and leaves any other Steam.dll")+ func removesSteamDLLLinks() async throws {+ let layout = try layout()+ defer { try? FileManager.default.removeItem(at: layout.root) }+ let files = FileManager.default+ let ours = SteamLibrary(root: layout.root.appending(path: "ours"))+ let foreign = SteamLibrary(root: layout.root.appending(path: "foreign"))+ let real = SteamLibrary(root: layout.root.appending(path: "real"))+ let empty = SteamLibrary(root: layout.root.appending(path: "empty"))+ func dll(_ library: SteamLibrary) -> URL { library.steamapps.appending(path: "common/Steam.dll") }+ for library in [ours, foreign, real] {+ try files.createDirectory(at: dll(library).deletingLastPathComponent(), withIntermediateDirectories: true)+ }+ try files.createSymbolicLink(+ atPath: dll(ours).path(percentEncoded: false),+ withDestinationPath: layout.legacyCompat.appending(path: "Steam.dll").path(percentEncoded: false))+ let elsewhere = layout.root.appending(path: "elsewhere/Steam.dll")+ try files.createDirectory(at: elsewhere.deletingLastPathComponent(), withIntermediateDirectories: true)+ try Data("other".utf8).write(to: elsewhere)+ try files.createSymbolicLink(+ atPath: dll(foreign).path(percentEncoded: false),+ withDestinationPath: elsewhere.path(percentEncoded: false))+ try Data("real".utf8).write(to: dll(real))++ let outcome = try await Uninstall.run(+ app: layout.app, innerPlist: layout.innerPlist, updateBlocks: [layout.updateBlock],+ legacyCompat: layout.legacyCompat, compatTools: layout.compatTools,+ directories: [layout.support, layout.caches], libraries: [ours, foreign, real, empty],+ repair: { _ in }, stop: { _ in false })++ #expect((try? files.destinationOfSymbolicLink(atPath: dll(ours).path(percentEncoded: false))) == nil)+ #expect(outcome.removed.filter { $0 == "Steam.dll" }.count == 1)+ #expect(+ try files.destinationOfSymbolicLink(atPath: dll(foreign).path(percentEncoded: false))+ == elsewhere.path(percentEncoded: false))+ #expect(try String(contentsOf: dll(real), encoding: .utf8) == "real")+ #expect(!files.fileExists(atPath: empty.root.path(percentEncoded: false)))+ }+@Test("Uninstall reports template cleanup refusal rather than claiming completion")func reportsTemplateCleanupFailure() async throws {let layout = try layout()diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.shindex 7731141..7d5c6f4 100755--- a/dylib/feats/compat_run.sh+++ b/dylib/feats/compat_run.sh@@ -1013,6 +1013,20 @@ install_legacycompat() {done}+# Steam on Linux symlinks this for every compat tool launch. Is needed for some legacy games.+link_legacy_steam_dll() {+ src="$STEAM_COMPAT_CLIENT_INSTALL_PATH/legacycompat/Steam.dll"+ [ -n "$STEAM_COMPAT_INSTALL_PATH" ] && [ -f "$src" ] || return 0+ dst="$(dirname "$STEAM_COMPAT_INSTALL_PATH")/Steam.dll"+ [ -L "$dst" ] || [ ! -e "$dst" ] || return 0+ [ "$(readlink "$dst" 2>/dev/null)" = "$src" ] && return 0+ if ln -sfn "$src" "$dst" 2>> "$log"; then+ echo "=== linked legacy Steam.dll at $dst ===" >> "$log" 2>&1 || true+ else+ echo "=== could not link legacy Steam.dll at $dst ===" >> "$log" 2>&1 || true+ fi+}+bridge_files="steamclient64.dll steamclient.dll tier0_s64.dll vstdlib_s64.dll"bridge_files="$bridge_files lsteamclient.dll lsteamclient.so steam.exe"# A clone cannot cross drives, so a prefix on another drive clones from a copy of the@@ -1103,6 +1117,7 @@ if [ -d "$bridge_src" ] && [ -n "$WINEPREFIX" ]; thenexport STEAM_COMPAT_CLIENT_INSTALL_PATH="$native_client"fiinstall_legacycompat+ link_legacy_steam_dllecho "=== bridge staged into $prefix_steam ===" >> "$log" 2>&1 || trueecho "WINEDLLPATH=$WINEDLLPATH" >> "$log" 2>&1 || trueecho "WINEDLLOVERRIDES=$WINEDLLOVERRIDES" >> "$log" 2>&1 || truediff --git a/dylib/tests/bridgecheck.sh b/dylib/tests/bridgecheck.shindex bd17ccd..5101225 100644--- a/dylib/tests/bridgecheck.sh+++ b/dylib/tests/bridgecheck.sh@@ -201,5 +201,38 @@ is "the launch goes on" reached "$(cat "$work/out")"logged "the failure is logged" "=== could not copy legacycompat/Steam.dll to $work/client/legacycompat/Steam.dll ==="is "the reason is logged" yes "$(grep -q 'Permission denied' "$work/log" && echo yes || echo no)"+echo "== the legacy Steam.dll is linked next to the game folder"+link=$(sed -n '/^link_legacy_steam_dll() {/,/^}/p' "$SRC")+[ -n "$link" ] || { echo "FAIL: link_legacy_steam_dll not found in $SRC"; exit 1; }+is "the launch links it" 1 "$(grep -c '^ link_legacy_steam_dll$' "$SRC")"+mkdir -p "$work/lib/common/Game"+printf 'client Steam.dll\n' > "$work/client/legacycompat/Steam.dll"+run_link() {+ env STEAM_COMPAT_CLIENT_INSTALL_PATH="$work/client" STEAM_COMPAT_INSTALL_PATH="$work/lib/common/Game" \+ log="$work/log" link="$link" sh -ec 'eval "$link"; link_legacy_steam_dll; echo reached' > "$work/out" 2>&1 || true+}+: > "$work/log"+run_link+is "the launch goes on" reached "$(cat "$work/out")"+is "a missing link is created" "$work/client/legacycompat/Steam.dll" "$(readlink "$work/lib/common/Steam.dll")"+logged "the link is logged" "=== linked legacy Steam.dll at $work/lib/common/Steam.dll ==="+: > "$work/log"+run_link+is "a current link is left alone" "" "$(cat "$work/log")"+ln -sfn "$work/old/Steam.dll" "$work/lib/common/Steam.dll"+run_link+is "a stale link is replaced" "$work/client/legacycompat/Steam.dll" "$(readlink "$work/lib/common/Steam.dll")"+rm -f "$work/lib/common/Steam.dll"+printf 'real\n' > "$work/lib/common/Steam.dll"+run_link+is "a real file is kept" real "$(cat "$work/lib/common/Steam.dll")"+rm -f "$work/lib/common/Steam.dll"+chmod 500 "$work/lib/common"+: > "$work/log"+run_link+chmod 700 "$work/lib/common"+is "an unwritable library does not stop the launch" reached "$(cat "$work/out")"+logged "the failure is logged" "=== could not link legacy Steam.dll at $work/lib/common/Steam.dll ==="+[ "$fails" -eq 0 ] || { echo "==> bridgecheck: $fails failure(s)"; exit 1; }echo "==> bridgecheck: the bridge stages on fresh, current, stale and incomplete prefixes"