mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Add Launching IPC Event. API 5.8
This commit is contained in:
parent
7498bc469f
commit
01e6f58463
4 changed files with 35 additions and 2 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 2cbf4bace53a5749d3eab1ff03025a6e6bd9fc37
|
||||
Subproject commit bd56d82816b8366e19dddfb2dc7fd7f167e264ee
|
||||
|
|
@ -16,13 +16,16 @@ public class PenumbraApi(
|
|||
TemporaryApi temporary,
|
||||
UiApi ui) : IDisposable, IApiService, IPenumbraApi
|
||||
{
|
||||
public const int BreakingVersion = 5;
|
||||
public const int FeatureVersion = 8;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Valid = false;
|
||||
}
|
||||
|
||||
public (int Breaking, int Feature) ApiVersion
|
||||
=> (5, 7);
|
||||
=> (BreakingVersion, FeatureVersion);
|
||||
|
||||
public bool Valid { get; private set; } = true;
|
||||
public IPenumbraApiCollection Collection { get; } = collection;
|
||||
|
|
|
|||
28
Penumbra/Api/IpcLaunchingProvider.cs
Normal file
28
Penumbra/Api/IpcLaunchingProvider.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using Dalamud.Plugin;
|
||||
using OtterGui.Log;
|
||||
using OtterGui.Services;
|
||||
using Penumbra.Api.Api;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace Penumbra.Api;
|
||||
|
||||
public sealed class IpcLaunchingProvider : IApiService
|
||||
{
|
||||
public IpcLaunchingProvider(IDalamudPluginInterface pi, Logger log)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var subscriber = log.MainLogger.IsEnabled(LogEventLevel.Debug)
|
||||
? IpcSubscribers.Launching.Subscriber(pi,
|
||||
(major, minor) => log.Debug($"[IPC] Invoked Penumbra.Launching IPC with API Version {major}.{minor}."))
|
||||
: null;
|
||||
|
||||
using var provider = IpcSubscribers.Launching.Provider(pi);
|
||||
provider.Invoke(PenumbraApi.BreakingVersion, PenumbraApi.FeatureVersion);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Error($"[IPC] Could not invoke Penumbra.Launching IPC:\n{ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,6 +58,8 @@ public class Penumbra : IDalamudPlugin
|
|||
{
|
||||
HookOverrides.Instance = HookOverrides.LoadFile(pluginInterface);
|
||||
_services = StaticServiceManager.CreateProvider(this, pluginInterface, Log);
|
||||
// Invoke the IPC Penumbra.Launching method before any hooks or other services are created.
|
||||
_services.GetService<IpcLaunchingProvider>();
|
||||
Messager = _services.GetService<MessageService>();
|
||||
_validityChecker = _services.GetService<ValidityChecker>();
|
||||
_services.EnsureRequiredServices();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue