fix: require valid key installations before moving onto firmware setup step

This commit is contained in:
GreemDev 2025-11-22 17:44:16 -06:00
parent 94cb992083
commit fa3a0c11ce
4 changed files with 31 additions and 30 deletions

View file

@ -2,7 +2,7 @@ using System;
namespace Ryujinx.HLE.Exceptions
{
class InvalidFirmwarePackageException : Exception
public class InvalidFirmwarePackageException : Exception
{
public InvalidFirmwarePackageException(string message) : base(message) { }
}

View file

@ -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;
}

View file

@ -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()