mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 20:33:40 +01:00
Add a message to the plugin window when SafeMode is active
This commit is contained in:
parent
e302b3bd8f
commit
910176914e
3 changed files with 33 additions and 13 deletions
|
|
@ -236,15 +236,14 @@ namespace Dalamud
|
||||||
{
|
{
|
||||||
Log.Information("[T3] START!");
|
Log.Information("[T3] START!");
|
||||||
|
|
||||||
|
var pluginManager = Service<PluginManager>.Set();
|
||||||
|
Service<CallGate>.Set();
|
||||||
|
|
||||||
if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_PLUGINS") ?? "false"))
|
if (!bool.Parse(Environment.GetEnvironmentVariable("DALAMUD_NOT_HAVE_PLUGINS") ?? "false"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Service<CallGate>.Set();
|
pluginManager.OnInstalledPluginsChanged += Troubleshooting.LogTroubleshooting;
|
||||||
|
|
||||||
var pluginManager = Service<PluginManager>.Set();
|
|
||||||
pluginManager.OnInstalledPluginsChanged += () =>
|
|
||||||
Troubleshooting.LogTroubleshooting();
|
|
||||||
|
|
||||||
Log.Information("[T3] PM OK!");
|
Log.Information("[T3] PM OK!");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -770,6 +770,12 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
{
|
{
|
||||||
var pluginManager = Service<PluginManager>.Get();
|
var pluginManager = Service<PluginManager>.Get();
|
||||||
|
|
||||||
|
if (pluginManager.SafeMode)
|
||||||
|
{
|
||||||
|
ImGui.Text(Locs.TabBody_SafeMode);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var ready = pluginManager.PluginsReady && pluginManager.ReposReady;
|
var ready = pluginManager.PluginsReady && pluginManager.ReposReady;
|
||||||
|
|
||||||
if (!ready)
|
if (!ready)
|
||||||
|
|
@ -1873,6 +1879,8 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
public static string TabBody_DownloadFailed => Loc.Localize("InstallerDownloadFailed", "Download failed.");
|
public static string TabBody_DownloadFailed => Loc.Localize("InstallerDownloadFailed", "Download failed.");
|
||||||
|
|
||||||
|
public static string TabBody_SafeMode => Loc.Localize("InstallerSafeMode", "Dalamud is running in Plugin Safe Mode, restart to activate plugins.");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Search text
|
#region Search text
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ using Dalamud.Plugin.Internal.Exceptions;
|
||||||
using Dalamud.Plugin.Internal.Types;
|
using Dalamud.Plugin.Internal.Types;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Dalamud.Plugin.Internal
|
namespace Dalamud.Plugin.Internal
|
||||||
|
|
@ -52,6 +51,7 @@ namespace Dalamud.Plugin.Internal
|
||||||
public PluginManager()
|
public PluginManager()
|
||||||
{
|
{
|
||||||
var startInfo = Service<DalamudStartInfo>.Get();
|
var startInfo = Service<DalamudStartInfo>.Get();
|
||||||
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
|
|
||||||
this.pluginDirectory = new DirectoryInfo(startInfo.PluginDirectory);
|
this.pluginDirectory = new DirectoryInfo(startInfo.PluginDirectory);
|
||||||
this.devPluginDirectory = new DirectoryInfo(startInfo.DefaultPluginDirectory);
|
this.devPluginDirectory = new DirectoryInfo(startInfo.DefaultPluginDirectory);
|
||||||
|
|
@ -62,6 +62,12 @@ namespace Dalamud.Plugin.Internal
|
||||||
if (!this.devPluginDirectory.Exists)
|
if (!this.devPluginDirectory.Exists)
|
||||||
this.devPluginDirectory.Create();
|
this.devPluginDirectory.Create();
|
||||||
|
|
||||||
|
if (this.SafeMode = configuration.PluginSafeMode)
|
||||||
|
{
|
||||||
|
configuration.PluginSafeMode = false;
|
||||||
|
configuration.Save();
|
||||||
|
}
|
||||||
|
|
||||||
this.PluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(startInfo.ConfigurationPath) ?? string.Empty, "pluginConfigs"));
|
this.PluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(startInfo.ConfigurationPath) ?? string.Empty, "pluginConfigs"));
|
||||||
|
|
||||||
var bannedPluginsJson = File.ReadAllText(Path.Combine(startInfo.AssetDirectory, "UIRes", "bannedplugin.json"));
|
var bannedPluginsJson = File.ReadAllText(Path.Combine(startInfo.AssetDirectory, "UIRes", "bannedplugin.json"));
|
||||||
|
|
@ -112,6 +118,11 @@ namespace Dalamud.Plugin.Internal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ReposReady => this.Repos.All(repo => repo.State != PluginRepositoryState.InProgress);
|
public bool ReposReady => this.Repos.All(repo => repo.State != PluginRepositoryState.InProgress);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the plugin manager started in safe mode.
|
||||||
|
/// </summary>
|
||||||
|
public bool SafeMode { get; init; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of all IPC subscriptions.
|
/// Gets a list of all IPC subscriptions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -163,18 +174,14 @@ namespace Dalamud.Plugin.Internal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadAllPlugins()
|
public void LoadAllPlugins()
|
||||||
{
|
{
|
||||||
var configuration = Service<DalamudConfiguration>.Get();
|
if (this.SafeMode)
|
||||||
|
|
||||||
if (configuration.PluginSafeMode)
|
|
||||||
{
|
{
|
||||||
Log.Information("PluginSafeMode was enabled, not loading any plugins.");
|
Log.Information("PluginSafeMode was enabled, not loading any plugins.");
|
||||||
|
|
||||||
configuration.PluginSafeMode = false;
|
|
||||||
configuration.Save();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
|
|
||||||
var pluginDefs = new List<PluginDef>();
|
var pluginDefs = new List<PluginDef>();
|
||||||
var devPluginDefs = new List<PluginDef>();
|
var devPluginDefs = new List<PluginDef>();
|
||||||
|
|
||||||
|
|
@ -326,6 +333,12 @@ namespace Dalamud.Plugin.Internal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ScanDevPlugins()
|
public void ScanDevPlugins()
|
||||||
{
|
{
|
||||||
|
if (this.SafeMode)
|
||||||
|
{
|
||||||
|
Log.Information("PluginSafeMode was enabled, not scanning any dev plugins.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var configuration = Service<DalamudConfiguration>.Get();
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
|
|
||||||
if (!this.devPluginDirectory.Exists)
|
if (!this.devPluginDirectory.Exists)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue