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