Use EarlyLoadedService for anything that is not mandatory for kicking off plugin loader

This commit is contained in:
Soreepeong 2024-04-07 21:53:23 +09:00
parent 532781308d
commit 7f5ef03917
43 changed files with 133 additions and 74 deletions

View file

@ -22,15 +22,13 @@ namespace Dalamud.Game;
/// This class represents the Framework of the native game client and grants access to various subsystems.
/// </summary>
[InterfaceVersion("1.0")]
[ServiceManager.BlockingEarlyLoadedService]
[ServiceManager.EarlyLoadedService]
internal sealed class Framework : IInternalDisposableService, IFramework
{
private static readonly ModuleLog Log = new("Framework");
private static readonly Stopwatch StatsStopwatch = new();
private readonly GameLifecycle lifecycle;
private readonly Stopwatch updateStopwatch = new();
private readonly HitchDetector hitchDetector;
@ -38,6 +36,9 @@ internal sealed class Framework : IInternalDisposableService, IFramework
private readonly Hook<OnRealDestroyDelegate> destroyHook;
private readonly FrameworkAddressResolver addressResolver;
[ServiceManager.ServiceDependency]
private readonly GameLifecycle lifecycle = Service<GameLifecycle>.Get();
[ServiceManager.ServiceDependency]
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
@ -51,9 +52,8 @@ internal sealed class Framework : IInternalDisposableService, IFramework
private ulong tickCounter;
[ServiceManager.ServiceConstructor]
private Framework(TargetSigScanner sigScanner, GameLifecycle lifecycle)
private Framework(TargetSigScanner sigScanner)
{
this.lifecycle = lifecycle;
this.hitchDetector = new HitchDetector("FrameworkUpdate", this.configuration.FrameworkUpdateHitch);
this.addressResolver = new FrameworkAddressResolver();
@ -90,7 +90,7 @@ internal sealed class Framework : IInternalDisposableService, IFramework
/// <summary>
/// Executes during FrameworkUpdate before all <see cref="Update"/> delegates.
/// </summary>
internal event IFramework.OnUpdateDelegate BeforeUpdate;
internal event IFramework.OnUpdateDelegate? BeforeUpdate;
/// <summary>
/// Gets or sets a value indicating whether the collection of stats is enabled.