diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index 27086df55..cc3903f5f 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -182,6 +182,8 @@ namespace Dalamud /// internal bool IsReady { get; private set; } + internal bool IsLoadedPluginSystem => this.PluginManager != null; + /// /// Gets location of stored assets. /// @@ -241,10 +243,6 @@ namespace Dalamud Log.Information("[SPOST] LOC OK!"); - this.PluginRepository = - new PluginRepository(this, this.StartInfo.PluginDirectory, this.StartInfo.GameVersion); - - Log.Information("[SPOST] PREPO OK!"); var isInterfaceLoaded = false; if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_INTERFACE") ?? "false")) @@ -293,28 +291,6 @@ namespace Dalamud Log.Information("[SPOST] CH OK!"); - if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_PLUGINS") ?? "false")) - { - try - { - this.PluginRepository.CleanupPlugins(); - - Log.Information("[SPOST] PRC OK!"); - - this.PluginManager = new PluginManager( - this, - this.StartInfo.PluginDirectory, - this.StartInfo.DefaultPluginDirectory); - this.PluginManager.LoadPlugins(); - - Log.Information("[SPOST] PM OK!"); - } - catch (Exception ex) - { - Log.Error(ex, "Plugin load failed."); - } - } - this.ClientState.Enable(); Log.Information("[SPOST] CS ENABLE!"); @@ -339,6 +315,40 @@ namespace Dalamud } } + public void LoadPluginSystem() + { + Log.Information("[LPS] START!"); + + this.PluginRepository = + new PluginRepository(this, this.StartInfo.PluginDirectory, this.StartInfo.GameVersion); + + Log.Information("[LPS] PREPO OK!"); + + if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_PLUGINS") ?? "false")) + { + try + { + this.PluginRepository.CleanupPlugins(); + + Log.Information("[LPS] PRC OK!"); + + this.PluginManager = new PluginManager( + this, + this.StartInfo.PluginDirectory, + this.StartInfo.DefaultPluginDirectory); + this.PluginManager.LoadPlugins(); + + Log.Information("[LPS] PM OK!"); + } + catch (Exception ex) + { + Log.Error(ex, "Plugin load failed."); + } + } + + Log.Information("[LPS] OK!"); + } + /// /// Queue an unload of Dalamud when it gets the chance. /// diff --git a/Dalamud/Game/Internal/Framework.cs b/Dalamud/Game/Internal/Framework.cs index c9104b079..fecad94ce 100644 --- a/Dalamud/Game/Internal/Framework.cs +++ b/Dalamud/Game/Internal/Framework.cs @@ -134,6 +134,9 @@ namespace Dalamud.Game.Internal { if (!this.dalamud.IsReady) this.dalamud.StartSubsystems(); + if (!this.dalamud.IsLoadedPluginSystem && this.dalamud.InterfaceManager.IsReady) + this.dalamud.LoadPluginSystem(); + try { Gui.Chat.UpdateQueue(this); Gui.Toast.UpdateQueue(); diff --git a/Dalamud/Interface/InterfaceManager.cs b/Dalamud/Interface/InterfaceManager.cs index 233dfd708..697f9e49a 100644 --- a/Dalamud/Interface/InterfaceManager.cs +++ b/Dalamud/Interface/InterfaceManager.cs @@ -70,6 +70,8 @@ namespace Dalamud.Interface public bool FontsReady { get; set; } = false; + public bool IsReady => this.scene != null; + public InterfaceManager(Dalamud dalamud, SigScanner scanner) { this.dalamud = dalamud; @@ -281,8 +283,8 @@ namespace Dalamud.Interface } ImGuiHelpers.MainViewport = ImGui.GetMainViewport(); - - Log.Information("[IM] Scene & ImGui setup OK!"); + + Log.Information("[IM] Scene & ImGui setup OK!"); } // Process information needed by ImGuiHelpers each frame.