mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-04-24 06:47:44 +02:00
UI: Show issue labels of games in the tooltip on playability status
This commit is contained in:
parent
1c0813d09d
commit
efa0cc7554
4 changed files with 90 additions and 28 deletions
|
@ -55,9 +55,21 @@
|
||||||
Tag="{Binding AppData.IdString}"
|
Tag="{Binding AppData.IdString}"
|
||||||
Text="{Binding AppData.LocalizedStatus}"
|
Text="{Binding AppData.LocalizedStatus}"
|
||||||
Foreground="{Binding AppData.PlayabilityStatus, Converter={x:Static helpers:PlayabilityStatusConverter.Shared}}"
|
Foreground="{Binding AppData.PlayabilityStatus, Converter={x:Static helpers:PlayabilityStatusConverter.Shared}}"
|
||||||
ToolTip.Tip="{Binding AppData.LocalizedStatusTooltip}"
|
|
||||||
TextAlignment="Start"
|
TextAlignment="Start"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap">
|
||||||
|
<ToolTip.Tip>
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<TextBlock
|
||||||
|
Text="{Binding AppData.LocalizedStatusTooltip}" />
|
||||||
|
<Separator
|
||||||
|
Margin="0, 10, 0, 10"
|
||||||
|
IsVisible="{Binding AppData.HasCompatibilityLabels}" />
|
||||||
|
<TextBlock
|
||||||
|
IsVisible="{Binding AppData.HasCompatibilityLabels}"
|
||||||
|
Text="{Binding AppData.FormattedCompatibilityLabels}" />
|
||||||
|
</StackPanel>
|
||||||
|
</ToolTip.Tip>
|
||||||
|
</TextBlock>
|
||||||
<Button.Styles>
|
<Button.Styles>
|
||||||
<Style Selector="Button">
|
<Style Selector="Button">
|
||||||
<Setter Property="MinWidth"
|
<Setter Property="MinWidth"
|
||||||
|
|
|
@ -93,8 +93,19 @@
|
||||||
IsVisible="{Binding HasPlayabilityInfo}"
|
IsVisible="{Binding HasPlayabilityInfo}"
|
||||||
Background="{DynamicResource AppListBackgroundColor}"
|
Background="{DynamicResource AppListBackgroundColor}"
|
||||||
Margin="-1, 0, 0, 0"
|
Margin="-1, 0, 0, 0"
|
||||||
Padding="0"
|
Padding="0">
|
||||||
ToolTip.Tip="{Binding LocalizedStatusTooltip}">
|
<ToolTip.Tip>
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<TextBlock
|
||||||
|
Text="{Binding LocalizedStatusTooltip}" />
|
||||||
|
<Separator
|
||||||
|
Margin="0, 10, 0, 10"
|
||||||
|
IsVisible="{Binding HasCompatibilityLabels}" />
|
||||||
|
<TextBlock
|
||||||
|
IsVisible="{Binding HasCompatibilityLabels}"
|
||||||
|
Text="{Binding FormattedCompatibilityLabels}" />
|
||||||
|
</StackPanel>
|
||||||
|
</ToolTip.Tip>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="1.5"
|
Margin="1.5"
|
||||||
Tag="{Binding IdString}"
|
Tag="{Binding IdString}"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Gommon;
|
||||||
using LibHac.Common;
|
using LibHac.Common;
|
||||||
using LibHac.Fs;
|
using LibHac.Fs;
|
||||||
using LibHac.Fs.Fsa;
|
using LibHac.Fs.Fsa;
|
||||||
|
@ -14,6 +15,7 @@ using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.Loaders.Processes.Extensions;
|
using Ryujinx.HLE.Loaders.Processes.Extensions;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.AppLibrary
|
namespace Ryujinx.Ava.Utilities.AppLibrary
|
||||||
|
@ -32,33 +34,12 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_id = value;
|
_id = value;
|
||||||
PlayabilityStatus = CompatibilityCsv.GetStatus(Id);
|
|
||||||
|
Compatibility = CompatibilityCsv.Find(Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string Developer { get; set; } = "Unknown";
|
public string Developer { get; set; } = "Unknown";
|
||||||
public string Version { get; set; } = "0";
|
public string Version { get; set; } = "0";
|
||||||
|
|
||||||
public bool HasPlayabilityInfo => PlayabilityStatus != null;
|
|
||||||
|
|
||||||
public string LocalizedStatus =>
|
|
||||||
PlayabilityStatus.HasValue
|
|
||||||
? LocaleManager.Instance[PlayabilityStatus!.Value]
|
|
||||||
: string.Empty;
|
|
||||||
|
|
||||||
public LocaleKeys? PlayabilityStatus { get; set; }
|
|
||||||
public string LocalizedStatusTooltip =>
|
|
||||||
PlayabilityStatus.HasValue
|
|
||||||
#pragma warning disable CS8509 // It is exhaustive for any value this property can contain.
|
|
||||||
? LocaleManager.Instance[PlayabilityStatus!.Value switch
|
|
||||||
#pragma warning restore CS8509
|
|
||||||
{
|
|
||||||
LocaleKeys.CompatibilityListPlayable => LocaleKeys.CompatibilityListPlayableTooltip,
|
|
||||||
LocaleKeys.CompatibilityListIngame => LocaleKeys.CompatibilityListIngameTooltip,
|
|
||||||
LocaleKeys.CompatibilityListMenus => LocaleKeys.CompatibilityListMenusTooltip,
|
|
||||||
LocaleKeys.CompatibilityListBoots => LocaleKeys.CompatibilityListBootsTooltip,
|
|
||||||
LocaleKeys.CompatibilityListNothing => LocaleKeys.CompatibilityListNothingTooltip,
|
|
||||||
}]
|
|
||||||
: string.Empty;
|
|
||||||
public int PlayerCount { get; set; }
|
public int PlayerCount { get; set; }
|
||||||
public int GameCount { get; set; }
|
public int GameCount { get; set; }
|
||||||
|
|
||||||
|
@ -84,6 +65,53 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
||||||
|
|
||||||
public string FileSizeString => ValueFormatUtils.FormatFileSize(FileSize);
|
public string FileSizeString => ValueFormatUtils.FormatFileSize(FileSize);
|
||||||
|
|
||||||
|
public Optional<CompatibilityEntry> Compatibility { get; private set; }
|
||||||
|
|
||||||
|
public bool HasPlayabilityInfo => Compatibility.HasValue;
|
||||||
|
|
||||||
|
public string LocalizedStatus => Compatibility.Convert(x => x.LocalizedStatus);
|
||||||
|
|
||||||
|
public bool HasCompatibilityLabels => !FormattedCompatibilityLabels.Equals(string.Empty);
|
||||||
|
|
||||||
|
public string FormattedCompatibilityLabels
|
||||||
|
=> Compatibility.Convert(x => x.FormattedIssueLabels).OrElse(string.Empty);
|
||||||
|
|
||||||
|
public LocaleKeys? PlayabilityStatus => Compatibility.Convert(x => x.Status).OrElse(null);
|
||||||
|
|
||||||
|
public string CompatibilityToolTip
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(LocalizedStatusTooltip);
|
||||||
|
|
||||||
|
string formattedCompatibilityLabels = FormattedCompatibilityLabels;
|
||||||
|
if (!string.IsNullOrEmpty(formattedCompatibilityLabels))
|
||||||
|
{
|
||||||
|
sb.AppendLine()
|
||||||
|
.AppendLine()
|
||||||
|
.Append(formattedCompatibilityLabels);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string LocalizedStatusTooltip =>
|
||||||
|
Compatibility.Convert(x =>
|
||||||
|
#pragma warning disable CS8509 It is exhaustive for all possible values this can contain.
|
||||||
|
LocaleManager.Instance[x.Status switch
|
||||||
|
#pragma warning restore CS8509
|
||||||
|
{
|
||||||
|
LocaleKeys.CompatibilityListPlayable => LocaleKeys.CompatibilityListPlayableTooltip,
|
||||||
|
LocaleKeys.CompatibilityListIngame => LocaleKeys.CompatibilityListIngameTooltip,
|
||||||
|
LocaleKeys.CompatibilityListMenus => LocaleKeys.CompatibilityListMenusTooltip,
|
||||||
|
LocaleKeys.CompatibilityListBoots => LocaleKeys.CompatibilityListBootsTooltip,
|
||||||
|
LocaleKeys.CompatibilityListNothing => LocaleKeys.CompatibilityListNothingTooltip,
|
||||||
|
}]
|
||||||
|
).OrElse(string.Empty);
|
||||||
|
|
||||||
|
|
||||||
[JsonIgnore] public string IdString => Id.ToString("x16");
|
[JsonIgnore] public string IdString => Id.ToString("x16");
|
||||||
|
|
||||||
[JsonIgnore] public ulong IdBase => Id & ~0x1FFFUL;
|
[JsonIgnore] public ulong IdBase => Id & ~0x1FFFUL;
|
||||||
|
|
|
@ -60,10 +60,21 @@ namespace Ryujinx.Ava.Utilities.Compat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CompatibilityEntry Find(string titleId)
|
||||||
|
=> Entries.FirstOrDefault(x => x.TitleId.HasValue && x.TitleId.Value.EqualsIgnoreCase(titleId));
|
||||||
|
|
||||||
|
public static CompatibilityEntry Find(ulong titleId)
|
||||||
|
=> Find(titleId.ToString("X16"));
|
||||||
|
|
||||||
public static LocaleKeys? GetStatus(string titleId)
|
public static LocaleKeys? GetStatus(string titleId)
|
||||||
=> Entries.FirstOrDefault(x => x.TitleId.HasValue && x.TitleId.Value.EqualsIgnoreCase(titleId))?.Status;
|
=> Find(titleId)?.Status;
|
||||||
|
|
||||||
public static LocaleKeys? GetStatus(ulong titleId) => GetStatus(titleId.ToString("X16"));
|
public static LocaleKeys? GetStatus(ulong titleId) => GetStatus(titleId.ToString("X16"));
|
||||||
|
|
||||||
|
public static string GetLabels(string titleId)
|
||||||
|
=> Find(titleId)?.FormattedIssueLabels;
|
||||||
|
|
||||||
|
public static string GetLabels(ulong titleId) => GetLabels(titleId.ToString("X16"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CompatibilityEntry
|
public class CompatibilityEntry
|
||||||
|
|
Loading…
Add table
Reference in a new issue