mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-11-11 17:02:43 -05:00
Compare commits
5 Commits
Canary-1.2
...
Canary-1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
845c86f545 | ||
|
|
27993b789f | ||
|
|
bdd890cf6f | ||
|
|
c5574b41a1 | ||
|
|
292e27f0da |
@@ -12,8 +12,8 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
private static readonly Lazy<PlayabilityStatusConverter> _shared = new(() => new());
|
||||
public static PlayabilityStatusConverter Shared => _shared.Value;
|
||||
|
||||
public object Convert(object? value, Type _, object? __, CultureInfo ___) =>
|
||||
value.Cast<LocaleKeys>() switch
|
||||
public object Convert(object value, Type _, object __, CultureInfo ___)
|
||||
=> value.Cast<LocaleKeys>() switch
|
||||
{
|
||||
LocaleKeys.CompatibilityListNothing or
|
||||
LocaleKeys.CompatibilityListBoots or
|
||||
@@ -22,7 +22,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
_ => Brushes.ForestGreen
|
||||
};
|
||||
|
||||
public object ConvertBack(object? value, Type _, object? __, CultureInfo ___)
|
||||
public object ConvertBack(object value, Type _, object __, CultureInfo ___)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,7 +741,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
Applications.ToObservableChangeSet()
|
||||
.Filter(Filter)
|
||||
.Sort(GetComparer())
|
||||
.Bind(out _appsObservableList).AsObservableList();
|
||||
#pragma warning disable MVVMTK0034
|
||||
.Bind(out _appsObservableList)
|
||||
#pragma warning enable MVVMTK0034
|
||||
.AsObservableList();
|
||||
|
||||
OnPropertyChanged(nameof(AppsObservableList));
|
||||
}
|
||||
|
||||
@@ -32,29 +32,27 @@ namespace Ryujinx.Ava.Utilities
|
||||
|
||||
public string GetContentPath(ContentManager contentManager)
|
||||
=> (contentManager ?? _contentManager)
|
||||
.GetInstalledContentPath(ProgramId, StorageId.BuiltInSystem, NcaContentType.Program);
|
||||
?.GetInstalledContentPath(ProgramId, StorageId.BuiltInSystem, NcaContentType.Program);
|
||||
|
||||
public bool CanStart(ContentManager contentManager, out ApplicationData appData,
|
||||
out BlitStruct<ApplicationControlProperty> appControl)
|
||||
{
|
||||
contentManager ??= _contentManager;
|
||||
if (contentManager == null)
|
||||
{
|
||||
appData = null;
|
||||
appControl = new BlitStruct<ApplicationControlProperty>(0);
|
||||
return false;
|
||||
}
|
||||
if (contentManager == null)
|
||||
goto BadData;
|
||||
|
||||
string contentPath = GetContentPath(contentManager);
|
||||
if (string.IsNullOrEmpty(contentPath))
|
||||
goto BadData;
|
||||
|
||||
appData = new() { Name = Name, Id = ProgramId, Path = GetContentPath(contentManager) };
|
||||
|
||||
if (string.IsNullOrEmpty(appData.Path))
|
||||
{
|
||||
appControl = new BlitStruct<ApplicationControlProperty>(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
appControl = StructHelpers.CreateCustomNacpData(Name, Version);
|
||||
return true;
|
||||
|
||||
BadData:
|
||||
appData = null;
|
||||
appControl = new BlitStruct<ApplicationControlProperty>(0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using nietras.SeparatedValues;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Common.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -11,7 +10,7 @@ using System.Text;
|
||||
|
||||
namespace Ryujinx.Ava.Utilities.Compat
|
||||
{
|
||||
public struct ColumnIndices(SepReaderHeader header)
|
||||
public struct ColumnIndices(Func<ReadOnlySpan<char>, int> getIndex)
|
||||
{
|
||||
public const string TitleIdCol = "\"title_id\"";
|
||||
public const string GameNameCol = "\"game_name\"";
|
||||
@@ -19,11 +18,11 @@ namespace Ryujinx.Ava.Utilities.Compat
|
||||
public const string StatusCol = "\"status\"";
|
||||
public const string LastUpdatedCol = "\"last_updated\"";
|
||||
|
||||
public readonly int TitleId = header.IndexOf(TitleIdCol);
|
||||
public readonly int GameName = header.IndexOf(GameNameCol);
|
||||
public readonly int Labels = header.IndexOf(LabelsCol);
|
||||
public readonly int Status = header.IndexOf(StatusCol);
|
||||
public readonly int LastUpdated = header.IndexOf(LastUpdatedCol);
|
||||
public readonly int TitleId = getIndex(TitleIdCol);
|
||||
public readonly int GameName = getIndex(GameNameCol);
|
||||
public readonly int Labels = getIndex(LabelsCol);
|
||||
public readonly int Status = getIndex(StatusCol);
|
||||
public readonly int LastUpdated = getIndex(LastUpdatedCol);
|
||||
}
|
||||
|
||||
public class CompatibilityCsv
|
||||
@@ -34,20 +33,15 @@ namespace Ryujinx.Ava.Utilities.Compat
|
||||
.GetManifestResourceStream("RyujinxGameCompatibilityList")!;
|
||||
csvStream.Position = 0;
|
||||
|
||||
LoadFromStream(csvStream);
|
||||
}
|
||||
|
||||
public static void LoadFromStream(Stream stream)
|
||||
{
|
||||
var reader = Sep.Reader().From(stream);
|
||||
var columnIndices = new ColumnIndices(reader.Header);
|
||||
using SepReader reader = Sep.Reader().From(csvStream);
|
||||
ColumnIndices columnIndices = new(reader.Header.IndexOf);
|
||||
|
||||
Entries = reader
|
||||
.Enumerate(row => new CompatibilityEntry(ref columnIndices, row))
|
||||
.OrderBy(it => it.GameName)
|
||||
.ToArray();
|
||||
|
||||
Logger.Debug?.Print(LogClass.UI, "Compatibility CSV loaded.");
|
||||
Logger.Debug?.Print(LogClass.UI, "Compatibility CSV loaded.", "LoadCompatCsv");
|
||||
}
|
||||
|
||||
public static CompatibilityEntry[] Entries { get; private set; }
|
||||
@@ -57,7 +51,7 @@ namespace Ryujinx.Ava.Utilities.Compat
|
||||
{
|
||||
public CompatibilityEntry(ref ColumnIndices indices, SepReader.Row row)
|
||||
{
|
||||
var titleIdRow = ColStr(row[indices.TitleId]);
|
||||
string titleIdRow = ColStr(row[indices.TitleId]);
|
||||
TitleId = !string.IsNullOrEmpty(titleIdRow)
|
||||
? titleIdRow
|
||||
: default(Optional<string>);
|
||||
@@ -100,7 +94,7 @@ namespace Ryujinx.Ava.Utilities.Compat
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder("CompatibilityEntry: {");
|
||||
StringBuilder sb = new("CompatibilityEntry: {");
|
||||
sb.Append($"{nameof(GameName)}=\"{GameName}\", ");
|
||||
sb.Append($"{nameof(TitleId)}={TitleId}, ");
|
||||
sb.Append($"{nameof(Labels)}=\"{Labels}\", ");
|
||||
@@ -161,8 +155,8 @@ namespace Ryujinx.Ava.Utilities.Compat
|
||||
if (value == string.Empty)
|
||||
return string.Empty;
|
||||
|
||||
var firstChar = value[0];
|
||||
var rest = value[1..];
|
||||
char firstChar = value[0];
|
||||
string rest = value[1..];
|
||||
|
||||
return $"{char.ToUpper(firstChar)}{rest}";
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Ryujinx.Ava.Utilities.Compat
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TextBox_OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (DataContext is not CompatibilityViewModel cvm)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user