Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
Offer patched private-API MoltenVK for X4
Matt Van Horn5fcacff25490
diff --git a/Scripts/build-moltenvk.sh b/Scripts/build-moltenvk.shindex 60139b8..05911c8 100755--- a/Scripts/build-moltenvk.sh+++ b/Scripts/build-moltenvk.sh@@ -2,14 +2,29 @@# Reproducible build of the engine's MoltenVK component: a pinned upstream tag plus Highball's# patches, x86_64 only (the engine's Wine is x86_64 under Rosetta), packaged as the tarball the# engine manifest points at. Usage: Scripts/build-moltenvk.sh [tag] [out-dir]+# Set MVK_USE_METAL_PRIVATE_API=1 for a separate private-API archive. For X4:+# MVK_USE_METAL_PRIVATE_API=1 MVK_PATCHES="shadow-import linear-fallback shadow-readback" \+# Scripts/build-moltenvk.sh v1.4.2set -euo pipefailTAG="${1:-v1.4.1}"OUT="${2:-$(pwd)/build-moltenvk}"+PRIVATE_API="${MVK_USE_METAL_PRIVATE_API:-0}"+case "$PRIVATE_API" in+ 0|1) ;;+ *) echo "MVK_USE_METAL_PRIVATE_API must be 0 or 1" >&2; exit 1 ;;+esacPATCHES="$(cd "$(dirname "$0")/.." && pwd)/spike/patches"WORK="$(mktemp -d)"echo "[moltenvk] tag $TAG, work dir $WORK"git clone -q --depth 1 --branch "$TAG" https://github.com/KhronosGroup/MoltenVK.git "$WORK/src"cd "$WORK/src"+# Upstream's Makefile passes this setting through GCC_PREPROCESSOR_DEFINITIONS.+# Reject unsupported tags before fetching dependencies or building.+if [ "$PRIVATE_API" = 1 ]; then+ grep -q 'MVK_USE_METAL_PRIVATE_API=1' README.md || {+ echo "$TAG does not document the private-API build setting" >&2; exit 1;+ }+fi# The patches, by name (spike/patches/moltenvk-<name>.patch), in this order: shadow-import (the Sims,# 32-bit Vulkan titles) and linear-fallback (Red Dead Redemption 2's linear 3D and mipmapped images). The# Wine 11 engines ship 1.4.2 with both; the Wine 10 engines ship 1.4.1 with shadow-import only, which@@ -22,11 +37,13 @@ read -r -a PATCH_NAMES <<< "${MVK_PATCHES:-shadow-import linear-fallback}"for NAME_ in "${PATCH_NAMES[@]}"; doPATCH="$PATCHES/moltenvk-$NAME_.patch"echo "[moltenvk] applying $(basename "$PATCH")"- git apply --check "$PATCH" && git apply "$PATCH"+ git apply --check "$PATCH"+ git apply "$PATCH"done./fetchDependencies --macosxcodebuild build -project MoltenVKPackaging.xcodeproj -scheme "MoltenVK Package (macOS only)" \- -destination "generic/platform=macOS" -configuration Release ARCHS=x86_64 ONLY_ACTIVE_ARCH=NO -quiet+ -destination "generic/platform=macOS" -configuration Release ARCHS=x86_64 ONLY_ACTIVE_ARCH=NO \+ GCC_PREPROCESSOR_DEFINITIONS="\$(inherited) MVK_USE_METAL_PRIVATE_API=$PRIVATE_API" -quiet# The dynamic dylib, explicitly: 1.4.2's package also carries static and xcframework copies# under Package/Release, and `find | head -1` picked one without the patch markers.DYLIB="Package/Release/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib"@@ -38,7 +55,9 @@ for NAME_ in "${PATCH_NAMES[@]}"; dogrep -q "HIGHBALL $NAME_" <<< "$MARKS" || { echo "patch missing from build: $NAME_"; exit 1; }donemkdir -p "$OUT/pkg" && cp "$DYLIB" "$OUT/pkg/libMoltenVK.dylib"-NAME="moltenvk-${TAG#v}$(printf -- "-%s-1" "${PATCH_NAMES[@]}")-x86_64.tar.gz"+VARIANT=""+if [ "$PRIVATE_API" = 1 ]; then VARIANT="-private-api-1"; fi+NAME="moltenvk-${TAG#v}$(printf -- "-%s-1" "${PATCH_NAMES[@]}")${VARIANT}-x86_64.tar.gz"tar -czf "$OUT/$NAME" -C "$OUT/pkg" libMoltenVK.dylibecho "[moltenvk] $OUT/$NAME"echo " sha256: $(shasum -a 256 "$OUT/$NAME" | awk '{print $1}')"