Show exception in service init error message

This commit is contained in:
goaaats 2025-04-26 21:52:45 +02:00
parent febf4e55a4
commit c82bb8191d

View file

@ -35,7 +35,7 @@ internal sealed class Dalamud : IServiceType
private static int shownServiceError = 0; private static int shownServiceError = 0;
private readonly ManualResetEvent unloadSignal; private readonly ManualResetEvent unloadSignal;
#endregion #endregion
/// <summary> /// <summary>
@ -48,15 +48,15 @@ internal sealed class Dalamud : IServiceType
public Dalamud(DalamudStartInfo info, ReliableFileStorage fs, DalamudConfiguration configuration, IntPtr mainThreadContinueEvent) public Dalamud(DalamudStartInfo info, ReliableFileStorage fs, DalamudConfiguration configuration, IntPtr mainThreadContinueEvent)
{ {
this.StartInfo = info; this.StartInfo = info;
this.unloadSignal = new ManualResetEvent(false); this.unloadSignal = new ManualResetEvent(false);
this.unloadSignal.Reset(); this.unloadSignal.Reset();
// Directory resolved signatures(CS, our own) will be cached in // Directory resolved signatures(CS, our own) will be cached in
var cacheDir = new DirectoryInfo(Path.Combine(this.StartInfo.WorkingDirectory!, "cachedSigs")); var cacheDir = new DirectoryInfo(Path.Combine(this.StartInfo.WorkingDirectory!, "cachedSigs"));
if (!cacheDir.Exists) if (!cacheDir.Exists)
cacheDir.Create(); cacheDir.Create();
// Set up the SigScanner for our target module // Set up the SigScanner for our target module
TargetSigScanner scanner; TargetSigScanner scanner;
using (Timings.Start("SigScanner Init")) using (Timings.Start("SigScanner Init"))
@ -71,10 +71,10 @@ internal sealed class Dalamud : IServiceType
configuration, configuration,
scanner, scanner,
Localization.FromAssets(info.AssetDirectory!, configuration.LanguageOverride)); Localization.FromAssets(info.AssetDirectory!, configuration.LanguageOverride));
// Set up FFXIVClientStructs // Set up FFXIVClientStructs
this.SetupClientStructsResolver(cacheDir); this.SetupClientStructsResolver(cacheDir);
void KickoffGameThread() void KickoffGameThread()
{ {
Log.Verbose("=============== GAME THREAD KICKOFF ==============="); Log.Verbose("=============== GAME THREAD KICKOFF ===============");
@ -85,12 +85,12 @@ internal sealed class Dalamud : IServiceType
void HandleServiceInitFailure(Task t) void HandleServiceInitFailure(Task t)
{ {
Log.Error(t.Exception!, "Service initialization failure"); Log.Error(t.Exception!, "Service initialization failure");
if (Interlocked.CompareExchange(ref shownServiceError, 1, 0) != 0) if (Interlocked.CompareExchange(ref shownServiceError, 1, 0) != 0)
return; return;
Util.Fatal( Util.Fatal(
"Dalamud failed to load all necessary services.\n\nThe game will continue, but you may not be able to use plugins.", $"Dalamud failed to load all necessary services.\nThe game will continue, but you may not be able to use plugins.\n\n{t.Exception}",
"Dalamud", false); "Dalamud", false);
} }
@ -124,7 +124,7 @@ internal sealed class Dalamud : IServiceType
this.DebugExceptionFilter = Service<TargetSigScanner>.Get().ScanText(debugSig); this.DebugExceptionFilter = Service<TargetSigScanner>.Get().ScanText(debugSig);
Log.Debug($"SE debug exception filter at {this.DebugExceptionFilter.ToInt64():X}"); Log.Debug($"SE debug exception filter at {this.DebugExceptionFilter.ToInt64():X}");
} }
/// <summary> /// <summary>
/// Gets the start information for this Dalamud instance. /// Gets the start information for this Dalamud instance.
/// </summary> /// </summary>
@ -188,7 +188,7 @@ internal sealed class Dalamud : IServiceType
/// <summary> /// <summary>
/// Replace the current exception handler with the default one. /// Replace the current exception handler with the default one.
/// </summary> /// </summary>
internal void UseDefaultExceptionHandler() => internal void UseDefaultExceptionHandler() =>
this.SetExceptionHandler(this.DefaultExceptionFilter); this.SetExceptionHandler(this.DefaultExceptionFilter);
/// <summary> /// <summary>