mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2026-04-10 01:10:19 +00:00
81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using Avalonia.Controls.Presenters;
|
|
using Gommon;
|
|
using Ryujinx.Ava.Common.Locale;
|
|
using Ryujinx.Ava.Systems.Configuration;
|
|
using Ryujinx.Ava.Systems.SetupWizard;
|
|
using Ryujinx.Ava.UI.ViewModels;
|
|
using Ryujinx.UI.SetupWizard;
|
|
using Ryujinx.UI.SetupWizard.Pages;
|
|
using System;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Ryujinx.Ava.UI.SetupWizard
|
|
{
|
|
public partial class RyujinxSetupWizard(ContentPresenter presenter, MainWindowViewModel mwvm, Action onClose) : BaseSetupWizard(presenter)
|
|
{
|
|
private bool _configWasModified = false;
|
|
|
|
public bool HasFirmware => mwvm.ContentManager.GetCurrentFirmwareVersion() != null;
|
|
|
|
public override async ValueTask Start()
|
|
{
|
|
RyujinxSetupWizardWindow.IsUsingSetupWizard = true;
|
|
Start:
|
|
await FirstPage();
|
|
|
|
Keys:
|
|
if (!mwvm.VirtualFileSystem.HasKeySet)
|
|
{
|
|
Retry:
|
|
SetupKeysPageViewModel kpvm = new();
|
|
bool result = await NextPage()
|
|
.WithTitle(LocaleKeys.SetupWizardKeysPageTitle)
|
|
.WithContent<SetupKeysPage>(kpvm)
|
|
.Show();
|
|
|
|
if (!result)
|
|
goto Start;
|
|
|
|
if (!Directory.Exists(kpvm.KeysFolderPath))
|
|
goto Retry;
|
|
|
|
Result installResult = InstallKeys(kpvm.KeysFolderPath);
|
|
if (!installResult.IsSuccess)
|
|
{
|
|
goto Retry;
|
|
}
|
|
}
|
|
|
|
Firmware:
|
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
// i know its always false thats the fucking point, its not done
|
|
if (!HasFirmware && false)
|
|
{
|
|
if (!mwvm.VirtualFileSystem.HasKeySet)
|
|
goto Keys;
|
|
|
|
Retry:
|
|
SetupKeysPageViewModel kpvm = new();
|
|
bool result = await NextPage()
|
|
.WithTitle(LocaleKeys.SetupWizardKeysPageTitle)
|
|
.WithContent<SetupKeysPage>(kpvm)
|
|
.Show();
|
|
|
|
if (!result)
|
|
goto Keys;
|
|
|
|
if (!Directory.Exists(kpvm.KeysFolderPath))
|
|
goto Retry;
|
|
|
|
await mwvm.HandleKeysInstallation(kpvm.KeysFolderPath);
|
|
}
|
|
|
|
Return:
|
|
onClose();
|
|
|
|
if (_configWasModified)
|
|
ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.GlobalConfigurationPath);
|
|
}
|
|
}
|
|
}
|