From 46ebdcfe03ef3f4b8901a72adeab6b35bb7061ac Mon Sep 17 00:00:00 2001 From: Diana Atsuko Herring Date: Sat, 30 Mar 2024 23:49:30 -0500 Subject: [PATCH] Prompt user on first launch to manage profiles Related to #3396 Checks if system/Profiles.json exists, if it does not then prompt the user to manage user profiles. --- .../HOS/Services/Account/Acc/AccountManager.cs | 2 +- src/Ryujinx/Program.cs | 7 +++++++ src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs index a815cf9d95..d1774ccf4f 100644 --- a/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs +++ b/src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs @@ -43,7 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc // Use a random UserId as default to avoid issues in multiplayer per #3396. UserId userId = new UserId(Guid.NewGuid().ToString().Replace("-", "")); - + AddUser("RyuPlayer", defaultUserImage, userId); OpenUser(userId); diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index aecc585fcb..4b94de5c1c 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -118,6 +118,13 @@ namespace Ryujinx.Ava } } + // Check if we've made any profiles yet + if (!File.Exists(Path.Combine(AppDataManager.BaseDirPath, "system", "Profiles.json"))) + { + MainWindow.ShowNewUserEditPrompt = true; + } + + if (CommandLineState.LaunchPathArg != null) { MainWindow.DeferLoadApplication(CommandLineState.LaunchPathArg, CommandLineState.StartFullscreenArg); diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 33a9af5b61..0ed80afaf2 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -54,6 +54,8 @@ namespace Ryujinx.Ava.UI.Windows public SettingsWindow SettingsWindow { get; set; } public static bool ShowKeyErrorOnLoad { get; set; } + + public static bool ShowNewUserEditPrompt { get; set; } public ApplicationLibrary ApplicationLibrary { get; set; } public MainWindow() @@ -295,6 +297,20 @@ namespace Ryujinx.Ava.UI.Windows await Dispatcher.UIThread.InvokeAsync(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys)); } + if (ShowNewUserEditPrompt) + { + ShowNewUserEditPrompt = false; + + await Dispatcher.UIThread.InvokeAsync(async () => + { + UserResult result = await ContentDialogHelper.CreateInfoDialog("The default profile has been created.", "Would you like to manage profiles now?", "Yes", "No", "First Launch"); + if (result == UserResult.Ok) + { + await ViewModel.ManageProfiles(); + } + }); + } + if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false)) { await Updater.BeginParse(this, false).ContinueWith(task =>