Compare commits

...

5 commits

Author SHA1 Message Date
dianyaa d1165cfb0e
Merge 0ab2c80575 into a23d8cb92f 2024-05-09 01:26:53 +02:00
Marco Carvalho a23d8cb92f
Replace "List.ForEach" for "foreach" (#6783)
* Replace "List.ForEach" for "foreach"

* dotnet format

* Update Ptc.cs

* Update GpuContext.cs
2024-05-08 13:53:25 +02:00
Diana Atsuko Herring 0ab2c80575
Open first user after deleting one.
Current behavior opens the DefaultUserId, however with the change to use
a randomly generated ID for the first user there is not a user with that
ID. Instead we open the first user in _profiles.
2024-03-31 00:19:33 -05:00
Diana Atsuko Herring 46ebdcfe03
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.
2024-03-30 23:49:30 -05:00
Diana Atsuko Herring ba9e0ca6dc
Change behavior of default user creation. (#3396)
Change AccountManager to create a random id for the default user.
Change UserEditorView to not show the 'Delete' button if there is only one user present.
2024-03-30 22:32:06 -05:00
6 changed files with 50 additions and 10 deletions

View file

@ -857,8 +857,14 @@ namespace ARMeilleure.Translation.PTC
Stopwatch sw = Stopwatch.StartNew();
threads.ForEach((thread) => thread.Start());
threads.ForEach((thread) => thread.Join());
foreach (var thread in threads)
{
thread.Start();
}
foreach (var thread in threads)
{
thread.Join();
}
threads.Clear();

View file

@ -395,8 +395,14 @@ namespace Ryujinx.Graphics.Gpu
{
Renderer.CreateSync(SyncNumber, strict);
SyncActions.ForEach(action => action.SyncPreAction(syncpoint));
SyncpointActions.ForEach(action => action.SyncPreAction(syncpoint));
foreach (var action in SyncActions)
{
action.SyncPreAction(syncpoint);
}
foreach (var action in SyncpointActions)
{
action.SyncPreAction(syncpoint);
}
SyncNumber++;

View file

@ -37,13 +37,16 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
_accountSaveDataManager = new AccountSaveDataManager(_profiles);
if (!_profiles.TryGetValue(DefaultUserId.ToString(), out _))
if (_profiles.IsEmpty)
{
byte[] defaultUserImage = EmbeddedResources.Read("Ryujinx.HLE/HOS/Services/Account/Acc/DefaultUserImage.jpg");
AddUser("RyuPlayer", defaultUserImage, DefaultUserId);
// Use a random UserId as default to avoid issues in multiplayer per #3396.
UserId userId = new UserId(Guid.NewGuid().ToString().Replace("-", ""));
OpenUser(DefaultUserId);
AddUser("RyuPlayer", defaultUserImage, userId);
OpenUser(userId);
}
else
{
@ -184,7 +187,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
_profiles.Remove(userId.ToString(), out _);
OpenUser(DefaultUserId);
OpenUser(new UserId(_profiles.First().Key));
_accountSaveDataManager.Save(_profiles);
}

View file

@ -123,6 +123,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);

View file

@ -1,13 +1,13 @@
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Interactivity;
using FluentAvalonia.Core;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Navigation;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Controls;
using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.UI.Models;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using System;
using UserProfile = Ryujinx.Ava.UI.Models.UserProfile;
@ -21,7 +21,9 @@ namespace Ryujinx.Ava.UI.Views.User
public TempProfile TempProfile { get; set; }
public static uint MaxProfileNameLength => 0x20;
public bool IsDeletable => _profile.UserId != AccountManager.DefaultUserId;
// Don't allow deletion if there is only one user
public bool IsDeletable => _parent.AccountManager.GetAllUsers().Count() != 1;
public UserEditorView()
{

View file

@ -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 readonly double StatusBarHeight;
@ -300,6 +302,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 =>