From 9c12f52805cbfbfa57ea63c74147a4e11b26f8ba Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Thu, 30 Jan 2025 17:41:25 -0600 Subject: [PATCH] =?UTF-8?q?UI:=20Pretty=20Atmosph=C3=A8re=20mod=20names=20?= =?UTF-8?q?(#601)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes the mods from the Atmosphère folder to show a pretty name instead of just the name of the folder they're in, because those names are always just a title ID. NOTE: The DLC names are from the file names, not retrieved from the content file itself like the main applications. --- src/Ryujinx/UI/Models/ModModel.cs | 7 +++++- src/Ryujinx/UI/Windows/ModManagerWindow.axaml | 2 +- .../AppLibrary/ApplicationLibrary.cs | 24 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx/UI/Models/ModModel.cs b/src/Ryujinx/UI/Models/ModModel.cs index ee28ca5f5..a713f8e36 100644 --- a/src/Ryujinx/UI/Models/ModModel.cs +++ b/src/Ryujinx/UI/Models/ModModel.cs @@ -1,5 +1,5 @@ using Ryujinx.Ava.UI.ViewModels; -using System.IO; +using System.Globalization; namespace Ryujinx.Ava.UI.Models { @@ -21,6 +21,11 @@ namespace Ryujinx.Ava.UI.Models public string Path { get; } public string Name { get; } + public string FormattedName => + InSd && ulong.TryParse(Name, NumberStyles.HexNumber, null, out ulong applicationId) + ? $"Atmosphère: {System.IO.Path.GetFileNameWithoutExtension(RyujinxApp.MainWindow.ApplicationLibrary.GetNameForApplicationId(applicationId))}" + : Name; + public ModModel(string path, string name, bool enabled, bool inSd) { Path = path; diff --git a/src/Ryujinx/UI/Windows/ModManagerWindow.axaml b/src/Ryujinx/UI/Windows/ModManagerWindow.axaml index a8fd3a2e7..b50ea2c8e 100644 --- a/src/Ryujinx/UI/Windows/ModManagerWindow.axaml +++ b/src/Ryujinx/UI/Windows/ModManagerWindow.axaml @@ -81,7 +81,7 @@ MaxLines="2" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" - Text="{Binding Name}" /> + Text="{Binding FormattedName}" /> + /// Gets a name for an available content file based on the Application ID ''. + ///

+ /// For Applications, this returns the localized name of the app found in the file. + /// For DLCs, this returns the name of the file that contains the DLC, minus the file extension. + /// + /// The Application ID to search for. + /// + /// If the provided Application ID does not have a corresponding Application OR DLC file, + /// formatted as hexadecimal is returned. + /// + /// A formatted Application name, or as hexadecimal if none is found. + public string GetNameForApplicationId(ulong id) + { + DynamicData.Kernel.Optional appData = Applications.Lookup(id); + if (appData.HasValue) + return appData.Value.Name; + + if (DownloadableContents.Keys.FindFirst(x => x.TitleId == id).TryGet(out DownloadableContentModel dlcData)) + return dlcData.FileName; + + return id.ToString("X16"); + } + /// The configured key set is missing a key. /// The NCA header could not be decrypted. /// The NCA version is not supported.