diff --git a/src/Ryujinx/App.axaml b/src/Ryujinx/App.axaml index eab318b7..685efea5 100644 --- a/src/Ryujinx/App.axaml +++ b/src/Ryujinx/App.axaml @@ -6,6 +6,9 @@ + + avares://Ryujinx/Assets/Fonts/Mono/#JetBrains Mono + @@ -14,4 +17,4 @@ - \ No newline at end of file + diff --git a/src/Ryujinx/Assets/Fonts/Mono/AUTHORS.txt b/src/Ryujinx/Assets/Fonts/Mono/AUTHORS.txt new file mode 100644 index 00000000..88149416 --- /dev/null +++ b/src/Ryujinx/Assets/Fonts/Mono/AUTHORS.txt @@ -0,0 +1,10 @@ +# This is the official list of project authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS.txt file. +# See the latter for an explanation. +# +# Names should be added to this file as: +# Name or Organization + +JetBrains <> +Philipp Nurullin +Konstantin Bulenkov diff --git a/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Bold.ttf b/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Bold.ttf new file mode 100644 index 00000000..f78f84fb Binary files /dev/null and b/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Bold.ttf differ diff --git a/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-BoldItalic.ttf b/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-BoldItalic.ttf new file mode 100644 index 00000000..9fb8c832 Binary files /dev/null and b/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-BoldItalic.ttf differ diff --git a/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Italic.ttf b/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Italic.ttf new file mode 100644 index 00000000..4e9c3802 Binary files /dev/null and b/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Italic.ttf differ diff --git a/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Regular.ttf b/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Regular.ttf new file mode 100644 index 00000000..70d2ec9e Binary files /dev/null and b/src/Ryujinx/Assets/Fonts/Mono/JetBrainsMonoNL-Regular.ttf differ diff --git a/src/Ryujinx/Assets/Fonts/Mono/OFL.txt b/src/Ryujinx/Assets/Fonts/Mono/OFL.txt new file mode 100644 index 00000000..8bee4148 --- /dev/null +++ b/src/Ryujinx/Assets/Fonts/Mono/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index 04171edc..3cfa6e1f 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -798,7 +798,7 @@ "MultiplayerModeLdnMitm": "ldn_mitm", "CompatibilityListOpen": "Open Compatibility List", "CompatibilityListLastUpdated": "Last updated: {0}", - "CompatibilityListWarning": "This compatibility list might contain out of date entries.\\nDo not be opposed to testing games in the \"Ingame\" status.", + "CompatibilityListWarning": "This compatibility list might contain out of date entries.\nDo not be opposed to testing games in the \"Ingame\" status.", "CompatibilityListSearchBoxWatermark": "Search compatibility entries...", "CompatibilityListOnlyShowOwnedGames": "Only show owned games", "CompatibilityListPlayable": "Playable", diff --git a/src/Ryujinx/Assets/Styles/Styles.xaml b/src/Ryujinx/Assets/Styles/Styles.xaml index b3a6f59c..6ac8cb20 100644 --- a/src/Ryujinx/Assets/Styles/Styles.xaml +++ b/src/Ryujinx/Assets/Styles/Styles.xaml @@ -389,7 +389,7 @@ 13 26 28 - 600 + 900 756 diff --git a/src/Ryujinx/Modules/Compatibility/CompatibilityCsv.cs b/src/Ryujinx/Modules/Compatibility/CompatibilityCsv.cs index 861891e8..951bfebd 100644 --- a/src/Ryujinx/Modules/Compatibility/CompatibilityCsv.cs +++ b/src/Ryujinx/Modules/Compatibility/CompatibilityCsv.cs @@ -77,6 +77,18 @@ namespace Ryujinx.Ava.Modules.Compatibility } public string GameName { get; } + + public bool CheckTitleId(Func checker) => TitleId is not null && checker(TitleId); + + public bool MatchesId(string titleId) => + TitleId is not null && TitleId.Equals(titleId, StringComparison.OrdinalIgnoreCase); + + public bool NearMatchesId(string titleId) => + TitleId is not null && TitleId.Contains(titleId, StringComparison.OrdinalIgnoreCase); + + public bool MatchesAnyId(params string[] titleIds) => + TitleId is not null && titleIds.Any(it => TitleId.Equals(it, StringComparison.OrdinalIgnoreCase)); + public string TitleId { get; } public string[] Labels { get; } internal LocaleKeys? Status { get; } diff --git a/src/Ryujinx/Ryujinx.csproj b/src/Ryujinx/Ryujinx.csproj index 5d390591..eb9b0678 100644 --- a/src/Ryujinx/Ryujinx.csproj +++ b/src/Ryujinx/Ryujinx.csproj @@ -102,6 +102,10 @@ Designer + + + + MSBuild:Compile diff --git a/src/Ryujinx/UI/Controls/CompatibilityList.axaml b/src/Ryujinx/UI/Controls/CompatibilityList.axaml new file mode 100644 index 00000000..3bc0f3dc --- /dev/null +++ b/src/Ryujinx/UI/Controls/CompatibilityList.axaml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Ryujinx/UI/Controls/CompatibilityList.axaml.cs b/src/Ryujinx/UI/Controls/CompatibilityList.axaml.cs new file mode 100644 index 00000000..5a2735e6 --- /dev/null +++ b/src/Ryujinx/UI/Controls/CompatibilityList.axaml.cs @@ -0,0 +1,61 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using Avalonia.Styling; +using FluentAvalonia.UI.Controls; +using Ryujinx.Ava.Common.Locale; +using Ryujinx.Ava.UI.Helpers; +using Ryujinx.Ava.UI.ViewModels; +using Ryujinx.Ava.UI.Windows; +using System.Threading.Tasks; + +namespace Ryujinx.UI.Controls +{ + public partial class CompatibilityList : UserControl + { + public static async Task Show() + { + var mainWindow = ((Application.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow as MainWindow); + + ContentDialog contentDialog = new() + { + PrimaryButtonText = string.Empty, + SecondaryButtonText = string.Empty, + CloseButtonText = LocaleManager.Instance[LocaleKeys.SettingsButtonClose], + Content = new CompatibilityList + { + DataContext = new CompatibilityViewModel(mainWindow!.ViewModel.Applications) + } + }; + + Style closeButton = new(x => x.Name("CloseButton")); + closeButton.Setters.Add(new Setter(WidthProperty, 80d)); + + Style closeButtonParent = new(x => x.Name("CommandSpace")); + closeButtonParent.Setters.Add(new Setter(HorizontalAlignmentProperty, Avalonia.Layout.HorizontalAlignment.Right)); + + contentDialog.Styles.Add(closeButton); + contentDialog.Styles.Add(closeButtonParent); + + await ContentDialogHelper.ShowAsync(contentDialog); + } + + public CompatibilityList() + { + InitializeComponent(); + } + + private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e) + { + if (DataContext is not CompatibilityViewModel cvm) + return; + + if (sender is not TextBox searchBox) + return; + + cvm.Search(searchBox.Text); + } + } +} + diff --git a/src/Ryujinx/UI/Helpers/PlayabilityStatusConverter.cs b/src/Ryujinx/UI/Helpers/PlayabilityStatusConverter.cs new file mode 100644 index 00000000..9d60b9fd --- /dev/null +++ b/src/Ryujinx/UI/Helpers/PlayabilityStatusConverter.cs @@ -0,0 +1,27 @@ +using Avalonia.Data.Converters; +using Avalonia.Media; +using Ryujinx.Ava.Common.Locale; +using System; +using System.Globalization; + +namespace Ryujinx.Ava.UI.Helpers +{ + public class PlayabilityStatusConverter : IValueConverter + { + private static readonly Lazy _shared = new(() => new()); + public static PlayabilityStatusConverter Shared => _shared.Value; + + public object Convert(object value, Type _, object __, CultureInfo ___) + => ((LocaleKeys)value) switch + { + LocaleKeys.CompatibilityListNothing or + LocaleKeys.CompatibilityListBoots or + LocaleKeys.CompatibilityListMenus => Brushes.Red, + LocaleKeys.CompatibilityListIngame => Brushes.Yellow, + _ => Brushes.ForestGreen + }; + + public object ConvertBack(object value, Type _, object __, CultureInfo ___) + => throw new NotSupportedException(); + } +} diff --git a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs new file mode 100644 index 00000000..221097e0 --- /dev/null +++ b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs @@ -0,0 +1,58 @@ +using Ryujinx.Ava.Modules.Compatibility; +using Ryujinx.UI.App.Common; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; + +namespace Ryujinx.Ava.UI.ViewModels +{ + public class CompatibilityViewModel : BaseModel + { + private bool _onlyShowOwnedGames = true; + + public bool OnlyShowOwnedGames + { + get => _onlyShowOwnedGames; + set + { + _onlyShowOwnedGames = value; + OnPropertyChanged(); + OnPropertyChanged(nameof(CurrentEntries)); + } + } + + private IEnumerable _currentEntries = CompatibilityCsv.Entries; + private readonly string[] _ownedGameTitleIds = []; + + public IEnumerable CurrentEntries => OnlyShowOwnedGames + ? _currentEntries.Where(x => x.MatchesAnyId(_ownedGameTitleIds)) + : _currentEntries; + + public CompatibilityViewModel() {} + + public CompatibilityViewModel(ObservableCollection appLibraryApps) + { + _ownedGameTitleIds = appLibraryApps.Select(x => x.Id.ToString("X16")).ToArray(); + } + + public void Search(string searchTerm) + { + if (string.IsNullOrEmpty(searchTerm)) + { + SetEntries(CompatibilityCsv.Entries); + return; + } + + SetEntries(CompatibilityCsv.Entries.Where(x => + x.GameName.Contains(searchTerm, StringComparison.OrdinalIgnoreCase) + || x.NearMatchesId(searchTerm))); + } + + private void SetEntries(IEnumerable entries) + { + _currentEntries = entries.ToList(); + OnPropertyChanged(nameof(CurrentEntries)); + } + } +} diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml index 79f9dfef..c4cdd4db 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml @@ -206,6 +206,9 @@ Click="OpenAboutWindow" Header="{locale:Locale MenuBarHelpAbout}" ToolTip.Tip="{locale:Locale OpenAboutTooltip}" /> + diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs index 73ae0df1..9fca5d69 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs @@ -15,6 +15,7 @@ using Ryujinx.UI.App.Common; using Ryujinx.UI.Common; using Ryujinx.UI.Common.Configuration; using Ryujinx.UI.Common.Helper; +using Ryujinx.UI.Controls; using System; using System.Collections.Generic; using System.IO; @@ -266,6 +267,11 @@ namespace Ryujinx.Ava.UI.Views.Main { await AboutWindow.Show(); } + + public async void OpenCompatibilityList(object sender, RoutedEventArgs e) + { + await CompatibilityList.Show(); + } public void CloseWindow(object sender, RoutedEventArgs e) {