From 82dcd0912e6fa6bc001148d2c1ffad1b28eb9931 Mon Sep 17 00:00:00 2001 From: Kenneth M Date: Fri, 3 Jan 2025 08:33:45 -0600 Subject: [PATCH] Add `OpenMainWindow` to `PenumbraService` --- Brio/IPC/PenumbraService.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Brio/IPC/PenumbraService.cs b/Brio/IPC/PenumbraService.cs index bf71243a..97805065 100644 --- a/Brio/IPC/PenumbraService.cs +++ b/Brio/IPC/PenumbraService.cs @@ -30,6 +30,7 @@ internal class PenumbraService : IDisposable private readonly GetCollections _penumbraGetCollections; private readonly SetCollectionForObject _penumbraSetCollectionForObject; private readonly GetCollectionForObject _penumbraGetCollectionForObject; + private readonly OpenMainWindow _penumbraOpenMainWindow; public PenumbraService(IDalamudPluginInterface pluginInterface, ConfigurationService configurationService) { @@ -40,6 +41,7 @@ public PenumbraService(IDalamudPluginInterface pluginInterface, ConfigurationSer _penumbraDisposedSubscriber = Penumbra.Api.IpcSubscribers.Disposed.Subscriber(pluginInterface, RefreshPenumbraStatus); _penumbraRedrawEvent = Penumbra.Api.IpcSubscribers.GameObjectRedrawn.Subscriber(pluginInterface, HandlePenumbraRedraw); + _penumbraOpenMainWindow = new Penumbra.Api.IpcSubscribers.OpenMainWindow(pluginInterface); _penumbraGetCollectionForObject = new Penumbra.Api.IpcSubscribers.GetCollectionForObject(_pluginInterface); _penumbraSetCollectionForObject = new Penumbra.Api.IpcSubscribers.SetCollectionForObject(_pluginInterface); _penumbraGetCollections = new Penumbra.Api.IpcSubscribers.GetCollections(_pluginInterface); @@ -72,7 +74,6 @@ bool ConnectToPenumbra() return false; } - var (major, minor) = _penumbraApiVersion.Invoke(); if(major != PenumbraApiMajor || minor < PenumbraApiMinor) { @@ -80,21 +81,24 @@ bool ConnectToPenumbra() return false; } - - Brio.Log.Debug("Penumbra integration initialized"); return true; } catch(Exception ex) { - Brio.Log.Debug(ex, "Penumbra initialize error"); + Brio.Log.Error(ex, "Penumbra initialize error"); return false; } } } + public void OpenPenumbra() + { + _penumbraOpenMainWindow.Invoke(Penumbra.Api.Enums.TabType.Mods); + } + public string GetCollectionForObject(IGameObject gameObject) { var (_, _, collection) = _penumbraGetCollectionForObject.Invoke(gameObject.ObjectIndex);