Skip to content

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

Fix inaccurate comments and improve comment clarity

NotProtonNot690e835ca1b7
diff --git a/bridge/fetch-valve.sh b/bridge/fetch-valve.sh
index cf222d3..cb32aea 100755
--- a/bridge/fetch-valve.sh
+++ b/bridge/fetch-valve.sh
@@ -1,19 +1,8 @@
#!/bin/sh
-# Fetch the Valve binaries the bridge stages, from Valve's client packages.
+# Fetches the Valve binaries the bridge stages from Valve's client packages.
#
-# ./fetch.sh download, verify every hash, report
-# ./fetch.sh --install also copy them into the bridge
-#
-# The ten Valve files in the bridge come from two pinned Steam client packages. The
-# pins, the CDN hosts and every file hash live in the manifest this reads, which the
-# app reads as a bundled resource too, so there is one definition rather than one per
-# consumer. That file also records where the package names come from, and why two of
-# the paths inside the packages look misplaced.
-#
-# The shim once linked steam_api.dll and steam_api64.dll, which are in no client
-# package and could not be fetched. That dependency is gone: steam.cpp loads
-# steamclient64.dll and calls its CreateInterface instead, so every payload file is
-# either built here or fetchable.
+# ./fetch-valve.sh download, verify every hash, report
+# ./fetch-valve.sh --install also copy them into the bridge
set -eu
here="$(cd "$(dirname "$0")" && pwd)"
@@ -23,7 +12,6 @@ WORK="${WORK:-$repo/scratch/valve-fetch}"
MANIFEST="${MANIFEST:-$repo/app/Sources/NotProtonApp/Resources/valve-packages.manifest}"
[ -f "$MANIFEST" ] || { echo "==> no package manifest at $MANIFEST" >&2; exit 1; }
-# Akamai is listed first and the rest are fallbacks. All three serve identical bytes.
BASES="${BASES:-$(awk '$1 == "base" { printf "%s ", $2 }' "$MANIFEST")}"
install=0
@@ -37,7 +25,6 @@ FILES="$(awk '$1 == "file" { print $2 "|" $3 "|" $4 "|" $5 }' "$MANIFEST")"
sha() { shasum -a 256 "$1" | cut -d' ' -f1; }
-# Downloads once and keeps the package, so a second run verifies without refetching.
get_pkg() {
name="$1"
want="$2"
@@ -69,7 +56,6 @@ for spec in $PACKAGES; do
get_pkg "$(echo "$spec" | cut -d'|' -f2)" "$(echo "$spec" | cut -d'|' -f3)"
done
-# Extracted fresh every run so a stale extract cannot pass the hash check by luck.
EX="$WORK/extract"
rm -rf "$EX"
mkdir -p "$EX"
diff --git a/bridge/register-components.diff b/bridge/register-components.diff
index d6e340b..025ca3f 100644
--- a/bridge/register-components.diff
+++ b/bridge/register-components.diff
@@ -1,17 +1,5 @@
Register dlls/lsteamclient and programs/steam.exe with Wine's build system.
-Wine's configure enumerates the makefiles it will generate, so a component has to be
-declared before configure runs. Undeclared, it gets no makefile and its build target
-silently does nothing.
-
-WINE_EXTERNAL(programs/steam.exe) is what stops makedep reading the internal includes
-inside jsoncpp's amalgamation. Those sit behind JSON_IS_AMALGAMATION and never compile,
-but the scanner follows them regardless of the #if.
-
-Tracked as a patch rather than regenerated with autoconf. It is +8/-1 mechanical lines
-across the two files, where a local autoconf against stock 11.15 would rewrite the whole
-of configure with whatever version happens to be installed.
-
diff --git a/configure b/configure
index aa3c65e..2df611f 100755
--- a/configure
diff --git a/bridge/setup-wine-tree.sh b/bridge/setup-wine-tree.sh
index 06c86a4..82f1d63 100755
--- a/bridge/setup-wine-tree.sh
+++ b/bridge/setup-wine-tree.sh
@@ -1,20 +1,13 @@
#!/bin/sh
-# Create and configure the wine tree that the component builds need.
+# Sets up the Wine source tree that lsteamclient and the steam.exe shim are built in.
+# CrossOver doesn't ship winegcc or winebuild, so they can't be built against it.
#
-# ./setup-wine-tree.sh create and configure, skipping whatever is already done
+# ./setup-wine-tree.sh skips any step that's already done
#
-# CrossOver ships a runtime-only Wine with no winegcc or winebuild, so lsteamclient
-# and the steam.exe shim are built in a wine source tree and staged into the bridge
-# unsigned.
+# Uses stock Wine 11.15, the version CrossOver is based on.
#
-# The base is stock Wine 11.15, the version the CrossOver runtime is built from
-# (wine-11.15-8895-g32f409fef6a). ntdll from a different vintage speaks a different
-# server protocol and the shipped loader refuses to boot it.
-#
-# A unix half loads into the wine loader's own process and has to match its arch. The
-# rosetta loader is x86_64, which on an Apple Silicon host needs the cross configure
-# that HOST and the two compilers below provide. The FEX loader is arm64 and wants a
-# native tree, so each gets its own build directory. The PE halves come from mingw.
+# By default this configures an x86_64 build for the Rosetta runtime. 'make bridge'
+# runs it a second time with HOST=aarch64-apple-darwin for the FEX runtime.
set -eu
here="$(cd "$(dirname "$0")" && pwd)"
diff --git a/bridge/verify.sh b/bridge/verify.sh
index 5559185..9b87047 100755
--- a/bridge/verify.sh
+++ b/bridge/verify.sh
@@ -1,53 +1,34 @@
#!/bin/sh
-# Check the bridge holds exactly what a launch consumes, and nothing else.
+# Checks that the bridge holds exactly the files listed in payload.manifest.
#
-# ./verify.sh report what is missing, unexpected, or present
-# ./verify.sh --prune also move anything unexpected out to scratch/bridge-attic
+# ./verify.sh lists missing and unexpected files
+# ./verify.sh --prune also moves unexpected files to scratch/bridge-attic
#
-# The bridge is the staging area RUN_SCRIPT installs from on every launch, so what
-# sits in it ends up in the CrossOver tree, the wine prefix, and the Steam client
-# directory. Stray files there are not harmless:
+# It also looks for old copies of the bridge next to it, and for bridge files left
+# in Steam Play prefixes.
#
-# - legacycompat is copied by glob, so anything dropped in it is installed into the
-# Steam client directory verbatim.
-# - a stale lsteamclient.so or steamclient64.so beside a PE of the same name makes
-# wine bind that builtin to the old unix half instead of loading the dll.
-# - a wrong-arch PE on WINEDLLPATH aborts builtin lookup outright with c000007b.
-#
-# Backups belong outside the bridge for the same reason, which is why --prune moves
-# rather than deletes: the attic is in scratch, which is disposable.
-#
-# Every file here is reproducible. The built ones come from make lsteamclient,
-# make steam-shim and make ntdll-patch. The Valve ones come from the Steam client
-# packages, fetched by fetch-valve.sh beside this script.
+# The built files come from 'make bridge', the patched ntdlls from the NotProton app,
+# and the Valve files from fetch-valve.sh.
set -eu
here="$(cd "$(dirname "$0")" && pwd)"
repo="$(cd "$here/.." && pwd)"
BRIDGE_DIR="${BRIDGE_DIR:-$HOME/Library/Application Support/notproton/bridge}"
ATTIC="${ATTIC:-$repo/scratch/bridge-attic}"
-# Stale whole-bridge copies get made next to it rather than inside it, where a
-# check that only walks the bridge cannot see them.
SUPPORT_DIR="${SUPPORT_DIR:-$(dirname "$BRIDGE_DIR")}"
BRIDGE_NAME="$(basename "$BRIDGE_DIR")"
prune=0
[ "${1:-}" = "--prune" ] && prune=1
-# What RUN_SCRIPT reads, taken from the manifest the companion app also ships, so
-# this list and the one the installer stages from cannot drift apart. The manifest
-# sits in the app's resource directory because that is the only place Swift Package
-# Manager will package a file from.
+# The same manifest the app installs from.
MANIFEST="${MANIFEST:-$repo/app/Sources/NotProtonApp/Resources/payload.manifest}"
if [ ! -f "$MANIFEST" ]; then
echo "==> no payload manifest at $MANIFEST" >&2
exit 1
fi
-# Three origins collapse to the two sections this check has always printed. The
-# manifest separates built from patched because the installer treats them
-# differently, the patched ntdlls being made from the user's own CrossOver. That
-# distinction does not matter here.
+# The patched ntdlls are listed with the built files.
origin() {
awk -v want="$1" '$1 == want { print $2 }' "$MANIFEST"
}
@@ -88,11 +69,7 @@ report() {
report "built here" "$built"
report "from Valve" "$valve"
-# Listed relative to the bridge so the paths stay printable and the directory name
-# containing spaces never has to be stripped by pattern. grep does the comparison
-# because a case statement inside a command substitution does not parse in the sh
-# macOS ships. Every line of $expected is one fixed whole-line pattern, and grep
-# exits nonzero when nothing is left over, which is the ordinary result.
+# grep exits 1 when there are no strays.
strays="$(cd "$BRIDGE_DIR" && { find . -mindepth 1 -type f | sed 's|^\./||' \
| grep -Fxv "$expected" || true; })"
@@ -120,9 +97,7 @@ if [ "$prune" -eq 1 ] && [ "$unexpected" -gt 0 ]; then
unexpected=0
fi
-# A whole copy of the bridge parked beside it is the other way this directory
-# accumulates. Each one is a few hundred megabytes of binaries that no launch reads
-# and that no build target maintains, so they only go stale.
+# Old copies like bridge.old next to the bridge. Nothing reads or updates them.
copies="$(find "$SUPPORT_DIR" -maxdepth 1 -mindepth 1 -type d -name "$BRIDGE_NAME.*" \
| sed "s|^$SUPPORT_DIR/||" | sort)"
stale=0
@@ -146,14 +121,9 @@ else
[ "$prune" -eq 1 ] && stale=0
fi
-
-# RUN_SCRIPT rewrites the flat bridge files in each prefix's Steam directory and the one
-# i386 lsteamclient.dll trigger in syswow64 on every launch, so a stale copy in either
-# place heals itself and is only worth reporting. Anywhere else in a prefix is different:
-# nothing rewrites it and nothing prunes it, so it keeps whatever build put it there.
-# system32 is the case that matters. install_lsteamclient deliberately puts nothing there
-# so that a 64 bit load never finds a trigger it did not stage, and a correct-arch PE
-# appearing there defeats that on its own.
+# Every launch rewrites the bridge files in a prefix's Steam folder and
+# syswow64/lsteamclient.dll, so old copies there are only counted. A copy anywhere
+# else, system32 included, stays until removed, so it's listed as a stray.
PREFIX_ROOT="${PREFIX_ROOT:-$HOME/Library/Application Support/Steam/steamapps/compatdata}"
prefix_strays=""
diff --git a/dylib/feats/webui.c b/dylib/feats/webui.c
index 0b64b35..e9c5511 100644
--- a/dylib/feats/webui.c
+++ b/dylib/feats/webui.c
@@ -1,5 +1,5 @@
// WebUI route registration for routes the macOS client does not serve.
-// Specific to the Steam beta client, which has a new UI.
+// Needed since the October 13th 2026 Steam client update (1791918634), which has a new UI.
#include "webui.h"
#include "../core/macho.h"
#include "../util/log.h"
diff --git a/dylib/feats/webui.h b/dylib/feats/webui.h
index 8e271a5..1cc4d9a 100644
--- a/dylib/feats/webui.h
+++ b/dylib/feats/webui.h
@@ -1,5 +1,5 @@
// WebUI route registration for routes the macOS client does not serve.
-// Specific to the Steam beta client, which has a new UI.
+// Needed since the October 13th 2026 Steam client update (1791918634), which has a new UI.
#ifndef NOTPROTON_FEATS_WEBUI_H
#define NOTPROTON_FEATS_WEBUI_H
@@ -7,7 +7,7 @@
#include <stddef.h>
#include <mach-o/loader.h>
-// The Compatibility page on beta Steam needs GetCompatTools and SpecifyCompatTool,
+// The Compatibility page in the new UI needs GetCompatTools and SpecifyCompatTool,
// neither of which are served on the macOS client, rudely.
int np_webui_init(const struct mach_header_64 *mh, intptr_t slide,
uintptr_t register_fn, uintptr_t dispatch_fn,
diff --git a/lsteamclient/build.sh b/lsteamclient/build.sh
index 14ffa54..c766171 100755
--- a/lsteamclient/build.sh
+++ b/lsteamclient/build.sh
@@ -1,46 +1,19 @@
#!/bin/bash
-# Build lsteamclient from the tree fetch.sh assembles, which is Valve's sources with
-# the files authored here laid over them. This directory holds only the authored ones.
-# The module has two halves and both come from the same SOURCES list in Makefile.in:
-# the .cpp entries are the unix half (lsteamclient.so), the .c entries are the PE side
-# (lsteamclient.dll, one per Windows arch).
+# Builds lsteamclient from the tree fetch.sh puts together: Valve's sources with
+# the files in this folder copied over them.
#
-# The PE halves build with the wine build tree's own make. The unix half cannot,
-# and that is why the second half of this script exists: make links for the machine
-# rather than for the tree's host, silently ignores every object of the other arch,
-# and drops a ~104 KB stub that loads but exports nothing. Every compile and link
-# below therefore names its arch explicitly.
+# ./build.sh builds the PE halves (i386 and x86_64 .dll) and the unix half (.so)
+# ./build.sh --pe PE halves only
+# ./build.sh --unix unix half only
+# ./build.sh --install also copies them into the bridge and the runner clone
#
-# A unix half runs inside the wine loader's own process, so UNIX_ARCH is whichever
-# arch that loader is: x86_64 for the rosetta CrossOver build, arm64 for the FEX one.
-# It has to match the tree WINE_BUILD points at, because the ntdll.so it links
-# against comes from there.
+# The PE halves build with make in the Wine tree. make links lsteamclient.so for
+# the wrong arch, so this script compiles and links it itself.
#
-# SOURCES order is the link order and affects the output bytes, so never sort it.
+# UNIX_ARCH is x86_64 for the Rosetta runtime and arm64 for FEX, and has to match
+# WINE_BUILD. 'make bridge' runs this a second time with UNIX_ARCH=arm64 --unix.
#
-# An x86_64 unix half must be unsigned, because wine builtins fail to load once
-# codesigned. arm64 is the other way round: the platform will not map an unsigned
-# arm64 image at all, so the linker signs its output as it produces it and that
-# signature has to survive. CrossOver's own arm64 builtins are signed for the same
-# reason. PE files carry no Mach-O signature, so none of this applies to them.
-#
-# Reproducibility differs between the halves. A PE rebuild from unchanged source
-# is byte-identical except for two header fields, TimeDateStamp and the optional
-# header CheckSum, so this script reports a hash with those zeroed and that value
-# can be compared across builds. The unix half has no such property: -g makes the
-# linker stamp every object's mtime into the Mach-O debug map, which also changes
-# LC_UUID, so two builds of identical source never hash the same. Compare code
-# and symbols instead:
-# otool -s __TEXT __text <so> | tail -n +2 | shasum
-# nm -U <so> | awk '{print $2, $3}' | sort
-#
-# Usage:
-# ./build.sh build and verify both halves
-# ./build.sh --pe PE halves only
-# ./build.sh --unix unix half only
-# ./build.sh --install also install to the CrossOver tree and bridge
-#
-# Overridable: WINE_BUILD, WINE_SRC_REL, CX_ROOT, BRIDGE_DIR, UNIX_ARCH, MIN_VER
+# Overridable: WINE_BUILD, WINE_SRC_REL, CX_ROOT, BRIDGE_DIR, UNIX_ARCH, MIN_VER, TREE
set -eu
@@ -48,8 +21,6 @@ here=$(cd "$(dirname "$0")" && pwd)
repo=$(cd "$here/.." && pwd)
WINE_BUILD=${WINE_BUILD:-$repo/scratch/wine-build-dual}
-# Mach-O spells the arm64 arch arm64 and wine spells its directory aarch64-unix, so
-# both names are kept rather than derived from each other at every use.
UNIX_ARCH=${UNIX_ARCH:-x86_64}
MIN_VER=${MIN_VER:-15.0}
case "$UNIX_ARCH" in
@@ -57,14 +28,11 @@ case "$UNIX_ARCH" in
arm64) unix_dir=aarch64-unix ;;
*) echo "==> UNIX_ARCH is $UNIX_ARCH, expected x86_64 or arm64" >&2; exit 1 ;;
esac
-# Relative because it lands in the debug info. Keep the default sibling layout so
-# a rebuild stays comparable to the shipped binary.
+# Relative, since it ends up in the debug info.
WINE_SRC_REL=${WINE_SRC_REL:-../wine}
-# The complete tree, unlike $here, which holds only the authored files.
+# Valve's sources with ours copied over, from fetch.sh.
TREE=${TREE:-$repo/build/lsteamclient}
-# The cloned runner, not the user's installed CrossOver. --install writes into this
-# tree, and the installed app has to stay stock: it is the only clean copy on the
-# machine and it is what the clone and the ntdll patcher are both taken from.
+# The runner clone, never the installed CrossOver.
if [ -z "${CX_ROOT:-}" ]; then
for clone in "$HOME/Library/Application Support/notproton/runners"/crossover-*/CrossOver; do
[ -d "$clone" ] || continue
@@ -97,7 +65,7 @@ out=$dll/lsteamclient.so
if [ ! -d "$WINE_BUILD/$dll" ]; then
echo "==> no wine build tree at $WINE_BUILD/$dll"
- echo " the tree is a configured CrossOver 11.0 source drop, see ALIGNMENT.md"
+ echo " run bridge/setup-wine-tree.sh to clone and configure it"
exit 1
fi
@@ -107,11 +75,7 @@ src=$WINE_SRC_REL/$dll
[ -d "$src" ] || { echo "==> no wine source tree at $WINE_BUILD/$src"; exit 1; }
echo "==> syncing the assembled tree into $WINE_SRC_REL/$dll"
-# --delete so the build cannot see anything but the assembled sources. Dropping
-# steamclient.spec and steamclient64.spec is safe: the generated Makefile names only
-# lsteamclient.spec, because MODULE is lsteamclient.dll.
-# Unchanged files keep their mtime so the staleness checks below do not rebuild the
-# world.
+# Unchanged files keep their mtime, so they aren't recompiled.
rsync -a --delete "$TREE/" "$src/"
pe_info=$here/../bridge/pe-info.py
@@ -136,8 +100,7 @@ if [ "$do_pe" -eq 1 ]; then
# shellcheck disable=SC2046
set -- $("$pe_info" "$target")
[ "$1" = "$want" ] || { echo "==> $target is $1, expected $want"; exit 1; }
- # A PE half that lost its objects would be orders of magnitude smaller than
- # the ~30 MB the real thing weighs.
+ # The real PE halves are about 30 MB.
[ "$size" -gt 1000000 ] || { echo "==> $target is only $size bytes, the link dropped objects"; exit 1; }
echo "==> built $target $1 $size bytes $2 (timestamp and checksum zeroed)"
done
@@ -151,6 +114,7 @@ if [ "$do_unix" -eq 1 ]; then
exit 1
fi
+ # Keep SOURCES order, it's the link order.
objs=$(sed -n 's/^[[:space:]]*\([A-Za-z0-9_]*\.cpp\)[[:space:]]*\\*[[:space:]]*$/\1/p' "$TREE/Makefile.in")
count=$(echo "$objs" | wc -l | tr -d ' ')
echo "==> unix half: $count sources from Makefile.in SOURCES"
@@ -184,14 +148,12 @@ if [ "$do_unix" -eq 1 ]; then
-install_name @rpath/lsteamclient.so -Wl,-rpath,@loader_path/ \
$link_objs dlls/ntdll/ntdll.so -lc++ -Wl,-undefined,dynamic_lookup
- # A real unix half is ~3.3 MB, so a size floor catches a link that dropped its
- # objects and left the stub.
+ # A link that dropped its objects leaves a small stub.
size=$(stat -f %z "$out")
arch=$(lipo -archs "$out")
[ "$arch" = "$UNIX_ARCH" ] || { echo "==> built $arch, expected $UNIX_ARCH"; exit 1; }
[ "$size" -gt 1000000 ] || { echo "==> only $size bytes, the link dropped objects"; exit 1; }
- # codesign exits non-zero for an object that is not signed at all, which is the
- # state x86_64 has to be in, so the text is what gets checked and not the status.
+ # codesign -dv fails on unsigned files, so check its output instead.
signing=$(codesign -dv "$out" 2>&1 || true)
if [ "$UNIX_ARCH" = x86_64 ]; then
if ! echo "$signing" | grep -q "not signed at all"; then
@@ -213,10 +175,8 @@ fi
[ -d "$CX_ROOT/lib/wine" ] || { echo "==> no CrossOver tree at $CX_ROOT"; exit 1; }
-# Refuse to write into an installed CrossOver, whatever CX_ROOT says. That copy is
-# the source the runner clone and the ntdll patcher are both taken from, and
-# CrossOver ships no lsteamclient, so anything added there is a modification of the
-# user's application that nothing would ever clean up.
+# The runner clone and the ntdll patch are made from the installed CrossOver, so it
+# has to stay stock.
case "$CX_ROOT" in
/Applications/*)
echo "==> refusing to install into $CX_ROOT" >&2
@@ -226,18 +186,8 @@ case "$CX_ROOT" in
;;
esac
-# Each half goes to three places.
-#
-# The bridge arch directories are what RUN_SCRIPT's install_lsteamclient copies
-# into the CrossOver tree on every launch, so they are the real source of truth.
-# Writing the CrossOver tree here as well only makes the current build testable
-# without launching a game first; the next launch overwrites it from the bridge
-# either way, which means skipping the bridge copy silently reverts the install.
-#
-# The flat bridge copies are separate consumers, not duplicates: RUN_SCRIPT
-# stages them into the prefix Steam directory as the load trigger for the 64 bit
-# side, alongside the 32 bit trigger it puts in syswow64. Wrong-arch flat PEs
-# abort builtin lookup outright, so the flat copy is the x86_64 one.
+# Each launch installs from the bridge, so the CX_ROOT copy only saves launching a
+# game to test. The flat lsteamclient.dll is what goes in the prefix's Steam folder.
install_one() {
from=$1
shift
diff --git a/lsteamclient/fetch.sh b/lsteamclient/fetch.sh
index d13407e..710bcb2 100755
--- a/lsteamclient/fetch.sh
+++ b/lsteamclient/fetch.sh
@@ -1,14 +1,9 @@
#!/bin/sh
-# Assemble a complete lsteamclient source tree: Valve's, at the pinned commit, with
-# the files authored here laid over the top.
+# Puts together the lsteamclient source tree: Valve's, from Proton at the pinned
+# commit, with the files in this folder copied over it.
#
-# Only the authored files are tracked in this repo. Valve's 3,133 are fetched, so
-# their Steamworks SDK licensed sources and the LGPL cxx.h are never redistributed
-# here.
-#
-# Usage:
-# ./fetch.sh assemble if needed
-# ./fetch.sh --refetch discard the cached tarball and assembled tree first
+# ./fetch.sh downloads Proton if needed and rebuilds the tree
+# ./fetch.sh --refetch deletes the download and the tree first
#
# Overridable: PROTON_COMMIT, BASELINE_DIGEST, WORK, TREE
@@ -19,17 +14,14 @@ repo=$(cd "$here/.." && pwd)
PROTON_COMMIT=${PROTON_COMMIT:-164e0ccd2ea2b1ec2e5d08dc97f65b184c2539ca}
-# sha256 over the extracted tree: for each path in sorted order, the sha256 of the
-# path then the sha256 of the contents. This pins content, not the archive, because
-# codeload regenerates the tarball and the gzip framing moves. It also means a
-# force-push that orphans the commit is caught as a mismatch instead of silently
-# building against whatever the branch holds now.
+# sha256 of the extracted files, not the tarball, because the tarball's bytes can
+# change between downloads.
BASELINE_DIGEST=${BASELINE_DIGEST:-b286df1df46a70d9e2cc674676afcc6e08b1a56ce472e5add0932b86940657bf}
WORK=${WORK:-$repo/scratch/proton-lsc}
TREE=${TREE:-$repo/build/lsteamclient}
-# Laid over Valve's tree, in this order, by the loop at the end.
+# Our files that replace Valve's.
authored="steamclient_main.c
unix_steam_input_manual.cpp
unixlib.cpp"
@@ -79,8 +71,7 @@ fi
count=$(find "$base" -type f | wc -l | tr -d ' ')
echo "==> baseline verified: Proton $PROTON_COMMIT, $count files"
-# Rebuilt from the baseline each time so a removed authored file cannot leave a stale
-# copy behind, and so the overlay below is always the only divergence.
+# Rebuilt every time so a file we've removed doesn't linger.
rm -rf "$TREE"
mkdir -p "$(dirname "$TREE")"
cp -c -R "$base" "$TREE" 2>/dev/null || cp -R "$base" "$TREE"
diff --git a/ntdll-patch/detour32.c b/ntdll-patch/detour32.c
index 7013390..3d103a9 100644
--- a/ntdll-patch/detour32.c
+++ b/ntdll-patch/detour32.c
@@ -1,4 +1,4 @@
-//Clever detours, but 32 bit
+// Clever detours, but 32 bit
typedef unsigned long long u64;
typedef unsigned int u32;
@@ -52,7 +52,7 @@ struct io_status { u32 status; u32 information; };
#define ARG_FLAGS(fp) ( (u32 *)((u8 *)(fp) + FLAGS_SLOT))
#define ARG_LOAD_PATH(fp) (*(void **)((u8 *)(fp) + LOAD_PATH_SLOT))
-//WINE_MODREF 32
+// WINE_MODREF 32
#define WM_DLLBASE(wm) (*(u8 **)((u8 *)(wm) + 0x18))
#define WM_FULLNAME(wm) ( (const struct us *)((u8 *)(wm) + 0x24))
#define WM_BASENAME(wm) (*(const u16 **)((u8 *)(wm) + 0x30))
diff --git a/steam-shim/Makefile.in b/steam-shim/Makefile.in
index 31a8b1d..a9a35b7 100644
--- a/steam-shim/Makefile.in
+++ b/steam-shim/Makefile.in
@@ -1,7 +1,6 @@
MODULE = steam.exe
-# CXX_PE_LIBS is Wine's own PE libc++, libc++abi, libunwind, msvcp140 and vcruntime140.
-# mingw's libstdc++ mismatches these and leaves std::basic_string and
-# _Unwind_SjLj_Resume undefined. dlls/dmsynth imports the same way.
+# Wine's own PE libc++. mingw's libstdc++ leaves std::basic_string and
+# _Unwind_SjLj_Resume undefined.
IMPORTS = $(CXX_PE_LIBS) user32 advapi32 shlwapi shell32 msi
EXTRADLLFLAGS = -mwindows -mcygwin -static-libgcc
diff --git a/steam-shim/build.sh b/steam-shim/build.sh
index aaf05ce..ec1e96b 100755
--- a/steam-shim/build.sh
+++ b/steam-shim/build.sh
@@ -1,21 +1,9 @@
#!/bin/bash
-# Build the steam.exe shim from the tracked sources in this directory.
+# Builds the steam.exe shim with make in the Wine tree. Only x86_64 is built,
+# because 32-bit games use the same steam.exe.
#
-# The shim is a PE executable and the wine build tree's own make builds it, so
-# unlike the lsteamclient unix half there is no hand-rolled compile or link here.
-#
-# Only x86_64 is built and shipped. The tree can produce an i386 shim as well and
-# nothing consumes it: RUN_SCRIPT stages one flat steam.exe into the prefix Steam
-# directory, and a 32 bit game reaching it gets a separate process under wow64, so
-# the 64 bit build serves both.
-#
-# A rebuild from unchanged source is byte-identical except for TimeDateStamp and
-# the optional header CheckSum, so the hash reported below has those two fields
-# zeroed and is comparable across builds. See pe-info.py.
-#
-# Usage:
-# ./build.sh build and verify
-# ./build.sh --install also install to the bridge
+# ./build.sh builds and checks it
+# ./build.sh --install also copies it into the bridge
#
# Overridable: WINE_BUILD, WINE_SRC_REL, BRIDGE_DIR
@@ -25,8 +13,7 @@ here=$(cd "$(dirname "$0")" && pwd)
repo=$(cd "$here/.." && pwd)
WINE_BUILD=${WINE_BUILD:-$repo/scratch/wine-build-dual}
-# Relative because it lands in the debug info. Keep the default sibling layout so
-# a rebuild stays comparable to the shipped binary.
+# Relative, since it ends up in the debug info.
WINE_SRC_REL=${WINE_SRC_REL:-../wine}
BRIDGE_DIR=${BRIDGE_DIR:-$HOME/Library/Application Support/notproton/bridge}
@@ -52,16 +39,12 @@ command -v x86_64-w64-mingw32-gcc >/dev/null || { echo "==> missing x86_64-w64-m
"$here/fetch-headers.sh"
echo "==> syncing tracked sources into $WINE_SRC_REL/$prog"
-# The generated Makefile lists only config.status and makedep as its prerequisites,
-# not the per-module Makefile.in files, so a change to IMPORTS or EXTRAINCL here is
-# silently ignored and the build keeps using the previous flags. Notice it rather
-# than trusting make to.
+# The generated Makefile doesn't depend on Makefile.in, so regenerate it here when
+# that changes.
regen=0
cmp -s "$here/Makefile.in" "$src/Makefile.in" || regen=1
-# Unchanged files keep their mtime so make does not rebuild what it does not have
-# to. proton-headers/ goes across too: it is generated, but EXTRAINCL is written
-# against srcdir, so it has to sit under it.
+# proton-headers/ goes too, because EXTRAINCL looks for it under srcdir.
rsync -a --exclude build.sh --exclude fetch-headers.sh "$here/" "$src/"
if [ "$regen" = 1 ]; then
@@ -76,8 +59,7 @@ size=$(stat -f %z "$out")
# shellcheck disable=SC2046
set -- $("$here/../bridge/pe-info.py" "$out")
[ "$1" = "x86_64" ] || { echo "==> built $1, expected x86_64"; exit 1; }
-# The shim statically links jsoncpp and weighs ~14 MB. Anything near zero means
-# the link dropped objects.
+# The real shim is about 14 MB.
[ "$size" -gt 1000000 ] || { echo "==> only $size bytes, the link dropped objects"; exit 1; }
if grep -qa 'ole32\.dll' "$out"; then
echo "==> the shim imports ole32, so a helper run would show up in the Dock"
@@ -87,9 +69,8 @@ echo "==> built $out $1 $size bytes $2 (timestamp and checksum zeroed)"
[ "$install" -eq 1 ] || { echo "==> not installing, pass --install to deploy"; exit 0; }
-# One consumer: RUN_SCRIPT copies the flat bridge copy into the prefix Steam
-# directory on every launch. The shim is not a wine builtin, so nothing goes into
-# the CrossOver tree.
+# Each launch copies this into the prefix's Steam folder. It's not a Wine builtin,
+# so it doesn't go in the CrossOver tree.
dst=$BRIDGE_DIR/steam.exe
mkdir -p "$BRIDGE_DIR"
cp -f "$out" "$dst"
diff --git a/steam-shim/dlfcn.h b/steam-shim/dlfcn.h
index e17aa78..3682c6e 100644
--- a/steam-shim/dlfcn.h
+++ b/steam-shim/dlfcn.h
@@ -1,9 +1,8 @@
#ifndef STEAM_HELPER_DLFCN_SHIM_H
#define STEAM_HELPER_DLFCN_SHIM_H
-/* Minimal dlfcn shim for the PE build. steam.cpp only calls these from the
- OpenVR and vulkan bridge paths, which do not run on this target; the inline
- bodies exist so the source compiles and links unchanged without a POSIX libdl. */
+/* mingw has no dlfcn.h. These stubs always fail, so the OpenVR and Vulkan code in
+ steam.cpp that needs them does nothing. */
#ifdef __cplusplus
extern "C" {
diff --git a/steam-shim/fetch-headers.sh b/steam-shim/fetch-headers.sh
index 728f6f0..a3d059b 100755
--- a/steam-shim/fetch-headers.sh
+++ b/steam-shim/fetch-headers.sh
@@ -1,20 +1,14 @@
#!/bin/sh
-# Assemble the headers the shim compiles against, into proton-headers/ next to the
-# sources so the whole include set sits under srcdir once build.sh syncs it across.
+# Puts the headers the shim needs into proton-headers/.
#
-# Three of them come from Proton submodules, which a codeload tarball does not carry:
-# it records openvr and wine as empty directories. They are fetched individually at
-# the commits Proton pins on proton_9.0, which is the branch this shim's steam.cpp
-# comes from, and each is checked against its recorded hash. Nothing else in either
-# submodule is used: openvr.h pulls in only stdint.h and string, ivrclientcore.h
-# includes nothing, and heap.h needs winbase.h, which the wine tree supplies.
+# openvr.h and ivrclientcore.h come from Valve's openvr repo, and wine/heap.h from
+# Valve's wine repo. Proton includes both as submodules, but its source tarball
+# has empty openvr/ and wine/ folders. So each header is downloaded from its own
+# repo at the commit Proton 9.0 uses. The Steamworks SDK headers are copied from
+# the tree lsteamclient/fetch.sh puts together.
#
-# The Steamworks SDK headers are Valve's too but arrive with lsteamclient, so they
-# are copied from the tree its fetch.sh assembles rather than fetched again.
-#
-# Usage:
-# ./fetch-headers.sh assemble if needed
-# ./fetch-headers.sh --refetch discard the cache first
+# ./fetch-headers.sh downloads what's missing and copies everything
+# ./fetch-headers.sh --refetch deletes the downloads first
#
# Overridable: OPENVR_COMMIT, WINE_COMMIT, CACHE, OUT, LSC_TREE
@@ -23,8 +17,7 @@ set -eu
here=$(cd "$(dirname "$0")" && pwd)
repo=$(cd "$here/.." && pwd)
-# Submodule pins as recorded by Proton at proton_9.0. openvr is ValveSoftware/openvr;
-# the wine submodule url is ../wine relative to Proton, so ValveSoftware/wine.
+# Proton 9.0's submodule pins.
OPENVR_COMMIT=${OPENVR_COMMIT:-f51d87ecf8f7903e859b0aa4d617ff1e5f33db5a}
WINE_COMMIT=${WINE_COMMIT:-015230dc0f78a543032dea0907f6c97304b25ca3}
diff --git a/steam-shim/posix_compat.h b/steam-shim/posix_compat.h
index 0547c3e..98c2439 100644
--- a/steam-shim/posix_compat.h
+++ b/steam-shim/posix_compat.h
@@ -1,9 +1,8 @@
#ifndef STEAM_HELPER_POSIX_COMPAT_H
#define STEAM_HELPER_POSIX_COMPAT_H
-/* setenv is POSIX and absent from the mingw PE C runtime. steam.cpp uses it to
- publish anti-cheat and VR runtime paths into the environment; map it onto the
- mingw _putenv_s so the source builds unchanged. */
+/* mingw has no setenv. steam.cpp uses it for the locale and the anti-cheat
+ runtime paths. */
#include <stdlib.h>
diff --git a/vendor/README.md b/vendor/README.md
index 1435185..27e3966 100644
--- a/vendor/README.md
+++ b/vendor/README.md
@@ -2,24 +2,14 @@
## cJSON
-Tracked in this repo as `cJSON.c` and `cJSON.h`. MIT. Used only by the signature
-database loader.
+`cJSON.c` and `cJSON.h`, MIT licensed, used by the signature database loader.
## Dobby
-Not tracked. `.gitignore` ignores `vendor/dobby/`, so a fresh checkout has to fetch
-it before `make dobby` will work:
+Apache 2.0 licensed, isn't tracked in repo, clone it at the commit used by this project:
git clone https://github.com/jmpews/Dobby.git vendor/dobby
git -C vendor/dobby checkout 5dfc8546954ce3b3198132ab13fddb89ee92cdd7
-That commit is `Fixup typo`, 2024-03-14, and is the revision every measurement in
-this project was taken against. Apache-2.0.
-
-Dobby is pinned rather than tracked at a moving `main` because the inline hook
-trampolines are architecture-specific and a newer revision changes code generation.
-Do not advance the pin without a good reason as well as verifying that hooks still
-install on a supported Steam version.
-
-Build it with `make dobby`. The libraries land in `build/dobby/` and the top-level
-`Makefile` links them from there.
+Then run `make dobby`, which builds it into `build/dobby/`. If you change the commit, check that the hooks still install, and update
+`DOBBY_COMMIT` in `.github/workflows/app.yml` to match.