diff --git a/src/Ryujinx.HLE/Exceptions/InvalidFirmwarePackageException.cs b/src/Ryujinx.HLE/Exceptions/InvalidFirmwarePackageException.cs index fd9110327..3afa0a532 100644 --- a/src/Ryujinx.HLE/Exceptions/InvalidFirmwarePackageException.cs +++ b/src/Ryujinx.HLE/Exceptions/InvalidFirmwarePackageException.cs @@ -2,7 +2,7 @@ using System; namespace Ryujinx.HLE.Exceptions { - class InvalidFirmwarePackageException : Exception + public class InvalidFirmwarePackageException : Exception { public InvalidFirmwarePackageException(string message) : base(message) { } } diff --git a/src/Ryujinx.HLE/FileSystem/ContentManager.cs b/src/Ryujinx.HLE/FileSystem/ContentManager.cs index d0fe0f1a7..0283ce195 100644 --- a/src/Ryujinx.HLE/FileSystem/ContentManager.cs +++ b/src/Ryujinx.HLE/FileSystem/ContentManager.cs @@ -487,7 +487,7 @@ namespace Ryujinx.HLE.FileSystem if (keyPaths.Length is 0) throw new FileNotFoundException($"Directory '{keysSource}' contained no '.keys' files."); - + foreach (string filePath in keyPaths) { try diff --git a/src/Ryujinx/UI/SetupWizard/RyujinxSetupWizard.Helpers.cs b/src/Ryujinx/UI/SetupWizard/RyujinxSetupWizard.Helpers.cs index 594e8da89..d0dfb846b 100644 --- a/src/Ryujinx/UI/SetupWizard/RyujinxSetupWizard.Helpers.cs +++ b/src/Ryujinx/UI/SetupWizard/RyujinxSetupWizard.Helpers.cs @@ -4,10 +4,10 @@ using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; +using Ryujinx.HLE.Exceptions; using Ryujinx.HLE.FileSystem; using System; using System.IO; -using System.Threading; namespace Ryujinx.Ava.UI.SetupWizard { @@ -26,34 +26,16 @@ namespace Ryujinx.Ava.UI.SetupWizard Logger.Info?.Print(LogClass.Application, $"Installing keys from {directory}"); - Thread thread = new(() => - { - try - { - ContentManager.InstallKeys(directory, systemDirectory); + ContentManager.InstallKeys(directory, systemDirectory); - NotificationHelper.ShowInformation( - title: LocaleManager.Instance[LocaleKeys.RyujinxInfo], - text: LocaleManager.Instance[LocaleKeys.DialogKeysInstallerKeysInstallSuccessMessage]); - } - catch (Exception ex) - { - string message = ex.Message; - if (ex is FormatException) - { - message = LocaleManager.Instance.UpdateAndGetDynamicValue( - LocaleKeys.DialogKeysInstallerKeysNotFoundErrorMessage, directory); - } - - NotificationHelper.ShowError(message, waitingExit: true); - } - finally - { - mwvm.VirtualFileSystem.ReloadKeySet(); - } - }) { Name = "GUI.KeysInstallerThread" }; - - thread.Start(); + NotificationHelper.ShowInformation( + title: LocaleManager.Instance[LocaleKeys.RyujinxInfo], + text: LocaleManager.Instance[LocaleKeys.DialogKeysInstallerKeysInstallSuccessMessage]); + } + catch (InvalidFirmwarePackageException ifwpe) + { + NotificationHelper.ShowError(ifwpe.Message, waitingExit: true); + return Result.Failure(NoKeysFoundInFolder.Shared); } catch (MissingKeyException ex) { @@ -62,8 +44,21 @@ namespace Ryujinx.Ava.UI.SetupWizard } catch (Exception ex) { + string message = ex.Message; + if (ex is FormatException) + { + message = LocaleManager.Instance.UpdateAndGetDynamicValue( + LocaleKeys.DialogKeysInstallerKeysNotFoundErrorMessage, directory); + } + + NotificationHelper.ShowError(message, waitingExit: true); + return Result.Failure(new MessageError(ex.Message)); } + finally + { + mwvm.VirtualFileSystem.ReloadKeySet(); + } return Result.Success; } diff --git a/src/Ryujinx/UI/SetupWizard/RyujinxSetupWizard.cs b/src/Ryujinx/UI/SetupWizard/RyujinxSetupWizard.cs index d9eaf04f4..c645a5c7a 100644 --- a/src/Ryujinx/UI/SetupWizard/RyujinxSetupWizard.cs +++ b/src/Ryujinx/UI/SetupWizard/RyujinxSetupWizard.cs @@ -75,6 +75,12 @@ namespace Ryujinx.Ava.UI.SetupWizard { if (!HasFirmware) { + if (!mwvm.VirtualFileSystem.HasKeySet) + { + NotificationHelper.ShowError("Keys still seem to not be installed. Are you sure they're in that folder?"); + return false; + } + Retry: SetupFirmwarePageViewModel fwvm = new(); bool result = await NextPage()