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 namespace Ryujinx.HLE.Exceptions
{ {
class InvalidFirmwarePackageException : Exception public class InvalidFirmwarePackageException : Exception
{ {
public InvalidFirmwarePackageException(string message) : base(message) { } public InvalidFirmwarePackageException(string message) : base(message) { }
} }

View file

@ -487,7 +487,7 @@ namespace Ryujinx.HLE.FileSystem
if (keyPaths.Length is 0) if (keyPaths.Length is 0)
throw new FileNotFoundException($"Directory '{keysSource}' contained no '.keys' files."); throw new FileNotFoundException($"Directory '{keysSource}' contained no '.keys' files.");
foreach (string filePath in keyPaths) foreach (string filePath in keyPaths)
{ {
try try

View file

@ -4,10 +4,10 @@ using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.HLE.Exceptions;
using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.FileSystem;
using System; using System;
using System.IO; using System.IO;
using System.Threading;
namespace Ryujinx.Ava.UI.SetupWizard namespace Ryujinx.Ava.UI.SetupWizard
{ {
@ -26,34 +26,16 @@ namespace Ryujinx.Ava.UI.SetupWizard
Logger.Info?.Print(LogClass.Application, $"Installing keys from {directory}"); Logger.Info?.Print(LogClass.Application, $"Installing keys from {directory}");
Thread thread = new(() => ContentManager.InstallKeys(directory, systemDirectory);
{
try
{
ContentManager.InstallKeys(directory, systemDirectory);
NotificationHelper.ShowInformation( NotificationHelper.ShowInformation(
title: LocaleManager.Instance[LocaleKeys.RyujinxInfo], title: LocaleManager.Instance[LocaleKeys.RyujinxInfo],
text: LocaleManager.Instance[LocaleKeys.DialogKeysInstallerKeysInstallSuccessMessage]); text: LocaleManager.Instance[LocaleKeys.DialogKeysInstallerKeysInstallSuccessMessage]);
} }
catch (Exception ex) catch (InvalidFirmwarePackageException ifwpe)
{ {
string message = ex.Message; NotificationHelper.ShowError(ifwpe.Message, waitingExit: true);
if (ex is FormatException) return Result.Failure(NoKeysFoundInFolder.Shared);
{
message = LocaleManager.Instance.UpdateAndGetDynamicValue(
LocaleKeys.DialogKeysInstallerKeysNotFoundErrorMessage, directory);
}
NotificationHelper.ShowError(message, waitingExit: true);
}
finally
{
mwvm.VirtualFileSystem.ReloadKeySet();
}
}) { Name = "GUI.KeysInstallerThread" };
thread.Start();
} }
catch (MissingKeyException ex) catch (MissingKeyException ex)
{ {
@ -62,8 +44,21 @@ namespace Ryujinx.Ava.UI.SetupWizard
} }
catch (Exception ex) 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)); return Result.Failure(new MessageError(ex.Message));
} }
finally
{
mwvm.VirtualFileSystem.ReloadKeySet();
}
return Result.Success; return Result.Success;
} }

View file

@ -75,6 +75,12 @@ namespace Ryujinx.Ava.UI.SetupWizard
{ {
if (!HasFirmware) 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: Retry:
SetupFirmwarePageViewModel fwvm = new(); SetupFirmwarePageViewModel fwvm = new();
bool result = await NextPage() bool result = await NextPage()