Skip to content

Commit

Permalink
UI: Link to the Discord in the About window, more Discord RPC games.
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Oct 13, 2024
1 parent df9450d commit 456f1ec
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Ryujinx.Common/ReleaseInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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%%";

Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.HLE/Switch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 9 additions & 4 deletions src/Ryujinx.UI.Common/DiscordIntegrationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/Ryujinx/UI/Windows/AboutWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
HorizontalAlignment="Center"
Orientation="Horizontal"
Spacing="10">
<Button
<Button Name="GitHubRepoButton"
MinWidth="30"
MinHeight="30"
MaxWidth="30"
Expand All @@ -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>
Expand All @@ -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>
Expand Down
8 changes: 6 additions & 2 deletions src/Ryujinx/UI/Windows/AboutWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,6 +21,9 @@ public AboutWindow()
DataContext = new AboutWindowViewModel();

InitializeComponent();

GitHubRepoButton.Tag =
$"https://github.com/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}";
}

public static async Task Show()
Expand All @@ -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());
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/Ryujinx/UI/Windows/AmiiboWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
21 changes: 5 additions & 16 deletions src/Ryujinx/UI/Windows/CheatWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string t

_enabledCheatsPath = Path.Combine(titleModsPath, "cheats", "enabled.txt");

string[] enabled = Array.Empty<string>();
string[] enabled = [];

if (File.Exists(_enabledCheatsPath))
{
Expand Down Expand Up @@ -101,24 +101,13 @@ public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string t
public void Save()
{
if (NoCheatsFound)
{
return;
}

List<string> 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);

Expand Down

0 comments on commit 456f1ec

Please sign in to comment.