mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-02-23 21:54:37 +01:00
UI: RPC: Maintain game started timestamp for the duration of the AppHost
This commit is contained in:
parent
250acab7a7
commit
e3f20abd23
@ -3,6 +3,7 @@ using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Threading;
|
||||
using DiscordRPC;
|
||||
using LibHac.Common;
|
||||
using LibHac.Ns;
|
||||
using LibHac.Tools.FsSystem;
|
||||
@ -594,6 +595,8 @@ namespace Ryujinx.Ava
|
||||
gamepad?.ClearLed();
|
||||
gamepad?.Dispose();
|
||||
}
|
||||
|
||||
DiscordIntegrationModule.GuestAppStartedAt = null;
|
||||
|
||||
Rainbow.Disable();
|
||||
Rainbow.Reset();
|
||||
@ -685,6 +688,8 @@ namespace Ryujinx.Ava
|
||||
|
||||
public async Task<bool> LoadGuestApplication(BlitStruct<ApplicationControlProperty>? customNacpData = null)
|
||||
{
|
||||
DiscordIntegrationModule.GuestAppStartedAt = Timestamps.Now;
|
||||
|
||||
InitEmulatedSwitch();
|
||||
MainWindow.UpdateGraphicsConfig();
|
||||
|
||||
|
@ -14,7 +14,8 @@ namespace Ryujinx.Ava
|
||||
{
|
||||
public static class DiscordIntegrationModule
|
||||
{
|
||||
public static Timestamps StartedAt { get; set; }
|
||||
public static Timestamps EmulatorStartedAt { get; set; }
|
||||
public static Timestamps GuestAppStartedAt { get; set; }
|
||||
|
||||
private static string VersionString
|
||||
=> (ReleaseInformation.IsCanaryBuild ? "Canary " : string.Empty) + $"v{ReleaseInformation.Version}";
|
||||
@ -43,7 +44,7 @@ namespace Ryujinx.Ava
|
||||
},
|
||||
Details = "Main Menu",
|
||||
State = "Idling",
|
||||
Timestamps = StartedAt
|
||||
Timestamps = EmulatorStartedAt
|
||||
};
|
||||
|
||||
ConfigurationState.Instance.EnableDiscordIntegration.Event += Update;
|
||||
@ -100,7 +101,7 @@ namespace Ryujinx.Ava
|
||||
State = appMeta.LastPlayed.HasValue && appMeta.TimePlayed.TotalSeconds > 5
|
||||
? $"Total play time: {ValueFormatUtils.FormatTimeSpan(appMeta.TimePlayed)}"
|
||||
: "Never played",
|
||||
Timestamps = Timestamps.Now
|
||||
Timestamps = GuestAppStartedAt ??= Timestamps.Now
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace Ryujinx.Headless
|
||||
public static void Initialize()
|
||||
{
|
||||
// Ensure Discord presence timestamp begins at the absolute start of when Ryujinx is launched
|
||||
DiscordIntegrationModule.StartedAt = Timestamps.Now;
|
||||
DiscordIntegrationModule.EmulatorStartedAt = Timestamps.Now;
|
||||
|
||||
// Delete backup files after updating.
|
||||
Task.Run(Updater.CleanupUpdate);
|
||||
|
@ -94,7 +94,7 @@ namespace Ryujinx.Ava
|
||||
private static void Initialize(string[] args)
|
||||
{
|
||||
// Ensure Discord presence timestamp begins at the absolute start of when Ryujinx is launched
|
||||
DiscordIntegrationModule.StartedAt = Timestamps.Now;
|
||||
DiscordIntegrationModule.EmulatorStartedAt = Timestamps.Now;
|
||||
|
||||
// Parse arguments
|
||||
CommandLineState.ParseArguments(args);
|
||||
|
Loading…
x
Reference in New Issue
Block a user