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
Linux launch option handling
NotProtonNote7758ba557d1
diff --git a/Makefile b/Makefileindex 02b6726..062ad12 100644--- a/Makefile+++ b/Makefile@@ -306,6 +306,9 @@ panel-behavior:$(PANEL_TESTS)/emit.c && \node $(PANEL_TESTS)/behavior.js $(OUT_DIR)/panel-emit && \node $(PANEL_TESTS)/switching.js $(OUT_DIR)/panel-emit && \+ node $(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 && \echo "==> panel behavior: renders as expected, no stale arguments"CX_ROOT ?= /Applications/CrossOver Preview.appdiff --git a/app/Tests/NotProtonAppTests/ToggleAgreementTests.swift b/app/Tests/NotProtonAppTests/ToggleAgreementTests.swiftindex 5d24830..1775e69 100644--- a/app/Tests/NotProtonAppTests/ToggleAgreementTests.swift+++ b/app/Tests/NotProtonAppTests/ToggleAgreementTests.swift@@ -40,7 +40,7 @@ struct ToggleAgreementTests {#expect(names.count >= 8, "found \(names.count) toggles, the parse looks wrong")#expect(- webpatch.contains(#"v.push(\"%command%\")"#),+ webpatch.contains(#"r=add+\" %command%\""#),"webpatch.c no longer writes %command%, so the toggles would reach the game as arguments")diff --git a/dylib/core/loader.c b/dylib/core/loader.cindex 0280ea2..a89f467 100644--- a/dylib/core/loader.c+++ b/dylib/core/loader.c@@ -155,10 +155,6 @@ static void *install_thread(void *unused) {return NULL;}- // Everything else aborts on a stale signature database,- // but this hooks a name and not an address.- np_hooks_launch_install(mh, slide);-uintptr_t text_base = 0;size_t text_size = 0;@@ -198,6 +194,8 @@ static void *install_thread(void *unused) {return NULL;}+ np_hooks_launch_install(mh, slide);+int total = 0;int installed = np_hooks_install_all(mh, slide, &resolved, &total);diff --git a/dylib/feats/compat.c b/dylib/feats/compat.cindex 15e95c4..4947703 100644--- a/dylib/feats/compat.c+++ b/dylib/feats/compat.c@@ -15,6 +15,7 @@// the tool's name contains "proton" so without a match every AutoCloud rule silently// skips the app.#define TOOL_DIR_NAME "notproton"+#define TOOL_RUN "/run"#define COMPAT_MANAGER_ENABLED_OFF 0x7B0#define COMPAT_TOOL_STRIDE 0x130@@ -30,7 +31,7 @@ static const char TOOL_MANIFEST[] ="\"manifest\"\n""{\n"" \"version\" \"2\"\n"- " \"commandline\" \"/run %verb%\"\n"+ " \"commandline\" \"" TOOL_RUN " %verb%\"\n""}\n";// Steam's compatibilitytools.d scanner registers a tool when this file is present@@ -304,16 +305,23 @@ static tool_entry_t g_tools[TOOL_LIST_MAX];static int g_tool_count;static int g_tool_list_present;+static int is_name_char(char c, const char *extra) {+ if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))+ return 1;+ return c && strchr(extra, c);+}+static int is_token(const char *s, const char *extra) {if (!*s) return 0;- for (; *s; s++) {- if ((*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') || (*s >= '0' && *s <= '9'))- continue;- if (!strchr(extra, *s)) return 0;- }+ for (; *s; s++)+ if (!is_name_char(*s, extra)) return 0;return 1;}+static int is_tool_name(const char *s) {+ return s && strncmp(s, TOOL_DIR_NAME, strlen(TOOL_DIR_NAME)) == 0 && is_token(s, "._-");+}+static int is_display(const char *s) {if (!*s) return 0;for (; *s; s++)@@ -330,8 +338,7 @@ static int parse_tool_line(char *line, tool_entry_t *out) {field[n++] = tok;if (n != 4) return 0;- if (strncmp(field[0], TOOL_DIR_NAME, strlen(TOOL_DIR_NAME)) != 0- || !is_token(field[0], "._-") || !is_token(field[1], ".-")+ if (!is_tool_name(field[0]) || !is_token(field[1], ".-")|| (strcmp(field[2], "fex") != 0 && strcmp(field[2], "rosetta") != 0)|| !is_display(field[3]))return 0;@@ -566,8 +573,24 @@ const char *np_compat_tool_dir(void) {return dir;}+int np_compat_runs_tool(const char *cmd) {+ static const char lead[] = "/compatibilitytools.d/" TOOL_DIR_NAME;+ static const char run[] = "'" TOOL_RUN " ";+ static const char run_dot[] = "/.'" TOOL_RUN " ";+ if (!cmd) return 0;++ for (const char *at = strstr(cmd, lead); at; at = strstr(at + 1, lead)) {+ const char *p = at + sizeof(lead) - 1;+ while (is_name_char(*p, "._-"))+ p++;+ if (strncmp(p, run, sizeof(run) - 1) == 0 || strncmp(p, run_dot, sizeof(run_dot) - 1) == 0)+ return 1;+ }+ return 0;+}+const char *np_compat_tool_commandline(void) {- return "/run %verb%";+ return TOOL_RUN " %verb%";}void np_compat_force_enable(void *compat_mgr) {@@ -697,6 +720,12 @@ void *np_compat_manager(void) {return g_manager;}+int np_compat_app_runs_tool(uint32_t appid) {+ const uint8_t *tool = np_compat_tool_for_app(g_manager, appid);++ return tool && is_tool_name(*(const char *const *)(tool + COMPAT_TOOL_NAME_OFF));+}+static void *find_tool(void *compat_mgr, const char *wanted) {uint8_t *base = (uint8_t *)compat_mgr;uint8_t *array = *(uint8_t **)(base + COMPAT_MANAGER_TOOL_ARRAY_OFF);diff --git a/dylib/feats/compat.h b/dylib/feats/compat.hindex 9ce2aaf..3d531bb 100644--- a/dylib/feats/compat.h+++ b/dylib/feats/compat.h@@ -122,6 +122,12 @@ void *np_compat_registered_tool(void *compat_mgr);// Absolute path to the directory of the first tool in the app's list, or NULL.const char *np_compat_tool_dir(void);+// True when the launch command runs a NotProton compatibility tool.+int np_compat_runs_tool(const char *cmd);++// True when the app is set to run with a NotProton compatibility tool.+int np_compat_app_runs_tool(uint32_t appid);+// Command line template for the tool's toolmanifest.vdf commandline value.const char *np_compat_tool_commandline(void);diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.shindex 60a8de0..7e1c931 100755--- a/dylib/feats/compat_run.sh+++ b/dylib/feats/compat_run.sh@@ -8,23 +8,6 @@ shift || true# hook_launch.c passes the launch options through a shell before this script runs, matching# Linux Steam. A NAME=value option placed ahead of %command% is an environment variable,# and anything after %command% is a launch argument passed to the game.-# Options saved before the panel wrote %command% arrive after the game instead of ahead of it.-launch_env=""-argc=$#-argi=0-while [ "$argi" -lt "$argc" ]; do- arg="$1"- shift- case "$arg" in- CX_GRAPHICS*=*|D3DM_*=*|DXMT_*=*|DXVK_*=*|MTL_*=*|NOTPROTON_*=*|ROSETTA_*=*|WINE*=*)- # shellcheck disable=SC2163 # arg is a NAME=VALUE pair, which export takes as an assignment- export "$arg"- launch_env="$launch_env $arg"- ;;- *) set -- "$@" "$arg" ;;- esac- argi=$((argi + 1))-donelaunch_args="$*"case "$verb" in@@ -85,7 +68,7 @@ fi{echo "=== notproton run $(date) ==="echo "verb=$verb"- echo "args:"; for a in "$@"; do echo " [$a]"; done+ echo "args:"; for a in "$@"; do printf ' [%s]\n' "$a"; doneecho "cwd=$(pwd)"echo "STEAM_COMPAT_DATA_PATH=$STEAM_COMPAT_DATA_PATH"echo "STEAM_COMPAT_INSTALL_PATH=$STEAM_COMPAT_INSTALL_PATH"@@ -878,9 +861,8 @@ fiexport WINEDEBUG="${WINEDEBUG:-err+all,fixme-all}"exec 8>&-trap - EXIT-echo "launch_args=$launch_args" >> "$log" 2>&1 || true-[ -z "$launch_env" ] || echo "launch_env=$launch_env" >> "$log" 2>&1 || true-echo "=== launching ($verb): $WINELOADER $* ===" >> "$log" 2>&1 || true+printf 'launch_args=%s\n' "$launch_args" >> "$log" 2>&1 || true+printf '=== launching (%s): %s %s ===\n' "$verb" "$WINELOADER" "$*" >> "$log" 2>&1 || truetarget="$1"# A game can arrive as a URL with no install path to match, so the verb has to decide the route.@@ -927,6 +909,8 @@ if [ -x "$appinfo_tool" ] && [ -f "$appinfo_vdf" ]; thenmeta_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="" ;; esacfigame_name="$meta_name"if [ -z "$game_name" ] && [ -f "$manifest" ]; thendiff --git a/dylib/feats/webpatch.c b/dylib/feats/webpatch.cindex fbb89dd..1123ce6 100644--- a/dylib/feats/webpatch.c+++ b/dylib/feats/webpatch.c@@ -104,6 +104,35 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {return 1;}+// Finds the launch options set before %command%.+#define NP_CX_LAUNCH_PARSE \+ "E=(()=>{let i=0,c=[];const cs=[c]," \+ "qs=x=>{while(i<o.length&&o[i]!==x)i+=x!==\"'\"&&o[i]==='\\\\'?2:1;i++}," \+ "nest=(a,b)=>{for(let d=1;i<o.length&&d;){const x=o[i++];" \+ "if(x==='\\\\')i++;else if(\"'\\\"`\".includes(x))qs(x);else if(x===a)d++;else if(x===b)d--}}," \+ "wd=()=>{const s=i;let v=\"\",q=0,l=1;while(i<o.length){const x=o[i];" \+ "if(q===39){if(x===\"'\")q=0;else v+=x;i++;continue}" \+ "if(x==='\\\\'){const n=o[i+1]||\"\";if(q&&!'\"\\\\$`\\n'.includes(n)){v+=x;i++;continue}" \+ "if(n!=='\\n')v+=n;i+=2;continue}" \+ "if(x==='\"'){q=q?0:34;i++;continue}" \+ "if(!q&&' \\t\\n;&|<>()'.includes(x))break;" \+ "if(!q&&x===\"'\"){q=39;i++;continue}" \+ "if(x==='`'){l=0;i++;qs(x);continue}" \+ "if(x==='$'){l=0;const n=o[i+1];if(n==='('||n==='{'){i+=2;nest(n,n==='('?')':'}');continue}}" \+ "v+=x;i++}return{start:s,end:i,value:l?v:null}};" \+ "while(i<o.length){const x=o[i],r=/^(<<-|<<|>>|<&|>&|<>|>\\||&>>|&>|<|>)/.exec(o.slice(i));" \+ "if(x===' '||x==='\\t')i++;" \+ "else if(x==='\\\\'&&o[i+1]==='\\n')i+=2;" \+ "else if(x==='#')while(i<o.length&&o[i]!=='\\n')i++;" \+ "else if(r)i+=r[0].length;" \+ "else if(';&|\\n()'.includes(x)){i++;cs.push(c=[])}" \+ "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:[]};" \+ "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)}})(),"+// CrossOver options panel. Not in great shape, but it'll do#define NP_CX_OPTIONS_CSS \"\".MSCXPanel{margin-top:10px}" \@@ -115,13 +144,16 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {#define NP_CX_OPTIONS_BODY(ARG, RT, BARREL) \ARG "=>{" \"const t=" ARG ".details,o=t.strLaunchOptions||\"\"," \- "g=k=>{const p=o.split(\" \").find(x=>x.indexOf(k+\"=\")===0);return p?p.slice(k.length+1):\"\"}," \- "s=ps=>{const a=o.split(\" \").filter(x=>x&&!ps.some(p=>x.indexOf(p[0]+\"=\")===0))," \- "v=ps.filter(p=>p[1]).map(p=>p[0]+\"=\"+p[1]);" \- "if(v.length&&a.indexOf(\"%command%\")<0)v.push(\"%command%\");" \- "const r=v.concat(a);" \- "SteamClient.Apps.SetAppLaunchOptions(t.unAppID," \- "1===r.length&&\"%command%\"===r[0]?\"\":r.join(\" \"))}," \+ 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(t.unAppID,r.trim()===\"%command%\"?\"\":r)}," \"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])," \@@ -130,7 +162,11 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"dx=\"\"===b||\"dxmt\"===b," \"sw=\"1\"===g(\"DXMT_METALFX_SPATIAL_SWAPCHAIN\")," \"F=\"d3d11.metalSpatialUpscaleFactor=\"," \- "cf=g(\"DXMT_CONFIG\")," \+ "fe=g(\"DXMT_CONFIG\").split(\";\").filter(e=>e.trim())," \+ "fk=e=>/^[ \\t\\r]*d3d11\\.metalSpatialUpscaleFactor[ \\t\\r]*=/.test(e)," \+ "fx=v=>fe.filter(e=>!fk(e)).concat(v?[F+v]:[]).join(\";\")," \+ "fv=(fe.filter(fk).pop()||\"=2\").replace(/^[^=]*=/,\"\").replace(/\"/g,\"\").trim().split(/\\s/)[0]," \+ "fn=Math.max(isNaN(+fv)?2:+fv,1)," \"U=[{data:\"\",label:\"Off\"}," \"{data:\"1.5\",label:\"1.5x\"}," \"{data:\"1.72\",label:\"1.72x\"}," \@@ -150,7 +186,7 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"onChange:v=>s([[\"CX_GRAPHICS_BACKEND\",v.data]]" \".concat(\"\"===v.data||\"d3dmetal\"===v.data?[]:[[\"D3DM_ENABLE_METALFX\",\"\"]])" \".concat(\"\"===v.data||\"dxmt\"===v.data?[]:" \- "[[\"DXMT_METALFX_SPATIAL_SWAPCHAIN\",\"\"],[\"DXMT_CONFIG\",\"\"]])" \+ "[[\"DXMT_METALFX_SPATIAL_SWAPCHAIN\",\"\"],[\"DXMT_CONFIG\",fx(\"\")]])" \".concat(\"dxmt\"===v.data?[]:[[\"DXMT_ENABLE_NVEXT\",\"\"]]))})," \"T([\"MTL_HUD_ENABLED\"],\"Metal HUD\",\"1\")," \"dm&&T([\"D3DM_ENABLE_METALFX\"],\"DLSS\",\"1\")," \@@ -162,9 +198,8 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"dx&&(0," RT ".jsx)(" BARREL ".XY," \"{label:\"MetalFX Upscaling (Samples from the resolution the game is set to)\"," \"children:(0," RT ".jsx)(" BARREL ".m,{rgOptions:U," \- "selectedOption:sw?(0===cf.indexOf(F)?cf.slice(F.length):\"2.0\"):\"\"," \- "onChange:v=>s(v.data?[[\"DXMT_METALFX_SPATIAL_SWAPCHAIN\",\"1\"],[\"DXMT_CONFIG\",F+v.data]]" \- ":[[\"DXMT_METALFX_SPATIAL_SWAPCHAIN\",\"\"],[\"DXMT_CONFIG\",\"\"]])})},\"usf\")" \+ "selectedOption:sw?(U.find(u=>u.data&&+u.data===fn)||{data:String(fn)}).data:\"\"," \+ "onChange:v=>s([[\"DXMT_METALFX_SPATIAL_SWAPCHAIN\",v.data?\"1\":\"\"],[\"DXMT_CONFIG\",fx(v.data)]])})},\"usf\")" \"]})})}"#define NP_CX_OPTIONS_COMPONENT \@@ -174,6 +209,35 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {#define NP_CX_OPTIONS_STATEMENT \"var MSCXOpts=" NP_CX_OPTIONS_BODY("np", NP_C3, NP_C4) ";"+// 1.0.x saved CrossOver settings without %command%, this migrates them.+#define NP_LAUNCH_MIGRATION_RULE \+ "o=>{const T=/(?:[^\\s\"'\\\\]|\\\\[^]|\"(?:[^\"\\\\]|\\\\[^])*\"|'[^']*')+/g," \+ "w=o.match(T)||[]," \+ "k=x=>/^(CX_GRAPHICS|D3DM_|DXMT_|DXVK_|MTL_|NOTPROTON_|ROSETTA_|WINE)\\w*=/.test(x)," \+ "e=w.filter(k);" \+ "if(/%command%/i.test(o)||o.replace(T,\"\").trim()||!e.length)return null;" \+ "return e.map(x=>{const i=x.indexOf(\"=\"),v=x.slice(i+1);" \+ "return/[\"'\\\\]/.test(x)||/^[\\w.,:=\\/+@%-]*$/.test(v)?x:x.slice(0,i+1)+\"'\"+v+\"'\"})" \+ ".concat(\"%command%\",w.filter(x=>!k(x))).join(\" \")}"++#define NP_LAUNCH_MIGRATION \+ "(async()=>{try{" \+ "const K=\"NotProtonLaunchMigrated_\"+this.m_cm.steamid.GetAccountID();" \+ "if(localStorage.getItem(K))return;" \+ "const M=" NP_LAUNCH_MIGRATION_RULE ";" \+ "const A=[...window.appStore.m_mapApps.values()].filter(a=>a);let n=0;" \+ "for(let i=0;i<A.length;i+=20)await Promise.all(A.slice(i,i+20).map(async a=>{const id=a.appid;" \+ "const t=await Promise.race([window.appDetailsStore.RequestAppDetails(id)," \+ "new Promise(r=>setTimeout(r,5e3))]);" \+ "if(!t){console.warn(\"NotProton: no details for app \"+id+\", its launch options were not moved\");return}" \+ "if(!(id<2147483648&&(t.vecPlatforms||[]).indexOf(\"osx\")>=0&&!t.strCompatToolName)){" \+ "const r=M(t.strLaunchOptions||\"\");" \+ "if(r!==null){SteamClient.Apps.SetAppLaunchOptions(id,r);n++;" \+ "console.log(\"NotProton: moved the launch options of app \"+id)}}}));" \+ "console.log(\"NotProton: checked the launch options of \"+A.length+\" apps, moved \"+n);" \+ "localStorage.setItem(K,\"1\")" \+ "}catch(e){console.error(\"NotProton: launch options migration failed\",e)}})()"+static const np_gate_t g_gates_forcetool[] = {// SteamPlay settings section{ "function ue(e){return(0,T.CI)()?",@@ -262,6 +326,8 @@ static const np_gate_t g_fixes[] = {"(t.unAppID,r),o=r&&!!t.strCompatToolName&&t.nCompatToolPriority==h.JN,""l=a.length?(a.find(e=>e.strToolName===u.rV.settings.strCompatTool)||a[0]).strToolName:\"\"",1 },+ { "this.m_bServicesInitialized=!0,SteamClient.UI.NotifyAppInitialized()",+ "this.m_bServicesInitialized=!0," NP_LAUNCH_MIGRATION ",SteamClient.UI.NotifyAppInitialized()", 1 },};#define NP_FIX_COUNT (sizeof(g_fixes) / sizeof(g_fixes[0]))diff --git a/dylib/hooks/hook_launch.c b/dylib/hooks/hook_launch.cindex af7af84..7001c1a 100644--- a/dylib/hooks/hook_launch.c+++ b/dylib/hooks/hook_launch.c@@ -1,6 +1,7 @@-// Makes Steam's Launch Options behave the way they do on Linux.+// Makes Steam Play Launch Options function the way they do on Linux.#include "hooks.h"#include "../core/macho.h"+#include "../feats/compat.h"#include "../util/log.h"#include <dlfcn.h>@@ -14,6 +15,7 @@typedef int (*fn_parse_shell)(const char *cmd, void *argv, int max, const char **rest);static fn_parse_shell orig_parse_shell;+static int np_shell_wrapped;static size_t np_quote(char *out, const char *s) {size_t n = 0;@@ -34,7 +36,7 @@ static size_t np_quote(char *out, const char *s) {// Shell, followed by the command line as one argument.static char *np_launch_shell(const char *cmd, const char *shell, int max, const char **rest) {// np_hook_parse_shell frees the wrapped copy before its caller reads *rest.- if (!cmd || max != -1 || rest)+ if (!cmd || max != -1 || rest || !np_compat_runs_tool(cmd))return NULL;const char *lead = shell ? "" : "/bin/sh -c ";@@ -68,6 +70,79 @@ static int np_hook_parse_shell(const char *cmd, void *argv, int max, const charreturn rc;}+// Doubles every backslash in place. Enlarge the buffer before calling this.+static void np_double_backslashes(char *s, size_t len, size_t extra) {+ char *out = s + len + extra;++ *out = 0;+ while (len) {+ char c = s[--len];+ *--out = c;+ if (c == '\\')+ *--out = c;+ }+}++static size_t np_count_backslashes(const char *s) {+ size_t n = 0;++ for (; *s; s++)+ n += *s == '\\';+ return n;+}++typedef void *(*fn_plat_realloc)(void *p, size_t size);+typedef uint64_t (*fn_vr_support)(void *self, uint32_t appid, char **arguments);++static void *orig_vr_support;+static fn_plat_realloc plat_realloc;++// Hooked to fix games that have backslashes in their Steam launch config, not for VR.+// Linux Steam doubles backslashes in game arguments right after this VR check, and macOS+// Steam does not.+static uint64_t np_hook_vr_support(void *self, uint32_t appid, char **arguments) {+ fn_vr_support orig = (fn_vr_support)orig_vr_support;++ if (!orig) {+ NP_ERR("[launch] SteamVRSupport check: no original, app %u keeps its arguments", appid);+ return 0;+ }+ uint64_t ret = orig(self, appid, arguments);++ if (!np_shell_wrapped || !arguments || !*arguments || !np_compat_app_runs_tool(appid))+ return ret;+ size_t extra = np_count_backslashes(*arguments);+ if (!extra)+ return ret;++ size_t len = strlen(*arguments);+ char *buf = plat_realloc ? plat_realloc(*arguments, len + extra + 1) : NULL;+ if (!buf)+ return ret;+ np_double_backslashes(buf, len, extra);+ *arguments = buf;+ NP_LOG("[launch] app %u arguments: %s", appid, buf);+ return ret;+}++static np_patch_entry_t g_hooks[] = {+ {+ .label = "LaunchBuilder::SteamVRSupportCheck",+ .signature = "LaunchBuilder::SteamVRSupportCheck",+ .entry = (void *)np_hook_vr_support,+ .trampoline = &orig_vr_support,+ .tolerate_missing = 1,+ },+};++int np_hooks_launch_count(void) {+ return np_shell_wrapped ? (int)(sizeof(g_hooks) / sizeof(g_hooks[0])) : 0;+}++np_patch_entry_t *np_hooks_launch_defs(void) {+ return g_hooks;+}+void np_hooks_launch_install(const struct mach_header_64 *mh, intptr_t slide) {if (np_hooks_env_lists_label("NOTPROTON_DISABLE", "launch")) {NP_WARN("[launch] DISABLED via NOTPROTON_DISABLE, launches keep running "@@ -85,9 +160,17 @@ void np_hooks_launch_install(const struct mach_header_64 *mh, intptr_t slide) {int rebound = np_rebind_import(mh, slide, "_" NP_PARSE_SYM_POSIX,(void *)np_hook_parse_shell);+ np_shell_wrapped = rebound > 0;if (rebound > 0)NP_LOG("[launch] V_ParseShellCommandLinePOSIX: %d import slot(s) rebound", rebound);elseNP_WARN("[launch] V_ParseShellCommandLinePOSIX: no import slot in steamclient ""(rc=%d), launches keep running without a shell", rebound);++ // Steam frees this string itself, so it has to be grown with Steam's allocator as a+ // plain realloc would crash.+ plat_realloc = (fn_plat_realloc)dlsym(RTLD_DEFAULT, "Plat_Realloc");+ if (!plat_realloc)+ NP_WARN("[launch] Plat_Realloc: unresolved, unquoted backslashes in app "+ "arguments are lost");}diff --git a/dylib/hooks/hooks.c b/dylib/hooks/hooks.cindex af2df36..5314059 100644--- a/dylib/hooks/hooks.c+++ b/dylib/hooks/hooks.c@@ -41,6 +41,7 @@ typedef struct {static const np_hook_group_t np_groups[] = {{ "compat", np_hooks_compat_count, np_hooks_compat_defs },{ "webui", np_hooks_webui_count, np_hooks_webui_defs },+ { "launch", np_hooks_launch_count, np_hooks_launch_defs },};static const np_hook_group_t np_steamui_groups[] = {diff --git a/dylib/hooks/hooks.h b/dylib/hooks/hooks.hindex 2cf3242..f3f9b7b 100644--- a/dylib/hooks/hooks.h+++ b/dylib/hooks/hooks.h@@ -44,6 +44,9 @@ np_patch_entry_t *np_hooks_webui_defs(void);void np_hooks_webui_bind(const struct mach_header_64 *mh, intptr_t slide,uintptr_t register_fn, uintptr_t dispatch_fn);+int np_hooks_launch_count(void);+np_patch_entry_t *np_hooks_launch_defs(void);+int np_hooks_shortcut_count(void);np_patch_entry_t *np_hooks_shortcut_defs(void);@@ -60,8 +63,6 @@ int np_hooks_install_steamui(const struct mach_header_64 *mh, intptr_t slide,// NOTPROTON_DISABLE uses this to skip named hooks.int np_hooks_env_lists_label(const char *var, const char *label);-// Resolved by symbol name instead of the signature database, so %command% keeps working-// on a client that is newer than the database.void np_hooks_launch_install(const struct mach_header_64 *mh, intptr_t slide);// Resolved from libc rather than the signature database, and installed before the clientdiff --git a/dylib/tests/compatcheck.c b/dylib/tests/compatcheck.cindex 0aafc0f..9675824 100644--- a/dylib/tests/compatcheck.c+++ b/dylib/tests/compatcheck.c@@ -233,6 +233,30 @@ static void tool_list_cases(void) {&& !g_tool_list_present, "a missing list keeps no tools and says so");}+static void tool_launch_cases(void) {+ static const char *tool[] = {+ "'/tools/compatibilitytools.d/notproton/.'/run waitforexitandrun '/g/game.exe'",+ "A=1 '/tools/compatibilitytools.d/notproton-26.3/.'/run waitforexitandrun '/g/game.exe' -x",+ "'/tools/compatibilitytools.d/notproton-fex-rosetta/.'/run run ",+ "'/tools/compatibilitytools.d/notproton'/run waitforexitandrun '/g/game.exe'",+ "'/Volumes/Ext/Steam/compatibilitytools.d/notproton/.'/run waitforexitandrun '/g/game.exe'",+ };+ static const char *native[] = {+ "'/g/Game.app' -windowed",+ "'/g/Game.app/Contents/MacOS/Game'",+ "'/tools/compatibilitytools.d/proton-other/.'/run waitforexitandrun '/g/game.exe'",+ "'/tools/compatibilitytools.d/notproton/Game' -x",+ "'/tools/compatibilitytools.d/notproton/sub/.'/run waitforexitandrun '/g/game.exe'",+ "'/tools/compatibilitytools.d/notproton'/other '/g/game.exe'",+ "",+ };+ for (size_t i = 0; i < sizeof(tool) / sizeof(tool[0]); i++)+ check(np_compat_runs_tool(tool[i]), tool[i]);+ for (size_t i = 0; i < sizeof(native) / sizeof(native[0]); i++)+ check(!np_compat_runs_tool(native[i]), native[i]);+ check(!np_compat_runs_tool(NULL), "no command line is no tool launch");+}+static int put(const char *dir, const char *name, const char *text) {char path[768];snprintf(path, sizeof(path), "%s/%s", dir, name);@@ -368,6 +392,7 @@ int main(void) {enabled_cases();manager_cases();tool_list_cases();+ tool_launch_cases();stale_tool_cases();installed_fn_cases();diff --git a/dylib/tests/envcheck.sh b/dylib/tests/envcheck.shindex 403717d..e75b40c 100755--- a/dylib/tests/envcheck.sh+++ b/dylib/tests/envcheck.sh@@ -36,23 +36,6 @@ WINEDLLOVERRIDES="lsteamclient=n"eval "$overrides_line"is "trio outranks user" "lsteamclient=n;steamclient=n;steamclient64=n;lsteamclient=b" "$WINEDLLOVERRIDES"-echo "== options saved without %command% =="-promote=$(sed -n '/^launch_env=""$/,/^launch_args="\$\*"$/p' "$SRC")-[ -n "$promote" ] || { echo "FAIL: the trailing option loop not found"; exit 1; }-trailing() {- (- set -- "$@"- eval "$promote"- printf '%s|%s|%s|%s' "${CX_GRAPHICS_BACKEND:-}" "${WINEMSYNC:-}" "$#" "$launch_args"- )-}-is "known assignments leave the game's arguments" "dxmt|1|2|/g/game.exe -novid" \- "$(trailing /g/game.exe CX_GRAPHICS_BACKEND=dxmt -novid WINEMSYNC=1)"-is "other assignments stay the game's" "||3|/g/game.exe +map=e1m1 P=1" \- "$(trailing /g/game.exe +map=e1m1 P=1)"-is "a path with spaces stays one argument" "||1|/g/My Game/game.exe" \- "$(trailing "/g/My Game/game.exe")"-if [ "$fails" -eq 0 ]; thenecho "==> envcheck: all assertions hold"elsediff --git a/dylib/tests/launch-shell.c b/dylib/tests/launch-shell.cindex 101a0a0..c27b19b 100644--- a/dylib/tests/launch-shell.c+++ b/dylib/tests/launch-shell.c@@ -5,20 +5,89 @@int np_log_level = 0;FILE *np_log_file = NULL;+static int rebind_rc = -1;+int np_rebind_import(const struct mach_header_64 *mh, intptr_t slide,const char *symbol, void *replacement) {(void)mh; (void)slide; (void)symbol; (void)replacement;- return -1;+ return rebind_rc;}-int np_hooks_env_lists_label(const char *var, const char *label) {- (void)var; (void)label;+int fake_parse_shell(const char *cmd, void *argv, int max, const char **rest)+ __asm__("_" NP_PARSE_SYM_POSIX);++int fake_parse_shell(const char *cmd, void *argv, int max, const char **rest) {+ (void)cmd; (void)argv; (void)max; (void)rest;return 0;}+static int launch_disabled = 0;++int np_hooks_env_lists_label(const char *var, const char *label) {+ (void)var;+ return launch_disabled && strcmp(label, "launch") == 0;+}++static int compat_tool = 1;++int np_compat_runs_tool(const char *cmd) {+ (void)cmd;+ return compat_tool;+}++static int app_tool = 1;++int np_compat_app_runs_tool(uint32_t appid) {+ (void)appid;+ return app_tool;+}++void *Plat_Realloc(void *p, size_t size) {+ return realloc(p, size);+}++static int vr_calls;++static uint64_t fake_vr_support(void *self, uint32_t appid, char **arguments) {+ (void)self; (void)appid; (void)arguments;+ vr_calls++;+ return 7;+}+static int failures;static const char *shell;+static char *sh_words(const char *args) {+ static char out[512];+ char cmd[1024];++ snprintf(cmd, sizeof(cmd), "printf '[%%s]' %s", args);+ FILE *p = popen(cmd, "r");+ size_t n = p ? fread(out, 1, sizeof(out) - 1, p) : 0;++ if (p)+ pclose(p);+ out[n] = 0;+ return out;+}++static void keeps(const char *in, const char *want, const char *words) {+ char *args = strdup(in);+ int before = vr_calls;+ uint64_t ret = np_hook_vr_support(NULL, 2290, &args);++ if (ret != 7 || vr_calls != before + 1 || strcmp(args, want) != 0) {+ printf("FAIL %s\n want: %s\n got: %s\n", in, want, args);+ failures++;+ } else if (words && strcmp(sh_words(args), words) != 0) {+ printf("FAIL %s\n sh want: %s\n sh got: %s\n", in, words, sh_words(args));+ failures++;+ } else {+ printf(" ok %s\n", in);+ }+ free(args);+}+static void wraps(const char *in, const char *want) {char *got = np_launch_shell(in, shell, -1, NULL);@@ -76,6 +145,36 @@ int main(void) {wraps("/g/game.exe", "'' '/g/game.exe'");shell = NULL;+ printf("== a native macOS game keeps Steam's own parsing ==\n");+ compat_tool = 0;+ const char *native[] = {+ "'/g/Game.app'",+ "'/g/Game.app' -windowed",+ "A=1 '/g/Game.app/Contents/MacOS/Game'",+ "'/g/Game' > /tmp/log",+ };+ for (size_t i = 0; i < sizeof(native) / sizeof(native[0]); i++) {+ char *kept = np_launch_shell(native[i], NULL, -1, NULL);+ if (kept) {+ printf("FAIL a native launch must not rewrite, but %s became: %s\n", native[i], kept);+ failures++;+ } else {+ printf(" ok %s\n", native[i]);+ }+ free(kept);+ }+ shell = "/usr/bin/env";+ char *kept = np_launch_shell("'/g/Game.app'", shell, -1, NULL);+ if (kept) {+ printf("FAIL STEAM_GAME_LAUNCH_SHELL must not reach a native launch, but it became: %s\n", kept);+ failures++;+ } else {+ printf(" ok STEAM_GAME_LAUNCH_SHELL leaves a native launch alone\n");+ }+ free(kept);+ shell = NULL;+ compat_tool = 1;+printf("== a capped argument count keeps the caller on its own buffer ==\n");const char *rest = NULL;char *got = np_launch_shell("A=1 /g/game.exe", NULL, 2, NULL);@@ -97,6 +196,61 @@ int main(void) {}free(got);+ printf("== an app's own arguments reach the game with their backslashes ==\n");+ orig_vr_support = (void *)fake_vr_support;+ np_shell_wrapped = 1;+ plat_realloc = Plat_Realloc;+ keeps("-conf .\\base\\plutoniam.conf -fullscreen -exit",+ "-conf .\\\\base\\\\plutoniam.conf -fullscreen -exit",+ "[-conf][.\\base\\plutoniam.conf][-fullscreen][-exit]");+ keeps("--bundle-dir ..\\bundle", "--bundle-dir ..\\\\bundle", "[--bundle-dir][..\\bundle]");+ keeps("-conf \"..\\PAGA.conf\"", "-conf \"..\\\\PAGA.conf\"", "[-conf][..\\PAGA.conf]");+ keeps("\\\\server\\share", "\\\\\\\\server\\\\share", "[\\\\server\\share]");+ keeps("-windowed", "-windowed", "[-windowed]");+ keeps("", "", NULL);++ printf("== a native macOS game keeps the client's arguments ==\n");+ app_tool = 0;+ keeps("--cwd client_pc\\root\\bin\\pc", "--cwd client_pc\\root\\bin\\pc", NULL);+ app_tool = 1;++ printf("== without the shell, the client's arguments stay as they are ==\n");+ np_shell_wrapped = 0;+ keeps("--cwd client_pc\\root\\bin\\pc", "--cwd client_pc\\root\\bin\\pc", NULL);+ np_shell_wrapped = 1;++ printf("== the shell is used only when an import slot was rebound ==\n");+ int rcs[] = { -1, 0, 1, 2 };+ for (size_t i = 0; i < sizeof(rcs) / sizeof(rcs[0]); i++) {+ rebind_rc = rcs[i];+ np_shell_wrapped = -1;+ np_hooks_launch_install(NULL, 0);+ if (np_shell_wrapped != (rcs[i] > 0)+ || np_hooks_launch_count() != (rcs[i] > 0 ? 1 : 0)) {+ printf("FAIL rebind rc=%d left np_shell_wrapped=%d, %d hook(s)\n",+ rcs[i], np_shell_wrapped, np_hooks_launch_count());+ failures++;+ } else {+ printf(" ok rebind rc=%d, wrapped=%d, %d hook(s)\n",+ rcs[i], np_shell_wrapped, np_hooks_launch_count());+ }+ }++ printf("== NOTPROTON_DISABLE=launch turns off the shell and the backslash hook ==\n");+ rebind_rc = 1;+ np_shell_wrapped = 0;+ launch_disabled = 1;+ np_hooks_launch_install(NULL, 0);+ launch_disabled = 0;+ if (np_shell_wrapped || np_hooks_launch_count() != 0) {+ printf("FAIL disabled launch left np_shell_wrapped=%d, %d hook(s)\n",+ np_shell_wrapped, np_hooks_launch_count());+ failures++;+ } else {+ printf(" ok disabled, wrapped=0, 0 hooks\n");+ }+ np_shell_wrapped = 1;+if (failures) {printf("\n%d assertion(s) failed\n", failures);return 1;diff --git a/dylib/tests/panel-behavior/behavior.js b/dylib/tests/panel-behavior/behavior.jsindex 3438f1c..b89ac89 100644--- a/dylib/tests/panel-behavior/behavior.js+++ b/dylib/tests/panel-behavior/behavior.js@@ -9,7 +9,7 @@ let failed = 0;for (const form of Object.keys(FORMS)) {const { render: P, written } = panel(emit, form);const t = runner(form);- const nodes = opts => walk(P({ details: details(opts) }));+ const nodes = opts => walk(P({ details: details(opts + ' %command%') }));const toggles = ns => ns.filter(x => x.type === 'Toggle').map(x => x.props.label);const sections = ns => ns.filter(x => x.type === 'Section').map(x => x.props.label.split(' ')[0]);const last = () => (written.length ? written[written.length - 1].opts : '');diff --git a/dylib/tests/panel-behavior/emit.c b/dylib/tests/panel-behavior/emit.cindex 9872a1f..2d4cbc2 100644--- a/dylib/tests/panel-behavior/emit.c+++ b/dylib/tests/panel-behavior/emit.c@@ -18,6 +18,10 @@ int main(int argc, char **argv) {fputs(NP_CX_OPTIONS_STATEMENT, stdout);return 0;}- fputs("usage: emit component|statement\n", stderr);+ if (argc == 2 && strcmp(argv[1], "migration") == 0) {+ fputs(NP_LAUNCH_MIGRATION, stdout);+ return 0;+ }+ fputs("usage: emit component|statement|migration\n", stderr);return 2;}diff --git a/dylib/tests/panel-behavior/launch-options.js b/dylib/tests/panel-behavior/launch-options.jsnew file mode 100644index 0000000..bd5b244--- /dev/null+++ b/dylib/tests/panel-behavior/launch-options.js@@ -0,0 +1,130 @@+'use strict';+const { panel, walk, details, runner, FORMS } = require('./harness');++const emit = process.argv[2];+if (!emit) { console.error('usage: launch-options.js <emit>'); process.exit(2); }++let failed = 0;+for (const form of Object.keys(FORMS)) {+ const { render: P, written } = panel(emit, form);+ const t = runner(form);+ const nodes = opts => walk(P({ details: details(opts) }));+ const last = () => written[written.length - 1].opts;+ const hud = opts => nodes(opts).find(x => x.props.label === 'Metal HUD');++ for (const assignment of ['MTL_HUD_ENABLED="1"', "MTL_HUD_ENABLED='1'",+ 'MTL_HUD_ENABLED=\\1']) {+ t.ok(hud(assignment + ' %command%').props.checked, `reads ${assignment}`);+ written.length = 0;+ hud(assignment + ' %command%').props.onChange(false);+ t.ok(last() === '', `removes the whole token ${assignment}`);+ }++ for (const tail of [+ 'WINEDEBUG="err+all, trace+seh" %command% --name "two words"',+ "DXMT_CONFIG='d3d11.foo=1 d3d11.bar=2' %command% --name 'two words'",+ 'WINEDEBUG=err+all,\\ trace+seh %command% --name two\\ words',+ 'MTL_HUD_ENABLED_EXTRA=1 %command% --title "MTL_HUD_ENABLED=0 extra"',+ 'DXMT_CONFIG="literal \\"quote\\" and \\\\slash" %command%',+ 'WINEDEBUG="$(touch /tmp/notproton-panel-must-not-run)" %command%',+ '\tWINEDEBUG="a b"\t%command%\t--name "two words" ',+ ]) {+ written.length = 0;+ hud(tail).props.onChange(true);+ t.ok(last() === tail.replace(/^[ \t]*/, m => m + 'MTL_HUD_ENABLED=1 '),+ `preserves unrelated text exactly: ${JSON.stringify(tail)}`);+ }++ t.ok(!hud('"MTL_HUD_ENABLED=1" %command%').props.checked, 'a quoted name is not an assignment');+ written.length = 0;+ hud('"MTL_HUD_ENABLED=0" %command%').props.onChange(true);+ t.ok(last() === 'MTL_HUD_ENABLED=1 "MTL_HUD_ENABLED=0" %command%', 'a quoted name is left alone');+ t.ok(!hud('%command% --title "MTL_HUD_ENABLED=1"').props.checked,+ 'game arguments do not set the toggle');+ written.length = 0;+ hud('').props.onChange(true);+ let repeated = last();+ for (let i = 0; i < 3; i++) {+ hud(repeated).props.onChange(false);+ repeated = last();+ t.ok(repeated === '', 'removing the only assignment leaves empty options');+ hud(repeated).props.onChange(true);+ repeated = last();+ t.ok(repeated === 'MTL_HUD_ENABLED=1 %command%',+ 'repeated edits do not accumulate whitespace');+ }+ written.length = 0;+ hud('WINEDEBUG=x MTL_HUD_ENABLED=1 %command%').props.onChange(false);+ t.ok(last() === 'WINEDEBUG=x %command%', 'removing an assignment leaves one separator');++ const duplicates = 'MTL_HUD_ENABLED=1\tMTL_HUD_ENABLED="0" %command%';+ t.ok(!hud(duplicates).props.checked, 'the last assignment determines the toggle');+ written.length = 0;+ hud(duplicates).props.onChange(true);+ t.ok(last() === 'MTL_HUD_ENABLED=1 %command%', 'replaces all duplicate assignments');+ t.ok(!hud('MTL_HUD_ENABLED=1 MTL_HUD_ENABLED="" %command%').props.checked,+ 'an empty final assignment overrides earlier values');++ const backendOptions = 'CX_GRAPHICS_BACKEND="dxmt" DXMT_CONFIG="a=1 b=2" '+ + 'DXMT_METALFX_SPATIAL_SWAPCHAIN="1" %command% --title "a b"';+ written.length = 0;+ const backend = nodes(backendOptions).find(x => x.type === 'Dropdown');+ t.ok(backend.props.selectedOption === 'dxmt', 'reads a quoted backend');+ backend.props.onChange({ data: 'dxvk' });+ t.ok(last() === `CX_GRAPHICS_BACKEND=dxvk DXMT_CONFIG='a=1 b=2' %command% --title "a b"`,+ 'switching keeps DXMT_CONFIG entries the panel did not set and keeps game arguments');++ const upscaled = 'CX_GRAPHICS_BACKEND=dxmt DXMT_METALFX_SPATIAL_SWAPCHAIN="1" '+ + 'DXMT_CONFIG="d3d11.metalSpatialUpscaleFactor=1.5" %command%';+ t.ok(nodes(upscaled).filter(x => x.type === 'Dropdown')[1].props.selectedOption === '1.5',+ 'reads the factor from quoted DXMT_CONFIG');++ t.ok(!hud('MTL_HUD_ENABLED=1 -windowed').props.checked,+ 'assignments without %command% do not set the toggle');+ for (const [before, after] of [+ ['-windowed', 'MTL_HUD_ENABLED=1 %command% -windowed'],+ ['MTL_HUD_ENABLED=0 -windowed', 'MTL_HUD_ENABLED=1 %command% MTL_HUD_ENABLED=0 -windowed'],+ ['-windowed MTL_HUD_ENABLED=0', 'MTL_HUD_ENABLED=1 %command% -windowed MTL_HUD_ENABLED=0'],+ ]) {+ written.length = 0;+ hud(before).props.onChange(true);+ t.ok(last() === after, `adds %command% to ${JSON.stringify(before)}`);+ }+ written.length = 0;+ hud('MTL_HUD_ENABLED=1 -windowed').props.onChange(false);+ t.ok(written.length === 0, 'keeps game arguments written without %command%');+ t.ok(hud('MTL_HUD_ENABLED=1 gamemoderun %command%').props.checked, 'reads assignments before a wrapper');+ written.length = 0;+ hud('gamemoderun %command%').props.onChange(true);+ t.ok(last() === 'MTL_HUD_ENABLED=1 gamemoderun %command%', 'adds assignments before a wrapper');+ written.length = 0;+ hud('MTL_HUD_ENABLED=1 gamemoderun %command%').props.onChange(false);+ t.ok(last() === 'gamemoderun %command%', 'removes assignments before a wrapper');+ written.length = 0;+ hud('env FOO=1 %command%').props.onChange(true);+ t.ok(last() === 'MTL_HUD_ENABLED=1 env FOO=1 %command%', 'other wrapper assignments stay editable');++ for (const odd of ['WINEDEBUG="unfinished', "--title 'unfinished", '--title trailing\\',+ 'WINEDEBUG=1; %command%', 'WINEDEBUG=1 %command% | tee log',+ 'WINEDEBUG=1\n%command%',+ 'WINEDEBUG=`id` %command%', 'WINEDEBUG=1 %command% >log',+ 'MTL_HUD_ENABLED=0 %COMMAND%', 'MTL_HUD_ENABLED=0 %command%%command%',+ 'MTL_HUD_ENABLED=0 "%command%"', 'gamemoderun MTL_HUD_ENABLED=1 %command%',+ 'nice -n 5 CX_GRAPHICS_BACKEND=dxmt %command%']) {+ written.length = 0;+ const ns = nodes(odd);+ t.ok(ns.every(x => !x.props.disabled && x.props.role !== 'status'), `edits ${JSON.stringify(odd)}`);+ hud(odd).props.onChange(true);+ t.ok(written.length === 1 && hud(last()).props.checked, `turns the HUD on in ${JSON.stringify(odd)}`);+ t.ok((last().match(/%command%/gi) || []).length === Math.max(1, (odd.match(/%command%/gi) || []).length),+ `writes no extra %command% into ${JSON.stringify(odd)}`);+ }+ t.ok(hud('MTL_HUD_ENABLED=1 %command% %COMMAND%').props.checked,+ 'reads assignments before the first %command%');+ written.length = 0;+ hud('MTL_HUD_ENABLED=1 %command% %COMMAND%').props.onChange(false);+ t.ok(last() === '%command% %COMMAND%', 'leaves later %command% text alone');+ failed += t.failed;+}+console.log(failed ? `\n${failed} failure(s)` : '\nquoted launch options pass in both shapes');+process.exit(failed ? 1 : 0);diff --git a/dylib/tests/panel-behavior/migration.js b/dylib/tests/panel-behavior/migration.jsnew file mode 100644index 0000000..a7d600d--- /dev/null+++ b/dylib/tests/panel-behavior/migration.js@@ -0,0 +1,124 @@+'use strict';+const { execFileSync } = require('child_process');+const { runner } = require('./harness');++const emit = process.argv[2];+if (!emit) { console.error('usage: migration.js <emit>'); process.exit(2); }+const src = execFileSync(emit, ['migration'], { encoding: 'utf8' }).trim();++function steam(apps, opts) {+ opts = opts || {};+ const store = opts.storage || new Map();+ const written = [];+ const details = new Map(apps.map(a => [a.unAppID, a]));+ const window = {+ appStore: { m_mapApps: new Map(apps.map(a => [a.unAppID, { appid: a.unAppID, visible_in_game_list: !a.hidden }])+ .concat([[0, null]])) },+ appDetailsStore: {+ RequestAppDetails: id => opts.silent && opts.silent.includes(id)+ ? new Promise(() => {}) : Promise.resolve(details.get(id)),+ },+ };+ const localStorage = {+ getItem: k => store.has(k) ? store.get(k) : null,+ setItem: (k, v) => store.set(k, String(v)),+ };+ const SteamClient = { Apps: { SetAppLaunchOptions: (appid, o) => written.push({ appid, o }) } };+ const console = { log() {}, warn(...a) { written.push({ warn: a }); },+ error(...a) { written.push({ error: a }); } };+ const setTimeout = f => { if (!opts.hang) f(); };+ const self = { m_cm: { steamid: { GetAccountID: () => opts.account || 1 } } };+ const run = new Function('window', 'localStorage', 'SteamClient', 'console', 'setTimeout',+ 'return ' + src + ';');+ return { go: () => run.call(self, window, localStorage, SteamClient, console, setTimeout),+ written, store };+}++const app = (id, o, over) => Object.assign(+ { unAppID: id, vecPlatforms: ['windows'], strCompatToolName: '', strLaunchOptions: o }, over || {});++(async () => {+ const t = runner('migration');++ const rule = [+ ['MTL_HUD_ENABLED=1 -dx11', 'MTL_HUD_ENABLED=1 %command% -dx11'],+ ['-dx11 WINEMSYNC=1', 'WINEMSYNC=1 %command% -dx11'],+ ['CX_GRAPHICS_BACKEND=dxmt DXMT_CONFIG=d3d11.metalSpatialUpscaleFactor=2',+ 'CX_GRAPHICS_BACKEND=dxmt DXMT_CONFIG=d3d11.metalSpatialUpscaleFactor=2 %command%'],+ ['WINEDLLOVERRIDES=d3d11=n;dxgi=n -novid', "WINEDLLOVERRIDES='d3d11=n;dxgi=n' %command% -novid"],+ ['WINEDEBUG="a b" -x "two words"', 'WINEDEBUG="a b" %command% -x "two words"'],+ [' MTL_HUD_ENABLED=1 -a ', 'MTL_HUD_ENABLED=1 %command% -a'],+ ];+ const kept = ['-novid', '', 'MTL_HUD_ENABLED=1 %command%', 'mtl_hud_enabled=1 %COMMAND%',+ 'MTL_HUD_ENABLED=1 "unclosed', 'FOO=1 -x', '"WINEDEBUG=x" -y'];++ const apps = rule.map((r, i) => app(100 + i, r[0]))+ .concat(kept.map((o, i) => app(200 + i, o)));+ let s = steam(apps);+ await s.go();+ for (const [i, r] of rule.entries()) {+ const w = s.written.find(x => x.appid === 100 + i);+ t.ok(w && w.o === r[1], `rewrites ${JSON.stringify(r[0])}`);+ }+ for (const [i, o] of kept.entries())+ t.ok(!s.written.some(x => x.appid === 200 + i), `leaves ${JSON.stringify(o)} alone`);++ const out = s.written.find(x => x.appid === 103).o.replace('%command%', 'printenv WINEDLLOVERRIDES; echo');+ t.ok(execFileSync('/bin/sh', ['-c', out], { encoding: 'utf8' }) === 'd3d11=n;dxgi=n\n-novid\n',+ 'the shell reads a moved value with a semicolon as one env var');++ s.written.length = 0;+ await s.go();+ t.ok(s.written.length === 0, 'a second start rewrites nothing');++ const later = steam([app(100, 'WINEMSYNC=1 -x')], { storage: s.store });+ await later.go();+ t.ok(later.written.length === 0, 'a finished account is not checked again');+ const other = steam([app(100, 'MTL_HUD_ENABLED=1 -x')], { storage: s.store, account: 2 });+ await other.go();+ t.ok(other.written.length === 1, 'another account gets its own pass');++ const native = steam([app(1, 'MTL_HUD_ENABLED=1', { vecPlatforms: ['windows', 'osx'] }),+ app(2, 'MTL_HUD_ENABLED=1', { vecPlatforms: ['osx'], strCompatToolName: 'notproton' }),+ app(2147483650, 'MTL_HUD_ENABLED=1', { vecPlatforms: ['osx'] })]);+ await native.go();+ t.ok(native.written.map(x => x.appid).join() === '2,2147483650',+ 'skips native Mac games without a tool, as the panel does');++ const silent = steam([app(1, 'MTL_HUD_ENABLED=1'), app(2, 'MTL_HUD_ENABLED=1')], { silent: [1] });+ await silent.go();+ t.ok(silent.written.filter(x => x.appid).map(x => x.appid).join() === '2',+ 'a game with no details does not hold up the rest');+ t.ok(silent.written.some(x => x.warn && String(x.warn[0]).includes('app 1,')),+ 'a game with no details is named in the log');+ const retry = steam([app(1, 'MTL_HUD_ENABLED=1')], { storage: silent.store });+ await retry.go();+ t.ok(retry.written.length === 0, 'a game with no details is not retried once the pass finished');++ const cut = steam([app(1, 'MTL_HUD_ENABLED=1'), app(2, 'MTL_HUD_ENABLED=1')], { silent: [2], hang: true });+ cut.go();+ await new Promise(r => setImmediate(r));+ t.ok(cut.written.map(x => x.appid).join() === '1' && cut.store.size === 0,+ 'a pass cut short does not mark the account');+ const again = steam([app(1, 'MTL_HUD_ENABLED=1 %command%'), app(2, 'MTL_HUD_ENABLED=1')], { storage: cut.store });+ await again.go();+ t.ok(again.written.map(x => x.appid).join() === '2' && again.store.size === 1,+ 'the next start finishes the pass and leaves moved games alone');++ const bad = steam([app(1, 'MTL_HUD_ENABLED=1')]);+ bad.written.push = function (x) { if (x.appid) throw new Error('no'); return Array.prototype.push.call(this, x); };+ await bad.go();+ t.ok(bad.written.some(x => x.error) && bad.store.size === 0,+ 'an error is logged, not thrown into Steam, and the account stays unmarked');++ const hidden = steam([app(1, 'MTL_HUD_ENABLED=1', { hidden: true })]);+ await hidden.go();+ t.ok(hidden.written.some(x => x.appid === 1), 'covers uninstalled demos that the library hides');++ const many = steam(Array.from({ length: 45 }, (_, i) => app(i + 1, 'WINEMSYNC=1')));+ await many.go();+ t.ok(many.written.filter(x => x.appid).length === 45 && many.store.size === 1,+ 'checks every app when there are more than one batch');++ if (t.failed) process.exit(1);+})();diff --git a/dylib/tests/panel-behavior/shell.js b/dylib/tests/panel-behavior/shell.jsnew file mode 100644index 0000000..5100dac--- /dev/null+++ b/dylib/tests/panel-behavior/shell.js@@ -0,0 +1,203 @@+'use strict';+const fs = require('fs');+const os = require('os');+const path = require('path');+const { spawnSync } = require('child_process');+const { panel, walk, details, runner, FORMS } = require('./harness');++const emit = process.argv[2];+if (!emit) { console.error('usage: shell.js <emit>'); process.exit(2); }++const TOGGLES = {+ 'Metal HUD': 'MTL_HUD_ENABLED',+ 'MSync': 'WINEMSYNC',+ 'High Resolution': 'NOTPROTON_RETINA',+ 'Advertise AVX2 to Rosetta': 'ROSETTA_ADVERTISE_AVX',+};+const PANEL_KEYS = ['CX_GRAPHICS_BACKEND', 'MTL_HUD_ENABLED', 'D3DM_ENABLE_METALFX', 'DXMT_ENABLE_NVEXT',+ 'DXMT_METALFX_SPATIAL_SWAPCHAIN', 'DXMT_CONFIG', 'ROSETTA_ADVERTISE_AVX', 'WINEMSYNC', 'NOTPROTON_RETINA'];+const OTHER_KEYS = ['WINEDEBUG', 'DXVK_HUD', 'FOO'];++const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-shell-'));+const probe = path.join(dir, 'probe');+fs.writeFileSync(probe, '#!' + process.execPath + '\n' ++ `const k=${JSON.stringify(PANEL_KEYS.concat(OTHER_KEYS))};const e={};` ++ 'k.forEach(n=>{if(n in process.env)e[n]=process.env[n]});' ++ 'require("fs").appendFileSync(process.env.NP_PROBE_OUT,' ++ 'JSON.stringify({argv:process.argv.slice(2),env:e})+"\\n");\n', { mode: 0o755 });+fs.writeFileSync(path.join(dir, 'gamemoderun'), '#!/bin/sh\nexec "$@"\n', { mode: 0o755 });++const quote = s => "'" + s.replace(/'/g, "'\\''") + "'";+const COMMAND = quote(probe) + " 'game.exe'";++function steamLine(options) {+ const o = options.trim();+ return /%command%/i.test(o) ? o.replace(/%command%/gi, () => COMMAND) : COMMAND + (o ? ' ' + o : '');+}++const shells = ['/bin/sh', '/bin/dash'].filter(s => fs.existsSync(s));++function launch(shell, options) {+ const out = path.join(dir, 'runs');+ fs.rmSync(out, { force: true });+ spawnSync(shell, ['-c', steamLine(options)], {+ env: { PATH: dir + ':/usr/bin:/bin', HOME: process.env.HOME, NP_PROBE_OUT: out },+ cwd: dir, timeout: 10000, stdio: 'ignore',+ });+ return fs.existsSync(out) ? fs.readFileSync(out, 'utf8').trim().split('\n').map(JSON.parse) : [];+}++function view(form, options) {+ const P = panel(emit, form);+ const nodes = walk(P.render({ details: details(options) }));+ const toggles = {};+ nodes.filter(n => n.type === 'Toggle' && n.props.label in TOGGLES)+ .forEach(n => { toggles[TOGGLES[n.props.label]] = n; });+ const backend = nodes.find(n => n.type === 'Dropdown' && n.props.rgOptions.some(o => o.data === 'dxvk'));+ const upscale = nodes.find(n => n.type === 'Dropdown' && n.props.rgOptions.some(o => o.data === '1.5'));+ return { toggles, backend, upscale, written: P.written };+}++function dxmt(conf) {+ const out = {};+ for (const line of (conf || '').split(';')) {+ let n = 0;+ const ws = () => { while (n < line.length && ' \t\r'.includes(line[n])) n++; };+ ws();+ let key = '';+ while (n < line.length && /[0-9A-Za-z._]/.test(line[n])) key += line[n++];+ ws();+ if (line[n] !== '=') continue;+ n++; ws();+ let value = '', str = false;+ for (; n < line.length; n++) {+ if (!str && ' \t\r'.includes(line[n])) break;+ if (line[n] === '"') str = !str; else value += line[n];+ }+ out[key] = value;+ }+ return out;+}+const FACTOR = 'd3d11.metalSpatialUpscaleFactor';+const userDxmt = env => { const c = dxmt(env.DXMT_CONFIG); delete c[FACTOR]; return JSON.stringify(c); };++function agrees(t, v, env, what) {+ if (v.upscale) {+ const f = Math.max(parseFloat(dxmt(env.DXMT_CONFIG)[FACTOR] || '2'), 1);+ const want = env.DXMT_METALFX_SPATIAL_SWAPCHAIN === '1' ? f : '';+ const got = v.upscale.props.selectedOption;+ t.ok(got === '' ? want === '' : parseFloat(got) === want,+ `${what}: upscale shows "${got}", DXMT uses ${want}`);+ }+ for (const [key, node] of Object.entries(v.toggles))+ t.ok(node.props.checked === (env[key] === '1'), `${what}: ${key} shows ${node.props.checked}, game gets ${env[key]}`);+ t.ok(v.backend.props.selectedOption === (env.CX_GRAPHICS_BACKEND || ''),+ `${what}: backend shows "${v.backend.props.selectedOption}", game gets ${env.CX_GRAPHICS_BACKEND}`);+}++const ACTIONS = [+ { name: 'Metal HUD', run: v => v.toggles.MTL_HUD_ENABLED.props.onChange(!v.toggles.MTL_HUD_ENABLED.props.checked),+ want: (v0, v1) => v1.toggles.MTL_HUD_ENABLED.props.checked === !v0.toggles.MTL_HUD_ENABLED.props.checked },+ { name: 'MSync', run: v => v.toggles.WINEMSYNC.props.onChange(!v.toggles.WINEMSYNC.props.checked),+ want: (v0, v1) => v1.toggles.WINEMSYNC.props.checked === !v0.toggles.WINEMSYNC.props.checked },+ { name: 'backend dxvk', run: v => v.backend.props.onChange({ data: 'dxvk' }),+ want: (v0, v1) => v1.backend.props.selectedOption === 'dxvk' },+ { name: 'backend automatic', run: v => v.backend.props.onChange({ data: '' }),+ want: (v0, v1) => v1.backend.props.selectedOption === '' },+ { name: 'upscale 1.5', run: v => v.upscale && v.upscale.props.onChange({ data: '1.5' }),+ want: (v0, v1) => !v0.upscale || v1.upscale.props.selectedOption === '1.5' },+ { name: 'upscale off', run: v => v.upscale && v.upscale.props.onChange({ data: '' }),+ want: (v0, v1) => !v0.upscale || v1.upscale.props.selectedOption === '' },+];++const CASES = [+ "CX_GRAPHICS_BACKEND=dxmt DXMT_CONFIG='d3d11.preferredMaxFrameRate=60' %command%",+ 'CX_GRAPHICS_BACKEND=dxmt DXMT_METALFX_SPATIAL_SWAPCHAIN=1 DXMT_CONFIG="d3d11.preferredMaxFrameRate=60;" %command%',+ 'DXMT_METALFX_SPATIAL_SWAPCHAIN=1 DXMT_CONFIG="d3d11.metalSpatialUpscaleFactor = 1.5 ; d3d11.preferredMaxFrameRate=30" %command%',+ 'DXMT_METALFX_SPATIAL_SWAPCHAIN=1 DXMT_CONFIG="d3d11.metalSpatialUpscaleFactor=3.0;d3d11.metalSpatialUpscaleFactor=1.5" %command%',+ 'DXMT_METALFX_SPATIAL_SWAPCHAIN=1 DXMT_CONFIG=d3d11.metalSpatialUpscaleFactor=0.5 %command%',+ 'DXMT_METALFX_SPATIAL_SWAPCHAIN=1 DXMT_CONFIG="d3d11.metalSpatialUpscaleFactor=2" %command% --offline',+ "DXMT_CONFIG='d3d11.preferredMaxFrameRate=60' %command% --offline",+ '',+ '--offline',+ '%command%',+ '%command% --offline',+ 'MTL_HUD_ENABLED=1 %command%',+ 'MTL_HUD_ENABLED="1" %command% --offline',+ "MTL_HUD_ENABLED='1' WINEMSYNC=0 %command%",+ 'MTL_HUD_ENABLED=1 %COMMAND%',+ 'MTL_HUD_ENABLED=1 %Command% -windowed',+ 'MTL_HUD_ENABLED=1 %command%%command%',+ 'DXVK_HUD=1 %command% --offline',+ 'WINEDEBUG="err+all, trace+seh" MTL_HUD_ENABLED=1 %command% --name "two words"',+ "DXMT_CONFIG='d3d11.foo=1 d3d11.bar=2' %command% --name 'two words'",+ 'WINEDEBUG=err+all,\\ trace+seh %command% --name two\\ words',+ '%command% --title MTL_HUD_ENABLED=1',+ 'MTL_HUD_ENABLED_EXTRA=1 %command% --title "MTL_HUD_ENABLED=0 extra"',+ 'MTL_HUD_ENABLED=1\tMTL_HUD_ENABLED="0" %command%',+ 'MTL_HUD_ENABLED=1 MTL_HUD_ENABLED="" %command%',+ 'MTL_HUD_ENABLED=1 -windowed',+ 'MTL_HUD_ENABLED=1 CX_GRAPHICS_BACKEND=dxmt',+ '-windowed MTL_HUD_ENABLED=1',+ 'MTL_HUD_ENABLED=1 gamemoderun %command%',+ 'gamemoderun MTL_HUD_ENABLED=1 %command%',+ 'gamemoderun %command% --offline',+ 'MTL_HUD_ENABLED=1; %command%',+ 'MTL_HUD_ENABLED=1 true && %command%',+ 'true && MTL_HUD_ENABLED=1 %command% --offline',+ 'true; CX_GRAPHICS_BACKEND=dxmt %command%',+ 'MTL_HUD_ENABLED=1 %command% | cat',+ 'MTL_HUD_ENABLED=1 %command% > /dev/null 2>&1',+ 'MTL_HUD_ENABLED=1 2>/dev/null %command%',+ 'MTL_HUD_ENABLED=1>/dev/null %command%',+ 'MTL_HUD_ENABLED=1 %command% # MTL_HUD_ENABLED=0',+ '( MTL_HUD_ENABLED=1 %command% )',+ '{ MTL_HUD_ENABLED=1 %command%; }',+ 'if true; then MTL_HUD_ENABLED=1 %command%; fi',+ 'FOO=$(echo a b) MTL_HUD_ENABLED=1 %command%',+ 'FOO="$(echo "a)b")" MTL_HUD_ENABLED=1 %command%',+ 'FOO=`echo a b` MTL_HUD_ENABLED=1 %command%',+ 'FOO=${HOME:-a b} MTL_HUD_ENABLED=1 %command%',+ 'CX_GRAPHICS_BACKEND=dxmt DXMT_METALFX_SPATIAL_SWAPCHAIN=1 DXMT_CONFIG=d3d11.metalSpatialUpscaleFactor=2.0 %command%',+ 'MTL_HUD_ENABLED="1 %command%',+ 'MTL_HUD_ENABLED=1 "%command%"',+ 'MTL_HUD_ENABLED=1 \\%command%',+ ' MTL_HUD_ENABLED=1 %command% --offline ',+];++let failed = 0;+for (const shell of shells) {+ for (const form of Object.keys(FORMS)) {+ const t = runner(`${path.basename(shell)} ${form}`);+ for (const options of CASES) {+ const before = launch(shell, options);+ const v0 = view(form, options);+ const label = JSON.stringify(options);+ if (before.length) agrees(t, v0, before[0].env, label);+ for (const a of ACTIONS) {+ const v = view(form, options);+ a.run(v);+ const next = v.written.length ? v.written[v.written.length - 1].opts : options;+ const after = launch(shell, next);+ const what = `${label} ${a.name} -> ${JSON.stringify(next)}`;+ t.ok(after.length === before.length, `${what}: game runs ${after.length}x, was ${before.length}x`);+ const v1 = view(form, next);+ t.ok(a.want(v0, v1), `${what}: panel shows the change`);+ if (!after.length || after.length !== before.length) continue;+ agrees(t, v1, after[0].env, what);+ before.forEach((run, n) => {+ t.ok(JSON.stringify(after[n].argv) === JSON.stringify(run.argv),+ `${what}: game arguments kept ${JSON.stringify(after[n].argv)}`);+ for (const k of OTHER_KEYS)+ t.ok(after[n].env[k] === run.env[k], `${what}: ${k} kept`);+ t.ok(userDxmt(after[n].env) === userDxmt(run.env),+ `${what}: DXMT_CONFIG entries kept ${userDxmt(after[n].env)}`);+ });+ }+ }+ failed += t.failed;+ }+}+fs.rmSync(dir, { recursive: true, force: true });+console.log(failed ? `\n${failed} failure(s)` : `\npanel agrees with ${shells.join(' and ')}`);+process.exit(failed ? 1 : 0);diff --git a/dylib/tests/panel-behavior/switching.js b/dylib/tests/panel-behavior/switching.jsindex f2c1ce7..3f32dd4 100644--- a/dylib/tests/panel-behavior/switching.js+++ b/dylib/tests/panel-behavior/switching.js@@ -38,7 +38,7 @@ const CASES = [gone: D3DM, kept: NVEXT },// Stripping arguments by name is the kind of thing that takes neighbours with it.{ to: 'dxvk',- from: '-novid MTL_HUD_ENABLED=1 WINEMSYNC=1 NOTPROTON_RETINA=1 ' + UPSCALED + ' %command%',+ from: 'MTL_HUD_ENABLED=1 WINEMSYNC=1 NOTPROTON_RETINA=1 ' + UPSCALED + ' %command% -novid',gone: DXMT,kept: ['-novid', 'MTL_HUD_ENABLED=1', 'WINEMSYNC=1', 'NOTPROTON_RETINA=1', '%command%'] },];@@ -49,7 +49,8 @@ for (const form of Object.keys(FORMS)) {const t = runner(form);for (const c of CASES) {written.length = 0;- const nodes = walk(P({ details: details(c.from) }));+ const from = c.from.includes('%command%') ? c.from : c.from + ' %command%';+ const nodes = walk(P({ details: details(from) }));const backend = nodes.find(x => x.type === 'Dropdown' &&(x.props.rgOptions || []).some(o => o.data === 'dxmt'));backend.props.onChange({ data: c.to });diff --git a/signatures/macos.arm64/1788400362.json b/signatures/macos.arm64/1788400362.jsonindex 3107d46..f1cf09d 100644--- a/signatures/macos.arm64/1788400362.json+++ b/signatures/macos.arm64/1788400362.json@@ -168,6 +168,15 @@"value": "GetWildcardMapping: Invalid unAppID k_nAppIdAll"}},+ {+ "name": "LaunchBuilder::SteamVRSupportCheck",+ "aob_hex": "F6 57 BD A9 F4 4F 01 A9 FD 7B 02 A9 FD 83 00 91 F3 03 01 AA 08 00 40 F9 08 29 40 F9 00 01 3F D6",+ "anchor": {+ "kind": "string",+ "value": "SteamVRSupport"+ },+ "func_addr_this_build": "0xb174d8"+ },{"name": "steamui::ShortcutExtensionMatches","module": "steamui.dylib",diff --git a/signatures/macos.arm64/1789086785.json b/signatures/macos.arm64/1789086785.jsonindex f689e7d..3534b0c 100644--- a/signatures/macos.arm64/1789086785.json+++ b/signatures/macos.arm64/1789086785.json@@ -165,6 +165,15 @@"value": "GetWildcardMapping: Invalid unAppID k_nAppIdAll"}},+ {+ "name": "LaunchBuilder::SteamVRSupportCheck",+ "aob_hex": "F6 57 BD A9 F4 4F 01 A9 FD 7B 02 A9 FD 83 00 91 F3 03 01 AA 08 00 40 F9 08 29 40 F9 00 01 3F D6",+ "anchor": {+ "kind": "string",+ "value": "SteamVRSupport"+ },+ "func_addr_this_build": "0xb25964"+ },{"name": "steamui::ShortcutExtensionMatches","module": "steamui.dylib",diff --git a/signatures/macos.arm64/1790904859.json b/signatures/macos.arm64/1790904859.jsonindex 5433605..1592df7 100644--- a/signatures/macos.arm64/1790904859.json+++ b/signatures/macos.arm64/1790904859.json@@ -164,6 +164,15 @@},"func_addr_this_build": "0x6a503c"},+ {+ "name": "LaunchBuilder::SteamVRSupportCheck",+ "aob_hex": "F6 57 BD A9 F4 4F 01 A9 FD 7B 02 A9 FD 83 00 91 F3 03 01 AA 08 00 40 F9 08 29 40 F9 00 01 3F D6",+ "anchor": {+ "kind": "string",+ "value": "SteamVRSupport"+ },+ "func_addr_this_build": "0xb2544c"+ },{"name": "steamui::ShortcutExtensionMatches","module": "steamui.dylib",