Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
feat(dylib): move to the bridgeplay support dir and bridgeplay-proton tools
raymondchins39fc81d94fe0
diff --git a/dylib/feats/compat.c b/dylib/feats/compat.cindex a6aef86..627541c 100644--- a/dylib/feats/compat.c+++ b/dylib/feats/compat.c@@ -19,7 +19,10 @@// The client maps Cloud's Windows path roots into the compat prefix only when// the tool's name contains "proton" so without a match every AutoCloud rule silently// skips the app.-#define TOOL_DIR_NAME "notproton"+#define TOOL_DIR_NAME "bridgeplay-proton"+// The prefix tools had before Bridgeplay 3.0. The app renames them, and until it has, a+// tool under the old name is still ours.+#define LEGACY_TOOL_DIR_NAME "notproton"#define TOOL_RUN "/run"#define COMPAT_MANAGER_ENABLED_OFF 0x7B0@@ -363,8 +366,13 @@ static int is_token(const char *s, const char *extra) {return 1;}+static int has_tool_prefix(const char *s) {+ return strncmp(s, TOOL_DIR_NAME, strlen(TOOL_DIR_NAME)) == 0+ || strncmp(s, LEGACY_TOOL_DIR_NAME, strlen(LEGACY_TOOL_DIR_NAME)) == 0;+}+static int is_tool_name(const char *s) {- return s && strncmp(s, TOOL_DIR_NAME, strlen(TOOL_DIR_NAME)) == 0 && is_token(s, "._-");+ return s && has_tool_prefix(s) && is_token(s, "._-");}static int is_display(const char *s) {@@ -464,7 +472,7 @@ static void load_tool_list(void) {if (!home || tools_dir_path(tools_dir, sizeof(tools_dir)) != 0) return;char path[512];- snprintf(path, sizeof(path), "%s/Library/Application Support/notproton/tools", home);+ np_support_path(path, sizeof(path), home, "tools");np_compat_load_tool_list(path, tools_dir);}@@ -526,7 +534,8 @@ static int write_tool(const tool_entry_t *tool) {return 0;}-#define RUN_SCRIPT_MARK "\n# notproton CrossOver compatibility tool shim\n"+#define RUN_SCRIPT_MARK "\n# bridgeplay CrossOver compatibility tool shim\n"+#define LEGACY_RUN_SCRIPT_MARK "\n# notproton CrossOver compatibility tool shim\n"static int written_here(const char *tool_dir) {char path[768];@@ -540,7 +549,7 @@ static int written_here(const char *tool_dir) {size_t got = fread(head, 1, sizeof(head) - 1, f);fclose(f);head[got] = '\0';- return strstr(head, RUN_SCRIPT_MARK) != NULL;+ return strstr(head, RUN_SCRIPT_MARK) != NULL || strstr(head, LEGACY_RUN_SCRIPT_MARK) != NULL;}static void remove_tool(const char *tools_dir, const char *name) {@@ -578,7 +587,7 @@ static void remove_unlisted_tools(const char *tools_dir) {struct dirent *e;while ((e = readdir(dir)) != NULL) {- if (strncmp(e->d_name, TOOL_DIR_NAME, strlen(TOOL_DIR_NAME)) != 0) continue;+ if (!has_tool_prefix(e->d_name)) continue;if (is_listed(e->d_name)) continue;remove_tool(tools_dir, e->d_name);}@@ -628,13 +637,14 @@ const char *np_compat_tool_dir(void) {}int np_compat_runs_tool(const char *cmd) {- static const char lead[] = "/compatibilitytools.d/" TOOL_DIR_NAME;+ static const char lead[] = "/compatibilitytools.d/";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;+ if (!has_tool_prefix(p)) continue;while (is_name_char(*p, "._-"))p++;if (strncmp(p, run, sizeof(run) - 1) == 0 || strncmp(p, run_dot, sizeof(run_dot) - 1) == 0)@@ -901,8 +911,10 @@ void *np_compat_registered_tool(void *compat_mgr) {return NULL;load_tool_list_once();- if (g_tool_count == 0)- return find_tool(compat_mgr, TOOL_DIR_NAME);+ if (g_tool_count == 0) {+ void *entry = find_tool(compat_mgr, TOOL_DIR_NAME);+ return entry ? entry : find_tool(compat_mgr, LEGACY_TOOL_DIR_NAME);+ }for (int i = 0; i < g_tool_count; i++) {void *entry = find_tool(compat_mgr, g_tools[i].name);diff --git a/dylib/feats/compatsvc.c b/dylib/feats/compatsvc.cindex 7bf5542..b6e2732 100644--- a/dylib/feats/compatsvc.c+++ b/dylib/feats/compatsvc.c@@ -179,7 +179,7 @@ static int get_compat_tools(uintptr_t request, uintptr_t response) {// Raw mapping, including names that resolve to no installed tool.const char *chosen = appid ? np_compat_app_mapping(mgr, appid): tool_name(np_compat_chosen_tool(mgr, 0));- const bool holds_none = chosen && strcmp(chosen, NP_COMPAT_TOOL_NONE) == 0;+ const bool holds_none = np_compat_is_none(chosen);// The fallback tool for when no choice is made. The wildcard covers apps the// client will not run natively (Windows stuff). Left unset where nothing carries the app,// so the "Default" entry shows no name.diff --git a/dylib/feats/compatsvc.h b/dylib/feats/compatsvc.hindex 0a23c98..5d0dfc6 100644--- a/dylib/feats/compatsvc.h+++ b/dylib/feats/compatsvc.h@@ -4,6 +4,7 @@#include <stdint.h>#include <stddef.h>+#include <string.h>#include <mach-o/loader.h>// Registers on first route lookup rather than at install time@@ -20,8 +21,15 @@ enum {};int np_compatsvc_routes(void);-// Sentinel name for "no tool".-#define NP_COMPAT_TOOL_NONE "notproton.none"+// Sentinel name for "no tool", which Steam keeps in CompatToolMapping. Releases before+// Bridgeplay 3.0 wrote the legacy one, and it means the same until the app rewrites it.+#define NP_COMPAT_TOOL_NONE "bridgeplay-proton.none"+#define NP_COMPAT_TOOL_NONE_LEGACY "notproton.none"++static inline int np_compat_is_none(const char *name) {+ return name && (strcmp(name, NP_COMPAT_TOOL_NONE) == 0+ || strcmp(name, NP_COMPAT_TOOL_NONE_LEGACY) == 0);+}// Tells the page the mapping changed.void np_compatsvc_state_changed(void);diff --git a/dylib/feats/webpatch.c b/dylib/feats/webpatch.cindex 4b52c3c..de957e1 100644--- a/dylib/feats/webpatch.c+++ b/dylib/feats/webpatch.c@@ -2,6 +2,7 @@#include "webpatch.h"#include "nativeplatform.h"#include "../util/log.h"+#include "../util/file.h"#include <dirent.h>#include <stdio.h>@@ -307,8 +308,11 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"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):\"\"}," \+ /* The panel writes BRIDGEPLAY_<X>. NOTPROTON_<X>, from launch options written before 3.0, \+ is read too and wins, as it does in the run script and np-native. */ \+ "A1=k=>(nat?NE.filter(w=>wv(w).startsWith(k+\"=\")):E.e.filter(w=>o.startsWith(k+\"=\",w.start))).pop()," \+ "A=k=>/^BRIDGEPLAY_/.test(k)&&A1(\"NOTPROTON_\"+k.slice(11))||A1(k)," \+ "g=k=>{const p=A(k);if(!p)return\"\";const x=wv(p);return x.slice(x.indexOf(\"=\")+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:\"\")}" \@@ -321,8 +325,8 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {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)))||\"\";" \+ "L=Fx.h?Fx.h+\"/.bridgeplay/np-native\":(c&&E.G.slice(0,E.c).map(wv)" \+ ".find(x=>/\\/\\.(bridgeplay|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)]);" \@@ -331,7 +335,9 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"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)," \+ /* Writing BRIDGEPLAY_<X> drops a NOTPROTON_<X> the line still carries. */ \+ "s=ps=>{ps=ps.concat(ps.filter(p=>/^BRIDGEPLAY_/.test(p[0])).map(p=>[\"NOTPROTON_\"+p[0].slice(11),\"\"]));" \+ "return 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]||\"\"}" \@@ -348,15 +354,15 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"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\"," \+ "fo=fz(ev(\"BRIDGEPLAY_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\"}," \+ "D(\"BRIDGEPLAY_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\"}," \+ "fo&&D(\"BRIDGEPLAY_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\"}," \+ "fo&&T([\"BRIDGEPLAY_FRAMEGEN_UI\"],\"Protect UI (keeps static HUD and menus sharp)\",\"1\",\"0\")," \+ "fo&&T([\"BRIDGEPLAY_FRAMEGEN_FALLBACK\"],\"Fast-motion fallback (skips frames that would smear)\",\"1\",\"0\")," \+ "fo&&D(\"BRIDGEPLAY_FRAMEGEN_ENGINE\",\"Engine\",[{data:\"own\",label:\"Built-in optical flow\"}," \"{data:\"metalfx\",label:\"MetalFX\"}],lc(\"own\"))]},\"fgn\")," \/* A toggle that is on unless set to "0" (upstream 1.2.0: AVX2, FEX x87 precision). */ \"X=(k,l)=>(0," RT ".jsx)(" BARREL ".Yh,{className:\"MSCXRow\",label:l," \@@ -402,7 +408,7 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"\"dxmt\"===b&&T([\"DXMT_ENABLE_NVEXT\"],\"DLSS\",\"1\")," \"!fex&&X(\"ROSETTA_ADVERTISE_AVX\",npL(\"Advertise AVX2 to Rosetta\",\"向 Rosetta 声明 AVX2 支持\",\"Segnala AVX2 a Rosetta\"))," \"T([\"WINEMSYNC\"],\"MSync\",\"1\",\"0\")," \- "T([\"NOTPROTON_RETINA\"],npL(\"High Resolution\",\"高分辨率\",\"Alta risoluzione\"),\"1\",\"0\")" \+ "T([\"BRIDGEPLAY_RETINA\"],npL(\"High Resolution\",\"高分辨率\",\"Alta risoluzione\"),\"1\",\"0\")" \"]},\"gfx\")," \"dx&&(0," RT ".jsx)(" BARREL ".XY," \"{label:npL(\"MetalFX Upscaling (Samples from the resolution the game is set to)\"," \@@ -412,10 +418,10 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"onChange:v=>s([[\"DXMT_METALFX_SPATIAL_SWAPCHAIN\",v.data?\"1\":\"\"],[\"DXMT_CONFIG\",fx(v.data)]])})},\"usf\")," \"FG()," \"(0," RT ".jsxs)(" BARREL ".XY,{label:npL(\"Controllers\",\"控制器\",\"Controller\"),children:[" \- "T([\"NOTPROTON_RAW_CONTROLLERS\"],npL(\"Let games read controllers directly (May break Steam Input. Not recommended)\"," \+ "T([\"BRIDGEPLAY_RAW_CONTROLLERS\"],npL(\"Let games read controllers directly (May break Steam Input. Not recommended)\"," \"\"允许游戏直接读取控制器(可能导致 Steam Input 失效,不推荐)\"," \"\"Lascia che i giochi leggano direttamente i controller (pu\\u00f2 interferire con Steam Input, sconsigliato)\"),\"1\",\"\")," \- "T([\"NOTPROTON_DISABLE_HIDRAW\"],npL(\"Disable hidraw\",\"停用 hidraw\",\"Disable hidraw\"),\"1\",\"\")" \+ "T([\"BRIDGEPLAY_DISABLE_HIDRAW\"],npL(\"Disable hidraw\",\"停用 hidraw\",\"Disable hidraw\"),\"1\",\"\")" \"]},\"ctl\")," \"fex&&(0," RT ".jsx)(" BARREL ".XY,{label:\"FEX\"," \"children:X(\"FEX_X87REDUCEDPRECISION\"," \@@ -440,7 +446,7 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {#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)," \+ "k=x=>/^(BRIDGEPLAY_|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);" \@@ -725,31 +731,47 @@ int np_webpatch_should_patch(const char *path) {// gamefixes/native-default.conf with variable names as they are; those land in ng and na.#define NP_FX_MAX 16384+// The panel's names for the variables Bridgeplay reads. The page also accepts the NOTPROTON_+// spelling in launch options, but the defaults it is handed always use these.+static const char *const fx_bridgeplay_keys[] = {+ "BRIDGEPLAY_RETINA", "BRIDGEPLAY_FRAMEGEN", "BRIDGEPLAY_FRAMEGEN_QUALITY",+ "BRIDGEPLAY_FRAMEGEN_UI", "BRIDGEPLAY_FRAMEGEN_FALLBACK", "BRIDGEPLAY_FRAMEGEN_ENGINE",+};++// The BRIDGEPLAY_ name whose suffix follows prefix in key ("" for the run script's short+// conf keys), or NULL.+static const char *fx_bridgeplay_key(const char *key, const char *prefix) {+ size_t n = strlen(prefix);+ if (strncmp(key, prefix, n) != 0) return NULL;+ for (size_t i = 0; i < sizeof(fx_bridgeplay_keys) / sizeof(fx_bridgeplay_keys[0]); i++)+ if (strcmp(key + n, fx_bridgeplay_keys[i] + sizeof("BRIDGEPLAY_") - 1) == 0)+ return fx_bridgeplay_keys[i];+ return NULL;+}+static const char *fx_panel_key(const char *key) {static const char *const same[] = {"MTL_HUD_ENABLED", "ROSETTA_ADVERTISE_AVX", "D3DM_ENABLE_METALFX", "DXMT_ENABLE_NVEXT",};- if (strcmp(key, "RETINA") == 0) return "NOTPROTON_RETINA";if (strcmp(key, "MSYNC") == 0) return "WINEMSYNC";- if (strcmp(key, "FRAMEGEN") == 0) return "NOTPROTON_FRAMEGEN";- if (strcmp(key, "FRAMEGEN_QUALITY") == 0) return "NOTPROTON_FRAMEGEN_QUALITY";- if (strcmp(key, "FRAMEGEN_UI") == 0) return "NOTPROTON_FRAMEGEN_UI";- if (strcmp(key, "FRAMEGEN_FALLBACK") == 0) return "NOTPROTON_FRAMEGEN_FALLBACK";- if (strcmp(key, "FRAMEGEN_ENGINE") == 0) return "NOTPROTON_FRAMEGEN_ENGINE";+ // RETINA=1, which the run script also takes as BRIDGEPLAY_RETINA=1.+ const char *bp = fx_bridgeplay_key(key, "");+ if (!bp) bp = fx_bridgeplay_key(key, "BRIDGEPLAY_");+ if (bp) return bp;for (size_t i = 0; i < sizeof(same) / sizeof(same[0]); i++)if (strcmp(key, same[i]) == 0) return same[i];return NULL;}-// np-native confs name the variables themselves.+// np-native confs name the variables themselves, in either spelling.static const char *fx_native_key(const char *key) {- static const char *const keys[] = {- "MTL_HUD_ENABLED", "NP_PAD_MODE", "NOTPROTON_FRAMEGEN", "NOTPROTON_FRAMEGEN_QUALITY",- "NOTPROTON_FRAMEGEN_UI", "NOTPROTON_FRAMEGEN_FALLBACK", "NOTPROTON_FRAMEGEN_ENGINE",- };+ static const char *const keys[] = { "MTL_HUD_ENABLED", "NP_PAD_MODE" };for (size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); i++)if (strcmp(key, keys[i]) == 0) return keys[i];- return NULL;+ if (strncmp(key, "BRIDGEPLAY_FRAMEGEN", 19) != 0 && strncmp(key, "NOTPROTON_FRAMEGEN", 18) != 0)+ return NULL;+ const char *bp = fx_bridgeplay_key(key, "BRIDGEPLAY_");+ return bp ? bp : fx_bridgeplay_key(key, "NOTPROTON_");}// Characters that go into a JSON string unescaped, up to max of them.@@ -763,7 +785,7 @@ static int fx_word(const char *v, size_t max) {return 1;}-// Values fit fx_pair_t.val. Tool names are longer ("notproton-winecx-11.17") and are+// Values fit fx_pair_t.val. Tool names are longer ("bridgeplay-proton-winecx-11.17") and are// bounded by the fallback name they are compared against instead.static int fx_safe(const char *v) { return fx_word(v, 16); }@@ -911,7 +933,7 @@ static int fx_build(char *buf, size_t cap) {const char *home = getenv("HOME");if (!home || !*home) return 0;char root[512], path[768];- snprintf(root, sizeof(root), "%s/Library/Application Support/notproton", home);+ np_support_path(root, sizeof(root), home, NULL);// Steam's chunks end in "//# sourceMappingURL=..." with no newline after it, so the// assignment starts a line of its own or the browser reads it as part of that comment.@@ -965,8 +987,8 @@ static int fx_build(char *buf, size_t cap) {// The run script reads controllers directly unless the launch options say otherwise, and// overlay-shim keeps the UI sharp and falls back on fast motion unless told not to.- n = snprintf(buf + len, cap - len, "},\"d\":{\"NOTPROTON_RAW_CONTROLLERS\":\"1\","- "\"NOTPROTON_FRAMEGEN_UI\":\"1\",\"NOTPROTON_FRAMEGEN_FALLBACK\":\"1\"}");+ n = snprintf(buf + len, cap - len, "},\"d\":{\"BRIDGEPLAY_RAW_CONTROLLERS\":\"1\","+ "\"BRIDGEPLAY_FRAMEGEN_UI\":\"1\",\"BRIDGEPLAY_FRAMEGEN_FALLBACK\":\"1\"}");if (n < 0 || (size_t)n >= cap - len) return 0;len += (size_t)n;diff --git a/dylib/hooks/hook_compat.c b/dylib/hooks/hook_compat.cindex d2aada0..e43b518 100644--- a/dylib/hooks/hook_compat.c+++ b/dylib/hooks/hook_compat.c@@ -77,7 +77,7 @@ static void *hook_FindToolForTargetApp(void *self, uint32_t appid) {// The NP_COMPAT_TOOL_NONE sentinel is honored as an explicit refusal.const char *mapping = np_compat_app_mapping(self, appid);- if (mapping && strcmp(mapping, NP_COMPAT_TOOL_NONE) == 0)+ if (np_compat_is_none(mapping))return NULL;if (!np_compat_would_force(self, appid))diff --git a/dylib/tests/compatcheck.c b/dylib/tests/compatcheck.cindex 0e2ef4a..1bf22a3 100644--- a/dylib/tests/compatcheck.c+++ b/dylib/tests/compatcheck.c@@ -42,6 +42,10 @@ const char *np_home_dir(void) {return "/nonexistent";}+void np_support_path(char *buf, size_t bufsz, const char *home, const char *rel) {+ snprintf(buf, bufsz, "%s/Library/Application Support/bridgeplay/%s", home, rel ? rel : "");+}+int np_get_section_containing(const struct mach_header_64 *mh, intptr_t slide,uintptr_t addr, uintptr_t *out_base, size_t *out_size) {(void)mh; (void)slide; (void)addr; (void)out_base; (void)out_size;@@ -109,7 +113,7 @@ static void *checked_dlsym(void *handle, const char *name) {static void *first_fallback(void *arg) {int *ok = arg;const char *name = np_compat_fallback_tool_name();- *ok = atomic_load(&home_ready) && strcmp(name, "notproton") == 0;+ *ok = atomic_load(&home_ready) && strcmp(name, "bridgeplay-proton") == 0;return NULL;}@@ -336,7 +340,7 @@ static void registration_case(int shift, int mode) {partial_paths = mode == 6;build_manager(existing, -1);for (int i = 0; i < g_tool_count; i++) {- snprintf(tools[i].name, sizeof(tools[i].name), "notproton-%d", i);+ snprintf(tools[i].name, sizeof(tools[i].name), "bridgeplay-proton-%d", i);snprintf(tools[i].display, sizeof(tools[i].display), "Tool %d", i);snprintf(tools[i].dir, sizeof(tools[i].dir), "/tools/tool%d", i);if (i < existing)@@ -401,23 +405,24 @@ static void tool_list_cases(void) {check(0, "the tool list fixture can be written");return;}- fputs("notproton\t27.0.0.40921-fex\tfex\tCrossOver Preview (FEX)\n"- "notproton-fex-41069\t27.0.0.41069-fex\tfex\tCrossOver Preview 41069 (FEX)\n"- "notproton-fex-rosetta\t27.0.0.40921-fex\trosetta\tCrossOver Preview (Rosetta)\n"+ fputs("bridgeplay-proton\t27.0.0.40921-fex\tfex\tCrossOver Preview (FEX)\n"+ "bridgeplay-proton-fex-41069\t27.0.0.41069-fex\tfex\tCrossOver Preview 41069 (FEX)\n"+ "bridgeplay-proton-fex-rosetta\t27.0.0.40921-fex\trosetta\tCrossOver Preview (Rosetta)\n""notproton-26.3\t26.3.0.39832\trosetta\tCrossOver 26.3\n"- "notproton\t26.3.0.39832\trosetta\tDuplicate\n"+ "bridgeplay-proton\t26.3.0.39832\trosetta\tDuplicate\n""proton-other\t1\trosetta\tForeign\n"- "notproton-x\t1\tarm\tBad flavor\n"- "notproton-q\t1\trosetta\tQuote\"d\n"- "notproton-short\t1\trosetta\n"+ "bridgeplay-other\t1\trosetta\tNo proton in the name\n"+ "bridgeplay-proton-x\t1\tarm\tBad flavor\n"+ "bridgeplay-proton-q\t1\trosetta\tQuote\"d\n"+ "bridgeplay-proton-short\t1\trosetta\n""\n", f);fclose(f);int kept = np_compat_load_tool_list(path, "/tools");unlink(path);- check(kept == 4, "only well-formed, unique, notproton-named lines are kept");- check(strcmp(g_tools[0].name, "notproton") == 0+ check(kept == 4, "only well-formed, unique lines named bridgeplay-proton or notproton are kept");+ check(strcmp(g_tools[0].name, "bridgeplay-proton") == 0&& strcmp(g_tools[0].flavor, "fex") == 0, "the first line stays first");check(strcmp(g_tools[3].build, "26.3.0.39832") == 0&& strcmp(g_tools[3].dir, "/tools/notproton-26.3") == 0,@@ -427,16 +432,16 @@ static void tool_list_cases(void) {*(const char **)(entries + np_compat_tool_stride() + COMPAT_TOOL_NAME_OFF) = "notproton-26.3";check(np_compat_registered_tool(mgr) == entries + np_compat_tool_stride(),"the most preferred tool the manager holds is the default");- *(const char **)(entries + COMPAT_TOOL_NAME_OFF) = "notproton";+ *(const char **)(entries + COMPAT_TOOL_NAME_OFF) = "bridgeplay-proton";check(np_compat_registered_tool(mgr) == entries,"the first listed tool wins when the manager holds it");const char *fex[3] = { NULL, NULL, NULL };- check(np_compat_fex_tools(fex, 3) == 2 && strcmp(fex[0], "notproton") == 0- && strcmp(fex[1], "notproton-fex-41069") == 0 && !fex[2],+ check(np_compat_fex_tools(fex, 3) == 2 && strcmp(fex[0], "bridgeplay-proton") == 0+ && strcmp(fex[1], "bridgeplay-proton-fex-41069") == 0 && !fex[2],"only the fex flavor counts as FEX, not a FEX build's Rosetta tool");fex[0] = fex[1] = NULL;- check(np_compat_fex_tools(fex, 1) == 1 && strcmp(fex[0], "notproton") == 0 && !fex[1],+ check(np_compat_fex_tools(fex, 1) == 1 && strcmp(fex[0], "bridgeplay-proton") == 0 && !fex[1],"the FEX list stops at its limit, keeping the first listed");f = fopen(path, "w");@@ -445,13 +450,13 @@ static void tool_list_cases(void) {return;}for (int i = 0; i < 40; i++)- fprintf(f, "notproton-%d\t1\trosetta\tTool %d\n", i, i);+ fprintf(f, "bridgeplay-proton-%d\t1\trosetta\tTool %d\n", i, i);fclose(f);kept = np_compat_load_tool_list(path, "/tools");unlink(path);- check(kept == 40 && strcmp(g_tools[39].name, "notproton-39") == 0- && strcmp(g_tools[0].dir, "/tools/notproton-0") == 0, "a long list keeps every tool");- check(strcmp(np_compat_fallback_tool_name(), "notproton-0") == 0,+ check(kept == 40 && strcmp(g_tools[39].name, "bridgeplay-proton-39") == 0+ && strcmp(g_tools[0].dir, "/tools/bridgeplay-proton-0") == 0, "a long list keeps every tool");+ check(strcmp(np_compat_fallback_tool_name(), "bridgeplay-proton-0") == 0,"the fallback is the first configured tool");check(np_compat_fex_tools(fex, 3) == 0, "a list with no FEX tool has no FEX names");@@ -461,19 +466,24 @@ static void tool_list_cases(void) {static void tool_launch_cases(void) {static const char *tool[] = {+ "'/tools/compatibilitytools.d/bridgeplay-proton/.'/run waitforexitandrun '/g/game.exe'",+ "A=1 '/tools/compatibilitytools.d/bridgeplay-proton-26.3/.'/run waitforexitandrun '/g/game.exe' -x",+ "'/tools/compatibilitytools.d/bridgeplay-proton-fex-rosetta/.'/run run ",+ "'/tools/compatibilitytools.d/bridgeplay-proton'/run waitforexitandrun '/g/game.exe'",+ "'/Volumes/Ext/Steam/compatibilitytools.d/bridgeplay-proton/.'/run waitforexitandrun '/g/game.exe'","'/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'",+ "'/tools/compatibilitytools.d/proton-other/.'/run x '/tools/compatibilitytools.d/notproton/.'/run run ",};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/bridgeplay/.'/run waitforexitandrun '/g/game.exe'",+ "'/tools/compatibilitytools.d/bridgeplay-proton/Game' -x",+ "'/tools/compatibilitytools.d/bridgeplay-proton/sub/.'/run waitforexitandrun '/g/game.exe'",+ "'/tools/compatibilitytools.d/bridgeplay-proton'/other '/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++)@@ -502,27 +512,31 @@ static void stale_tool_cases(void) {check(0, "the tools directory fixture can be made");return;}- char current[700], legacy[700], user[700], lookalike[700];- snprintf(current, sizeof(current), "%s/notproton-26.3", root);+ char current[700], renamed[700], legacy[700], user[700], lookalike[700];+ snprintf(current, sizeof(current), "%s/bridgeplay-proton-26.3", root);+ snprintf(renamed, sizeof(renamed), "%s/notproton-winehq", root);snprintf(legacy, sizeof(legacy), "%s/notproton", root);snprintf(user, sizeof(user), "%s/notproton-mine", root);- snprintf(lookalike, sizeof(lookalike), "%s/notproton-copy", root);- const char *dirs[] = { current, legacy, user, lookalike };- for (size_t i = 0; i < 4; i++) mkdir(dirs[i], 0755);+ snprintf(lookalike, sizeof(lookalike), "%s/bridgeplay-proton-copy", root);+ const char *dirs[] = { current, renamed, legacy, user, lookalike };+ for (size_t i = 0; i < 5; i++) mkdir(dirs[i], 0755);put(current, "flavor", "rosetta\n");- put(current, "run", "#!/bin/sh\n# notproton CrossOver compatibility tool shim\n");+ put(current, "run", "#!/bin/sh\n# bridgeplay CrossOver compatibility tool shim\n");+ put(renamed, "flavor", "rosetta\n");+ put(renamed, "run", "#!/bin/sh\n# notproton CrossOver compatibility tool shim\n");put(legacy, "run", "#!/bin/sh\n# notproton CrossOver compatibility tool shim\nset -e\n");put(legacy, "toolmanifest.vdf", "\"manifest\" {}\n");put(legacy, "compatibilitytool.vdf", "\"compatibilitytools\" {}\n");put(user, "run", "#!/bin/sh\nexec my-wine \"$@\"\n");- put(lookalike, "run", "#!/bin/sh\n# notproton CrossOver compatibility tool shim\n");+ put(lookalike, "run", "#!/bin/sh\n# bridgeplay CrossOver compatibility tool shim\n");put(lookalike, "notes.txt", "mine\n");g_tool_count = 0;remove_unlisted_tools(root);check(!exists(current), "an unlisted tool with a flavor file is removed");+ check(!exists(renamed), "an unlisted tool under the pre-3.0 name is removed");check(!exists(legacy), "the single-tool dylib's directory is removed");check(exists(user), "a notproton directory the user wrote stays");char notes[768];diff --git a/dylib/tests/compatsvc-check.c b/dylib/tests/compatsvc-check.cindex bc8e0e1..c98bcbc 100644--- a/dylib/tests/compatsvc-check.c+++ b/dylib/tests/compatsvc-check.c@@ -454,6 +454,16 @@ static void none_entry_cases(void) {if (strcmp(r.tools[i].name, NP_COMPAT_TOOL_NONE) == 0) has_none = 1;check(has_none, "the none entry appears when the app already holds it");+ // The pre-3.0 none name is still the none choice, shown as selected.+ stub_app_mapping_val = NP_COMPAT_TOOL_NONE_LEGACY;+ rc = get_compat_tools(build_request(REQ_HAS_APPID, 7), (uintptr_t)response_buf);+ decode_reply(&r);+ has_none = 0;+ for (int i = 0; i < r.count; i++)+ if (strcmp(r.tools[i].name, NP_COMPAT_TOOL_NONE) == 0 && r.tools[i].is_active) has_none = 1;+ check(has_none, "the legacy none name selects the none entry");+ stub_app_mapping_val = NULL;+// The none entry never appears for the global scope (appid 0).stub_wildcard_val = "crossover";rc = get_compat_tools(build_request(0, 0), (uintptr_t)response_buf);diff --git a/dylib/tests/gatecheck.c b/dylib/tests/gatecheck.cindex 27dacdc..ca44005 100644--- a/dylib/tests/gatecheck.c+++ b/dylib/tests/gatecheck.c@@ -1,6 +1,7 @@// The gate table is static, so the unit under test is included rather than// linked.#include "../feats/webpatch.c"+#include "../util/file.c"#include <stdarg.h>#include <stdio.h>@@ -33,7 +34,7 @@ static void wrong(const char *fmt, ...) {static void *rewrite_fallback(void *arg) {atomic_int *stop = arg;while (!atomic_load(stop))- np_webpatch_set_fallback_tool("notproton-fex");+ np_webpatch_set_fallback_tool("bridgeplay-proton-fex");return NULL;}@@ -42,7 +43,7 @@ static void check_fallback(void) {"return t?(0,i.jsx)(m.B,{feature:p.OK,label:(0,l.we)""(\"#Settings_SteamPlay_DefaultTool\"),rgOptions:A,disabled:0==A.length,""selectedOption:t,onChange:e=>g(e.data)}):null";- np_webpatch_set_fallback_tool("notproton-fex");+ np_webpatch_set_fallback_tool("bridgeplay-proton-fex");atomic_int stop = 0;pthread_t writer;if (pthread_create(&writer, NULL, rewrite_fallback, &stop) != 0) {@@ -56,8 +57,8 @@ static void check_fallback(void) {char *out = np_webpatch_transform((const uint8_t *)source, sizeof(source) - 1,&length, NULL);int ok = out && !memchr(out, '\0', length)- && strstr(out, "A.some(e=>e.data===\"notproton-fex\")")- && strstr(out, "selectedOption:t||\"notproton-fex\"");+ && strstr(out, "A.some(e=>e.data===\"bridgeplay-proton-fex\")")+ && strstr(out, "selectedOption:t||\"bridgeplay-proton-fex\"");free(out);if (!ok) {wrong("concurrent fallback writes changed a chunk's tool name");@@ -70,9 +71,9 @@ static void check_fallback(void) {}static void check_fex_tools(void) {- np_webpatch_set_fex_tools((const char *[]){ "notproton-fex", "bad name", NULL, "",- "x\"y", "notproton-fex-41069" }, 6);- if (strcmp(g_fex_tools, "[\"notproton-fex\",\"notproton-fex-41069\"]") != 0)+ np_webpatch_set_fex_tools((const char *[]){ "bridgeplay-proton-fex", "bad name", NULL, "",+ "x\"y", "bridgeplay-proton-fex-41069" }, 6);+ if (strcmp(g_fex_tools, "[\"bridgeplay-proton-fex\",\"bridgeplay-proton-fex-41069\"]") != 0)wrong("the FEX tool array is %s", g_fex_tools);np_webpatch_set_fex_tools(NULL, 0);@@ -536,8 +537,8 @@ int main(int argc, char **argv) {return g_wrong;}- np_webpatch_set_fallback_tool("notproton-fex");- np_webpatch_set_fex_tools((const char *[]){ "notproton-fex", "notproton-fex-41069" }, 2);+ np_webpatch_set_fallback_tool("bridgeplay-proton-fex");+ np_webpatch_set_fex_tools((const char *[]){ "bridgeplay-proton-fex", "bridgeplay-proton-fex-41069" }, 2);for (int i = 1; i < argc; i++) {size_t len = 0;diff --git a/dylib/tests/panel-behavior/behavior.js b/dylib/tests/panel-behavior/behavior.jsindex ccbbe95..bd49995 100644--- a/dylib/tests/panel-behavior/behavior.js+++ b/dylib/tests/panel-behavior/behavior.js@@ -83,20 +83,20 @@ for (const form of Object.keys(FORMS)) {'controller hiding is on unless the game says otherwise');written.length = 0;nodes('').find(x => x.props.label === 'Disable hidraw').props.onChange(true);- t.ok(last().trim() === 'NOTPROTON_DISABLE_HIDRAW=1 %command%', `hidraw (${last()})`);+ t.ok(last().trim() === 'BRIDGEPLAY_DISABLE_HIDRAW=1 %command%', `hidraw (${last()})`);written.length = 0;raw('').props.onChange(true);- t.ok(last().trim() === 'NOTPROTON_RAW_CONTROLLERS=1 %command%', `the controller row writes its flag (${last()})`);- t.ok(raw('NOTPROTON_RAW_CONTROLLERS=1').props.checked === true, 'the controller row reads its flag');+ t.ok(last().trim() === 'BRIDGEPLAY_RAW_CONTROLLERS=1 %command%', `the controller row writes its flag (${last()})`);+ t.ok(raw('BRIDGEPLAY_RAW_CONTROLLERS=1').props.checked === true, 'the controller row reads its flag');written.length = 0;- raw('NOTPROTON_RAW_CONTROLLERS=1 WINEMSYNC=1').props.onChange(false);+ raw('BRIDGEPLAY_RAW_CONTROLLERS=1 WINEMSYNC=1').props.onChange(false);t.ok(last().trim() === 'WINEMSYNC=1 %command%', `turning the controller row off removes its flag (${last()})`);// Settings that come from the gamefix confs or the engine show as they will apply.globalThis.MSCXFx = {- g: { MTL_HUD_ENABLED: '1', NOTPROTON_RETINA: '1' },- a: { 287700: { NOTPROTON_RETINA: '0' } },- e: { notproton: { WINEMSYNC: '1' }, '': { WINEMSYNC: '0' } },- d: { NOTPROTON_RAW_CONTROLLERS: '1' },+ g: { MTL_HUD_ENABLED: '1', BRIDGEPLAY_RETINA: '1' },+ a: { 287700: { BRIDGEPLAY_RETINA: '0' } },+ e: { 'bridgeplay-proton': { WINEMSYNC: '1' }, '': { WINEMSYNC: '0' } },+ d: { BRIDGEPLAY_RAW_CONTROLLERS: '1' },};const row = (o, l) => nodes(o).find(x => x.props.label === l || (typeof x.props.label === 'string' && x.props.label.startsWith(l + ' (')));t.ok(row('', 'Metal HUD').props.checked === true, 'a global conf value reads as on');@@ -112,10 +112,10 @@ for (const form of Object.keys(FORMS)) {t.ok(last() === '', `turning it back on drops the override (${JSON.stringify(last())})`);written.length = 0;row('', 'High Resolution').props.onChange(true);- t.ok(last().trim() === 'NOTPROTON_RETINA=1 %command%', `turning on what a conf turns off writes 1 (${last()})`);+ t.ok(last().trim() === 'BRIDGEPLAY_RETINA=1 %command%', `turning on what a conf turns off writes 1 (${last()})`);written.length = 0;row('', 'Let games read controllers directly').props.onChange(false);- t.ok(last().trim() === 'NOTPROTON_RAW_CONTROLLERS=0 %command%', `opting out of raw controllers writes 0 (${last()})`);+ t.ok(last().trim() === 'BRIDGEPLAY_RAW_CONTROLLERS=0 %command%', `opting out of raw controllers writes 0 (${last()})`);delete globalThis.MSCXFx;// Frame generation: a mode for every backend, and the rest of its rows only once it is on.@@ -141,66 +141,66 @@ for (const form of Object.keys(FORMS)) {`the modes name themselves (${mode.props.rgOptions.map(x => x.label).join(',')})`);t.ok(mode.props.selectedOption === '0', 'frame generation is off by default');t.ok(fgRows('').length === 1, 'off hides every other frame generation row');- t.ok(fgrow('NOTPROTON_FRAMEGEN=0', 'Quality') === undefined, 'an explicit 0 hides them too');- t.ok(fgrow('NOTPROTON_FRAMEGEN=off', 'Mode').props.selectedOption === '0', 'off reads as Off');- const ordered = fgRows('NOTPROTON_FRAMEGEN=2').map(x => x.props.label);+ t.ok(fgrow('BRIDGEPLAY_FRAMEGEN=0', 'Quality') === undefined, 'an explicit 0 hides them too');+ t.ok(fgrow('BRIDGEPLAY_FRAMEGEN=off', 'Mode').props.selectedOption === '0', 'off reads as Off');+ const ordered = fgRows('BRIDGEPLAY_FRAMEGEN=2').map(x => x.props.label);t.ok(ordered.join('|') === ['Mode', 'Quality', FGT.ui, FGT.fb, 'Engine'].join('|'),`on shows five rows in order (${ordered.join('|')})`);- t.ok(fgRows('NOTPROTON_FRAMEGEN=2').every(x => x.type === 'Dropdown' ? x.props.strClassName === 'MSCXDrop'+ t.ok(fgRows('BRIDGEPLAY_FRAMEGEN=2').every(x => x.type === 'Dropdown' ? x.props.strClassName === 'MSCXDrop': x.props.className === 'MSCXRow'),'frame generation toggles are rows and its dropdowns stack their label above');for (const [v, want] of [['1', '2'], ['2', '2'], ['3', '3'], ['adaptive', 'adaptive'], ['Adaptive', 'adaptive']]) {- t.ok(fgrow('NOTPROTON_FRAMEGEN=' + v, 'Mode').props.selectedOption === want, `${v} reads as ${want}`);+ t.ok(fgrow('BRIDGEPLAY_FRAMEGEN=' + v, 'Mode').props.selectedOption === want, `${v} reads as ${want}`);}- for (const [v, want] of [['2', 'NOTPROTON_FRAMEGEN=2 %command%'], ['3', 'NOTPROTON_FRAMEGEN=3 %command%'],- ['adaptive', 'NOTPROTON_FRAMEGEN=adaptive %command%']]) {+ for (const [v, want] of [['2', 'BRIDGEPLAY_FRAMEGEN=2 %command%'], ['3', 'BRIDGEPLAY_FRAMEGEN=3 %command%'],+ ['adaptive', 'BRIDGEPLAY_FRAMEGEN=adaptive %command%']]) {written.length = 0;fgrow('', 'Mode').props.onChange({ data: v });t.ok(last().trim() === want, `picking ${v} writes it (${last()})`);}written.length = 0;- fgrow('NOTPROTON_FRAMEGEN=1 WINEMSYNC=1', 'Mode').props.onChange({ data: '0' });+ fgrow('BRIDGEPLAY_FRAMEGEN=1 WINEMSYNC=1', 'Mode').props.onChange({ data: '0' });t.ok(last().trim() === 'WINEMSYNC=1 %command%', `turning frame generation off removes its flag (${last()})`);written.length = 0;- fgrow('NOTPROTON_FRAMEGEN=1', 'Mode').props.onChange({ data: '3' });- t.ok(last().trim() === 'NOTPROTON_FRAMEGEN=3 %command%', `a legacy 1 is replaced, not kept (${last()})`);+ fgrow('BRIDGEPLAY_FRAMEGEN=1', 'Mode').props.onChange({ data: '3' });+ t.ok(last().trim() === 'BRIDGEPLAY_FRAMEGEN=3 %command%', `a legacy 1 is replaced, not kept (${last()})`);written.length = 0;- fgrow('NOTPROTON_FRAMEGEN=2 NOTPROTON_FRAMEGEN_QUALITY=quality', 'Mode').props.onChange({ data: '0' });- t.ok(last().trim() === 'NOTPROTON_FRAMEGEN_QUALITY=quality %command%',+ fgrow('BRIDGEPLAY_FRAMEGEN=2 BRIDGEPLAY_FRAMEGEN_QUALITY=quality', 'Mode').props.onChange({ data: '0' });+ t.ok(last().trim() === 'BRIDGEPLAY_FRAMEGEN_QUALITY=quality %command%',`turning it off keeps the sub-settings for the next time (${last()})`);- const on = 'NOTPROTON_FRAMEGEN=2';+ const on = 'BRIDGEPLAY_FRAMEGEN=2';const quality = fgrow(on, 'Quality');t.ok(quality.type === 'Dropdown' && quality.props.selectedOption === 'balanced', 'quality is balanced by default');t.ok(quality.props.rgOptions.map(x => x.label + ':' + x.data).join(',') ==='Performance:performance,Balanced:balanced,Quality:quality', 'the qualities name themselves');- t.ok(fgrow(on + ' NOTPROTON_FRAMEGEN_QUALITY=performance', 'Quality').props.selectedOption === 'performance',+ t.ok(fgrow(on + ' BRIDGEPLAY_FRAMEGEN_QUALITY=performance', 'Quality').props.selectedOption === 'performance','quality reads its flag');written.length = 0;fgrow(on, 'Quality').props.onChange({ data: 'quality' });- t.ok(last().trim() === 'NOTPROTON_FRAMEGEN_QUALITY=quality NOTPROTON_FRAMEGEN=2 %command%',+ t.ok(last().trim() === 'BRIDGEPLAY_FRAMEGEN_QUALITY=quality BRIDGEPLAY_FRAMEGEN=2 %command%',`quality writes its flag (${last()})`);written.length = 0;- fgrow(on + ' NOTPROTON_FRAMEGEN_QUALITY=quality', 'Quality').props.onChange({ data: 'balanced' });+ fgrow(on + ' BRIDGEPLAY_FRAMEGEN_QUALITY=quality', 'Quality').props.onChange({ data: 'balanced' });t.ok(last().trim() === on + ' %command%', `balanced drops the flag (${last()})`);const engine = fgrow(on, 'Engine');t.ok(engine.type === 'Dropdown' && engine.props.selectedOption === 'own', 'the engine is the built-in one by default');t.ok(engine.props.rgOptions.map(x => x.label + ':' + x.data).join(',') ==='Built-in optical flow:own,MetalFX:metalfx', 'the engines name themselves');- t.ok(fgrow(on + ' NOTPROTON_FRAMEGEN_ENGINE=metalfx', 'Engine').props.selectedOption === 'metalfx',+ t.ok(fgrow(on + ' BRIDGEPLAY_FRAMEGEN_ENGINE=metalfx', 'Engine').props.selectedOption === 'metalfx','the engine reads its flag');written.length = 0;fgrow(on, 'Engine').props.onChange({ data: 'metalfx' });- t.ok(last().includes('NOTPROTON_FRAMEGEN_ENGINE=metalfx '), `the engine writes its flag (${last()})`);+ t.ok(last().includes('BRIDGEPLAY_FRAMEGEN_ENGINE=metalfx '), `the engine writes its flag (${last()})`);written.length = 0;- fgrow(on + ' NOTPROTON_FRAMEGEN_ENGINE=metalfx', 'Engine').props.onChange({ data: 'own' });+ fgrow(on + ' BRIDGEPLAY_FRAMEGEN_ENGINE=metalfx', 'Engine').props.onChange({ data: 'own' });t.ok(last().trim() === on + ' %command%', `own drops the flag (${last()})`);// Both toggles are on unless told otherwise, which only the run script defaults say.globalThis.MSCXFx = { g: {}, a: {}, e: {},- d: { NOTPROTON_FRAMEGEN_UI: '1', NOTPROTON_FRAMEGEN_FALLBACK: '1' } };- for (const [k, l] of [['NOTPROTON_FRAMEGEN_UI', FGT.ui], ['NOTPROTON_FRAMEGEN_FALLBACK', FGT.fb]]) {+ d: { BRIDGEPLAY_FRAMEGEN_UI: '1', BRIDGEPLAY_FRAMEGEN_FALLBACK: '1' } };+ for (const [k, l] of [['BRIDGEPLAY_FRAMEGEN_UI', FGT.ui], ['BRIDGEPLAY_FRAMEGEN_FALLBACK', FGT.fb]]) {t.ok(fgrow(on, l).type === 'Toggle' && fgrow(on, l).props.checked === true, `${k} is on by default`);t.ok(fgrow(on + ` ${k}=0`, l).props.checked === false, `${k} reads 0 as off`);written.length = 0;@@ -211,9 +211,9 @@ for (const form of Object.keys(FORMS)) {t.ok(last().trim() === `${on} %command%`, `turning ${k} back on drops it (${last()})`);}// A conf that turns frame generation on: Off has to say so, picking the conf's mode says nothing.- globalThis.MSCXFx = { g: { NOTPROTON_FRAMEGEN: '1', NOTPROTON_FRAMEGEN_QUALITY: 'performance',- NOTPROTON_FRAMEGEN_ENGINE: 'metalfx', NOTPROTON_FRAMEGEN_UI: '0' },- a: {}, e: {}, d: { NOTPROTON_FRAMEGEN_UI: '1', NOTPROTON_FRAMEGEN_FALLBACK: '1' } };+ globalThis.MSCXFx = { g: { BRIDGEPLAY_FRAMEGEN: '1', BRIDGEPLAY_FRAMEGEN_QUALITY: 'performance',+ BRIDGEPLAY_FRAMEGEN_ENGINE: 'metalfx', BRIDGEPLAY_FRAMEGEN_UI: '0' },+ a: {}, e: {}, d: { BRIDGEPLAY_FRAMEGEN_UI: '1', BRIDGEPLAY_FRAMEGEN_FALLBACK: '1' } };t.ok(fgrow('', 'Mode').props.selectedOption === '2', 'a global conf 1 reads frame generation as 2x');t.ok(fgRows('').length === 5, 'a conf that turns it on shows every row');t.ok(fgrow('', 'Quality').props.selectedOption === 'performance', 'quality reads the conf');@@ -221,24 +221,24 @@ for (const form of Object.keys(FORMS)) {t.ok(fgrow('', FGT.ui).props.checked === false, 'the conf beats the run script default');written.length = 0;fgrow('', 'Mode').props.onChange({ data: '0' });- t.ok(last().trim() === 'NOTPROTON_FRAMEGEN=0 %command%', `off over a conf default writes 0 (${last()})`);+ t.ok(last().trim() === 'BRIDGEPLAY_FRAMEGEN=0 %command%', `off over a conf default writes 0 (${last()})`);written.length = 0;- fgrow('NOTPROTON_FRAMEGEN=0', 'Mode').props.onChange({ data: '2' });+ fgrow('BRIDGEPLAY_FRAMEGEN=0', 'Mode').props.onChange({ data: '2' });t.ok(last() === '', `the conf's own mode drops the override (${JSON.stringify(last())})`);written.length = 0;fgrow('', 'Quality').props.onChange({ data: 'balanced' });- t.ok(last().trim() === 'NOTPROTON_FRAMEGEN_QUALITY=balanced %command%',+ t.ok(last().trim() === 'BRIDGEPLAY_FRAMEGEN_QUALITY=balanced %command%',`balanced over a conf default writes it (${last()})`);delete globalThis.MSCXFx;// Native macOS builds with nothing pinned run through np-native: HUD, frame generation, pads.const HOME = '/Users/some one';- const NAT = "'/Users/some one/.notproton/np-native'";+ const NAT = "'/Users/some one/.bridgeplay/np-native'";const mac = (o, over) => details(o, Object.assign({ vecPlatforms: ['osx'], strCompatToolName: '' }, over || {}));const nnodes = o => walk(P({ details: mac(o) }));const nrow = (o, l) => nnodes(o).find(x => x.props.label === l || (typeof x.props.label === 'string' && x.props.label.startsWith(l + ' (')));- globalThis.MSCXFx = { g: { MTL_HUD_ENABLED: '1', NOTPROTON_FRAMEGEN: '2' }, a: { 287700: { WINEMSYNC: '1' } },- e: {}, d: { NOTPROTON_FRAMEGEN_UI: '1', NOTPROTON_FRAMEGEN_FALLBACK: '1' },+ globalThis.MSCXFx = { g: { MTL_HUD_ENABLED: '1', BRIDGEPLAY_FRAMEGEN: '2' }, a: { 287700: { WINEMSYNC: '1' } },+ e: {}, d: { BRIDGEPLAY_FRAMEGEN_UI: '1', BRIDGEPLAY_FRAMEGEN_FALLBACK: '1' },ng: {}, na: {}, h: HOME };let n = nnodes('');t.ok(P({ details: mac('') }) !== null && P({ details: mac('') }).props.className === 'MSCXPanel',@@ -249,7 +249,7 @@ for (const form of Object.keys(FORMS)) {'native dropdowns: the mode and the controller layer');t.ok(nrow('', 'Metal HUD').props.checked === false && nrow('', 'Mode').props.selectedOption === '0','the Wine confs do not reach a native game');- t.ok(nnodes('NOTPROTON_FRAMEGEN=3 %command%').filter(x => x.props.label === 'Quality').length === 1,+ t.ok(nnodes('BRIDGEPLAY_FRAMEGEN=3 %command%').filter(x => x.props.label === 'Quality').length === 1,'the native panel carries the same frame generation rows');const pad = nrow('', 'Controller layer');t.ok(pad.props.rgOptions.map(x => x.label + ':' + x.data).join(',') ===@@ -261,12 +261,12 @@ for (const form of Object.keys(FORMS)) {t.ok(nnodes('').some(x => x.type === 'Section' && x.props.label === 'Controllers'), 'the native controller section');t.ok(P({ details: mac('', { unAppID: 3420702832 }) }).props.children.props.children.length > 4,'a mac shortcut still gets the full panel');- t.ok(P({ details: mac('', { strCompatToolName: 'notproton' }) }).props.children.props.children.length > 4,+ t.ok(P({ details: mac('', { strCompatToolName: 'bridgeplay-proton' }) }).props.children.props.children.length > 4,'a mac build with a tool pinned still gets the full panel');const ARCH = '/usr/bin/arch -arm64 -x86_64 -e "DYLD_INSERT_LIBRARIES=/Users/x/Library/Application Support/a.dylib"' +' -e NP_PAD_MODE=hid -e MTL_HUD_ENABLED=1 %command% -novid';- const NEW = '/Users/someone/.notproton/np-native NP_PAD_MODE=hid MTL_HUD_ENABLED=1 %command% -novid';+ const NEW = '/Users/someone/.bridgeplay/np-native NP_PAD_MODE=hid MTL_HUD_ENABLED=1 %command% -novid';for (const [name, o] of [['arch', ARCH], ['np-native', NEW]]) {t.ok(nrow(o, 'Metal HUD').props.checked === true, `${name}: the HUD reads from -e/VAR pairs`);t.ok(nrow(o, 'Controller layer').props.selectedOption === 'hid', `${name}: the controller layer reads hid`);@@ -276,7 +276,7 @@ for (const form of Object.keys(FORMS)) {`${name}: rewritten under the launcher, -novid kept (${last()})`);written.length = 0;nrow(o, 'Mode').props.onChange({ data: 'adaptive' });- t.ok(last() === NAT + ' NP_PAD_MODE=hid MTL_HUD_ENABLED=1 NOTPROTON_FRAMEGEN=adaptive %command% -novid',+ t.ok(last() === NAT + ' NP_PAD_MODE=hid MTL_HUD_ENABLED=1 BRIDGEPLAY_FRAMEGEN=adaptive %command% -novid',`${name}: a new variable goes before %command% (${last()})`);written.length = 0;nrow(o, 'Metal HUD').props.onChange(false);@@ -292,18 +292,18 @@ for (const form of Object.keys(FORMS)) {nrow(NAT + ' NP_PAD_MODE=gc %command% -novid +map x', 'Controller layer').props.onChange({ data: '' });t.ok(last() === NAT + ' %command% -novid +map x', `Automatic as the last variable keeps the launcher (${last()})`);written.length = 0;- nrow('/x/.notproton/np-native MTL_HUD_ENABLED=1 %command% -novid', 'Metal HUD').props.onChange(false);+ nrow('/x/.bridgeplay/np-native MTL_HUD_ENABLED=1 %command% -novid', 'Metal HUD').props.onChange(false);t.ok(last() === NAT + ' %command% -novid', `no variable left keeps the launcher and the arguments (${last()})`);written.length = 0;nrow('', 'Controller layer').props.onChange({ data: 'off' });t.ok(last() === NAT + ' NP_PAD_MODE=off %command%', `empty options get the launcher (${last()})`);written.length = 0;nrow('-novid', 'Mode').props.onChange({ data: '3' });- t.ok(last() === NAT + ' NOTPROTON_FRAMEGEN=3 %command% -novid', `bare game arguments follow %command% (${last()})`);+ t.ok(last() === NAT + ' BRIDGEPLAY_FRAMEGEN=3 %command% -novid', `bare game arguments follow %command% (${last()})`);// Native defaults come from np-native's confs, the per-app one first.- globalThis.MSCXFx = { g: {}, a: {}, e: {}, d: { NOTPROTON_FRAMEGEN_UI: '1', NOTPROTON_FRAMEGEN_FALLBACK: '1' },- ng: { MTL_HUD_ENABLED: '1', NP_PAD_MODE: 'hid', NOTPROTON_FRAMEGEN: 'adaptive' },+ globalThis.MSCXFx = { g: {}, a: {}, e: {}, d: { BRIDGEPLAY_FRAMEGEN_UI: '1', BRIDGEPLAY_FRAMEGEN_FALLBACK: '1' },+ ng: { MTL_HUD_ENABLED: '1', NP_PAD_MODE: 'hid', BRIDGEPLAY_FRAMEGEN: 'adaptive' },na: { 287700: { NP_PAD_MODE: 'gc' } }, h: '/Users/me' };t.ok(nrow('', 'Metal HUD').props.checked === true, 'native-default.conf reads the HUD as on');t.ok(nrow('', 'Mode').props.selectedOption === 'adaptive', 'native-default.conf sets the mode');@@ -311,22 +311,48 @@ for (const form of Object.keys(FORMS)) {t.ok(nrow('', FGT.ui).props.checked === true, 'the shim defaults hold for native games');written.length = 0;nrow('', 'Metal HUD').props.onChange(false);- t.ok(last() === '/Users/me/.notproton/np-native MTL_HUD_ENABLED=0 %command%',+ t.ok(last() === '/Users/me/.bridgeplay/np-native MTL_HUD_ENABLED=0 %command%',`turning a native default off writes 0 under the home from the page (${last()})`);written.length = 0;nrow('NP_PAD_MODE=hid %command%', 'Controller layer').props.onChange({ data: 'gc' });- t.ok(last() === '/Users/me/.notproton/np-native %command%', `the conf's own layer drops the override (${last()})`);+ t.ok(last() === '/Users/me/.bridgeplay/np-native %command%', `the conf's own layer drops the override (${last()})`);// Without a home from the page the launcher already there is reused, and nothing is guessed.globalThis.MSCXFx = { g: {}, a: {}, e: {}, d: {} };written.length = 0;nrow(NEW, 'Mode').props.onChange({ data: '2' });- t.ok(last() === '/Users/someone/.notproton/np-native NP_PAD_MODE=hid MTL_HUD_ENABLED=1 NOTPROTON_FRAMEGEN=2 %command% -novid',+ t.ok(last() === '/Users/someone/.bridgeplay/np-native NP_PAD_MODE=hid MTL_HUD_ENABLED=1 BRIDGEPLAY_FRAMEGEN=2 %command% -novid',`no home: the existing launcher path is kept (${last()})`);written.length = 0;nrow(ARCH, 'Mode').props.onChange({ data: '2' });t.ok(written.length === 0, 'no home and no launcher: nothing is written');delete globalThis.MSCXFx;+ // Launch options written before 3.0: NOTPROTON_<X> and ~/.notproton/np-native still read,+ // NOTPROTON_<X> winning as in the run script, and a write moves the line to the new names.+ t.ok(raw('NOTPROTON_RAW_CONTROLLERS=1').props.checked === true, 'a NOTPROTON_ flag still reads');+ t.ok(raw('NOTPROTON_RAW_CONTROLLERS=1 BRIDGEPLAY_RAW_CONTROLLERS=0').props.checked === true,+ 'NOTPROTON_ wins over BRIDGEPLAY_ when a line has both');+ t.ok(fgrow('NOTPROTON_FRAMEGEN=3', 'Mode').props.selectedOption === '3', 'a NOTPROTON_ value still reads');+ written.length = 0;+ raw('NOTPROTON_RAW_CONTROLLERS=1 WINEMSYNC=1').props.onChange(false);+ t.ok(last().trim() === 'WINEMSYNC=1 %command%', `turning a NOTPROTON_ flag off removes it (${last()})`);+ written.length = 0;+ nodes('NOTPROTON_RETINA=0 WINEMSYNC=1').find(x => x.props.label === 'High Resolution').props.onChange(true);+ t.ok(last().trim() === 'BRIDGEPLAY_RETINA=1 WINEMSYNC=1 %command%', `a write replaces the NOTPROTON_ name (${last()})`);+ globalThis.MSCXFx = { g: {}, a: {}, e: {}, d: {}, ng: {}, na: {}, h: '/Users/me' };+ t.ok(nrow('/Users/me/.notproton/np-native NOTPROTON_FRAMEGEN=2 %command% -novid', 'Mode').props.selectedOption === '2',+ 'a native line under the old launcher reads');+ written.length = 0;+ nrow('/Users/me/.notproton/np-native NOTPROTON_FRAMEGEN=2 %command% -novid', 'Mode').props.onChange({ data: '3' });+ t.ok(last() === '/Users/me/.bridgeplay/np-native BRIDGEPLAY_FRAMEGEN=3 %command% -novid',+ `a native write moves the launcher and the name (${last()})`);+ globalThis.MSCXFx = { g: {}, a: {}, e: {}, d: {} };+ written.length = 0;+ nrow('/Users/someone/.notproton/np-native MTL_HUD_ENABLED=1 %command%', 'Mode').props.onChange({ data: '2' });+ t.ok(last() === '/Users/someone/.notproton/np-native MTL_HUD_ENABLED=1 BRIDGEPLAY_FRAMEGEN=2 %command%',+ `no home: the old launcher is found and kept (${last()})`);+ delete globalThis.MSCXFx;+const css = nodes('').filter(x => x.type === 'style');t.ok(css.length === 1 && css[0].props.children.includes('.MSCXPanel .MSCXRow{'),'the panel carries one stylesheet defining the row rule');diff --git a/dylib/tests/panel-behavior/effective.js b/dylib/tests/panel-behavior/effective.jsindex 49a0538..2c45dbb 100644--- a/dylib/tests/panel-behavior/effective.js+++ b/dylib/tests/panel-behavior/effective.js@@ -15,7 +15,7 @@ if (!emit) { console.error('usage: effective.js <emit>'); process.exit(2); }// A quote and a space in the home have to reach the page escaped and the launch options quoted.const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'np-effective-'));const home = path.join(tmp, 'home "q" x');-const np = path.join(home, 'Library', 'Application Support', 'notproton');+const np = path.join(home, 'Library', 'Application Support', 'bridgeplay');const put = (rel, text) => {fs.mkdirSync(path.dirname(path.join(np, rel)), { recursive: true });fs.writeFileSync(path.join(np, rel), text);@@ -29,16 +29,18 @@ put('gamefixes/default.conf','D3DM_ENABLE_METALFX=1\n' +'FRAMEGEN=1\nFRAMEGEN_QUALITY=quality\nFRAMEGEN_UI=0\nFRAMEGEN_FALLBACK=0\nFRAMEGEN_ENGINE=metalfx\n');put('gamefixes-default/1888930.conf', 'ROSETTA_ADVERTISE_AVX=1\n');-put('gamefixes/1778821.conf', 'FRAMEGEN=0\n');-// np-native's own confs: raw variable names, export and quotes allowed.+// The run script's short keys also take the BRIDGEPLAY_ name.+put('gamefixes/1778821.conf', 'BRIDGEPLAY_FRAMEGEN=0\n');+// np-native's own confs: raw variable names, export and quotes allowed, and the pre-3.0+// NOTPROTON_ spelling still read under the BRIDGEPLAY_ name.put('gamefixes/native-default.conf', '# native\nexport MTL_HUD_ENABLED=1\nNP_PAD_MODE = "hid"\n' +- 'NOTPROTON_FRAMEGEN=3\nFRAMEGEN=2\nNOTPROTON_RETINA=1\n');-put('gamefixes/native/1778820.conf', "NP_PAD_MODE='gc'\nNOTPROTON_FRAMEGEN_ENGINE=metalfx\n");+ 'NOTPROTON_FRAMEGEN=3\nFRAMEGEN=2\nBRIDGEPLAY_RETINA=1\n');+put('gamefixes/native/1778820.conf', "NP_PAD_MODE='gc'\nBRIDGEPLAY_FRAMEGEN_ENGINE=metalfx\n");// The first tool is the default one, and its name runs past the 16 characters a value may.put('tools',- 'notproton-winecx-11.17\twinecx-11.17\trosetta\tWineCX 11.17 (msync, D3DMetal)\n' +- 'notproton-winecx\twinecx-11.15\trosetta\tWineCX 11.15 (msync, D3DMetal)\n' +- 'notproton-winehq\twinehq-11.15\trosetta\tWineHQ 11.15 - Rosetta\n');+ 'bridgeplay-proton-winecx-11.17\twinecx-11.17\trosetta\tWineCX 11.17 (msync, D3DMetal)\n' ++ 'bridgeplay-proton-winecx\twinecx-11.15\trosetta\tWineCX 11.15 (msync, D3DMetal)\n' ++ 'bridgeplay-proton-winehq\twinehq-11.15\trosetta\tWineHQ 11.15 - Rosetta\n');// Steam's chunks end in a source map comment with no newline after it.const chunk = path.join(home, 'chunk.js');@@ -48,33 +50,45 @@ fs.writeFileSync(chunk, fs.readFileSync(fixture, 'utf8').replace(/\n$/, '') + malet failed = 0;const t0 = runner('chunk');-let fx;+let fx, legacyFx;try {- const out = execFileSync(emit, ['transform', chunk, 'notproton-winecx-11.17'],+ const out = execFileSync(emit, ['transform', chunk, 'bridgeplay-proton-winecx-11.17'],{ encoding: 'utf8', env: Object.assign({}, process.env, { HOME: home }) });// Everything from the comment on is code the browser parses at the end of the chunk.const tail = out.slice(out.lastIndexOf(map));const ctx = vm.createContext({});vm.runInContext(tail, ctx);fx = ctx.MSCXFx;+ // A home the app has not moved over yet: only the pre-3.0 support folder exists.+ const legacyHome = path.join(tmp, 'legacy');+ const legacy = path.join(legacyHome, 'Library', 'Application Support', 'notproton', 'gamefixes');+ fs.mkdirSync(legacy, { recursive: true });+ fs.writeFileSync(path.join(legacy, 'default.conf'), 'RETINA=1\n');+ const legacyOut = execFileSync(emit, ['transform', chunk, 'notproton-winecx-11.17'],+ { encoding: 'utf8', env: Object.assign({}, process.env, { HOME: legacyHome }) });+ const lctx = vm.createContext({});+ vm.runInContext(legacyOut.slice(legacyOut.lastIndexOf(map)), lctx);+ legacyFx = lctx.MSCXFx;} finally {fs.rmSync(tmp, { recursive: true, force: true });}t0.ok(fx !== undefined, 'the defaults survive the source map comment the chunk ends in');-t0.ok(!!(fx && fx.e && fx.e['notproton-winecx-11.17'] && fx.e['notproton-winecx-11.17'].WINEMSYNC === '1'),+t0.ok(!!(fx && fx.e && fx.e['bridgeplay-proton-winecx-11.17'] && fx.e['bridgeplay-proton-winecx-11.17'].WINEMSYNC === '1'),'a tool name longer than a value still reaches the engine map');t0.ok(!!(fx && fx.e && fx.e[''] && fx.e[''].WINEMSYNC === '1'), 'the default tool stands in for an unpinned game');t0.ok(!!fx && fx.h === home, `the home reaches the page escaped (${fx && JSON.stringify(fx.h)})`);-t0.ok(!!fx && JSON.stringify(fx.g).includes('"NOTPROTON_FRAMEGEN":"1"') &&- fx.g.NOTPROTON_FRAMEGEN_QUALITY === 'quality' && fx.g.NOTPROTON_FRAMEGEN_UI === '0' &&- fx.g.NOTPROTON_FRAMEGEN_FALLBACK === '0' && fx.g.NOTPROTON_FRAMEGEN_ENGINE === 'metalfx',+t0.ok(!!fx && JSON.stringify(fx.g).includes('"BRIDGEPLAY_FRAMEGEN":"1"') &&+ fx.g.BRIDGEPLAY_FRAMEGEN_QUALITY === 'quality' && fx.g.BRIDGEPLAY_FRAMEGEN_UI === '0' &&+ fx.g.BRIDGEPLAY_FRAMEGEN_FALLBACK === '0' && fx.g.BRIDGEPLAY_FRAMEGEN_ENGINE === 'metalfx','the FRAMEGEN conf keys map to their variables');-t0.ok(!!fx && fx.d.NOTPROTON_FRAMEGEN_UI === '1' && fx.d.NOTPROTON_FRAMEGEN_FALLBACK === '1',+t0.ok(!!fx && fx.d.BRIDGEPLAY_FRAMEGEN_UI === '1' && fx.d.BRIDGEPLAY_FRAMEGEN_FALLBACK === '1','Protect UI and the fast-motion fallback default on');-t0.ok(!!fx && JSON.stringify(fx.ng) === '{"MTL_HUD_ENABLED":"1","NP_PAD_MODE":"hid","NOTPROTON_FRAMEGEN":"3"}',+t0.ok(!!fx && JSON.stringify(fx.ng) === '{"MTL_HUD_ENABLED":"1","NP_PAD_MODE":"hid","BRIDGEPLAY_FRAMEGEN":"3"}',`native-default.conf is read the way np-native reads it (${fx && JSON.stringify(fx.ng)})`);-t0.ok(!!fx && JSON.stringify(fx.na) === '{"1778820":{"NP_PAD_MODE":"gc","NOTPROTON_FRAMEGEN_ENGINE":"metalfx"}}',+t0.ok(!!fx && JSON.stringify(fx.na) === '{"1778820":{"NP_PAD_MODE":"gc","BRIDGEPLAY_FRAMEGEN_ENGINE":"metalfx"}}',`native/<appid>.conf lands per app (${fx && JSON.stringify(fx.na)})`);+t0.ok(!!legacyFx && legacyFx.g.BRIDGEPLAY_RETINA === '1',+ `a home with only the pre-3.0 support folder is still read (${legacyFx && JSON.stringify(legacyFx.g)})`);failed += t0.failed;const LABELS = ['Metal HUD', 'DLSS', 'Advertise AVX2 to Rosetta', 'MSync', 'High Resolution',@@ -89,9 +103,9 @@ for (const form of Object.keys(FORMS)) {const on = checked({ strCompatToolName: '' });t.ok(LABELS.every(l => on.includes(l)),`a game on the default tool shows every conf and engine default on (${on.join(',')})`);- t.ok(checked({ strCompatToolName: 'notproton-winecx-11.17' }).includes('MSync'),+ t.ok(checked({ strCompatToolName: 'bridgeplay-proton-winecx-11.17' }).includes('MSync'),'the default tool named outright reads MSync as on');- t.ok(!checked({ strCompatToolName: 'notproton-winehq' }).includes('MSync'),+ t.ok(!checked({ strCompatToolName: 'bridgeplay-proton-winehq' }).includes('MSync'),'a tool without msync reads MSync as off');// Frame generation as the confs set it up.const fg = (id, o, os) => walk(P({ details: details(o || '', Object.assign({ unAppID: id }, os || {})) }));@@ -113,7 +127,7 @@ for (const form of Object.keys(FORMS)) {t.ok(lab(fg(999, '', mac), 'Controller layer').props.selectedOption === 'hid', 'another native game gets the default');written.length = 0;lab(fg(999, '-novid', mac), 'Metal HUD').props.onChange(false);- const want = "'" + home.replace(/'/g, "'\\''") + "/.notproton/np-native' MTL_HUD_ENABLED=0 %command% -novid";+ const want = "'" + home.replace(/'/g, "'\\''") + "/.bridgeplay/np-native' MTL_HUD_ENABLED=0 %command% -novid";t.ok(written.length === 1 && written[0].opts === want, `the launcher path is the user's home (${written[0] && written[0].opts})`);failed += t.failed;}diff --git a/dylib/tests/panel-behavior/emit.c b/dylib/tests/panel-behavior/emit.cindex be535ac..cb8311c 100644--- a/dylib/tests/panel-behavior/emit.c+++ b/dylib/tests/panel-behavior/emit.c@@ -2,6 +2,7 @@// Both forms come from one body, which is what makes the checks that run against// this output speak for both page shapes at once.#include "../../feats/webpatch.c"+#include "../../util/file.c"#include <stdio.h>#include <string.h>diff --git a/dylib/tests/panel-behavior/fex.js b/dylib/tests/panel-behavior/fex.jsindex e095de2..38386b0 100644--- a/dylib/tests/panel-behavior/fex.js+++ b/dylib/tests/panel-behavior/fex.js@@ -9,15 +9,15 @@ if (!emit) { console.error('usage: fex.js <emit>'); process.exit(2); }const AVX = 'Advertise AVX2 to Rosetta';const X87 = 'Reduced x87 Precision (Reducing precision improves game performance, is enabled by default in CrossOver Preview)';-// The hook passes only FEX tools; notproton-rosetta stands for a Rosetta tool next to it.-const FEX_TOOLS = ['notproton-fex'];+// The hook passes only FEX tools; bridgeplay-proton-rosetta stands for a Rosetta tool next to it.+const FEX_TOOLS = ['bridgeplay-proton-fex'];let failed = 0;for (const form of Object.keys(FORMS)) {for (const fex of [false, true]) {const { render: P, written } = panel(emit, form, undefined, { fexTools: FEX_TOOLS });const t = runner(`${form}, ${fex ? 'FEX' : 'Rosetta'}`);- const tool = fex ? 'notproton-fex' : 'notproton-rosetta';+ const tool = fex ? 'bridgeplay-proton-fex' : 'bridgeplay-proton-rosetta';const nodes = opts =>walk(P({ details: details(opts + ' %command%', { strCompatToolName: tool }) }));const toggles = ns => ns.filter(x => x.type === 'Toggle').map(x => x.props.label);@@ -94,7 +94,7 @@ for (const form of Object.keys(FORMS)) {// A game with no tool name runs under the fallback tool.for (const first of [false, true]) {- const fallback = first ? 'notproton-fex' : 'notproton-rosetta';+ const fallback = first ? 'bridgeplay-proton-fex' : 'bridgeplay-proton-rosetta';const { render: P } = panel(emit, form, undefined, { fallback, fexTools: FEX_TOOLS });const t = runner(`${form}, unmapped, fallback ${fallback}`);const r = walk(P({ details: details('', { strCompatToolName: '' }) }));@@ -104,9 +104,9 @@ for (const form of Object.keys(FORMS)) {failed += t.failed;}- const { render: L } = panel(emit, form, undefined, { fexTools: ['notproton-fex-41069'] });+ const { render: L } = panel(emit, form, undefined, { fexTools: ['bridgeplay-proton-fex-41069'] });const tp = runner(`${form}, FEX tool name prefix`);- const pr = walk(L({ details: details('', { strCompatToolName: 'notproton-fex' }) }));+ const pr = walk(L({ details: details('', { strCompatToolName: 'bridgeplay-proton-fex' }) }));tp.ok(pr.find(x => x.type === 'Dropdown').props.rgOptions.some(o => o.data === 'd3dmetal'),'a tool whose name prefixes a FEX tool keeps the Rosetta options');failed += tp.failed;@@ -122,18 +122,18 @@ for (const form of Object.keys(FORMS)) {};const all = 'WINEDEBUG=-all CX_GRAPHICS_BACKEND=d3dmetal D3DM_ENABLE_METALFX=1 MTL_HUD_ENABLED=1 ' +"ROSETTA_ADVERTISE_AVX=0 FEX_X87REDUCEDPRECISION=0 DXMT_CONFIG='a;b' %command% -novid";- const r = choose(all, 'notproton-fex');+ const r = choose(all, 'bridgeplay-proton-fex');t.ok(r === "WINEDEBUG=-all MTL_HUD_ENABLED=1 FEX_X87REDUCEDPRECISION=0 DXMT_CONFIG='a;b' %command% -novid",`picking FEX drops only the D3DMetal and Rosetta entries (${r})`);- t.ok(choose(all, 'notproton-rosetta') === null, 'picking a Rosetta tool writes nothing');- t.ok(choose('D3DM_lower=1 %command%', 'notproton-fex') === null,+ t.ok(choose(all, 'bridgeplay-proton-rosetta') === null, 'picking a Rosetta tool writes nothing');+ t.ok(choose('D3DM_lower=1 %command%', 'bridgeplay-proton-fex') === null,'names the launch script does not forward are left alone');for (const o of ['>D3DM_LOG=1 %command%', "X=$'a\\'b D3DM_Y=1 c' %command%",'wrapper <(x) D3DM_Y=1 %command%', 'D3DM_Y=1 \\\n%command%'])- t.ok(choose(o, 'notproton-fex') === null, `text the parser does not model is left alone (${o})`);- t.ok(choose('CX_GRAPHICS_BACKEND=dxmt %command%', 'notproton-fex') === null,+ t.ok(choose(o, 'bridgeplay-proton-fex') === null, `text the parser does not model is left alone (${o})`);+ t.ok(choose('CX_GRAPHICS_BACKEND=dxmt %command%', 'bridgeplay-proton-fex') === null,'another backend is not a reason to write');- t.ok(choose('-novid CX_GRAPHICS_BACKEND=d3dmetal', 'notproton-fex') === null,+ t.ok(choose('-novid CX_GRAPHICS_BACKEND=d3dmetal', 'bridgeplay-proton-fex') === null,'text after the game, not set before %command%, is left alone');failed += t.failed;}@@ -143,11 +143,11 @@ for (const form of Object.keys(FORMS)) {const globals = { document: { documentElement: { lang: 'en' } },appDetailsStore: { GetAppDetails: id => id === 287700 ? details(opts) : undefined } };const { toolQuery, written } = panel(emit, 'statement', globals,- { fallback: 'notproton-fex', fexTools: FEX_TOOLS });+ { fallback: 'bridgeplay-proton-fex', fexTools: FEX_TOOLS });const t = runner('statement, the new tool picker');- const data = { default_tool_identifier: 'notproton-fex',- aliases: [{ alias: 'np-latest', current_tool_name: 'notproton-fex' },- { alias: 'np-rosetta', current_tool_name: 'notproton-rosetta' }] };+ const data = { default_tool_identifier: 'bridgeplay-proton-fex',+ aliases: [{ alias: 'np-latest', current_tool_name: 'bridgeplay-proton-fex' },+ { alias: 'np-rosetta', current_tool_name: 'bridgeplay-proton-rosetta' }] };const choose = (value, id = 287700, d = data) => {const saved = [];written.length = 0;@@ -155,21 +155,21 @@ for (const form of Object.keys(FORMS)) {set(value);return { query, saved, opts: written.length ? written[written.length - 1].opts : null };};- let r = choose('notproton-fex');- t.ok(r.saved[0] === 'notproton-fex' && r.query.data === data, 'the query and the pick still reach Steam');+ let r = choose('bridgeplay-proton-fex');+ t.ok(r.saved[0] === 'bridgeplay-proton-fex' && r.query.data === data, 'the query and the pick still reach Steam');t.ok(r.opts === 'MTL_HUD_ENABLED=1 %command%', `picking FEX drops the D3DMetal entry (${r.opts})`);t.ok(choose('').opts === 'MTL_HUD_ENABLED=1 %command%', 'the default entry counts as the default tool');t.ok(choose('', 287700, { ...data, default_tool_identifier: '' }).opts === 'MTL_HUD_ENABLED=1 %command%','with no default saved, the default entry counts as the fallback tool');- t.ok(choose('', 287700, { ...data, default_tool_identifier: 'notproton-rosetta' }).opts === null,+ t.ok(choose('', 287700, { ...data, default_tool_identifier: 'bridgeplay-proton-rosetta' }).opts === null,'a Rosetta default wins over a FEX fallback');t.ok(choose('np-latest').opts === 'MTL_HUD_ENABLED=1 %command%', 'an alias counts as its current tool');t.ok(choose('np-rosetta').opts === null, 'an alias for a Rosetta tool writes nothing');- t.ok(choose('notproton-rosetta').opts === null, 'picking a Rosetta tool writes nothing');- r = choose('notproton-fex', null);- t.ok(r.saved[0] === 'notproton-fex' && r.opts === null, 'the settings page picker has no game to edit');- t.ok(choose('notproton-fex', 4000).opts === null, 'a game with no loaded details is left alone');- t.ok(choose('notproton-fex', 287700, null).opts === null, 'a picker with no tool list writes nothing');+ t.ok(choose('bridgeplay-proton-rosetta').opts === null, 'picking a Rosetta tool writes nothing');+ r = choose('bridgeplay-proton-fex', null);+ t.ok(r.saved[0] === 'bridgeplay-proton-fex' && r.opts === null, 'the settings page picker has no game to edit');+ t.ok(choose('bridgeplay-proton-fex', 4000).opts === null, 'a game with no loaded details is left alone');+ t.ok(choose('bridgeplay-proton-fex', 287700, null).opts === null, 'a picker with no tool list writes nothing');failed += t.failed;}console.log(failed ? `\n${failed} failure(s)` : '\nFEX hides what it cannot run, Rosetta keeps everything');diff --git a/dylib/tests/panel-behavior/harness.js b/dylib/tests/panel-behavior/harness.jsindex 29cd2c4..036132b 100644--- a/dylib/tests/panel-behavior/harness.js+++ b/dylib/tests/panel-behavior/harness.js@@ -28,7 +28,7 @@ const FORMS = {// 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' } } }),- { fallback = 'notproton', fexTools = [], names = ['R0', 'B0'] } = {}) {+ { fallback = 'bridgeplay-proton', 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] });@@ -59,7 +59,7 @@ function details(launchOptions, over) {return Object.assign({unAppID: 287700,vecPlatforms: ['windows'],- strCompatToolName: 'notproton',+ strCompatToolName: 'bridgeplay-proton',strLaunchOptions: launchOptions,}, over || {});}diff --git a/dylib/tests/panel-behavior/launch-options.js b/dylib/tests/panel-behavior/launch-options.jsindex bd5b244..f6ae4c0 100644--- a/dylib/tests/panel-behavior/launch-options.js+++ b/dylib/tests/panel-behavior/launch-options.js@@ -26,7 +26,7 @@ for (const form of Object.keys(FORMS)) {'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%',+ 'WINEDEBUG="$(touch /tmp/bridgeplay-panel-must-not-run)" %command%','\tWINEDEBUG="a b"\t%command%\t--name "two words" ',]) {written.length = 0;diff --git a/dylib/tests/panel-behavior/localization.js b/dylib/tests/panel-behavior/localization.jsindex a9f5ff4..233c7ee 100644--- a/dylib/tests/panel-behavior/localization.js+++ b/dylib/tests/panel-behavior/localization.js@@ -34,7 +34,7 @@ for (const form of Object.keys(FORMS)) {'Lascia che i giochi leggano direttamente i controller (può interferire con Steam Input, sconsigliato)'));assert(nodes.some(n => n.props.label === t('Disable hidraw', '停用 hidraw', 'Disable hidraw')));raw.props.onChange(true);- assert.equal(written.at(-1).opts, 'NOTPROTON_RAW_CONTROLLERS=1 CX_GRAPHICS_BACKEND=dxmt %command%');+ assert.equal(written.at(-1).opts, 'BRIDGEPLAY_RAW_CONTROLLERS=1 CX_GRAPHICS_BACKEND=dxmt %command%');const hud = nodes.find(n => n.props.label === t('Metal HUD', 'Metal 性能监视器', 'Metal HUD'));hud.props.onChange(true);assert.equal(written.at(-1).opts, 'MTL_HUD_ENABLED=1 CX_GRAPHICS_BACKEND=dxmt %command%');diff --git a/dylib/tests/panel-behavior/migration.js b/dylib/tests/panel-behavior/migration.jsindex a7d600d..3f00d3e 100644--- a/dylib/tests/panel-behavior/migration.js+++ b/dylib/tests/panel-behavior/migration.js@@ -48,6 +48,8 @@ const app = (id, o, over) => Object.assign(['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'],+ ['NOTPROTON_RETINA=1 -x', 'NOTPROTON_RETINA=1 %command% -x'],+ ['BRIDGEPLAY_RETINA=1 -x', 'BRIDGEPLAY_RETINA=1 %command% -x'],];const kept = ['-novid', '', 'MTL_HUD_ENABLED=1 %command%', 'mtl_hud_enabled=1 %COMMAND%','MTL_HUD_ENABLED=1 "unclosed', 'FOO=1 -x', '"WINEDEBUG=x" -y'];@@ -79,7 +81,7 @@ const app = (id, o, over) => Object.assign(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(2, 'MTL_HUD_ENABLED=1', { vecPlatforms: ['osx'], strCompatToolName: 'bridgeplay-proton' }),app(2147483650, 'MTL_HUD_ENABLED=1', { vecPlatforms: ['osx'] })]);await native.go();t.ok(native.written.map(x => x.appid).join() === '2,2147483650',diff --git a/dylib/tests/panel-behavior/shell.js b/dylib/tests/panel-behavior/shell.jsindex bdb2a54..7d11b2e 100644--- a/dylib/tests/panel-behavior/shell.js+++ b/dylib/tests/panel-behavior/shell.js@@ -11,15 +11,15 @@ if (!emit) { console.error('usage: shell.js <emit>'); process.exit(2); }const TOGGLES = {'Metal HUD': 'MTL_HUD_ENABLED','MSync': 'WINEMSYNC',- 'High Resolution': 'NOTPROTON_RETINA',+ 'High Resolution': 'BRIDGEPLAY_RETINA','Advertise AVX2 to Rosetta': 'ROSETTA_ADVERTISE_AVX',- 'Let games read controllers directly (May break Steam Input. Not recommended)': 'NOTPROTON_RAW_CONTROLLERS',- 'Disable hidraw': 'NOTPROTON_DISABLE_HIDRAW',+ 'Let games read controllers directly (May break Steam Input. Not recommended)': 'BRIDGEPLAY_RAW_CONTROLLERS',+ 'Disable hidraw': 'BRIDGEPLAY_DISABLE_HIDRAW',};const ON_UNLESS_0 = { ROSETTA_ADVERTISE_AVX: true };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',- 'NOTPROTON_RAW_CONTROLLERS', 'NOTPROTON_DISABLE_HIDRAW'];+ 'DXMT_METALFX_SPATIAL_SWAPCHAIN', 'DXMT_CONFIG', 'ROSETTA_ADVERTISE_AVX', 'WINEMSYNC', 'BRIDGEPLAY_RETINA',+ 'BRIDGEPLAY_RAW_CONTROLLERS', 'BRIDGEPLAY_DISABLE_HIDRAW'];const OTHER_KEYS = ['WINEDEBUG', 'DXVK_HUD', 'FOO'];const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'np-shell-'));@@ -108,8 +108,8 @@ const ACTIONS = [want: (v0, v1) => v1.toggles.WINEMSYNC.props.checked === !v0.toggles.WINEMSYNC.props.checked },{ name: 'AVX2', run: v => v.toggles.ROSETTA_ADVERTISE_AVX.props.onChange(!v.toggles.ROSETTA_ADVERTISE_AVX.props.checked),want: (v0, v1) => v1.toggles.ROSETTA_ADVERTISE_AVX.props.checked === !v0.toggles.ROSETTA_ADVERTISE_AVX.props.checked },- { name: 'raw controllers', run: v => v.toggles.NOTPROTON_RAW_CONTROLLERS.props.onChange(!v.toggles.NOTPROTON_RAW_CONTROLLERS.props.checked),- want: (v0, v1) => v1.toggles.NOTPROTON_RAW_CONTROLLERS.props.checked === !v0.toggles.NOTPROTON_RAW_CONTROLLERS.props.checked },+ { name: 'raw controllers', run: v => v.toggles.BRIDGEPLAY_RAW_CONTROLLERS.props.onChange(!v.toggles.BRIDGEPLAY_RAW_CONTROLLERS.props.checked),+ want: (v0, v1) => v1.toggles.BRIDGEPLAY_RAW_CONTROLLERS.props.checked === !v0.toggles.BRIDGEPLAY_RAW_CONTROLLERS.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: '' }),diff --git a/dylib/tests/panel-behavior/switching.js b/dylib/tests/panel-behavior/switching.jsindex 3f32dd4..5af6d56 100644--- a/dylib/tests/panel-behavior/switching.js+++ b/dylib/tests/panel-behavior/switching.js@@ -38,9 +38,9 @@ const CASES = [gone: D3DM, kept: NVEXT },// Stripping arguments by name is the kind of thing that takes neighbours with it.{ to: 'dxvk',- from: 'MTL_HUD_ENABLED=1 WINEMSYNC=1 NOTPROTON_RETINA=1 ' + UPSCALED + ' %command% -novid',+ from: 'MTL_HUD_ENABLED=1 WINEMSYNC=1 BRIDGEPLAY_RETINA=1 ' + UPSCALED + ' %command% -novid',gone: DXMT,- kept: ['-novid', 'MTL_HUD_ENABLED=1', 'WINEMSYNC=1', 'NOTPROTON_RETINA=1', '%command%'] },+ kept: ['-novid', 'MTL_HUD_ENABLED=1', 'WINEMSYNC=1', 'BRIDGEPLAY_RETINA=1', '%command%'] },];let failed = 0;diff --git a/dylib/util/file.c b/dylib/util/file.cindex 541964f..f674209 100644--- a/dylib/util/file.c+++ b/dylib/util/file.c@@ -56,8 +56,19 @@ const char *np_home_dir(void) {return NULL;}+// Bridgeplay 3.0 moved the support folder from .../notproton. Until the app has moved it, a+// home that has only the old folder keeps using it, and nothing creates the new one beside it.+static int is_dir(const char *home, const char *rel) {+ char path[1024];+ struct stat st;+ snprintf(path, sizeof(path), "%s%s", home, rel);+ return stat(path, &st) == 0 && S_ISDIR(st.st_mode);+}+void np_support_path(char *buf, size_t bufsz, const char *home, const char *rel) {- static const char base[] = "/Library/Application Support/notproton";+ static const char current[] = "/Library/Application Support/bridgeplay";+ static const char legacy[] = "/Library/Application Support/notproton";+ const char *base = !is_dir(home, current) && is_dir(home, legacy) ? legacy : current;if (rel && rel[0])snprintf(buf, bufsz, "%s%s/%s", home, base, rel);elsediff --git a/dylib/util/log.c b/dylib/util/log.cindex 0e49197..eb771a9 100644--- a/dylib/util/log.c+++ b/dylib/util/log.c@@ -74,7 +74,7 @@ static void log_open(int may_rotate) {char logpath[512];np_support_path(folder, sizeof(folder), home, NULL);mkdir(folder, 0755);- snprintf(logpath, sizeof(logpath), "%s/notproton.log", folder);+ snprintf(logpath, sizeof(logpath), "%s/bridgeplay.log", folder);struct stat info;int oversize = (may_rotate && stat(logpath, &info) == 0diff --git a/dylib/util/log.h b/dylib/util/log.hindex 9c45585..94d4c8d 100644--- a/dylib/util/log.h+++ b/dylib/util/log.h@@ -17,7 +17,7 @@ enum {NP_LVL_DBG,};-#define NP_LOG_PREFIX "[notproton]"+#define NP_LOG_PREFIX "[bridgeplay]"#define NP_EMIT(level, tag, fmt, ...) do { \if (np_log_level >= (level)) { \