Skip to content

Commit 92f8d1f

Browse files
committed
fix(prefix): remove wineboot, fix winetricks target/wine-binary, drop system-wine calls
- Remove wineboot -u from init() and quick_setup(): Proton creates the prefix on first installer run; wineboot created a broken system-wine skeleton at WINEPREFIX/ that defeated the system32 guard and caused winetricks to run against an uninitialised system-wine prefix - _install_winetricks_verbs: check WINEPREFIX/pfx/ (Proton prefix) not WINEPREFIX/ (system-wine flat dir); use Proton's bundled wine64 binary so winetricks can load kernel32.dll on hosts where system wine cannot; set WINE/WINESERVER/LD_LIBRARY_PATH inside a subshell to avoid leaking env overrides; skip with helpful message if pfx/ not yet initialised (run `wig install <app>` first to build the Proton prefix) - Remove wine winecfg /v win10 and wine reg add calls from init() and quick_setup(): these targeted the system-wine prefix (WINEPREFIX/), not the Proton prefix (WINEPREFIX/pfx/), and were silently creating the false system32 directory that allowed winetricks to mis-fire
1 parent 7ee8250 commit 92f8d1f

1 file changed

Lines changed: 44 additions & 41 deletions

File tree

lib/prefix.sh

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,55 @@ _install_winetricks_verbs() {
1818
)
1919
local heavy_verbs=( dotnet48 dotnet472 physx )
2020

21-
# Proton-GE bundles dxvk, vkd3d, vcrun, and other DLLs natively.
22-
# Winetricks requires a complete Wine prefix (system32 must exist).
23-
if [ ! -d "${WINEPREFIX}/drive_c/windows/system32" ]; then
24-
print_warning "Skipping winetricks: Wine prefix has no system32."
25-
print_info "Proton-GE provides these DLLs natively. Run winetricks manually if needed:"
26-
print_info " WINEPREFIX=\"\$WINEPREFIX/pfx\" winetricks <verb>"
21+
# Winetricks must target Proton's pfx/ prefix, not the bare STEAM_COMPAT_DATA_PATH.
22+
# pfx/ is created by Proton on the first installer run — run `wig install <app>` first.
23+
local _wt_prefix="$WINEPREFIX/pfx"
24+
if [ ! -d "$_wt_prefix/drive_c/windows/system32" ]; then
25+
print_warning "Skipping winetricks: Proton prefix not yet initialised."
26+
print_info "Run \`wig install <app>\` first (builds the prefix), then \`wig init\` for verbs."
27+
print_info "Proton-GE provides dxvk/vkd3d/vcrun natively; most verbs are optional."
2728
return 0
2829
fi
2930

30-
print_info "Installing fast winetricks verbs (${#fast_verbs[@]} packages)..."
31-
local v
32-
for v in "${fast_verbs[@]}"; do
33-
printf " → %s ... " "$v"
34-
if WINETRICKS_LATEST_VERSION_CHECK=enabled \
35-
winetricks -q --force "$v" >/dev/null 2>&1; then
36-
echo "ok"
37-
else
38-
echo "FAILED (continuing)"
39-
fi
31+
# Prefer Proton's bundled wine binary; system wine may not function on this host.
32+
local _wine_bin="wine"
33+
local _candidate
34+
for _candidate in "$PROTON_DIR/files/bin/wine64" "$PROTON_DIR/files/bin/wine"; do
35+
[ -x "$_candidate" ] && { _wine_bin="$_candidate"; break; }
4036
done
4137

42-
print_warning "Installing heavy verbs (${heavy_verbs[*]}) — each may take several minutes"
43-
print_info "Output is streamed below; press Ctrl-C to skip a verb."
44-
for v in "${heavy_verbs[@]}"; do
45-
echo ""
46-
print_info "winetricks → $v"
47-
WINETRICKS_LATEST_VERSION_CHECK=enabled \
48-
winetricks -q --force "$v" 2>&1 \
49-
| grep -Ev "^warning:|winetricks latest version check|^Executing cd|^-{10,}$|^WINEPREFIX INFO:|Drive C: total|^[dl-][-rwx]{9} |^Registry info:|/#arch=|^$" \
50-
|| print_warning "$v failed or was skipped — continuing"
51-
done
38+
# Subshell isolates wine env overrides from the rest of the script.
39+
(
40+
export WINE="$_wine_bin"
41+
export WINESERVER="$(dirname "$_wine_bin")/wineserver"
42+
export WINEPREFIX="$_wt_prefix"
43+
if [ -d "$PROTON_DIR/files/lib64" ]; then
44+
export LD_LIBRARY_PATH="$PROTON_DIR/files/lib:$PROTON_DIR/files/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
45+
fi
46+
47+
print_info "Installing fast winetricks verbs (${#fast_verbs[@]} packages)..."
48+
local v
49+
for v in "${fast_verbs[@]}"; do
50+
printf " → %s ... " "$v"
51+
if WINETRICKS_LATEST_VERSION_CHECK=enabled \
52+
winetricks -q --force "$v" >/dev/null 2>&1; then
53+
echo "ok"
54+
else
55+
echo "FAILED (continuing)"
56+
fi
57+
done
58+
59+
print_warning "Installing heavy verbs (${heavy_verbs[*]}) — each may take several minutes"
60+
print_info "Output is streamed below; press Ctrl-C to skip a verb."
61+
for v in "${heavy_verbs[@]}"; do
62+
echo ""
63+
print_info "winetricks → $v"
64+
WINETRICKS_LATEST_VERSION_CHECK=enabled \
65+
winetricks -q --force "$v" 2>&1 \
66+
| grep -Ev "^warning:|winetricks latest version check|^Executing cd|^-{10,}$|^WINEPREFIX INFO:|Drive C: total|^[dl-][-rwx]{9} |^Registry info:|/#arch=|^$" \
67+
|| print_warning "$v failed or was skipped — continuing"
68+
done
69+
)
5270
}
5371

5472
# Print the managed prefix paths and env-var exports for manual use.
@@ -170,16 +188,8 @@ init() {
170188
touch "${HOME}/.config/winetricks/enable-latest-version-check"
171189
export WINETRICKS_LATEST_VERSION_CHECK=enabled
172190

173-
print_info "Initialising Wine prefix (wineboot)..."
174-
wineboot -u 2>&1 || true
175-
176191
_install_winetricks_verbs
177192

178-
print_info "Configuring Wine environment..."
179-
wine winecfg /v win10 >/dev/null 2>&1 || true
180-
wine reg add "HKEY_CURRENT_USER\Software\Wine\Direct3D" /v "VideoMemorySize" /t REG_SZ /d "8192" /f >/dev/null 2>&1 || true
181-
wine reg add "HKEY_CURRENT_USER\Software\Wine\Direct3D" /v "CSMT" /t REG_SZ /d "enabled" /f >/dev/null 2>&1 || true
182-
183193
print_success "Wine prefix initialised"
184194

185195
# Auto-install the wig wrapper and aliases so wine-gaming commands work globally.
@@ -252,15 +262,8 @@ quick_setup() {
252262
# --reinstall: force-reinstall wine packages + wineboot + winetricks via init
253263
init --reinstall
254264
else
255-
wineboot -u
256-
257265
print_info "Reinstalling Wine dependencies via winetricks (non-destructive)..."
258266
_install_winetricks_verbs
259-
260-
print_info "Configuring Wine environment..."
261-
wine winecfg /v win10 >/dev/null 2>&1 || true
262-
wine reg add "HKEY_CURRENT_USER\Software\Wine\Direct3D" /v "VideoMemorySize" /t REG_SZ /d "8192" /f >/dev/null 2>&1 || true
263-
wine reg add "HKEY_CURRENT_USER\Software\Wine\Direct3D" /v "CSMT" /t REG_SZ /d "enabled" /f >/dev/null 2>&1 || true
264267
fi
265268

266269
print_info "Installing any missing launchers..."

0 commit comments

Comments
 (0)