mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 00:16:23 +02:00
Compare commits
5 commits
Canary-1.3
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0cc94fdf37 | ||
![]() |
74a9b94227 | ||
![]() |
d3208a4c44 | ||
![]() |
5d136980a3 | ||
![]() |
572ad1eac5 |
6 changed files with 300 additions and 296 deletions
File diff suppressed because it is too large
Load diff
|
@ -75,6 +75,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
|
|
||||||
private readonly long _ticksPerFrame;
|
private readonly long _ticksPerFrame;
|
||||||
private readonly Stopwatch _chrono;
|
private readonly Stopwatch _chrono;
|
||||||
|
private readonly Stopwatch _playTimer;
|
||||||
private long _ticks;
|
private long _ticks;
|
||||||
|
|
||||||
private readonly AccountManager _accountManager;
|
private readonly AccountManager _accountManager;
|
||||||
|
@ -175,6 +176,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
|
|
||||||
_chrono = new Stopwatch();
|
_chrono = new Stopwatch();
|
||||||
_ticksPerFrame = Stopwatch.Frequency / TargetFps;
|
_ticksPerFrame = Stopwatch.Frequency / TargetFps;
|
||||||
|
_playTimer = new Stopwatch();
|
||||||
|
|
||||||
if (ApplicationPath.StartsWith("@SystemContent"))
|
if (ApplicationPath.StartsWith("@SystemContent"))
|
||||||
{
|
{
|
||||||
|
@ -565,6 +567,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
_isActive = false;
|
_isActive = false;
|
||||||
|
_playTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Exit()
|
private void Exit()
|
||||||
|
@ -616,7 +619,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
private void Dispose()
|
private void Dispose()
|
||||||
{
|
{
|
||||||
if (Device.Processes != null)
|
if (Device.Processes != null)
|
||||||
MainWindowViewModel.UpdateGameMetadata(Device.Processes.ActiveApplication.ProgramIdText);
|
MainWindowViewModel.UpdateGameMetadata(Device.Processes.ActiveApplication.ProgramIdText, _playTimer.Elapsed);
|
||||||
|
|
||||||
ConfigurationState.Instance.System.IgnoreMissingServices.Event -= UpdateIgnoreMissingServicesState;
|
ConfigurationState.Instance.System.IgnoreMissingServices.Event -= UpdateIgnoreMissingServicesState;
|
||||||
ConfigurationState.Instance.Graphics.AspectRatio.Event -= UpdateAspectRatioState;
|
ConfigurationState.Instance.Graphics.AspectRatio.Event -= UpdateAspectRatioState;
|
||||||
|
@ -635,6 +638,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
_gpuCancellationTokenSource.Dispose();
|
_gpuCancellationTokenSource.Dispose();
|
||||||
|
|
||||||
_chrono.Stop();
|
_chrono.Stop();
|
||||||
|
_playTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisposeGpu()
|
public void DisposeGpu()
|
||||||
|
@ -868,6 +872,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText,
|
ApplicationLibrary.LoadAndSaveMetaData(Device.Processes.ActiveApplication.ProgramIdText,
|
||||||
appMetadata => appMetadata.UpdatePreGame()
|
appMetadata => appMetadata.UpdatePreGame()
|
||||||
);
|
);
|
||||||
|
_playTimer.Start();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -877,6 +882,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
Device?.System.TogglePauseEmulation(false);
|
Device?.System.TogglePauseEmulation(false);
|
||||||
|
|
||||||
_viewModel.IsPaused = false;
|
_viewModel.IsPaused = false;
|
||||||
|
_playTimer.Start();
|
||||||
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowOldUI);
|
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowOldUI);
|
||||||
Logger.Info?.Print(LogClass.Emulation, "Emulation was resumed");
|
Logger.Info?.Print(LogClass.Emulation, "Emulation was resumed");
|
||||||
}
|
}
|
||||||
|
@ -886,6 +892,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
Device?.System.TogglePauseEmulation(true);
|
Device?.System.TogglePauseEmulation(true);
|
||||||
|
|
||||||
_viewModel.IsPaused = true;
|
_viewModel.IsPaused = true;
|
||||||
|
_playTimer.Stop();
|
||||||
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowOldUI, LocaleManager.Instance[LocaleKeys.Paused]);
|
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowOldUI, LocaleManager.Instance[LocaleKeys.Paused]);
|
||||||
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
|
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,19 +33,11 @@ namespace Ryujinx.Ava.Systems.AppLibrary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates <see cref="LastPlayed"/> and <see cref="TimePlayed"/>. Call this after a game ends.
|
/// Updates <see cref="LastPlayed"/> and <see cref="TimePlayed"/>. Call this after a game ends.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdatePostGame()
|
/// <param name="playTime">The active gameplay time this past session.</param>
|
||||||
|
public void UpdatePostGame(TimeSpan playTime)
|
||||||
{
|
{
|
||||||
DateTime? prevLastPlayed = LastPlayed;
|
|
||||||
UpdatePreGame();
|
UpdatePreGame();
|
||||||
|
TimePlayed += playTime;
|
||||||
if (!prevLastPlayed.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TimeSpan diff = DateTime.UtcNow - prevLastPlayed.Value;
|
|
||||||
double newTotalSeconds = TimePlayed.Add(diff).TotalSeconds;
|
|
||||||
TimePlayed = TimeSpan.FromSeconds(Math.Round(newTotalSeconds, MidpointRounding.AwayFromZero));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,10 +310,15 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
|
|
||||||
private void TotalTimePlayed_Recalculated(Optional<TimeSpan> ts)
|
private void TotalTimePlayed_Recalculated(Optional<TimeSpan> ts)
|
||||||
{
|
{
|
||||||
ShowTotalTimePlayed = ts.HasValue;
|
|
||||||
|
|
||||||
if (ts.HasValue)
|
if (ts.HasValue)
|
||||||
LocaleManager.Instance.SetDynamicValues(LocaleKeys.GameListLabelTotalTimePlayed, ValueFormatUtils.FormatTimeSpan(ts.Value));
|
{
|
||||||
|
var formattedPlayTime = ValueFormatUtils.FormatTimeSpan(ts.Value);
|
||||||
|
LocaleManager.Instance.SetDynamicValues(LocaleKeys.GameListLabelTotalTimePlayed, formattedPlayTime);
|
||||||
|
ShowTotalTimePlayed = formattedPlayTime != string.Empty;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowTotalTimePlayed = ts.HasValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ShowTotalTimePlayed
|
public bool ShowTotalTimePlayed
|
||||||
|
@ -334,7 +339,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
_listSelectedApplication = value;
|
_listSelectedApplication = value;
|
||||||
|
|
||||||
if (_listSelectedApplication != null && ListAppContextMenu == null)
|
if (_listSelectedApplication != null && ListAppContextMenu == null)
|
||||||
|
|
||||||
ListAppContextMenu = new ApplicationContextMenu();
|
ListAppContextMenu = new ApplicationContextMenu();
|
||||||
else if (_listSelectedApplication == null && ListAppContextMenu != null)
|
else if (_listSelectedApplication == null && ListAppContextMenu != null)
|
||||||
ListAppContextMenu = null!;
|
ListAppContextMenu = null!;
|
||||||
|
@ -1688,8 +1692,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
RendererHostControl.Focus();
|
RendererHostControl.Focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
public static void UpdateGameMetadata(string titleId)
|
public static void UpdateGameMetadata(string titleId, TimeSpan playTime)
|
||||||
=> ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata => appMetadata.UpdatePostGame());
|
=> ApplicationLibrary.LoadAndSaveMetaData(titleId, appMetadata => appMetadata.UpdatePostGame(playTime));
|
||||||
|
|
||||||
public void RefreshFirmwareStatus()
|
public void RefreshFirmwareStatus()
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
MinWidth="200"
|
MinWidth="200"
|
||||||
Height="6"
|
Height="6"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
Margin="0, 0, 5, 0"
|
||||||
Foreground="{DynamicResource SystemAccentColorLight2}"
|
Foreground="{DynamicResource SystemAccentColorLight2}"
|
||||||
IsVisible="{Binding StatusBarVisible}"
|
IsVisible="{Binding StatusBarVisible}"
|
||||||
Maximum="{Binding StatusBarProgressMaximum}"
|
Maximum="{Binding StatusBarProgressMaximum}"
|
||||||
|
|
|
@ -213,13 +213,13 @@ namespace Ryujinx.Ava.UI.Windows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Application_Opened(object sender, ApplicationOpenedEventArgs args)
|
public async void Application_Opened(object sender, ApplicationOpenedEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Application != null)
|
if (args.Application != null)
|
||||||
{
|
{
|
||||||
ViewModel.SelectedIcon = args.Application.Icon;
|
ViewModel.SelectedIcon = args.Application.Icon;
|
||||||
|
|
||||||
ViewModel.LoadApplication(args.Application).Wait();
|
await ViewModel.LoadApplication(args.Application);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue