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
feat(scripts): move scripts and installer to the bridgeplay folders
raymondchins8c2634530920
diff --git a/.gitignore b/.gitignoreindex 16ebfc1..07f6a56 100644--- a/.gitignore+++ b/.gitignore@@ -5,7 +5,7 @@ out/*.a*.dylib# The x86_64 SDL2 FreeEngineWinecx installs for winebus.so (docs/WINECX.md).-!app/Sources/NotProtonApp/Resources/libSDL2-2.0.0.dylib+!app/Sources/BridgeplayApp/Resources/libSDL2-2.0.0.dylib.DS_Storevendor/dobby/@@ -23,7 +23,7 @@ xcuserdata/*.xcuserstateDerivedData/-app/Sources/NotProtonApp/Resources/payload/+app/Sources/BridgeplayApp/Resources/payload/__pycache__/installer/Bridgeplay.app/installer/gptk/diff --git a/installer/BACA DULU.txt b/installer/BACA DULU.txtindex 2799606..1af5029 100644--- a/installer/BACA DULU.txt+++ b/installer/BACA DULU.txt@@ -20,6 +20,10 @@ Butuh:Bridgeplay di jendela Settings yang terbuka. Setup lanjut sendiri.5. Klik Open Steam, pilih game Windows, Install, Play.+Update dari Bridgeplay 2.x: saat pertama dibuka, 3.0.0 memindahkan file-nya dari+folder lama "notproton" ke "bridgeplay" dan menyimpan backup. Tutup Steam dan+game dulu; Bridgeplay menunggu sampai keduanya tertutup.+Controller: pertama kali controller dipakai, Steam minta izin InputMonitoring. Klik Allow (atau nyalakan Steam di System Settings > Privacy &Security > Input Monitoring).diff --git a/installer/Install.command b/installer/Install.commandindex eccfd44..a12d1e2 100755--- a/installer/Install.command+++ b/installer/Install.command@@ -7,7 +7,23 @@set -uo pipefailhere="$(cd "$(dirname "$0")" && pwd)"-support="$HOME/Library/Application Support/notproton"+support="$HOME/Library/Application Support/bridgeplay"+caches="$HOME/Library/Caches/bridgeplay"+# Bridgeplay before 3.0.0 kept its files under "notproton". The app moves them to+# "bridgeplay" itself on first launch (with a backup), so the installer never moves them.+# While only the old folders exist, it writes into them so that move carries the new+# files along; a bridgeplay folder made next to them would get in the migration's way.+legacy_support="$HOME/Library/Application Support/notproton"+legacy_caches="$HOME/Library/Caches/notproton"+migrate_later=0+if [ ! -d "$support" ] && [ -d "$legacy_support" ]; then+ support="$legacy_support"+ migrate_later=1+fi+if [ ! -d "$caches" ] && [ -d "$legacy_caches" ]; then+ caches="$legacy_caches"+ migrate_later=1+fisay() { printf '\n\033[1;32m==>\033[0m %s\n' "$*"; }die() { printf '\n\033[1;31mGagal:\033[0m %s\n' "$*" >&2; read -r -p "Tekan Enter untuk menutup..." _; exit 1; }@@ -64,11 +80,14 @@ if [ ! -d /Applications/Steam.app ]; thenfisay "Menyalin Game Porting Toolkit, engine WineCX dan config (tanpa download)..."-mkdir -p "$support/gamefixes" "$HOME/Library/Caches/notproton"+if [ "$migrate_later" -eq 1 ]; then+ say "Data Bridgeplay lama ditemukan di folder notproton. File baru ditaruh di sana dulu; Bridgeplay memindahkannya ke folder bridgeplay saat pertama dibuka (tutup Steam dan game dulu)."+fi+mkdir -p "$support/gamefixes" "$caches"rm -rf "$support/gptk"ditto "$here/gptk" "$support/gptk" || die "Game Porting Toolkit gagal disalin."# Bridgeplay reuses any cached file whose hash matches its pin, so nothing is downloaded.-ditto "$here/cache" "$HOME/Library/Caches/notproton" || die "File engine gagal disalin."+ditto "$here/cache" "$caches" || die "File engine gagal disalin."# default.conf is always the bundled one (an existing different copy is kept as .bak);# per-game confs the user already has are left alone.if [ -f "$support/gamefixes/default.conf" ] && ! cmp -s "$here/config/gamefixes/default.conf" "$support/gamefixes/default.conf"; thendiff --git a/installer/README.md b/installer/README.mdindex cfa3c35..ec7a4ac 100644--- a/installer/README.md+++ b/installer/README.md@@ -17,9 +17,14 @@ archive does not match its pin in `FreeEngine*.swift`:| `Bridgeplay.app` | `out/Bridgeplay.app` from `make app` || `Install.command`, `BACA DULU.txt`, `README.txt`, `config/` | this folder || `LICENSE`, `LICENSE.*`, `NOTICE` | repository root |-| `gptk/` | `~/Library/Application Support/notproton/gptk` (`redist/lib` of Apple's Game Porting Toolkit DMG) |+| `gptk/` | `~/Library/Application Support/bridgeplay/gptk` (`redist/lib` of Apple's Game Porting Toolkit DMG) || `GPTK-License.rtf` | `gptk/License.rtf` from the same DMG |-| `cache/engines/` | the pinned WineCX runtime, DXMT and DXVK archives from `~/Library/Caches/notproton/engines` |+| `cache/engines/` | the pinned WineCX runtime, DXMT and DXVK archives from `~/Library/Caches/bridgeplay/engines` |++On a Mac the app has not migrated to 3.0.0 yet, the script falls back to the old+`notproton` folders. `Install.command` installs into the `bridgeplay` folders. When only the+old `notproton` folders exist, it writes into those instead and leaves the move to the app,+which migrates them on first launch.Never shipped: Valve's Steam client and the Steam packages in `valve-packages/` (the appdownloads those from Valve's CDN), and GPTK is never committed. GPTK's `/redist` files arediff --git a/installer/README.txt b/installer/README.txtindex 509295e..9a97b0e 100644--- a/installer/README.txt+++ b/installer/README.txt@@ -20,6 +20,10 @@ You need:the Settings window that opens. Setup then continues by itself.5. Click Open Steam, pick a Windows game, Install, Play.+Updating from Bridgeplay 2.x: the first time 3.0.0 opens, it moves its files+from the old "notproton" folders to "bridgeplay" and keeps a backup. Quit Steam+and any game first; it waits until they are closed.+Controllers: the first time you use a controller, Steam asks for InputMonitoring. Click Allow (or turn on Steam in System Settings > Privacy &Security > Input Monitoring).diff --git a/scripts/np-test-game.sh b/scripts/np-test-game.shindex 5324ec0..8759ca3 100755--- a/scripts/np-test-game.sh+++ b/scripts/np-test-game.sh@@ -39,7 +39,10 @@ command -v jq >/dev/null || { echo "jq required" >&2; exit 64; }REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"SUP="$HOME/Library/Application Support"STEAMAPPS="$SUP/Steam/steamapps"-NP="$SUP/notproton"+# The support folder and log names moved to bridgeplay in 3.0.0; fall back to the old+# ones on a Mac the app has not migrated yet.+NP="$SUP/bridgeplay"+[ -d "$NP" ] || [ ! -d "$SUP/notproton" ] || NP="$SUP/notproton"MANIFEST="$STEAMAPPS/appmanifest_${APPID}.acf"[ -f "$MANIFEST" ] || { echo "app $APPID is not installed (no $MANIFEST)" >&2; exit 64; }@@ -47,9 +50,10 @@ acf() { sed -n "s/^[[:space:]]*\"$1\"[[:space:]]*\"\(.*\)\"[[:space:]]*$/\1/p" "NAME="$(acf name)"INSTALLDIR="$STEAMAPPS/common/$(acf installdir)"PFX="$STEAMAPPS/compatdata/$APPID/pfx"-RUNLOG="$STEAMAPPS/compatdata/$APPID/notproton-run.log"-WINELOG="$NP/launchers/$APPID/notproton-wine.log"-NPLOG="$NP/notproton.log"+# Each log is read under both names (see legacy_of below).+RUNLOG="$STEAMAPPS/compatdata/$APPID/bridgeplay-run.log"+WINELOG="$NP/launchers/$APPID/bridgeplay-wine.log"+NPLOG="$NP/bridgeplay.log"FIXDIR="$NP/gamefixes"FIX="$FIXDIR/$APPID.conf"@@ -118,6 +122,16 @@ size_of() { [ -f "$1" ] && stat -f %z "$1" || echo 0; }since() { # $1 file, $2 offset -> bytes after offset[ -f "$1" ] && tail -c +"$(( $2 + 1 ))" "$1" || true}+# Before 3.0.0 the logs were notproton-*.log. Reading both names keeps runs against a+# build or prefix from before the rename working; the old file just stops growing.+legacy_of() { echo "${1%/*}/notproton${1##*/bridgeplay}"; }+latest_of() { if [ -f "$1" ]; then echo "$1"; else legacy_of "$1"; fi; }+size2() { echo "$(size_of "$1") $(size_of "$(legacy_of "$1")")"; }+since2() { # $1 file, $2 "offset legacy_offset" -> new bytes of both names+ # shellcheck disable=SC2086 # split "offset legacy_offset" into $2 $3+ set -- "$1" $2+ since "$1" "$2"; since "$(legacy_of "$1")" "$3"+}if [ -n "$(ps_game)" ]; thenecho "game exe already running under wine; run with --stop first or: scripts/np-test-game.sh $APPID --stop" >&2@@ -125,7 +139,7 @@ if [ -n "$(ps_game)" ]; thenfipgrep -xq steam_osx || echo "warning: Steam does not appear to be running; 'open steam://' will start it" >&2-OFF_RUN=$(size_of "$RUNLOG"); OFF_WINE=$(size_of "$WINELOG"); OFF_NP=$(size_of "$NPLOG")+OFF_RUN=$(size2 "$RUNLOG"); OFF_WINE=$(size2 "$WINELOG"); OFF_NP=$(size2 "$NPLOG")T0=$(now)echo "[$APPID] $NAME backend=$BACKEND max=${SECONDS_MAX}s -> $OUT" >&2open "steam://rungameid/$APPID"@@ -135,7 +149,7 @@ FIRST=""; LAST=""; MISSES=0; WINE_SEEN=0; DEADLINE=$(( T0 + SECONDS_MAX )); CRASwhile :; dosleep "$INTERVAL"t=$(now)- since "$RUNLOG" "$OFF_RUN" > "$WORK/run.new"; add_exes_from_runlog "$WORK/run.new"+ since2 "$RUNLOG" "$OFF_RUN" > "$WORK/run.new"; add_exes_from_runlog "$WORK/run.new"[ -n "$(wine_procs)" ] && WINE_SEEN=1hit="$(ps_game)"if [ -n "$hit" ]; then@@ -155,10 +169,10 @@ done# ---- collect ----ps -axww -o pid=,etime=,command= > "$OUT/ps-end.txt" 2>/dev/null[ -n "$(ps_game)" ] && ALIVE=true || ALIVE=false-since "$RUNLOG" "$OFF_RUN" > "$OUT/notproton-run.log"-since "$WINELOG" "$OFF_WINE" | tail -n 2000 > "$OUT/notproton-wine.log"-since "$NPLOG" "$OFF_NP" > "$OUT/notproton.log"-[ -f "$RUNLOG" ] && tail -n 200 "$RUNLOG" > "$OUT/notproton-run.tail.log"+since2 "$RUNLOG" "$OFF_RUN" > "$OUT/bridgeplay-run.log"+since2 "$WINELOG" "$OFF_WINE" | tail -n 2000 > "$OUT/bridgeplay-wine.log"+since2 "$NPLOG" "$OFF_NP" > "$OUT/bridgeplay.log"+[ -f "$(latest_of "$RUNLOG")" ] && tail -n 200 "$(latest_of "$RUNLOG")" > "$OUT/bridgeplay-run.tail.log"# engineENGINE="$(grep -h 'state crossOver' "$NP/app.log" 2>/dev/null | tail -1 | sed -n 's/.*state crossOver \(.*\) version=.*/\1/p')"@@ -167,7 +181,7 @@ ENGINE="$(grep -h 'state crossOver' "$NP/app.log" 2>/dev/null | tail -1 | sed -n# error signaturesSIG='err:module|err:seh|err:virtual|err:d3d|err:ntdll|DXGI_ERROR|DXMT.*(error|fail)|vkd3d.*(error|fail)|Unhandled exception|wine: could not load|wine: cannot find|No such file|Bad CPU type|Assertion failed|Segmentation fault|page fault|fixme:.*not implemented|cannot open|failed to'-cat "$OUT/notproton-run.log" "$OUT/notproton-wine.log" "$OUT/notproton.log" 2>/dev/null \+cat "$OUT/bridgeplay-run.log" "$OUT/bridgeplay-wine.log" "$OUT/bridgeplay.log" 2>/dev/null \| grep -Ei "$SIG" \| sed -E 's/^[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9:]+Z? //; s/^[0-9a-f]{4}:(err|fixme)/\1/; s/0x[0-9a-fA-F]+/0xN/g' \| cut -c1-200 | sort | uniq -c | sort -rn | head -10 \@@ -193,7 +207,7 @@ restore_fix# ---- stop ----stop_game() {local ws=""- ws="$(sed -n 's/^WINESERVER=//p' "$RUNLOG" 2>/dev/null | tail -1)"+ ws="$(sed -n 's/^WINESERVER=//p' "$(latest_of "$RUNLOG")" 2>/dev/null | tail -1)"[ -x "$ws" ] || ws="$(ls -d "$NP"/engines/*/Contents/SharedSupport/CrossOver/bin/wineserver 2>/dev/null | head -1)"[ -x "$ws" ] || ws="$(ls "$NP"/runners/*/CrossOver/bin/wineserver "$NP"/runners/current/bin/wineserver 2>/dev/null | head -1)"if [ -x "$ws" ] && [ -d "$PFX" ]; thendiff --git a/scripts/package-installer.sh b/scripts/package-installer.shindex 76fad97..6ccd32c 100755--- a/scripts/package-installer.sh+++ b/scripts/package-installer.sh@@ -10,7 +10,9 @@# itself are downloaded on the user's Mac from Valve. GPTK is never committed.## Overridable: APP (default out/Bridgeplay.app), ENGINE_CACHE (default-# ~/Library/Caches/notproton), GPTK_DIR (default ~/Library/Application Support/notproton/gptk)+# ~/Library/Caches/bridgeplay), GPTK_DIR (default ~/Library/Application Support/bridgeplay/gptk).+# On a Mac the app has not migrated to 3.0.0 yet, the defaults fall back to the old+# notproton folders when the bridgeplay ones are missing.set -eu@@ -18,12 +20,19 @@ repo=$(cd "$(dirname "$0")/.." && pwd)cd "$repo"APP=${APP:-$repo/out/Bridgeplay.app}-ENGINE_CACHE=${ENGINE_CACHE:-$HOME/Library/Caches/notproton}-GPTK_DIR=${GPTK_DIR:-$HOME/Library/Application Support/notproton/gptk}+if [ -z "${ENGINE_CACHE:-}" ]; then+ ENGINE_CACHE=$HOME/Library/Caches/bridgeplay+ [ -d "$ENGINE_CACHE" ] || [ ! -d "$HOME/Library/Caches/notproton" ] || ENGINE_CACHE=$HOME/Library/Caches/notproton+fi+if [ -z "${GPTK_DIR:-}" ]; then+ GPTK_DIR="$HOME/Library/Application Support/bridgeplay/gptk"+ legacy_gptk="$HOME/Library/Application Support/notproton/gptk"+ [ -d "$GPTK_DIR" ] || [ ! -d "$legacy_gptk" ] || GPTK_DIR=$legacy_gptk+fistage_root=$repo/out/installerstage=$stage_root/Bridgeplayzip=$repo/out/Bridgeplay-Installer.zip-models=app/Sources/NotProtonApp/Model+models=app/Sources/BridgeplayApp/Modeldie() {echo "==> $*" >&2diff --git a/scripts/release-local.sh b/scripts/release-local.shindex 41f9d99..71cae4a 100755--- a/scripts/release-local.sh+++ b/scripts/release-local.sh@@ -129,7 +129,11 @@ elsekey_args=""if [ -z "${CX_ROOT:-}" ]; then- CX_ROOT="$HOME/Library/Application Support/notproton/runners/crossover-winehq-11.15/CrossOver"+ # The support folder moved to bridgeplay in 3.0.0; a Mac the app has not migrated yet+ # still has it under notproton.+ CX_ROOT="$HOME/Library/Application Support/bridgeplay/runners/crossover-winehq-11.15/CrossOver"+ legacy_cx="$HOME/Library/Application Support/notproton/runners/crossover-winehq-11.15/CrossOver"+ [ -d "$CX_ROOT" ] || [ ! -d "$legacy_cx" ] || CX_ROOT=$legacy_cxexport CX_ROOTfiscripts/build-local.sh --checksdiff --git a/scripts/steam-launch-options.py b/scripts/steam-launch-options.pyindex 325bda8..e20ff89 100644--- a/scripts/steam-launch-options.py+++ b/scripts/steam-launch-options.py@@ -6,11 +6,25 @@ usage: steam-launch-options.py <localconfig.vdf> <TOKEN> <appid...>Edits userdata/<id>/config/localconfig.vdf in place. Run it only while Steamis fully closed (Steam rewrites the file on exit). A token already present isleft alone; an app with no launch options gets "<TOKEN> %command%".++A token is written with the public 3.0.0 spelling (BRIDGEPLAY_*, ~/.bridgeplay/...)+even when given as NOTPROTON_* or ~/.notproton/...; either spelling already in the+launch options counts as present."""import reimport sys-path, token = sys.argv[1], sys.argv[2]++def public(t):+ return re.sub(r"\bNOTPROTON_", "BRIDGEPLAY_", t.replace("/.notproton/", "/.bridgeplay/"))+++def legacy(t):+ return re.sub(r"\bBRIDGEPLAY_", "NOTPROTON_", t.replace("/.bridgeplay/", "/.notproton/"))+++path, token = sys.argv[1], public(sys.argv[2])+spellings = {token, legacy(token)}ids = set(sys.argv[3:])lines = open(path, encoding="utf-8").read().split("\n")out, done, in_apps, i = [], set(), False, 0@@ -33,7 +47,7 @@ while i < len(lines):if mm:found = Trueval = mm.group(2)- if token not in val.split():+ if not spellings & set(val.split()):rest = val if "%command%" in val else (val + " %command%").strip()val = f"{token} {rest}"block[k] = mm.group(1) + val + mm.group(3)diff --git a/scripts/update-gamecontrollerdb.sh b/scripts/update-gamecontrollerdb.shindex 9c6b663..92d1576 100755--- a/scripts/update-gamecontrollerdb.sh+++ b/scripts/update-gamecontrollerdb.sh@@ -16,7 +16,10 @@set -eudb_url=https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt-own="$HOME/Library/Application Support/notproton/gamecontrollerdb.txt"+own="$HOME/Library/Application Support/bridgeplay/gamecontrollerdb.txt"+# Before the app's 3.0.0 migration the file is still in the old support folder.+legacy_own="$HOME/Library/Application Support/notproton/gamecontrollerdb.txt"+[ -f "$own" ] || [ ! -f "$legacy_own" ] || own=$legacy_owndb="$db_url"out=""