Skip to content

Commit

Permalink
fix: create wine prefix with custom wine.
Browse files Browse the repository at this point in the history
* function failed to initialize dxvk if no wine prefix existed
  and custom wine selected, resulting in crash.
* Also updated error messages to include errors for no wine64
  found at location and path not existing.
  • Loading branch information
rankynbass committed Dec 7, 2022
1 parent ad9fd4e commit 6ee82c8
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions src/XIVLauncher.Core/Components/MainPage/MainPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -691,48 +691,54 @@ public async Task<Process> StartGameAndAddon(Launcher.LoginResult loginResult, b
}
else if (Environment.OSVersion.Platform == PlatformID.Unix)
{
if (App.Settings.WineStartupType == WineStartupType.Custom && App.Settings.WineBinaryPath == null)
throw new Exception("Custom wine binary path wasn't set.");
if (App.Settings.WineStartupType == WineStartupType.Custom)
{
if (App.Settings.WineBinaryPath == null)
throw new Exception("Custom wine binary path wasn't set.");
else if (!Directory.Exists(App.Settings.WineBinaryPath))
throw new Exception("Custom wine binary path is invalid: no such directory.\n" +
"Check path carefully for typos: " + App.Settings.WineBinaryPath);
else if (!File.Exists(App.Settings.WineBinaryPath + "/wine64"))
throw new Exception("Custom wine binary path is invalid: no wine64 found at that location.\n" +
"Check path carefully for typos: " + App.Settings.WineBinaryPath);
}

var signal = new ManualResetEvent(false);
var isFailed = false;

if (App.Settings.WineStartupType == WineStartupType.Managed)
var _ = Task.Run(async () =>
{
var _ = Task.Run(async () =>
{
var tempPath = App.Storage.GetFolder("temp");
var tempPath = App.Storage.GetFolder("temp");
await Program.CompatibilityTools.EnsureTool(tempPath).ConfigureAwait(false);
await Program.CompatibilityTools.EnsureTool(tempPath).ConfigureAwait(false);
var gameFixApply = new GameFixApply(App.Settings.GamePath, App.Settings.GameConfigPath, Program.CompatibilityTools.Settings.Prefix, tempPath);
gameFixApply.UpdateProgress += (text, hasProgress, progress) =>
{
App.LoadingPage.Line1 = "Applying game-specific fixes...";
App.LoadingPage.Line2 = text;
App.LoadingPage.Line3 = "This may take a little while. Please hold!";
App.LoadingPage.IsIndeterminate = !hasProgress;
App.LoadingPage.Progress = progress;
};
gameFixApply.Run();
}).ContinueWith(t =>
var gameFixApply = new GameFixApply(App.Settings.GamePath, App.Settings.GameConfigPath, Program.CompatibilityTools.Settings.Prefix, tempPath);
gameFixApply.UpdateProgress += (text, hasProgress, progress) =>
{
isFailed = t.IsFaulted || t.IsCanceled;
App.LoadingPage.Line1 = "Applying game-specific fixes...";
App.LoadingPage.Line2 = text;
App.LoadingPage.Line3 = "This may take a little while. Please hold!";
App.LoadingPage.IsIndeterminate = !hasProgress;
App.LoadingPage.Progress = progress;
};
gameFixApply.Run();
}).ContinueWith(t =>
{
isFailed = t.IsFaulted || t.IsCanceled;
if (isFailed)
Log.Error(t.Exception, "Couldn't ensure compatibility tool");
if (isFailed)
Log.Error(t.Exception, "Couldn't ensure compatibility tool");
signal.Set();
});
signal.Set();
});

App.StartLoading("Ensuring compatibility tool...", "This may take a little while. Please hold!");
signal.WaitOne();
signal.Dispose();
App.StartLoading("Ensuring compatibility tool...", "This may take a little while. Please hold!");
signal.WaitOne();
signal.Dispose();

if (isFailed)
return null;
}
if (isFailed)
return null;

App.StartLoading("Starting game...", "Have fun!");

Expand Down

0 comments on commit 6ee82c8

Please sign in to comment.