mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-01 13:23:40 +01:00
fix: add try/catch and error logging for all tiers
This commit is contained in:
parent
411cf3ee9c
commit
e84cd7f0be
1 changed files with 61 additions and 42 deletions
|
|
@ -189,23 +189,34 @@ namespace Dalamud
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal DirectoryInfo AssetDirectory => new DirectoryInfo(this.StartInfo.AssetDirectory);
|
internal DirectoryInfo AssetDirectory => new DirectoryInfo(this.StartInfo.AssetDirectory);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs tier 1 of the Dalamud initialization process.
|
||||||
|
/// </summary>
|
||||||
public void LoadTier1()
|
public void LoadTier1()
|
||||||
{
|
{
|
||||||
// Initialize the process information.
|
try
|
||||||
this.TargetModule = Process.GetCurrentProcess().MainModule;
|
{
|
||||||
this.SigScanner = new SigScanner(this.TargetModule, true);
|
// Initialize the process information.
|
||||||
|
this.TargetModule = Process.GetCurrentProcess().MainModule;
|
||||||
|
this.SigScanner = new SigScanner(this.TargetModule, true);
|
||||||
|
|
||||||
// Initialize game subsystem
|
// Initialize game subsystem
|
||||||
this.Framework = new Framework(this.SigScanner, this);
|
this.Framework = new Framework(this.SigScanner, this);
|
||||||
|
|
||||||
Log.Information("[T1] Framework OK!");
|
Log.Information("[T1] Framework OK!");
|
||||||
|
|
||||||
this.Framework.Enable();
|
this.Framework.Enable();
|
||||||
Log.Information("[T1] Framework ENABLE!");
|
Log.Information("[T1] Framework ENABLE!");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Tier 1 load failed.");
|
||||||
|
this.Unload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start and initialize Dalamud subsystems.
|
/// Runs tier 2 of the Dalamud initialization process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadTier2()
|
public void LoadTier2()
|
||||||
{
|
{
|
||||||
|
|
@ -296,55 +307,63 @@ namespace Dalamud
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, "Dalamud::LoadTier2() failed.");
|
Log.Error(ex, "Tier 2 load failed.");
|
||||||
this.Unload();
|
this.Unload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the plugin manager and repository.
|
/// Runs tier 3 of the Dalamud initialization process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadTier3()
|
public void LoadTier3()
|
||||||
{
|
{
|
||||||
Log.Information("[T3] START!");
|
try
|
||||||
|
|
||||||
this.PluginRepository =
|
|
||||||
new PluginRepository(this, this.StartInfo.PluginDirectory, this.StartInfo.GameVersion);
|
|
||||||
|
|
||||||
Log.Information("[T3] PREPO OK!");
|
|
||||||
|
|
||||||
if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_PLUGINS") ?? "false"))
|
|
||||||
{
|
{
|
||||||
try
|
Log.Information("[T3] START!");
|
||||||
|
|
||||||
|
this.PluginRepository =
|
||||||
|
new PluginRepository(this, this.StartInfo.PluginDirectory, this.StartInfo.GameVersion);
|
||||||
|
|
||||||
|
Log.Information("[T3] PREPO OK!");
|
||||||
|
|
||||||
|
if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_PLUGINS") ?? "false"))
|
||||||
{
|
{
|
||||||
this.PluginRepository.CleanupPlugins();
|
try
|
||||||
|
{
|
||||||
|
this.PluginRepository.CleanupPlugins();
|
||||||
|
|
||||||
Log.Information("[T3] PRC OK!");
|
Log.Information("[T3] PRC OK!");
|
||||||
|
|
||||||
this.PluginManager = new PluginManager(
|
this.PluginManager = new PluginManager(
|
||||||
this,
|
this,
|
||||||
this.StartInfo.PluginDirectory,
|
this.StartInfo.PluginDirectory,
|
||||||
this.StartInfo.DefaultPluginDirectory);
|
this.StartInfo.DefaultPluginDirectory);
|
||||||
this.PluginManager.LoadSynchronousPlugins();
|
this.PluginManager.LoadSynchronousPlugins();
|
||||||
|
|
||||||
Task.Run(() => this.PluginManager.LoadDeferredPlugins());
|
Task.Run(() => this.PluginManager.LoadDeferredPlugins());
|
||||||
|
|
||||||
Log.Information("[T3] PM OK!");
|
Log.Information("[T3] PM OK!");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, "Plugin load failed.");
|
Log.Error(ex, "Plugin load failed.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.DalamudUi = new DalamudInterface(this);
|
||||||
|
this.InterfaceManager.OnDraw += this.DalamudUi.Draw;
|
||||||
|
|
||||||
|
Log.Information("[T3] DUI OK!");
|
||||||
|
|
||||||
|
Troubleshooting.LogTroubleshooting(this, this.InterfaceManager != null);
|
||||||
|
|
||||||
|
Log.Information("Dalamud is ready.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Tier 3 load failed.");
|
||||||
|
this.Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.DalamudUi = new DalamudInterface(this);
|
|
||||||
this.InterfaceManager.OnDraw += this.DalamudUi.Draw;
|
|
||||||
|
|
||||||
Log.Information("[T3] DUI OK!");
|
|
||||||
|
|
||||||
Troubleshooting.LogTroubleshooting(this, this.InterfaceManager != null);
|
|
||||||
|
|
||||||
Log.Information("Dalamud is ready.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue