diff --git a/src/Metin2Launcher/Assets/Branding/launcher-bg.png b/src/Metin2Launcher/Assets/Branding/launcher-bg.png new file mode 100644 index 0000000..7235420 Binary files /dev/null and b/src/Metin2Launcher/Assets/Branding/launcher-bg.png differ diff --git a/src/Metin2Launcher/Metin2Launcher.csproj b/src/Metin2Launcher/Metin2Launcher.csproj index 867253b..653a2f3 100644 --- a/src/Metin2Launcher/Metin2Launcher.csproj +++ b/src/Metin2Launcher/Metin2Launcher.csproj @@ -26,4 +26,8 @@ + + + + diff --git a/src/Metin2Launcher/Program.cs b/src/Metin2Launcher/Program.cs index 8d53caf..97a6974 100644 --- a/src/Metin2Launcher/Program.cs +++ b/src/Metin2Launcher/Program.cs @@ -29,6 +29,30 @@ public static class Program Log.SetLogFilePath(Path.Combine(stateDir, "launcher.log")); Log.Info($"metin2 launcher starting in {clientRoot}"); + // Single-instance guard: two launchers running in the same install + // dir race on the staging files and blow up with "The process cannot + // access the file ... because it is being used by another process". + // Use a per-install-dir file lock (not a named mutex — named mutexes + // behave differently across Wine prefixes and Windows sessions). The + // lock is released when the process exits. + FileStream? instanceLock = null; + try + { + var lockPath = Path.Combine(stateDir, "launcher.lock"); + instanceLock = new FileStream( + lockPath, + FileMode.OpenOrCreate, + FileAccess.ReadWrite, + FileShare.None, + bufferSize: 1, + FileOptions.DeleteOnClose); + } + catch (IOException) + { + Log.Error($"another Metin2Launcher is already running in {clientRoot} — refusing to start a second instance"); + return 3; + } + if (args.Contains("--nogui")) { return RunHeadlessAsync(clientRoot, args).GetAwaiter().GetResult(); diff --git a/src/Metin2Launcher/UI/MainWindow.axaml b/src/Metin2Launcher/UI/MainWindow.axaml index 32194ac..9d20883 100644 --- a/src/Metin2Launcher/UI/MainWindow.axaml +++ b/src/Metin2Launcher/UI/MainWindow.axaml @@ -26,8 +26,12 @@ - - + + + + + + @@ -87,6 +91,18 @@ + + + + + + + + + @@ -232,4 +248,5 @@ +