feat: show error message if tier 3 load never happened

This commit is contained in:
goaaats 2021-10-20 22:39:13 +02:00
parent 491a0acca9
commit a819c72913
No known key found for this signature in database
GPG key ID: F18F057873895461
2 changed files with 19 additions and 0 deletions

View file

@ -13,6 +13,7 @@ using Dalamud.Hooking;
using Dalamud.Interface.Internal; using Dalamud.Interface.Internal;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Utility;
using Serilog; using Serilog;
namespace Dalamud.Game namespace Dalamud.Game
@ -27,6 +28,8 @@ namespace Dalamud.Game
private static Stopwatch statsStopwatch = new(); private static Stopwatch statsStopwatch = new();
private Stopwatch updateStopwatch = new(); private Stopwatch updateStopwatch = new();
private DateTime timeSinceTier2;
private Hook<OnUpdateDetour> updateHook; private Hook<OnUpdateDetour> updateHook;
private Hook<OnDestroyDetour> destroyHook; private Hook<OnDestroyDetour> destroyHook;
private Hook<OnRealDestroyDelegate> realDestroyHook; private Hook<OnRealDestroyDelegate> realDestroyHook;
@ -174,11 +177,23 @@ namespace Dalamud.Game
// If this is the first time we are running this loop, we need to init Dalamud subsystems synchronously // If this is the first time we are running this loop, we need to init Dalamud subsystems synchronously
if (!dalamud.IsReady) if (!dalamud.IsReady)
{
dalamud.LoadTier2(); dalamud.LoadTier2();
this.timeSinceTier2 = DateTime.Now;
goto original;
}
if (!dalamud.IsLoadedPluginSystem && (DateTime.Now - this.timeSinceTier2).TotalSeconds > 30)
{
Util.Fatal("The Dalamud plugin system could not initialize important subsystems.\nThis error may be caused by outdated ReShade or GShade installations.\n\nIf this error persists, please contact us.", "XIVLauncher Error");
}
// Plugins expect the interface to be available and ready, so we need to wait with plugins until we have init'd ImGui // Plugins expect the interface to be available and ready, so we need to wait with plugins until we have init'd ImGui
if (!dalamud.IsLoadedPluginSystem && Service<InterfaceManager>.GetNullable()?.IsReady == true) if (!dalamud.IsLoadedPluginSystem && Service<InterfaceManager>.GetNullable()?.IsReady == true)
{
dalamud.LoadTier3(); dalamud.LoadTier3();
goto original;
}
try try
{ {
@ -254,6 +269,7 @@ namespace Dalamud.Game
} }
} }
original:
return this.updateHook.Original(framework); return this.updateHook.Original(framework);
} }

View file

@ -6,6 +6,7 @@ using Dalamud.Configuration.Internal;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Utility; using Dalamud.Utility;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog;
namespace Dalamud.Interface.Style namespace Dalamud.Interface.Style
{ {
@ -83,6 +84,8 @@ namespace Dalamud.Interface.Style
configuration.SavedStyles = new List<StyleModel>(); configuration.SavedStyles = new List<StyleModel>();
configuration.SavedStyles.AddRange(configuration.SavedStylesOld); configuration.SavedStyles.AddRange(configuration.SavedStylesOld);
Log.Information("Transferred {0} styles", configuration.SavedStyles.Count);
configuration.SavedStylesOld = null; configuration.SavedStylesOld = null;
configuration.Save(); configuration.Save();
} }