mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-30 19:41:18 +00:00
Discord Rich Presence update (#1029)
* Fix bug * Add a few more titles and move the list from dat file into the code * requested changes
This commit is contained in:
parent
ab4867505e
commit
2816b2bf17
4 changed files with 77 additions and 65 deletions
|
@ -1,14 +1,13 @@
|
||||||
using DiscordRPC;
|
using DiscordRPC;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Ryujinx.Configuration
|
namespace Ryujinx.Configuration
|
||||||
{
|
{
|
||||||
static class DiscordIntegrationModule
|
static class DiscordIntegrationModule
|
||||||
{
|
{
|
||||||
private static DiscordRpcClient DiscordClient;
|
private static DiscordRpcClient _discordClient;
|
||||||
|
|
||||||
private static string LargeDescription = "Ryujinx is a Nintendo Switch emulator.";
|
private static string LargeDescription = "Ryujinx is a Nintendo Switch emulator.";
|
||||||
|
|
||||||
|
@ -38,25 +37,25 @@ namespace Ryujinx.Configuration
|
||||||
// If the integration was active, disable it and unload everything
|
// If the integration was active, disable it and unload everything
|
||||||
if (e.OldValue)
|
if (e.OldValue)
|
||||||
{
|
{
|
||||||
DiscordClient?.Dispose();
|
_discordClient?.Dispose();
|
||||||
|
|
||||||
DiscordClient = null;
|
_discordClient = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we need to activate it and the client isn't active, initialize it
|
// If we need to activate it and the client isn't active, initialize it
|
||||||
if (e.NewValue && DiscordClient == null)
|
if (e.NewValue && _discordClient == null)
|
||||||
{
|
{
|
||||||
DiscordClient = new DiscordRpcClient("568815339807309834");
|
_discordClient = new DiscordRpcClient("568815339807309834");
|
||||||
|
|
||||||
DiscordClient.Initialize();
|
_discordClient.Initialize();
|
||||||
DiscordClient.SetPresence(DiscordPresence);
|
_discordClient.SetPresence(DiscordPresence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SwitchToPlayingState(string titleId, string titleName)
|
public static void SwitchToPlayingState(string titleId, string titleName)
|
||||||
{
|
{
|
||||||
if (File.ReadAllLines(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RPsupported.dat")).Contains(titleId))
|
if (SupportedTitles.Contains(titleId))
|
||||||
{
|
{
|
||||||
DiscordPresence.Assets.LargeImageKey = titleId;
|
DiscordPresence.Assets.LargeImageKey = titleId;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +85,7 @@ namespace Ryujinx.Configuration
|
||||||
DiscordPresence.Assets.SmallImageText = LargeDescription;
|
DiscordPresence.Assets.SmallImageText = LargeDescription;
|
||||||
DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow);
|
DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow);
|
||||||
|
|
||||||
DiscordClient?.SetPresence(DiscordPresence);
|
_discordClient?.SetPresence(DiscordPresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SwitchToMainMenu()
|
public static void SwitchToMainMenu()
|
||||||
|
@ -99,12 +98,75 @@ namespace Ryujinx.Configuration
|
||||||
DiscordPresence.Assets.SmallImageText = null;
|
DiscordPresence.Assets.SmallImageText = null;
|
||||||
DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow);
|
DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow);
|
||||||
|
|
||||||
DiscordClient?.SetPresence(DiscordPresence);
|
_discordClient?.SetPresence(DiscordPresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Exit()
|
public static void Exit()
|
||||||
{
|
{
|
||||||
DiscordClient?.Dispose();
|
_discordClient?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly string[] SupportedTitles =
|
||||||
|
{
|
||||||
|
"0100000000010000", // Super Mario Odyssey™
|
||||||
|
"01000b900d8b0000", // Cadence of Hyrule – Crypt of the NecroDancer Featuring The Legend of Zelda
|
||||||
|
"01000d200ac0c000", // Bud Spencer & Terence Hill - Slaps And Beans
|
||||||
|
"01000d700be88000", // My Girlfriend is a Mermaid!?
|
||||||
|
"01000dc007e90000", // Sparkle Unleashed
|
||||||
|
"01000e2003fa0000", // MIGHTY GUNVOLT BURST
|
||||||
|
"0100225000fee000", // Blaster Master Zero
|
||||||
|
"010028d0045ce000", // Sparkle 2
|
||||||
|
"01002b30028f6000", // Celeste
|
||||||
|
"01002fc00c6d0000", // Witch Thief
|
||||||
|
"010034e005c9c000", // Code of Princess EX
|
||||||
|
"010036b0034e4000", // Super Mario Party™
|
||||||
|
"01003d200baa2000", // Pokémon Mystery Dungeon™: Rescue Team DX
|
||||||
|
"01004f8006a78000", // Super Meat Boy
|
||||||
|
"010051f00ac5e000", // SEGA AGES Sonic The Hedgehog
|
||||||
|
"010055d009f78000", // Fire Emblem™: Three Houses
|
||||||
|
"010056e00853a000", // A Hat in Time
|
||||||
|
"0100574009f9e000", // 嘘つき姫と盲目王子
|
||||||
|
"01005d700e742000", // DOOM 64
|
||||||
|
"0100628004bce000", // Nights of Azure 2: Bride of the New Moon
|
||||||
|
"0100633007d48000", // Hollow Knight
|
||||||
|
"010065500b218000", // メモリーズオフ -Innocent Fille-
|
||||||
|
"010068f00aa78000", // FINAL FANTASY XV POCKET EDITION HD
|
||||||
|
"01006bb00c6f0000", // The Legend of Zelda™: Link’s Awakening
|
||||||
|
"01006f8002326000", // Animal Crossing™: New Horizons
|
||||||
|
"01006a800016e000", // Super Smash Bros.™ Ultimate
|
||||||
|
"010072800cbe8000", // PC Building Simulator
|
||||||
|
"01007300020fa000", // ASTRAL CHAIN
|
||||||
|
"01007330027ee000", // Ultra Street Fighter® II: The Final Challengers
|
||||||
|
"0100749009844000", // 20XX
|
||||||
|
"01007a4008486000", // Enchanting Mahjong Match
|
||||||
|
"01007ef00011e000", // The Legend of Zelda™: Breath of the Wild
|
||||||
|
"010080b00ad66000", // Undertale
|
||||||
|
"010082400bcc6000", // Untitled Goose Game
|
||||||
|
"01008db008c2c000", // Pokémon™ Shield
|
||||||
|
"010094e00b52e000", // Capcom Beat 'Em Up Bundle
|
||||||
|
"01009aa000faa000", // Sonic Mania
|
||||||
|
"01009b90006dc000", // Super Mario Maker™ 2
|
||||||
|
"01009cc00c97c000", // DEAD OR ALIVE Xtreme 3 Scarlet 基本無料版
|
||||||
|
"0100ea80032ea000", // New Super Mario Bros.™ U Deluxe
|
||||||
|
"0100a4200a284000", // LUMINES REMASTERED
|
||||||
|
"0100a5c00d162000", // Cuphead
|
||||||
|
"0100abf008968000", // Pokémon™ Sword
|
||||||
|
"0100ae000aebc000", // Angels of Death
|
||||||
|
"0100b3f000be2000", // Pokkén Tournament™ DX
|
||||||
|
"0100bc2004ff4000", // Owlboy
|
||||||
|
"0100cf3007578000", // Atari Flashback Classics
|
||||||
|
"0100d5d00c6be000", // Our World Is Ended.
|
||||||
|
"0100d6b00cd88000", // YUMENIKKI -DREAM DIARY-
|
||||||
|
"0100d870045b6000", // Nintendo Entertainment System™ - Nintendo Switch Online
|
||||||
|
"0100e0c00adac000", // SENRAN KAGURA Reflexions
|
||||||
|
"0100e46006708000", // Terraria
|
||||||
|
"0100e7200b272000", // Lanota
|
||||||
|
"0100e9f00b882000", // null
|
||||||
|
"0100eab00605c000", // Poly Bridge
|
||||||
|
"0100efd00a4fa000", // Shantae and the Pirate's Curse
|
||||||
|
"0100f6a00a684000", // ひぐらしのなく頃に奉
|
||||||
|
"0100f9f00c696000", // Crash™ Team Racing Nitro-Fueled
|
||||||
|
"051337133769a000", // RGB-Seizure
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
01000d200ac0c000
|
|
||||||
01000d700be88000
|
|
||||||
01000dc007e90000
|
|
||||||
01000e2003fa0000
|
|
||||||
0100225000fee000
|
|
||||||
010028d0045ce000
|
|
||||||
01002b30028f6000
|
|
||||||
01002fc00c6d0000
|
|
||||||
010034e005c9c000
|
|
||||||
01004f8006a78000
|
|
||||||
010051f00ac5e000
|
|
||||||
010056e00853a000
|
|
||||||
0100574009f9e000
|
|
||||||
0100628004bce000
|
|
||||||
0100633007d48000
|
|
||||||
010065500b218000
|
|
||||||
010068f00aa78000
|
|
||||||
01006a800016e000
|
|
||||||
010072800cbe8000
|
|
||||||
01007300020fa000
|
|
||||||
01007330027ee000
|
|
||||||
0100749009844000
|
|
||||||
01007a4008486000
|
|
||||||
01007ef00011e000
|
|
||||||
010080b00ad66000
|
|
||||||
01008db008c2c000
|
|
||||||
010094e00b52e000
|
|
||||||
01009aa000faa000
|
|
||||||
01009b90006dc000
|
|
||||||
01009cc00c97c000
|
|
||||||
0100a4200a284000
|
|
||||||
0100a5c00d162000
|
|
||||||
0100abf008968000
|
|
||||||
0100ae000aebc000
|
|
||||||
0100b3f000be2000
|
|
||||||
0100bc2004ff4000
|
|
||||||
0100cf3007578000
|
|
||||||
0100d5d00c6be000
|
|
||||||
0100d6b00cd88000
|
|
||||||
0100d870045b6000
|
|
||||||
0100e0c00adac000
|
|
||||||
0100e46006708000
|
|
||||||
0100e7200b272000
|
|
||||||
0100e9f00b882000
|
|
||||||
0100eab00605c000
|
|
||||||
0100efd00a4fa000
|
|
||||||
0100f6a00a684000
|
|
||||||
0100f9f00c696000
|
|
||||||
051337133769a000
|
|
|
@ -93,9 +93,6 @@
|
||||||
<None Update="Config.json" Condition="'$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Profile Debug'">
|
<None Update="Config.json" Condition="'$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Profile Debug'">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="RPsupported.dat">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -363,7 +363,9 @@ namespace Ryujinx.Ui
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.PrintWarning(LogClass.Application, "Please specify a valid XCI/NCA/NSP/PFS0/NRO file.");
|
Logger.PrintWarning(LogClass.Application, "Please specify a valid XCI/NCA/NSP/PFS0/NRO file.");
|
||||||
End(device);
|
device.Dispose();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_emulationContext = device;
|
_emulationContext = device;
|
||||||
|
|
Loading…
Reference in a new issue