From 456f1ec7397844887aad88c26fb2a738ca026dad Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sat, 12 Oct 2024 21:44:13 -0500 Subject: [PATCH] UI: Link to the Discord in the About window, more Discord RPC games. --- src/Ryujinx.Common/ReleaseInformation.cs | 2 +- src/Ryujinx.HLE/Switch.cs | 2 +- .../DiscordIntegrationModule.cs | 13 ++++++++---- src/Ryujinx/UI/Windows/AboutWindow.axaml | 5 ++--- src/Ryujinx/UI/Windows/AboutWindow.axaml.cs | 8 +++++-- src/Ryujinx/UI/Windows/AmiiboWindow.axaml.cs | 3 +-- src/Ryujinx/UI/Windows/CheatWindow.axaml.cs | 21 +++++-------------- 7 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/Ryujinx.Common/ReleaseInformation.cs b/src/Ryujinx.Common/ReleaseInformation.cs index 774ae012a..dfba64191 100644 --- a/src/Ryujinx.Common/ReleaseInformation.cs +++ b/src/Ryujinx.Common/ReleaseInformation.cs @@ -8,7 +8,7 @@ public static class ReleaseInformation 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%%"; diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs index 9dfc69892..61e42775c 100644 --- a/src/Ryujinx.HLE/Switch.cs +++ b/src/Ryujinx.HLE/Switch.cs @@ -27,7 +27,7 @@ public class Switch : IDisposable 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; diff --git a/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs b/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs index 33e8529eb..0901319e4 100644 --- a/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs +++ b/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs @@ -15,7 +15,7 @@ public static class DiscordIntegrationModule { 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 @@ public static void SwitchToPlayingState(ApplicationMetadata appMeta, ProcessResu { 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 @@ public static void Exit() _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 @@ public static void Exit() "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 @@ public static void Exit() "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 diff --git a/src/Ryujinx/UI/Windows/AboutWindow.axaml b/src/Ryujinx/UI/Windows/AboutWindow.axaml index 16ddb87cb..c6fc7e3c3 100644 --- a/src/Ryujinx/UI/Windows/AboutWindow.axaml +++ b/src/Ryujinx/UI/Windows/AboutWindow.axaml @@ -118,7 +118,7 @@ HorizontalAlignment="Center" Orientation="Horizontal" Spacing="10"> - @@ -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}"> diff --git a/src/Ryujinx/UI/Windows/AboutWindow.axaml.cs b/src/Ryujinx/UI/Windows/AboutWindow.axaml.cs index c32661b0c..399d74813 100644 --- a/src/Ryujinx/UI/Windows/AboutWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/AboutWindow.axaml.cs @@ -7,6 +7,7 @@ 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 @@ public AboutWindow() DataContext = new AboutWindowViewModel(); InitializeComponent(); + + GitHubRepoButton.Tag = + $"https://github.com/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}"; } public static async Task Show() @@ -46,9 +50,9 @@ public static async Task Show() 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()); } } diff --git a/src/Ryujinx/UI/Windows/AmiiboWindow.axaml.cs b/src/Ryujinx/UI/Windows/AmiiboWindow.axaml.cs index 8829cb10b..66378f8ad 100644 --- a/src/Ryujinx/UI/Windows/AmiiboWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/AmiiboWindow.axaml.cs @@ -43,8 +43,7 @@ private void ScanButton_Click(object sender, RoutedEventArgs e) { if (ViewModel.AmiiboSelectedIndex > -1) { - AmiiboApi amiibo = ViewModel.AmiiboList[ViewModel.AmiiboSelectedIndex]; - ScannedAmiibo = amiibo; + ScannedAmiibo = ViewModel.AmiiboList[ViewModel.AmiiboSelectedIndex]; IsScanned = true; Close(); } diff --git a/src/Ryujinx/UI/Windows/CheatWindow.axaml.cs b/src/Ryujinx/UI/Windows/CheatWindow.axaml.cs index 8f4c3cebd..da8025b83 100644 --- a/src/Ryujinx/UI/Windows/CheatWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/CheatWindow.axaml.cs @@ -51,7 +51,7 @@ public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string t _enabledCheatsPath = Path.Combine(titleModsPath, "cheats", "enabled.txt"); - string[] enabled = Array.Empty(); + string[] enabled = []; if (File.Exists(_enabledCheatsPath)) { @@ -101,24 +101,13 @@ public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string t public void Save() { if (NoCheatsFound) - { return; - } - List enabledCheats = new(); - - foreach (var cheats in LoadedCheats) - { - foreach (var cheat in cheats.SubNodes) - { - if (cheat.IsEnabled) - { - enabledCheats.Add(cheat.BuildIdKey); - } - } - } + var enabledCheats = LoadedCheats.SelectMany(it => it.SubNodes) + .Where(it => it.IsEnabled) + .Select(it => it.BuildIdKey); - Directory.CreateDirectory(Path.GetDirectoryName(_enabledCheatsPath)); + Directory.CreateDirectory(Path.GetDirectoryName(_enabledCheatsPath)!); File.WriteAllLines(_enabledCheatsPath, enabledCheats);