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
Enable AVX2 by default
NotProtonNot3ffd284a6e02
diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.shindex ffa11c2..f013e8c 100755--- a/dylib/feats/compat_run.sh+++ b/dylib/feats/compat_run.sh@@ -185,6 +185,10 @@ if [ "${wine_unix##*/}" = aarch64-unix ]; thenfex_from=environment[ -n "${FEX_X87REDUCEDPRECISION+x}" ] || fex_from=defaultexport FEX_X87REDUCEDPRECISION="${FEX_X87REDUCEDPRECISION-1}"+else+ avx_from=environment+ [ -n "$ROSETTA_ADVERTISE_AVX" ] || avx_from=default+ export ROSETTA_ADVERTISE_AVX="${ROSETTA_ADVERTISE_AVX:-1}"fi# Keeps Wine from inheriting the prefix and template locks (fd 8 and 9).@@ -1175,8 +1179,11 @@ if [ -n "$STEAM_COMPAT_DATA_PATH" ]; thenrefuse_foreign_prefixclaim_prefixecho "sync: WINEMSYNC=$WINEMSYNC from $msync_from" >> "$log" 2>&1 || true- [ "${wine_unix##*/}" != aarch64-unix ] \- || echo "fex: FEX_X87REDUCEDPRECISION=$FEX_X87REDUCEDPRECISION from $fex_from" >> "$log" 2>&1 || true+ if [ "${wine_unix##*/}" = aarch64-unix ]; then+ echo "fex: FEX_X87REDUCEDPRECISION=$FEX_X87REDUCEDPRECISION from $fex_from" >> "$log" 2>&1 || true+ else+ echo "avx: ROSETTA_ADVERTISE_AVX=$ROSETTA_ADVERTISE_AVX from $avx_from" >> "$log" 2>&1 || true+ fiwithout_lock_fds "$WINESERVER" -k >> "$log" 2>&1 || truestage_step="prefix seed"seed_prefix_from_templatediff --git a/dylib/feats/webpatch.c b/dylib/feats/webpatch.cindex 98c82a1..360f8b5 100644--- a/dylib/feats/webpatch.c+++ b/dylib/feats/webpatch.c@@ -302,6 +302,8 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"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])," \+ "D=(k,l)=>(0," RT ".jsx)(" BARREL ".Yh,{className:\"MSCXRow\",label:l," \+ "checked:\"0\"!==g(k),onChange:v=>s([[k,v?\"\":\"0\"]])},k)," \"bv=g(\"CX_GRAPHICS_BACKEND\"),b=fex&&\"d3dmetal\"===bv?\"\":bv," \"dm=!fex&&(\"\"===b||\"d3dmetal\"===b)," \"dx=\"\"===b||\"dxmt\"===b," \@@ -336,7 +338,7 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"T([\"MTL_HUD_ENABLED\"],npL(\"Metal HUD\",\"Metal 性能监视器\",\"Metal HUD\"),\"1\")," \"dm&&T([\"D3DM_ENABLE_METALFX\"],\"DLSS\",\"1\")," \"\"dxmt\"===b&&T([\"DXMT_ENABLE_NVEXT\"],\"DLSS\",\"1\")," \- "!fex&&T([\"ROSETTA_ADVERTISE_AVX\"],npL(\"Advertise AVX2 to Rosetta\",\"向 Rosetta 声明 AVX2 支持\",\"Segnala AVX2 a Rosetta\"),\"1\",\"0\")," \+ "!fex&&D(\"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\")" \"]},\"gfx\")," \@@ -353,10 +355,8 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"T([\"NOTPROTON_DISABLE_HIDRAW\"],npL(\"Disable hidraw\",\"停用 hidraw\",\"Disable hidraw\"),\"1\",\"\")" \"]},\"ctl\")," \"fex&&(0," RT ".jsx)(" BARREL ".XY,{label:\"FEX\"," \- "children:(0," RT ".jsx)(" BARREL ".Yh,{className:\"MSCXRow\"," \- "label:\"Reduced x87 precision (Reducing precision improves game performance, is enabled by default in CrossOver Preview)\"," \- "checked:\"0\"!==g(\"FEX_X87REDUCEDPRECISION\")," \- "onChange:v=>s([[\"FEX_X87REDUCEDPRECISION\",v?\"\":\"0\"]])},\"FEX_X87REDUCEDPRECISION\")},\"fex\")" \+ "children:D(\"FEX_X87REDUCEDPRECISION\"," \+ "\"Reduced x87 precision (Reducing precision improves game performance, is enabled by default in CrossOver Preview)\")},\"fex\")" \"]})})}"#define NP_CX_OPTIONS_CAPTURE(RT, BARREL) \diff --git a/dylib/tests/envcheck.sh b/dylib/tests/envcheck.shindex fa486ab..088cba3 100755--- a/dylib/tests/envcheck.sh+++ b/dylib/tests/envcheck.sh@@ -124,6 +124,23 @@ is "other backends stay" "CX_GRAPHICS_BACKEND DXMT_CONFIG " "$(seen)"is "nothing to ignore logs nothing" "" "$np_dropped"unset -v CX_GRAPHICS_BACKEND DXMT_CONFIG+echo "== Rosetta AVX =="+wine_unix="/R R/lib/wine/x86_64-unix"+eval "$drop"+is "x86_64 Wine turns it on" "1" "$ROSETTA_ADVERTISE_AVX"+is "the default is logged as the default" "default" "$avx_from"+is "helpers inherit it" "1" "$(sh -c 'printf %s "$ROSETTA_ADVERTISE_AVX"')"+ROSETTA_ADVERTISE_AVX=0+eval "$drop"+is "a launch option of 0 is kept" "0" "$ROSETTA_ADVERTISE_AVX"+is "a launch option is logged as one" "environment" "$avx_from"+ROSETTA_ADVERTISE_AVX=+eval "$drop"+is "an empty launch option turns it on" "1" "$ROSETTA_ADVERTISE_AVX"+wine_unix="/R R/lib/wine/aarch64-unix"+eval "$drop"+is "arm64 Wine leaves it unset" "unset" "${ROSETTA_ADVERTISE_AVX-unset}"+echo "== FEX reduced x87 precision =="unset -v FEX_X87REDUCEDPRECISIONwine_unix="/R R/lib/wine/x86_64-unix"diff --git a/dylib/tests/panel-behavior/fex.js b/dylib/tests/panel-behavior/fex.jsindex b28ad18..2d387fe 100644--- a/dylib/tests/panel-behavior/fex.js+++ b/dylib/tests/panel-behavior/fex.js@@ -30,6 +30,21 @@ for (const form of Object.keys(FORMS)) {t.ok(toggles(r).includes(X87) === fex, `the x87 row is ${fex ? 'shown' : 'hidden'}`);t.ok(r.some(x => x.type === 'Section' && x.props.label === 'FEX') === fex,`the FEX section is ${fex ? 'shown' : 'hidden'}`);+ if (!fex) {+ const avx = ns => ns.find(x => x.type === 'Toggle' && x.props.label === AVX);+ t.ok(avx(r).props.checked === true, 'the AVX2 row is on by default');+ written.length = 0;+ avx(r).props.onChange(false);+ t.ok(written[written.length - 1].opts.includes('ROSETTA_ADVERTISE_AVX=0'),+ `turning the AVX2 row off writes 0 (${written[written.length - 1].opts})`);+ const off = nodes('ROSETTA_ADVERTISE_AVX=0');+ t.ok(avx(off).props.checked === false, 'a game set to 0 shows the AVX2 row off');+ written.length = 0;+ avx(off).props.onChange(true);+ t.ok(!written[written.length - 1].opts.includes('ROSETTA_ADVERTISE_AVX'),+ `turning the AVX2 row on removes the entry (${written[written.length - 1].opts})`);+ t.ok(avx(nodes('ROSETTA_ADVERTISE_AVX=1')).props.checked === true, 'a game set to 1 shows the AVX2 row on');+ }if (fex) {const x87 = ns => ns.find(x => x.type === 'Toggle' && x.props.label === X87);t.ok(x87(r).props.checked === true, 'the x87 row is on by default');diff --git a/dylib/tests/panel-behavior/shell.js b/dylib/tests/panel-behavior/shell.jsindex 50e3287..bdb2a54 100644--- a/dylib/tests/panel-behavior/shell.js+++ b/dylib/tests/panel-behavior/shell.js@@ -16,6 +16,7 @@ const TOGGLES = {'Let games read controllers directly (May break Steam Input. Not recommended)': 'NOTPROTON_RAW_CONTROLLERS','Disable hidraw': 'NOTPROTON_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'];@@ -92,8 +93,10 @@ function agrees(t, v, env, what) {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]}`);+ for (const [key, node] of Object.entries(v.toggles)) {+ const on = key in ON_UNLESS_0 ? env[key] !== '0' : env[key] === '1';+ t.ok(node.props.checked === on, `${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}`);}@@ -103,6 +106,8 @@ const ACTIONS = [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: '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: 'backend dxvk', run: v => v.backend.props.onChange({ data: 'dxvk' }),