1
1
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2025-09-18 23:47:55 -05:00

account: add Custom User Profiles support (#2227)

* Initial Impl

* Fix names

* remove useless ContentManager

* Support backgrounds and improve avatar loading

* Fix firmware checks

* Addresses gdkchan feedback
This commit is contained in:
Ac_K
2021-04-23 22:26:31 +02:00
committed by GitHub
parent 3e61fb0268
commit c46f6879ff
14 changed files with 1286 additions and 41 deletions

View File

@@ -115,7 +115,7 @@ namespace Ryujinx.Ui.Widgets
Logger.Warning?.Print(LogClass.Application, "No control file was found for this game. Using a dummy one instead. This may cause inaccuracies in some games.");
}
Uid user = new Uid(1, 0); // TODO: Remove Hardcoded value.
Uid user = new Uid((ulong)_accountManager.LastOpenedUser.UserId.High, (ulong)_accountManager.LastOpenedUser.UserId.Low);
result = EnsureApplicationSaveData(_virtualFileSystem.FsClient, out _, new LibHac.Ncm.ApplicationId(titleId), ref control, ref user);

View File

@@ -1,6 +1,7 @@
using Gtk;
using System.Reflection;
using Ryujinx.Common.Logging;
using System.Collections.Generic;
namespace Ryujinx.Ui.Widgets
{
@@ -76,6 +77,34 @@ namespace Ryujinx.Ui.Widgets
return response == ResponseType.Yes;
}
internal static ResponseType CreateCustomDialog(string title, string mainText, string secondaryText, Dictionary<int, string> buttons, MessageType messageType = MessageType.Other)
{
GtkDialog gtkDialog = new GtkDialog(title, mainText, secondaryText, messageType, ButtonsType.None);
foreach (var button in buttons)
{
gtkDialog.AddButton(button.Value, button.Key);
}
return (ResponseType)gtkDialog.Run();
}
internal static string CreateInputDialog(Window parent, string title, string mainText, uint inputMax)
{
GtkInputDialog gtkDialog = new GtkInputDialog(parent, title, mainText, inputMax);
ResponseType response = (ResponseType)gtkDialog.Run();
string responseText = gtkDialog.InputEntry.Text.TrimEnd();
gtkDialog.Dispose();
if (response == ResponseType.Ok)
{
return responseText;
}
return "";
}
internal static bool CreateExitDialog()
{
return CreateChoiceDialog("Ryujinx - Exit", "Are you sure you want to close Ryujinx?", "All unsaved data will be lost!");

View File

@@ -0,0 +1,37 @@
using Gtk;
namespace Ryujinx.Ui.Widgets
{
public class GtkInputDialog : MessageDialog
{
public Entry InputEntry { get; }
public GtkInputDialog(Window parent, string title, string mainText, uint inputMax) : base(parent, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.OkCancel, null)
{
SetDefaultSize(300, 0);
Title = title;
Label mainTextLabel = new Label
{
Text = mainText
};
InputEntry = new Entry
{
MaxLength = (int)inputMax
};
Label inputMaxTextLabel = new Label
{
Text = $"(Max length: {inputMax})"
};
((Box)MessageArea).PackStart(mainTextLabel, true, true, 0);
((Box)MessageArea).PackStart(InputEntry, true, true, 5);
((Box)MessageArea).PackStart(inputMaxTextLabel, true, true, 0);
ShowAll();
}
}
}