UI: Link to the Discord in the About window, more Discord RPC games.

This commit is contained in:
Evan Husted 2024-10-12 21:44:13 -05:00
parent df9450d2ad
commit 456f1ec739
7 changed files with 25 additions and 29 deletions

View File

@ -8,7 +8,7 @@ namespace Ryujinx.Common
private const string FlatHubChannelOwner = "flathub";
private const string BuildVersion = "%%RYUJINX_BUILD_VERSION%%";
private const string BuildGitHash = "%%RYUJINX_BUILD_GIT_HASH%%";
public const string BuildGitHash = "%%RYUJINX_BUILD_GIT_HASH%%";
private const string ReleaseChannelName = "%%RYUJINX_TARGET_RELEASE_CHANNEL_NAME%%";
private const string ConfigFileName = "%%RYUJINX_CONFIG_FILE_NAME%%";

View File

@ -27,7 +27,7 @@ namespace Ryujinx.HLE
public TamperMachine TamperMachine { get; }
public IHostUIHandler UIHandler { get; }
public bool EnableDeviceVsync { get; set; } = true;
public bool EnableDeviceVsync { get; set; }
public bool IsFrameAvailable => Gpu.Window.IsFrameAvailable;

View File

@ -15,7 +15,7 @@ namespace Ryujinx.UI.Common
{
public static Timestamps StartedAt { get; set; }
private static readonly string _description = $"{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo} {ReleaseInformation.Version}";
private static readonly string _description = $"v{ReleaseInformation.Version} {ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}@{ReleaseInformation.BuildGitHash}";
private const string ApplicationId = "1293250299716173864";
private const int ApplicationByteLimit = 128;
@ -70,7 +70,7 @@ namespace Ryujinx.UI.Common
{
Assets = new Assets
{
LargeImageKey = _discordGameAssets.Contains(procRes.ProgramIdText.ToLower()) ? procRes.ProgramIdText : "game",
LargeImageKey = _discordGameAssetKeys.Contains(procRes.ProgramIdText.ToLower()) ? procRes.ProgramIdText : "game",
LargeImageText = TruncateToByteLength($"{appMeta.Title} | {procRes.DisplayVersion}"),
SmallImageKey = "ryujinx",
SmallImageText = TruncateToByteLength(_description)
@ -115,11 +115,12 @@ namespace Ryujinx.UI.Common
_discordClient?.Dispose();
}
private static readonly string[] _discordGameAssets = [
private static readonly string[] _discordGameAssetKeys = [
"01002da013484000", // The Legend of Zelda: Skyward Sword HD
"01007ef00011e000", // The Legend of Zelda: Breath of the Wild
"0100f2c0115b6000", // The Legend of Zelda: Tears of the Kingdom
"01008cf01baac000", // The Legend of Zelda: Echoes of Wisdom
"01006bb00c6f0000", // The Legend of Zelda: Link's Awakening
"0100000000010000", // SUPER MARIO ODYSSEY
"010015100b514000", // Super Mario Bros. Wonder
@ -128,6 +129,9 @@ namespace Ryujinx.UI.Common
"010028600ebda000", // Super Mario 3D World + Bowser's Fury
"0100ecd018ebe000", // Paper Mario: The Thousand-Year Door
"010048701995e000", // Luigi's Mansion 2 HD
"0100dca0064a6000", // Luigi's Mansion 3
"01008f6008c5e000", // Pokémon Violet
"0100abf008968000", // Pokémon Sword
"01008db008c2c000", // Pokémon Shield
@ -137,10 +141,11 @@ namespace Ryujinx.UI.Common
"0100aa80194b0000", // Pikmin 1
"0100d680194b2000", // Pikmin 2
"0100f4c009322000", // Pikmin 3 Deluxe
"0100b7c00933a000", // Pikmin
"0100b7c00933a000", // Pikmin 4
"0100c2500fc20000", // Splatoon 3
"0100ba0018500000", // Splatoon 3: Splatfest World Premiere
"01007820196a6000", // Red Dead Redemption
"0100744001588000", // Cars 3: Driven to Win
"01006f8002326000", // Animal Crossing: New Horizons
"0100853015e86000", // No Man's Sky

View File

@ -118,7 +118,7 @@
HorizontalAlignment="Center"
Orientation="Horizontal"
Spacing="10">
<Button
<Button Name="GitHubRepoButton"
MinWidth="30"
MinHeight="30"
MaxWidth="30"
@ -127,7 +127,6 @@
Background="Transparent"
Click="Button_OnClick"
CornerRadius="15"
Tag="https://github.com/GreemDev/Ryujinx"
ToolTip.Tip="{locale:Locale AboutGithubUrlTooltipMessage}">
<Image Source="{Binding GithubLogo}" />
</Button>
@ -140,7 +139,7 @@
Background="Transparent"
Click="Button_OnClick"
CornerRadius="15"
Tag="https://discordapp.com/invite/N2FmfVc"
Tag="https://discord.gg/dHPrkBkkyA"
ToolTip.Tip="{locale:Locale AboutDiscordUrlTooltipMessage}">
<Image Source="{Binding DiscordLogo}" />
</Button>

View File

@ -7,6 +7,7 @@ using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Common;
using Ryujinx.UI.Common.Helper;
using System.Threading.Tasks;
using Button = Avalonia.Controls.Button;
@ -20,6 +21,9 @@ namespace Ryujinx.Ava.UI.Windows
DataContext = new AboutWindowViewModel();
InitializeComponent();
GitHubRepoButton.Tag =
$"https://github.com/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}";
}
public static async Task Show()
@ -46,9 +50,9 @@ namespace Ryujinx.Ava.UI.Windows
private void Button_OnClick(object sender, RoutedEventArgs e)
{
if (sender is Button button)
if (sender is Button { Tag: { } url })
{
OpenHelper.OpenUrl(button.Tag.ToString());
OpenHelper.OpenUrl(url.ToString());
}
}

View File

@ -43,8 +43,7 @@ namespace Ryujinx.Ava.UI.Windows
{
if (ViewModel.AmiiboSelectedIndex > -1)
{
AmiiboApi amiibo = ViewModel.AmiiboList[ViewModel.AmiiboSelectedIndex];
ScannedAmiibo = amiibo;
ScannedAmiibo = ViewModel.AmiiboList[ViewModel.AmiiboSelectedIndex];
IsScanned = true;
Close();
}

View File

@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.Windows
_enabledCheatsPath = Path.Combine(titleModsPath, "cheats", "enabled.txt");
string[] enabled = Array.Empty<string>();
string[] enabled = [];
if (File.Exists(_enabledCheatsPath))
{
@ -101,24 +101,13 @@ namespace Ryujinx.Ava.UI.Windows
public void Save()
{
if (NoCheatsFound)
{
return;
}
List<string> enabledCheats = new();
var enabledCheats = LoadedCheats.SelectMany(it => it.SubNodes)
.Where(it => it.IsEnabled)
.Select(it => it.BuildIdKey);
foreach (var cheats in LoadedCheats)
{
foreach (var cheat in cheats.SubNodes)
{
if (cheat.IsEnabled)
{
enabledCheats.Add(cheat.BuildIdKey);
}
}
}
Directory.CreateDirectory(Path.GetDirectoryName(_enabledCheatsPath));
Directory.CreateDirectory(Path.GetDirectoryName(_enabledCheatsPath)!);
File.WriteAllLines(_enabledCheatsPath, enabledCheats);