#!/usr/bin/env python3 """Persist a Wine DllOverrides entry ("version"="native,builtin") inside the Devour Proton prefix registry (user.reg). Steam cannot overwrite this (it only manages its own LaunchOptions), so the unlocker loads on every launch with zero user configuration. Must run while the game/wineserver is NOT running (wineserver writes user.reg back on clean exit). """ import pathlib, re, sys APPID = "1274570" SECTION = '[Software\\\\Wine\\\\DllOverrides]' # literal double backslash in reg file def find_prefixes(steam_home: pathlib.Path): out = [] direct = steam_home / f"steamapps/compatdata/{APPID}/pfx/user.reg" if direct.exists(): out.append(direct) lf = steam_home / "steamapps/libraryfolders.vdf" if lf.exists(): for m in re.finditer(r'"path"\s+"([^"]+)"', lf.read_text(errors="ignore")): cand = pathlib.Path(m.group(1)) / f"steamapps/compatdata/{APPID}/pfx/user.reg" if cand.exists() and cand not in out: out.append(cand) return out def patch(user_reg: pathlib.Path) -> bool: t = user_reg.read_text(encoding="utf-8", errors="ignore") changed = False if SECTION in t: i = t.index(SECTION) j = t.find("\n[", i + 1) end = j if j != -1 else len(t) body = t[i:end] if '"version"' in body: new_body = re.sub(r'"version"="[^"]*"', '"version"="native,builtin"', body) if new_body != body: changed = True else: new_body = body.rstrip("\n") + '\n"version"="native,builtin"\n\n' changed = True if changed: t = t[:i] + new_body + t[end:] else: t = t.rstrip("\n") + "\n\n" + SECTION + ' 1788000000\n"version"="native,builtin"\n\n' changed = True if changed: bak = user_reg.with_suffix(".reg.bak.devour") bak.write_text(t, encoding="utf-8") user_reg.write_text(t, encoding="utf-8") print(f"[+] {user_reg}: version=native,builtin set ({'updated' if 'updated' in locals() else 'added'})") else: print(f"[=] {user_reg}: already native,builtin") return changed if __name__ == "__main__": home = pathlib.Path.home() steam = home / ".local/share/Steam" prefixes = find_prefixes(steam) if not prefixes: print("[!] No Proton prefix for Devour found (launch the game once via Steam first)") sys.exit(0) for p in prefixes: patch(p)