Skip to content

Commit

Permalink
v1.6.2.1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amakvana committed Oct 10, 2023
1 parent a9aeb58 commit 8322173
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 28 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

<br>

## [1.6.2.1] - 2023-10-10

### Fixed

- [Issue #43](https://github.com/amakvana/EzYuzu/issues/43) - Race condition which caused EzYuzu to crash when `Launch Yuzu After Update` was checked - thanks [@DebugDax](https://github.com/amakvana/EzYuzu/issues/43), [@Gwouigwoui](https://github.com/amakvana/EzYuzu/issues/43)

<br>

## [1.6.2.0] - 2023-10-08

### Added
Expand Down
4 changes: 2 additions & 2 deletions source/EzYuzu/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.2.0")]
[assembly: AssemblyFileVersion("1.6.2.0")]
[assembly: AssemblyVersion("1.6.2.1")]
[assembly: AssemblyFileVersion("1.6.2.1")]
[assembly: SupportedOSPlatform("windows")]
57 changes: 31 additions & 26 deletions source/EzYuzu/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,7 @@ private async void FrmMain_LoadAsync(object sender, EventArgs e)

// launch Yuzu if install up to date and option checked
if (installationState == YuzuInstallationState.LatestVersionInstalled && launchYuzuAfterUpdateToolStripMenuItem.Checked)
{
Process.Start(new ProcessStartInfo(Path.Combine(txtYuzuLocation.Text, "yuzu.exe"))
{
UseShellExecute = true
})?.Dispose();
Application.Exit();
}
LaunchYuzu(txtYuzuLocation.Text);
}

formHasLoaded = true;
Expand Down Expand Up @@ -126,14 +120,7 @@ private async void BtnBrowse_ClickAsync(object sender, EventArgs e)

// launch Yuzu if install up to date and option checked
if (installationState == YuzuInstallationState.LatestVersionInstalled && launchYuzuAfterUpdateToolStripMenuItem.Checked)
{
string exeToLaunch = enableHDRToolStripMenuItem.Checked ? "cemu.exe" : "yuzu.exe";
Process.Start(new ProcessStartInfo(Path.Combine(txtYuzuLocation.Text, exeToLaunch))
{
UseShellExecute = true
})?.Dispose();
Application.Exit();
}
LaunchYuzu(txtYuzuLocation.Text);
}

private async void BtnProcess_ClickAsync(object sender, EventArgs e)
Expand Down Expand Up @@ -204,15 +191,8 @@ private async void BtnProcess_ClickAsync(object sender, EventArgs e)

// launch Yuzu if option checked
if (launchYuzuAfterUpdateToolStripMenuItem.Checked)
{
string exeToLaunch = enableHDRToolStripMenuItem.Checked ? "cemu.exe" : "yuzu.exe";
Process.Start(new ProcessStartInfo(Path.Combine(yuzuLocation, exeToLaunch))
{
UseShellExecute = true
})?.Dispose();
Application.Exit();
}

LaunchYuzu(yuzuLocation);

// if "Exit After Update" is selected, exit app
if (exitAfterUpdateToolStripMenuItem.Checked)
Application.Exit();
Expand Down Expand Up @@ -314,9 +294,7 @@ private void LoadApplicationSettings(bool isLaunchedInSafeMode)

// safe mode ui adjustments
if (isLaunchedInSafeMode)
{
this.Text = $"{this.Text} - Safe Mode";
}

if (!File.Exists("EzYuzu.settings.json"))
return;
Expand Down Expand Up @@ -547,5 +525,32 @@ private static void RenameFile(string path, string oldFileName, string newFileNa
renamed = true;
}
}

private static void LaunchYuzu(string yuzuLocationPath)
{
// wait for executable to exist
bool executableExists = false;
string executableToLaunch = "";
string[] possibleExecutables = { "yuzu.exe", "cemu.exe" };
while (!executableExists)
{
foreach (var executable in possibleExecutables)
{
if (File.Exists(Path.Combine(yuzuLocationPath, executable)))
{
executableExists = true;
executableToLaunch = executable;
break;
}
}
}

// executable now exists, run it
Process.Start(new ProcessStartInfo(Path.Combine(yuzuLocationPath, executableToLaunch))
{
UseShellExecute = true
})?.Dispose();
Application.Exit();
}
}
}

0 comments on commit 8322173

Please sign in to comment.