From 027786a79ddc96121b9be4c0671fd70f000502f6 Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Wed, 15 Apr 2026 12:22:30 +0200 Subject: [PATCH] game: auto-pick metin wine prefix when WINEPREFIX is unset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default ~/.wine prefix lacks tahoma + d3dx9 + vcrun, which makes the client run with invisible fonts and missing renderer DLLs — exactly what Jan hit when running the launcher against a fresh install dir on Fedora. If the parent shell already set WINEPREFIX, honor it. Otherwise fall back to ~/metin/wine-metin, which is what m2dev-client/scripts/setup-wine-prefix.sh prepares with the right runtime deps. The fallback is guarded on the dir existing, so deployments without that setup are a no-op rather than a broken prefix. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/Metin2Launcher/GameLaunch/GameProcess.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Metin2Launcher/GameLaunch/GameProcess.cs b/src/Metin2Launcher/GameLaunch/GameProcess.cs index add6aac..1d337b4 100644 --- a/src/Metin2Launcher/GameLaunch/GameProcess.cs +++ b/src/Metin2Launcher/GameLaunch/GameProcess.cs @@ -67,6 +67,21 @@ public static class GameProcess UseShellExecute = false, }; psi.ArgumentList.Add(exePath); + // The default ~/.wine prefix lacks tahoma + d3dx9 + vcrun, which + // makes the client run with invisible fonts and missing renderer + // DLLs. If the caller already set WINEPREFIX, honor it; otherwise + // fall back to the metin-specific prefix prepared by + // m2dev-client/scripts/setup-wine-prefix.sh. + if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WINEPREFIX"))) + { + var home = Environment.GetEnvironmentVariable("HOME"); + if (!string.IsNullOrEmpty(home)) + { + var metinPrefix = Path.Combine(home, "metin", "wine-metin"); + if (Directory.Exists(metinPrefix)) + psi.Environment["WINEPREFIX"] = metinPrefix; + } + } } else {