mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-13 14:19:12 +00:00
Prevent crash when game is corrupted.
This commit is contained in:
parent
9a1b74799d
commit
3df818c894
2 changed files with 30 additions and 8 deletions
|
@ -650,5 +650,6 @@
|
|||
"NetworkInterfaceDefault": "Default",
|
||||
"PackagingShaders": "Packaging Shaders",
|
||||
"AboutChangelogButton": "View Changelog on GitHub",
|
||||
"AboutChangelogButtonTooltipMessage": "Click to open the changelog for this version in your default browser."
|
||||
"AboutChangelogButtonTooltipMessage": "Click to open the changelog for this version in your default browser.",
|
||||
"DialogCorruptedGameError": "It appears this game is corrupted. Please dump the game again.\nInternal error code: {0}"
|
||||
}
|
|
@ -1480,10 +1480,29 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
async void Action()
|
||||
{
|
||||
if (!await AppHost.LoadGuestApplication())
|
||||
var loadSuccessful = false;
|
||||
try
|
||||
{
|
||||
AppHost.DisposeContext();
|
||||
loadSuccessful = await AppHost.LoadGuestApplication();
|
||||
}
|
||||
catch (HorizonResultException hex)
|
||||
{
|
||||
// Apphost Cleanup
|
||||
AppHost = null;
|
||||
SelectedIcon = null;
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
await ContentDialogHelper.CreateErrorDialog(
|
||||
string.Format(LocaleManager.Instance[LocaleKeys.DialogCorruptedGameError], hex.Message));
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!loadSuccessful)
|
||||
{
|
||||
PostAppCleanup();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1505,7 +1524,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
Thread gameThread = new(InitializeGame) { Name = "GUI.WindowThread" };
|
||||
gameThread.Start();
|
||||
}
|
||||
|
||||
|
||||
Dispatcher.UIThread.Post(Action);
|
||||
}
|
||||
|
||||
|
@ -1561,6 +1580,11 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
}
|
||||
|
||||
public void AppHost_AppExit(object sender, EventArgs e)
|
||||
{
|
||||
PostAppCleanup();
|
||||
}
|
||||
|
||||
private void PostAppCleanup()
|
||||
{
|
||||
if (IsClosing)
|
||||
{
|
||||
|
@ -1590,10 +1614,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
SelectedIcon = null;
|
||||
|
||||
Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
Title = $"Ryujinx {Program.Version}";
|
||||
});
|
||||
Dispatcher.UIThread.InvokeAsync(() => { Title = $"Ryujinx {Program.Version}"; });
|
||||
}
|
||||
|
||||
public void ToggleFullscreen()
|
||||
|
|
Loading…
Reference in a new issue