mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-03-15 04:14:47 +00:00
UI: Prevent desynced RPC when toggling it off/on while in-game
This commit is contained in:
parent
6a4bc02d7a
commit
abfbc6f4bc
1 changed files with 14 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
using DiscordRPC;
|
||||
using Gommon;
|
||||
using Humanizer;
|
||||
using Humanizer.Localisation;
|
||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||
|
@ -75,11 +76,23 @@ namespace Ryujinx.Ava
|
|||
_discordClient = new DiscordRpcClient(ApplicationId);
|
||||
|
||||
_discordClient.Initialize();
|
||||
_discordClient.SetPresence(_discordPresenceMain);
|
||||
|
||||
Use(TitleIDs.CurrentApplication);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Use(Optional<string> titleId)
|
||||
{
|
||||
if (titleId.TryGet(out string tid))
|
||||
SwitchToPlayingState(
|
||||
ApplicationLibrary.LoadAndSaveMetaData(tid),
|
||||
Switch.Shared.Processes.ActiveApplication
|
||||
);
|
||||
else
|
||||
SwitchToMainState();
|
||||
}
|
||||
|
||||
private static void SwitchToPlayingState(ApplicationMetadata appMeta, ProcessResult procRes)
|
||||
{
|
||||
_discordClient?.SetPresence(new RichPresence
|
||||
|
|
Loading…
Add table
Reference in a new issue