Skip to content

Commit

Permalink
Add OpenMainWindow to PenumbraService
Browse files Browse the repository at this point in the history
  • Loading branch information
Minmoose committed Jan 3, 2025
1 parent 1591e3d commit 82dcd09
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Brio/IPC/PenumbraService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down Expand Up @@ -72,29 +74,31 @@ bool ConnectToPenumbra()
return false;
}


var (major, minor) = _penumbraApiVersion.Invoke();
if(major != PenumbraApiMajor || minor < PenumbraApiMinor)
{
Brio.Log.Warning($"Penumbra API mismatch!, found v{major}.{minor}");
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);
Expand Down

0 comments on commit 82dcd09

Please sign in to comment.