Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

fix(crossover): start games on CrossOver Preview 27

raymondchinsf151dbfd9629
diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.sh
index e5367fe..1bb0537 100755
--- a/dylib/feats/compat_run.sh
+++ b/dylib/feats/compat_run.sh
@@ -2341,7 +2341,17 @@ stage_step="graphics backend"
select_backend "$1"
activate_backend || true
record_backend || true
-graphics_log "backend=$backend ($backend_from)"
+# An engine without lib/notproton-backends (CrossOver) picks its graphics itself, from
+# CX_GRAPHICS_BACKEND, so the log names that choice, not the dxmt-builtin placeholder.
+if [ "$backend" = dxmt-builtin ]; then
+ engine_backend=$(printf '%s' "${CX_GRAPHICS_BACKEND:-}" | tr '[:upper:]' '[:lower:]')
+ case "$engine_backend" in
+ d3dmetal|dxmt|dxvk|wined3d) graphics_log "backend=$engine_backend (CX_GRAPHICS_BACKEND, applied by the engine)" ;;
+ *) graphics_log "backend=engine-default (the engine picks its own graphics, CX_GRAPHICS_BACKEND is not set)" ;;
+ esac
+else
+ graphics_log "backend=$backend ($backend_from)"
+fi
compose_dll_overrides
[ -z "$backend_overrides" ] || graphics_log "backend overrides $backend_overrides"
@@ -2659,12 +2669,16 @@ for f in "$wine_unix"/*; do
done
ln "$WINELOADER" "$loader_macos/wine" 2>/dev/null || cp "$WINELOADER" "$loader_macos/wine"
game_host=""
+original_loader=$WINELOADER
if [ -x "$loader_macos/wine" ]; then
WINELOADER="$loader_app/Contents/MacOS/wine"
if "$np_support/prepare-game-loader" "$loader_macos/wine" "$loader_contents/Info.plist" >> "$log" 2>&1; then
game_host="$np_support/game-host.dylib"
else
- echo "embedded loader metadata unsupported; keeping original launcher behavior" >> "$log" 2>&1 || true
+ # A loader whose signature depends on its own wine.app (CrossOver 27's provisioning
+ # profile) is killed when run from the game's bundle, so run it where it is.
+ WINELOADER=$original_loader
+ echo "embedded loader metadata unsupported; running the engine's own loader" >> "$log" 2>&1 || true
fi
echo "loader staged in bundle for game mode" >> "$log" 2>&1 || true
else
diff --git a/helpers/prepare-game-loader.swift b/helpers/prepare-game-loader.swift
index d1609f7..b1ffb41 100644
--- a/helpers/prepare-game-loader.swift
+++ b/helpers/prepare-game-loader.swift
@@ -166,7 +166,13 @@ func prepare(_ target: URL, _ info: URL) throws {
var arguments = ["--force", "--sign", "-", "--identifier", identity]
if hardened { arguments += ["--options", "runtime"] }
if !entitlements.isEmpty {
- _ = try PropertyListSerialization.propertyList(from: entitlements, format: nil)
+ let parsed = try PropertyListSerialization.propertyList(from: entitlements, format: nil)
+ // An ad hoc signature can't carry com.apple.developer.* entitlements (CrossOver 27's
+ // cross-architecture-support): macOS kills the re-signed loader at launch, so the run
+ // script keeps the original signed one instead.
+ if let restricted = (parsed as? [String: Any])?.keys.first(where: { $0.hasPrefix("com.apple.developer.") }) {
+ throw PrepareError.invalid("\(restricted) only works under the original signature")
+ }
let file = temporary.appendingPathComponent("entitlements.plist")
try entitlements.write(to: file)
arguments += ["--entitlements", file.path]
diff --git a/helpers/tests/game-metadata.py b/helpers/tests/game-metadata.py
index d4db65a..2d6609e 100644
--- a/helpers/tests/game-metadata.py
+++ b/helpers/tests/game-metadata.py
@@ -53,6 +53,20 @@ with tempfile.TemporaryDirectory(prefix="np-game-metadata-") as folder:
subprocess.run(["codesign", "-s", "-", "--options", "runtime", str(hardened)], check=True)
subprocess.run([str(tool), str(hardened), str(info)], check=True)
assert "runtime" in flags(hardened), "a hardened loader lost the hardened runtime"
+ # An ad hoc re-sign can't keep a com.apple.developer.* entitlement (macOS kills it at launch)
+ (root / "restricted").mkdir()
+ restricted = root / "restricted" / "wine"
+ subprocess.run(["clang", str(c), "-Wl,-sectcreate,__TEXT,__info_plist," + str(embedded),
+ "-o", str(restricted)], check=True)
+ ents = root / "restricted.plist"
+ ents.write_bytes(plistlib.dumps({"com.apple.developer.cross-architecture-support": True,
+ "com.apple.security.cs.disable-library-validation": True}))
+ subprocess.run(["codesign", "-s", "-", "--options", "runtime", "--entitlements", str(ents),
+ str(restricted)], check=True)
+ untouched = restricted.read_bytes()
+ result = subprocess.run([str(tool), str(restricted), str(info)], capture_output=True)
+ assert result.returncode != 0, "a loader with a restricted entitlement was re-signed"
+ assert restricted.read_bytes() == untouched, "a refused loader was modified"
blob = wine.read_bytes()
assert b"com.notproton.launcher.999" in blob and b"LSSupportsGameMode" in blob
subprocess.run([str(tool), str(wine), str(info)], check=True)