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
Merge upstream/main into integrate (ray.25)
raymondchins4cca429593d7
diff --cc Makefileindex 27182cb,b922c87..5f19eba--- a/Makefile+++ b/Makefile@@@ -66,8 -67,7 +67,8 @@@ DEPS := $(OBJS:.o=.dtests-list overlay-shim overlay-shim-install overlay-shim-tests \overlay-shim-bench iconmaker icon \appinfo helpers-install ntdll-resolve bridge runcheck compatcheck \- compatsvc-check scriptcheck envcheck buildcheck settingscheck routecheck bridgecheck gamedrivecheck \- compatsvc-check shortcutcheck scriptcheck envcheck buildcheck settingscheck routecheck bridgecheck gamedrivecheck launchercheck launch-shell FORCE++ compatsvc-check shortcutcheck scriptcheck envcheck buildcheck settingscheck routecheck bridgecheck gamedrivecheck \+ gamefixescheck launchercheck padcheck launch-shell FORCEAPP_PAYLOAD := app/Sources/NotProtonApp/Resources/payload@@@ -343,8 -347,8 +356,9 @@@ panel-behaviornode $(PANEL_TESTS)/launch-options.js $(OUT_DIR)/panel-emit && \node $(PANEL_TESTS)/shell.js $(OUT_DIR)/panel-emit && \node $(PANEL_TESTS)/migration.js $(OUT_DIR)/panel-emit && \+ node $(PANEL_TESTS)/effective.js $(OUT_DIR)/panel-emit && \node $(PANEL_TESTS)/localization.js $(OUT_DIR)/panel-emit && \+ node $(PANEL_TESTS)/fex.js $(OUT_DIR)/panel-emit && \echo "==> panel behavior: renders as expected, no stale arguments"CX_ROOT ?= /Applications/CrossOver Preview.appdiff --cc dylib/feats/compat_run.shindex e95c265,e086029..2adc069--- a/dylib/feats/compat_run.sh+++ b/dylib/feats/compat_run.sh@@@ -18,24 -18,124 +18,142 @@@ case "$verb" iesacnp_support="$HOME/Library/Application Support/notproton"+controller_bridge="$np_support/controllers/dualsense/launch"+if [ "$verb" = waitforexitandrun ] && [ "${DSB_SESSION:-0}" != 1 ] && [ -x "$controller_bridge" ]; then+ exec "$controller_bridge" "$0" "$verb" "$@"+fi+if [ -n "$DSB_LIBRARY" ] && [ -f "$DSB_LIBRARY" ]; then+ export DYLD_INSERT_LIBRARIES="$DSB_LIBRARY${DYLD_INSERT_LIBRARIES:+:$DYLD_INSERT_LIBRARIES}"+fi+# Steam's macOS virtual Xbox device has input but no SDL2 rumble backend.+# The Wine-local adapter forwards only that device's rumble to native Steam.+steam_rumble="$np_support/controllers/steam-input/rumble.dylib"+NOTPROTON_RUMBLE_LIBRARY=""+if [ "$verb" = waitforexitandrun ] && [ "${NOTPROTON_RAW_CONTROLLERS:-0}" != 1 ] \+ && [ "${NOTPROTON_STEAM_RUMBLE:-1}" != 0 ] && [ -f "$steam_rumble" ]; then+ export NOTPROTON_STEAM_RUMBLE=1+ NOTPROTON_RUMBLE_LIBRARY="$steam_rumble"+ export DYLD_INSERT_LIBRARIES="$steam_rumble${DYLD_INSERT_LIBRARIES:+:$DYLD_INSERT_LIBRARIES}"+fi+export NOTPROTON_RUMBLE_LIBRARY+ iconmaker="$np_support/iconmaker"++ find_client_root() {+ client_root="$1"+ while [ -n "$client_root" ] && [ "$client_root" != "/" ] && [ ! -d "$client_root/appcache" ]; do+ client_root=$(dirname "$client_root")+ done+ }++ read_app_meta() {+ appinfo_tool="$np_support/appinfo"+ appinfo_vdf="$client_root/appcache/appinfo.vdf"+ meta_name=""+ meta_icon=""+ meta_clienticon=""+ if [ -x "$appinfo_tool" ] && [ -f "$appinfo_vdf" ]; then+ meta=$("$appinfo_tool" "$appinfo_vdf" "$app_id" 2>> "$log") || meta=""+ meta_name=$(printf '%s\n' "$meta" | sed -n 's/^name=//p')+ meta_icon=$(printf '%s\n' "$meta" | sed -n 's/^icon=//p')+ meta_clienticon=$(printf '%s\n' "$meta" | sed -n 's/^clienticon=//p')+ case "$meta_icon" in *[!0-9a-f]*) meta_icon="" ;; esac+ case "$meta_clienticon" in *[!0-9a-f]*) meta_clienticon="" ;; esac+ fi+ }++ resolve_icon() {+ set +e+ art_dir="$client_root/appcache/librarycache/$app_id"+ art=""+ ico=""+ if [ -n "$meta_clienticon" ]; then+ ico="$icon_root/clienticon-$meta_clienticon.ico"+ absent="$icon_root/clienticon-$meta_clienticon.absent"+ failed="$icon_root/clienticon-$meta_clienticon.failed"+ find "$icon_root" -maxdepth 1 -name 'clienticon-*' ! -name "clienticon-$meta_clienticon.*" -delete 2>/dev/null || true+ find "$absent" -mtime +14 -delete 2>/dev/null || true+ find "$failed" -mmin +60 -delete 2>/dev/null || true+ if [ ! -s "$ico" ] && [ ! -f "$absent" ] && [ ! -f "$failed" ]; then+ url="https://shared.fastly.steamstatic.com/community_assets/images/apps/$app_id/$meta_clienticon.ico"+ code=$(curl -fsL --connect-timeout 5 --max-time 20 -w '%{http_code}' -o "$ico.new" "$url" 2>>"$log")+ magic=$(od -An -tx1 -N4 "$ico.new" 2>/dev/null | tr -d ' \n')+ if [ "$magic" = "00000100" ]; then+ mv -f "$ico.new" "$ico"+ echo "fetched client icon $meta_clienticon" >> "$log" 2>&1 || true+ else+ rm -f "$ico.new"+ if [ "$code" = "404" ]; then+ : > "$absent"+ echo "no client icon published for $meta_clienticon" >> "$log" 2>&1 || true+ else+ : > "$failed"+ echo "client icon fetch for $meta_clienticon failed (http ${code:-none}), will retry in an hour" >> "$log" 2>&1 || true+ fi+ fi+ fi+ [ -s "$ico" ] && art="$ico"+ fi+ if [ -z "$art" ] && [ -n "$meta_icon" ] && [ -f "$art_dir/$meta_icon.jpg" ]; then+ art="$art_dir/$meta_icon.jpg"+ fi+ if [ -z "$art" ]; then+ art=$(find "$art_dir" -maxdepth 1 -type f -name '*.jpg' 2>/dev/null | grep -E '/[0-9a-f]{40}\.jpg$' | head -1)+ fi+ # Capsule art (horrible) fallback if no icon at all exists...+ if [ -z "$art" ]; then+ for name in library_600x900.jpg header.jpg; do+ found=$(find "$art_dir" -name "$name" 2>/dev/null | head -1)+ [ -n "$found" ] && { art="$found"; break; }+ done+ fi+ # non-Steam shortcuts have no art, so (as a temporary measure while I think of+ # better ways to solve for this) let's use the icon in the EXE itself instead.+ if [ -z "$art" ] && [ -f "$target" ]; then+ case "$(printf '%s' "$target" | tr '[:upper:]' '[:lower:]')" in+ *.exe) art="$target" ;;+ esac+ fi+ icon_source=""+ if [ -n "$art" ]; then+ icon_source="$art $(stat -f %m "$art" 2>/dev/null || echo 0)"+ fi+ icon_cache="$icon_root/game.icns"+ icon_status=1+ if [ -n "$art" ] && [ -s "$icon_cache" ] && [ "$(cat "$icon_root/notproton-icon.source" 2>/dev/null)" = "$icon_source" ]; then+ icon_status=0+ echo "icon reused from $art" >> "$log" 2>&1 || true+ elif [ -n "$art" ] && [ -x "$iconmaker" ]; then+ if "$iconmaker" "$art" "$icon_cache" >> "$log" 2>&1; then+ icon_status=0+ printf '%s\n' "$icon_source" > "$icon_root/notproton-icon.source"+ echo "icon built from $art" >> "$log" 2>&1 || true+ elif [ "$art" = "$ico" ]; then+ # A cached .ico that iconmaker rejects is corrupt and passes the size+ # guard on every launch, so drop it to force a clean fetch next time.+ rm -f "$ico"+ echo "discarded unreadable client icon $meta_clienticon" >> "$log" 2>&1 || true+ fi+ fi+ set -e+ return $icon_status+ }++ case "$verb" in+ shortcut-icons)+ app_id="$1"+ case "$app_id" in ''|0|*[!0-9]*) exit 1 ;; esac+ case "$2" in /*) ;; *) exit 1 ;; esac+ find_client_root "$2"+ icon_root="$np_support/shortcut-icons/$app_id"+ mkdir -p "$icon_root"+ log="$icon_root/icon.log"+ : > "$log"+ target=""+ read_app_meta+ resolve_icon && "$iconmaker" --shortcuts "$app_id" "$icon_cache" "$2/steam.icns" >> "$log" 2>&1 || true+ exit 0+ ;;+ esac# cxcompatdb resolves its database through CX_HOME and logs an error for# every module loaded without it :(@@@ -104,43 -210,9 +234,44 @@@ fecho "STEAM_COMPAT_APP_ID=$STEAM_COMPAT_APP_ID"echo "-- steam env passed through --"env | grep -iE '^(Steam|SDL_)' | sort+ [ -z "$np_dropped" ] || echo "ignored on arm64 Wine: $np_dropped"} >> "$log" 2>&1 || true+# Wine keeps its server socket in <tmp>/.wine-<uid> and the wineserver refuses to start when+# others can read it ("must not be accessible by other users"). A directory of ours with a+# looser mode goes back to 0700. A link, or a directory someone else owns, is only reported:+# it is never followed or changed.+heal_wine_tmp() {+ wine_tmp="$1/.wine-$(id -u)"+ if [ -L "$wine_tmp" ]; then+ echo "=== warning: $wine_tmp is a symlink, left alone; wineserver may refuse to start ===" >> "$log" 2>&1 || true+ return 0+ fi+ [ -e "$wine_tmp" ] || return 0+ wine_tmp_info=$(stat -f '%u %Lp %HT' "$wine_tmp" 2>/dev/null) || return 0+ wine_tmp_owner=${wine_tmp_info%% *}+ wine_tmp_rest=${wine_tmp_info#* }+ wine_tmp_mode=${wine_tmp_rest%% *}+ wine_tmp_type=${wine_tmp_rest#* }+ if [ "$wine_tmp_type" != Directory ]; then+ echo "=== warning: $wine_tmp is not a directory ($wine_tmp_type), left alone ===" >> "$log" 2>&1 || true+ return 0+ fi+ if [ "$wine_tmp_owner" != "$(id -u)" ]; then+ echo "=== warning: $wine_tmp belongs to uid $wine_tmp_owner, left alone; wineserver may refuse to start ===" >> "$log" 2>&1 || true+ return 0+ fi+ [ "$wine_tmp_mode" != 700 ] || return 0+ # -h: should the directory have been swapped for a link since the checks, the link+ # itself changes, never what it points at.+ if chmod -h 700 "$wine_tmp" 2>> "$log"; then+ echo "=== $wine_tmp was mode $wine_tmp_mode, set to 700 ===" >> "$log" 2>&1 || true+ else+ echo "=== warning: could not set $wine_tmp to mode 700 ===" >> "$log" 2>&1 || true+ fi+}+heal_wine_tmp /tmp+stage_step="startup"# shellcheck disable=SC2329 # the trap below invokes thisreport_early_exit() {@@@ -2026,14 -1363,8 +2070,14 @@@ for f in "$wine_unix"/*; dln -sfn "$f" "$loader_macos/$base"doneln "$WINELOADER" "$loader_macos/wine" 2>/dev/null || cp "$WINELOADER" "$loader_macos/wine"+game_host=""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+ fi- WINELOADER="$loader_app/Contents/MacOS/wine"echo "loader staged in bundle for game mode" >> "$log" 2>&1 || trueelseecho "loader staging failed, game mode unavailable" >> "$log" 2>&1 || true@@@ -2202,7 -1485,7 +2217,7 @@@ elsecho "=== client staged no overlay renderer, overlay disabled ===" >> "$log" 2>&1 || truefiset -- --args "$shim_exe" "$@"- for name in $(env | sed -nE 's/^(CX_APPLEGPTK_LIBD3DSHARED_PATH|SDL_GAMECONTROLLERCONFIG(_FILE)?|SDL_JOYSTICK_MFI|WINE_LARGE_ADDRESS_AWARE|WINE_CPU_TOPOLOGY|Steam[A-Za-z0-9]*|(CX_GRAPHICS|D3DM_|DXMT_|DXVK_|MVK_|VKD3D_|STAGING_|MTL_|ROSETTA_)[A-Z0-9_]*|NOTPROTON_FRAMEGEN(_[A-Z]+)?|NOTPROTON_NGX_SIGNER|NOTPROTON_NVAPI_DRIVER|NOTPROTON_DRIVER_VERSION|NOTPROTON_STDOUT_NULL|NOTPROTON_VSYNC|CX_ACTIVE_GRAPHICS_BACKEND)=.*/\1/p'); do-for name in $(env | LC_ALL=C sed -nE 's/^(CX_APPLEGPTK_LIBD3DSHARED_PATH|Steam[A-Za-z0-9]*|(CX_GRAPHICS|D3DM_|DXMT_|DXVK_|MTL_|ROSETTA_)[A-Z0-9_]*)=.*/\1/p'); do++for name in $(env | LC_ALL=C sed -nE 's/^(CX_APPLEGPTK_LIBD3DSHARED_PATH|SDL_GAMECONTROLLERCONFIG(_FILE)?|SDL_JOYSTICK_MFI|WINE_LARGE_ADDRESS_AWARE|WINE_CPU_TOPOLOGY|Steam[A-Za-z0-9]*|(CX_GRAPHICS|D3DM_|DXMT_|DXVK_|MVK_|VKD3D_|STAGING_|MTL_|ROSETTA_)[A-Z0-9_]*|NOTPROTON_FRAMEGEN(_[A-Z]+)?|NOTPROTON_NGX_SIGNER|NOTPROTON_NVAPI_DRIVER|NOTPROTON_DRIVER_VERSION|NOTPROTON_STDOUT_NULL|NOTPROTON_VSYNC|CX_ACTIVE_GRAPHICS_BACKEND)=.*/\1/p'); doeval "value=\$$name"# shellcheck disable=SC2154 # eval assigns value on the line aboveset -- --env "$name=$value" "$@"@@@ -2235,63 -1509,10 +2250,41 @@@ set --lsregister="/System/Library/Frameworks/CoreServices.framework/Versions/A"lsregister="$lsregister/Frameworks/LaunchServices.framework/Support/lsregister"[ -x "$lsregister" ] && "$lsregister" -f "$loader_app" >> "$log" 2>&1 || true-open -n -W -a "$loader_app" "$@" >> "$log" 2>&1 &+if [ "${NOTPROTON_LAUNCH_SERVICES:-0}" = "1" ]; then+ open -n -W -a "$loader_app" "$@" >> "$log" 2>&1 &+else+ # A bundle started by `open` is its own TCC responsible process, so every game+ # needed a separate Input Monitoring grant before controllers worked. Started+ # from here it stays attributed to Steam, which already holds that grant, and+ # macOS still takes the Dock name and icon from the enclosing bundle. env -i+ # with the same --env list keeps the environment `open` would have given it.+ count=$#+ i=0+ mode=vars+ while [ "$i" -lt "$count" ]; do+ arg=$1+ shift+ i=$((i + 1))+ case "$mode:$arg" in+ vars:--env)+ set -- "$@" "$1"+ shift+ i=$((i + 1))+ ;;+ vars:--args)+ mode=args+ set -- "$@" "$loader_app/Contents/MacOS/launcher"+ ;;+ args:*) set -- "$@" "$arg" ;;+ esac+ done+ echo "launching bundle directly so input permission stays with Steam" >> "$log" 2>&1 || true+ env -i HOME="$HOME" USER="$USER" LOGNAME="$LOGNAME" SHELL="$SHELL" TMPDIR="$TMPDIR" \+ __CF_USER_TEXT_ENCODING="$__CF_USER_TEXT_ENCODING" "$@" >> "$log" 2>&1 &+fiopen_pid=$!status=0- seen=0- idle=0- while :; do- if prefix_game_running; then- seen=1- idle=0- else- idle=$((idle + 1))- fi- if ! kill -0 "$open_pid" 2>/dev/null; then- wait "$open_pid" || status=$?- echo "=== bundle exited status=$status ===" >> "$log" 2>&1 || true- if [ "$status" -le 128 ]; then- wait_prefix_idle- fi- break- fi- if [ "$seen" -eq 1 ] && [ "$idle" -ge 10 ]; then- echo "=== game tree gone, ending session ===" >> "$log" 2>&1 || true- break- fi- sleep 1- done+ wait "$open_pid" || status=$?echo "=== game exited status=$status, killing wine prefix ===" >> "$log" 2>&1 || truekill_wine_prefixecho "=== wine prefix killed, session ending ===" >> "$log" 2>&1 || truediff --cc dylib/feats/webpatch.cindex 134bad4,d46bd18..cf7e23c--- a/dylib/feats/webpatch.c+++ b/dylib/feats/webpatch.c@@@ -157,10 -199,32 +201,32 @@@ static int out_expand(np_out_t *o, cons"else{const w=wd();if(!c.length&&/^(if|then|else|elif|do|while|until|!|\\{)$/" \".test(o.slice(w.start,w.end)))cs.push(c=[]);else c.push(w)}}" \"const m=w=>/%command%/i.test(o.slice(w.start,w.end)),G=cs.find(c=>c.some(m));" \- "if(!G)return{p:0,e:[]};" \+ "if(!G)return{p:0,e:[],G:[],c:-1};" \"const n=G.findIndex(w=>m(w)||!/^[A-Za-z_]\\w*=/.test(o.slice(w.start,w.end)));" \- "return{p:G[0].start,e:G.slice(0,n<0?G.length:n)}})(),"+ "return{p:G[0].start,e:G.slice(0,n<0?G.length:n),G:G,c:G.findIndex(m)}})(),"+ // Rewrites KEY=value entries before %command% and leaves the rest of the text byte for byte.+ #define NP_CX_LAUNCH \+ "(o,id)=>{const " NP_CX_LAUNCH_PARSE \+ "g=k=>{const p=E.e.filter(w=>o.startsWith(k+\"=\",w.start)).pop();" \+ "return p?(p.value===null?o.slice(p.start+k.length+1,p.end):p.value.slice(k.length+1)):\"\"}," \+ "qv=v=>/^[\\w.,:=\\/+@%-]*$/.test(v)?v:\"'\"+v.replace(/'/g,\"'\\\\''\")+\"'\"," \+ "s=ps=>{const add=ps.filter(p=>p[1]).map(p=>p[0]+\"=\"+qv(p[1])).join(\" \");let r;" \+ "if(!/%command%/i.test(o)){if(!add)return;r=add+\" %command%\"+(o.trim()?\" \"+o:\"\")}" \+ "else{let at=E.p;r=o.slice(0,at)+(add?add+\" \":\"\");" \+ "E.e.forEach(w=>{if(ps.some(p=>o.startsWith(p[0]+\"=\",w.start))){" \+ "r+=o.slice(at,w.start);at=w.end;while(o[at]===\" \"||o[at]===\"\\t\")at++}});r+=o.slice(at)}" \+ "SteamClient.Apps.SetAppLaunchOptions(id,r.trim()===\"%command%\"?\"\":r)};" \+ "return{g,s,k:E.e.map(w=>o.slice(w.start,w.end).split(\"=\")[0])}}"++ #define NP_CX_PICK \+ "(t,n)=>{const o=t.strLaunchOptions||\"\";" \+ "if(" NP_FEX_TOOLS ".indexOf(n)<0||/[<>\\n]|\\$'/.test(o))return;" \+ "const L=MSCXLaunch(o,t.unAppID)," \+ "ks=L.k.filter(k=>/^D3DM_[A-Z0-9_]*$/.test(k)||k===\"ROSETTA_ADVERTISE_AVX\"" \+ "||k===\"CX_GRAPHICS_BACKEND\"&&L.g(k)===\"d3dmetal\");" \+ "ks.length&&L.s(ks.map(k=>[k,\"\"]))}"+// CrossOver options panel. Not in great shape, but it'll do#define NP_WEB_IS_ZH \"(()=>{const l=(globalThis.document?.documentElement?.lang||" \@@@ -186,63 -251,14 +253,64 @@@#define NP_CX_OPTIONS_BODY(ARG, RT, BARREL) \ARG "=>{" \"const t=" ARG ".details,o=t.strLaunchOptions||\"\"," \+ "fex=" NP_FEX_TOOLS ".indexOf(t.strCompatToolName||\"" NP_FALLBACK_TOOL "\")>=0," \"npZh=" NP_WEB_IS_ZH ",npL=(en,zh)=>npZh?zh:en," \- "L=MSCXLaunch(o,t.unAppID),g=L.g,s=L.s," \+ NP_CX_LAUNCH_PARSE \+ "nat=t.unAppID<2147483648&&(t.vecPlatforms||[]).indexOf(\"osx\")>=0&&!t.strCompatToolName," \+ "wv=w=>w.value===null?o.slice(w.start,w.end):w.value," \+ "NE=E.c<0?[]:E.G.slice(0,E.c).filter(w=>/^[A-Za-z_]\\w*=/.test(wv(w)))," \+ "A=k=>(nat?NE.filter(w=>wv(w).startsWith(k+\"=\")):E.e.filter(w=>o.startsWith(k+\"=\",w.start))).pop()," \+ "g=k=>{const p=A(k);return p?wv(p).slice(k.length+1):\"\"}," \+ "qv=v=>/^[\\w.,:=\\/+@%-]*$/.test(v)?v:\"'\"+v.replace(/'/g,\"'\\\\''\")+\"'\"," \+ "sl=ps=>{const add=ps.filter(p=>p[1]).map(p=>p[0]+\"=\"+qv(p[1])).join(\" \");let r;" \+ "if(!/%command%/i.test(o)){if(!add)return;r=add+\" %command%\"+(o.trim()?\" \"+o:\"\")}" \+ "else{let at=E.p;r=o.slice(0,at)+(add?add+\" \":\"\");" \+ "E.e.forEach(w=>{if(ps.some(p=>o.startsWith(p[0]+\"=\",w.start))){" \+ "r+=o.slice(at,w.start);at=w.end;while(o[at]===\" \"||o[at]===\"\\t\")at++}});r+=o.slice(at)}" \+ "SteamClient.Apps.SetAppLaunchOptions(t.unAppID,r.trim()===\"%command%\"?\"\":r)}," \+ /* Native games run through np-native, which also forces arm64: <launcher> VAR=VALUE ... \+ %command% <game args>. Assignments are read from any word before %command%, so the \+ older "/usr/bin/arch ... -e VAR=VALUE" form is understood, and rewritten without the \+ arch prefix and its DYLD_INSERT_LIBRARIES. */ \+ "sn=ps=>{const c=E.c<0?null:E.G[E.c]," \+ "L=Fx.h?Fx.h+\"/.notproton/np-native\":(c&&E.G.slice(0,E.c).map(wv)" \+ ".find(x=>/\\/\\.notproton\\/np-native$/.test(x)))||\"\";" \+ "if(!L||!c&&!ps.some(p=>p[1]))return;" \+ "const kn=w=>{const x=wv(w);return x.slice(0,x.indexOf(\"=\"))};" \+ "let vs=NE.filter(w=>kn(w)!==\"DYLD_INSERT_LIBRARIES\").map(w=>[kn(w),o.slice(w.start,w.end)]);" \+ "ps.forEach(p=>{const i=vs.findIndex(x=>x[0]===p[0]);vs=vs.filter(x=>x[0]!==p[0]);" \+ "if(p[1])vs.splice(i<0?vs.length:i,0,[p[0],p[0]+\"=\"+qv(p[1])])});" \+ "const h=[qv(L)].concat(vs.map(x=>x[1])).join(\" \");" \+ "SteamClient.Apps.SetAppLaunchOptions(t.unAppID," \+ "c?o.slice(0,E.p)+h+\" \"+o.slice(c.start):h+\" %command%\"+(o.trim()?\" \"+o.trim():\"\"))}," \+ "s=ps=>nat?sn(ps):sl(ps)," \+ "Fx=globalThis.MSCXFx||{}," \+ "dv=k=>{if(nat){const a=(Fx.na||{})[t.unAppID]||{},n=Fx.ng||{};" \+ "return k in a?a[k]:k in n?n[k]:(Fx.d||{})[k]||\"\"}" \+ "const a=(Fx.a||{})[t.unAppID]||{},en=Fx.e||{},x=en[t.strCompatToolName]||en[\"\"]||{};" \+ "return k in a?a[k]:k in(Fx.g||{})?Fx.g[k]:k in x?x[k]:(Fx.d||{})[k]||\"\"}," \+ "ev=k=>A(k)?g(k):dv(k)," \"T=(ks,l,on,off)=>(0," RT ".jsx)(" BARREL ".Yh,{className:\"MSCXRow\",label:l," \- "checked:g(ks[0])===on," \- "onChange:v=>s(ks.map(k=>[k,v?on:(off||\"\")]))},ks[0])," \+ "checked:ev(ks[0])===on," \+ "onChange:v=>s(ks.map(k=>[k,v?(dv(k)===on?\"\":on):(dv(k)===on?(off||\"0\"):\"\")]))},ks[0])," \+ /* A labelled dropdown row. n turns a raw value, set or not, into an option's data, so \+ picking what the confs already give drops the argument instead of writing it. */ \+ "D=(k,l,O,n)=>(0," RT ".jsx)(" BARREL ".m,{label:l,strClassName:\"MSCXRow\",rgOptions:O," \+ "selectedOption:n(ev(k)),onChange:v=>s([[k,v.data===n(dv(k))?\"\":v.data]])},k)," \+ "lc=z=>x=>(x||z).toLowerCase()," \+ "fz=x=>{x=(x||\"\").toLowerCase();return x===\"1\"?\"2\":/^(0|off|false|no)?$/.test(x)?\"0\":x}," \+ "fo=fz(ev(\"NOTPROTON_FRAMEGEN\"))!==\"0\"," \+ "FG=()=>(0," RT ".jsxs)(" BARREL ".XY,{label:\"Frame Generation (Experimental. Adds input lag)\",children:[" \+ "D(\"NOTPROTON_FRAMEGEN\",\"Mode\",[{data:\"0\",label:\"Off\"},{data:\"2\",label:\"2x\"}," \+ "{data:\"3\",label:\"3x\"},{data:\"adaptive\",label:\"Adaptive (fills to display refresh)\"}],fz)," \+ "fo&&D(\"NOTPROTON_FRAMEGEN_QUALITY\",\"Quality\",[{data:\"performance\",label:\"Performance\"}," \+ "{data:\"balanced\",label:\"Balanced\"},{data:\"quality\",label:\"Quality\"}],lc(\"balanced\"))," \+ "fo&&T([\"NOTPROTON_FRAMEGEN_UI\"],\"Protect UI (keeps static HUD and menus sharp)\",\"1\",\"0\")," \+ "fo&&T([\"NOTPROTON_FRAMEGEN_FALLBACK\"],\"Fast-motion fallback (skips frames that would smear)\",\"1\",\"0\")," \+ "fo&&D(\"NOTPROTON_FRAMEGEN_ENGINE\",\"Engine\",[{data:\"own\",label:\"Built-in optical flow\"}," \+ "{data:\"metalfx\",label:\"MetalFX\"}],lc(\"own\"))]},\"fgn\")," \- "b=g(\"CX_GRAPHICS_BACKEND\")," \- "dm=\"\"===b||\"d3dmetal\"===b," \+ "bv=g(\"CX_GRAPHICS_BACKEND\"),b=fex&&\"d3dmetal\"===bv?\"\":bv," \+ "dm=!fex&&(\"\"===b||\"d3dmetal\"===b)," \"dx=\"\"===b||\"dxmt\"===b," \"sw=\"1\"===g(\"DXMT_METALFX_SPATIAL_SWAPCHAIN\")," \"F=\"d3d11.metalSpatialUpscaleFactor=\"," \@@@ -260,14 -276,9 +328,14 @@@"{data:\"d3dmetal\",label:\"D3DMetal\"}," \"{data:\"dxmt\",label:\"DXMT\"}," \"{data:\"dxvk\",label:\"DXVK\"}," \- "{data:\"wined3d\",label:\"WineD3D\"}];" \+ "{data:\"wined3d\",label:\"WineD3D\"}].filter(x=>!fex||x.data!==\"d3dmetal\");" \- "if(t.unAppID<2147483648&&(t.vecPlatforms||[]).indexOf(\"osx\")>=0" \- "&&!t.strCompatToolName)return null;" \+ "if(nat)return(0," RT ".jsx)(\"div\",{className:\"MSCXPanel\",children:(0," RT ".jsxs)(" RT ".Fragment,{children:[" \+ "(0," RT ".jsx)(\"style\",{children:" NP_CX_OPTIONS_CSS "})," \+ "T([\"MTL_HUD_ENABLED\"],\"Metal HUD\",\"1\"),FG()," \+ "(0," RT ".jsx)(" BARREL ".XY,{label:\"Controllers\",children:" \+ "D(\"NP_PAD_MODE\",\"Controller layer\",[{data:\"\",label:\"Automatic\"},{data:\"hid\",label:\"Raw HID (Unity, SDL, Unreal)\"}," \+ "{data:\"gc\",label:\"GameController\"},{data:\"off\",label:\"Off\"}],lc(\"\"))},\"ctl\")" \+ "]})});" \"return(0," RT ".jsx)(\"div\",{className:\"MSCXPanel\",children:(0," RT ".jsxs)(" RT ".Fragment,{children:[" \"(0," RT ".jsx)(\"style\",{children:" NP_CX_OPTIONS_CSS "})," \"(0," RT ".jsxs)(" BARREL ".XY,{label:npL(\"Graphics\",\"图形\"),children:[" \diff --cc dylib/tests/launchercheck.shindex 1031aff,a7cd3f7..bdc99b5--- a/dylib/tests/launchercheck.sh+++ b/dylib/tests/launchercheck.sh@@@ -217,5 -217,71 +217,72 @@@ for failure in install backup signal siis "$failure cleans staging" "0" "$(leftover)"done+ echo "== launch Dock icon =="+ icon_funcs=$(sed -n '/^find_client_root() {$/,/^case "\$verb" in$/p' "$SRC" | sed '$d')+ icon_lines=$(sed -n '/^icon_arg=""$/,/^\[ -n "\$icon_arg" \] ||/p' "$SRC")+ [ -n "$icon_funcs" ] && [ -n "$icon_lines" ] || { echo "FAIL: launch icon code not found"; exit 1; }+ eval "$icon_funcs"+ np_support="$T/support"+ iconmaker="$np_support/iconmaker"+ mkdir -p "$np_support" "$T/steam/appcache/librarycache/100"+ printf '#!/bin/sh\nprintf "icon=abc123\\n"\n' > "$np_support/appinfo"+ printf '#!/bin/sh\ncp "$1" "$2"\n' > "$iconmaker"+ chmod 755 "$np_support/appinfo" "$iconmaker"+ : > "$T/steam/appcache/appinfo.vdf"+ printf 'game art' > "$T/steam/appcache/librarycache/100/abc123.jpg"+ app_id=100+ target=""+ find_client_root "$T/steam/Steam.AppBundle/Steam/Contents/MacOS"+ read_app_meta+ loader_root="$T/launchers/100"+ loader_res="$loader_root/new/Contents/Resources"+ mkdir -p "$loader_res"+ : > "$log"+ eval "$icon_lines"+ is "icon key set" " <key>CFBundleIconFile</key><string>game</string>" "$icon_arg"+ is "bundle gets the artwork" "game art" "$(cat "$loader_res/game.icns")"+ is "artwork cached with the launcher" "game art" "$(cat "$loader_root/game.icns")"+ is "artwork built" "icon built from $T/steam/appcache/librarycache/100/abc123.jpg" "$(cat "$log")"+ rm -f "$iconmaker" "$loader_res/game.icns"+ : > "$log"+ eval "$icon_lines"+ is "cached artwork reused" "icon reused from $T/steam/appcache/librarycache/100/abc123.jpg" "$(cat "$log")"+ is "reused artwork copied" "game art" "$(cat "$loader_res/game.icns")"+ rm "$T/steam/appcache/librarycache/100/abc123.jpg" "$loader_res/game.icns"+ : > "$log"+ eval "$icon_lines"+ is "no artwork, no icon key" "" "$icon_arg"+ is "no artwork logged" "no icon resolved, launching without one" "$(cat "$log")"+ if [ -d "$np_support/shortcut-icons" ]; then bad "launch leaves shortcut cache alone" "absent" "present"; else ok "launch leaves shortcut cache alone"; fi++ echo "== session lasts as long as the shim =="+ session_trap=$(sed -n '/^terminate() {$/,/^trap terminate TERM INT HUP$/p' "$SRC")-session_wait=$(sed -n '/^open -n -W -a "\$loader_app"/,/^exit \$status$/p' "$SRC")++# NotProton-WineHQ launches directly unless NOTPROTON_LAUNCH_SERVICES=1; the open branch is the one tested.++session_wait=$(sed -n '/^if \[ "\${NOTPROTON_LAUNCH_SERVICES:-0}" = "1" \]; then$/,/^exit \$status$/p' "$SRC")+ [ -n "$session_trap" ] && [ -n "$session_wait" ] || { echo "FAIL: session code not found"; exit 1; }+ {+ printf 'log=%s\nopen() { sleep "$1"; return "$2"; }\n' "$T/session.log"+ printf 'kill_wine_prefix() { echo kill >> "%s"; }\n' "$T/session.ev"+ printf '%s\n' "$session_trap"- printf 'set -- "$1" "$2"\nloader_app=x\n'++ printf 'set -- "$1" "$2"\nloader_app=x\nNOTPROTON_LAUNCH_SERVICES=1\n'+ printf '%s\n' "$session_wait" | sed 's/open -n -W -a "\$loader_app" "\$@"/open "$@"/'+ } > "$T/session.sh"-grep -q '^open "\$@"' "$T/session.sh" || { echo "FAIL: session launch line not rewritten"; exit 1; }++grep -q '^ *open "\$@"' "$T/session.sh" || { echo "FAIL: session launch line not rewritten"; exit 1; }+ : > "$T/session.ev"+ start=$(date +%s)+ rc=0; sh "$T/session.sh" 3 7 || rc=$?+ is "the shim's exit status is the session's" 7 "$rc"+ is "the session waits for the shim" yes "$([ $(($(date +%s) - start)) -ge 3 ] && echo yes || echo no)"+ is "the prefix is torn down once" kill "$(cat "$T/session.ev")"+ : > "$T/session.ev"+ start=$(date +%s)+ sh "$T/session.sh" 30 0 & sp=$!+ sleep 1+ kill -TERM "$sp"+ rc=0; wait "$sp" || rc=$?+ is "exit game ends the session" 143 "$rc"+ is "exit game does not wait out the shim" yes "$([ $(($(date +%s) - start)) -lt 5 ] && echo yes || echo no)"+ is "exit game tears the prefix down" yes "$(grep -q kill "$T/session.ev" && echo yes || echo no)"+[ "$fails" -eq 0 ] || { echo "launchercheck: $fails failed"; exit 1; }echo "launchercheck: all passed"diff --cc dylib/tests/panel-behavior/emit.cindex 135d711,854ce3d..b5d2e46--- a/dylib/tests/panel-behavior/emit.c+++ b/dylib/tests/panel-behavior/emit.c@@@ -49,6 -38,7 +57,7 @@@ int main(int argc, char **argv)fputs(NP_IMAGE_FILES_LABEL, stdout);return 0;}- fputs("usage: emit component|statement|migration|transform <chunk> <fallback tool>|compat-hint|image-files-label\n", stderr);- fputs("usage: emit component|statement [fallback [fex-tool...]]|migration|compat-hint|"- "image-files-label\n", stderr);++ fputs("usage: emit component|statement [fallback [fex-tool...]]|migration|"++ "transform <chunk> <fallback tool>|compat-hint|image-files-label\n", stderr);return 2;}diff --cc dylib/tests/panel-behavior/harness.jsindex bc2b91c,eab2afc..48009c7--- a/dylib/tests/panel-behavior/harness.js+++ b/dylib/tests/panel-behavior/harness.js@@@ -21,18 -20,17 +20,19 @@@ const barrel = { XY: 'Section', m: 'Dro// The two shapes take the payload in different forms and bind different names, which// is the whole of the difference between them.const FORMS = {- component: { arg: 'component', react: 'i', barrel: 'c' },- statement: { arg: 'statement', react: 'R0', barrel: 'B0' },+ component: { react: '\u0004', barrel: '\u0005' },+ statement: { react: '\u0003', barrel: '\u0004' },};- // The stand-in global falls through to the real one, so a test's globalThis.MSCXFx still reaches the panel.-// `fallback` and `fexTools` stand in for what the hook sets before the transform.-function panel(emit, form, globals = { document: { documentElement: { lang: 'en' } } },++// `fallback` and `fexTools` stand in for what the hook sets before the transform. The++// stand-in global falls through to the real one, so a test's globalThis.MSCXFx still reaches the panel.+function panel(emit, form, globals = Object.assign(Object.create(globalThis),- { document: { documentElement: { lang: 'en' } } })) {- const raw = execFileSync(emit, [form], { encoding: 'utf8' }).trim();- const src = form === 'component'- ? 'var ' + raw.replace(/,$/, '')- : expand(raw).replace(/;$/, '');++ { document: { documentElement: { lang: 'en' } } }),+ { fallback = 'notproton', fexTools = [], names = ['R0', 'B0'] } = {}) {+ const raw = execFileSync(emit, [form, fallback, ...fexTools], { encoding: 'utf8' }).trim();const f = FORMS[form];+ const body = expand(raw, { [f.react]: names[0], [f.barrel]: names[1] });+ const src = form === 'component' ? 'var ' + body.replace(/,$/, '') : body.replace(/;$/, '');const written = [];const SteamClient = {Apps: { SetAppLaunchOptions: (appid, opts) => written.push({ appid, opts }) },diff --cc dylib/version.hindex d842b7c,7e4071a..9b76c4c--- a/dylib/version.h+++ b/dylib/version.h@@@ -2,6 -2,6 +2,6 @@@#ifndef NOTPROTON_VERSION_H#define NOTPROTON_VERSION_H- #define NOTPROTON_VERSION "1.1.7-winehq.1-ray.24"-#define NOTPROTON_VERSION "1.1.7"++#define NOTPROTON_VERSION "1.1.7-winehq.1-ray.25"#endif // NOTPROTON_VERSION_H