diff --git a/MareSynchronos/Plugin.cs b/MareSynchronos/Plugin.cs index 42c941f..a7c67ee 100644 --- a/MareSynchronos/Plugin.cs +++ b/MareSynchronos/Plugin.cs @@ -27,7 +27,6 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NReco.Logging.File; using System.Net.Http.Headers; -using System.Net.Http; using System.Reflection; using MareSynchronos.Services.CharaData; @@ -40,7 +39,7 @@ public sealed class Plugin : IDalamudPlugin public Plugin(IDalamudPluginInterface pluginInterface, ICommandManager commandManager, IDataManager gameData, IFramework framework, IObjectTable objectTable, IClientState clientState, ICondition condition, IChatGui chatGui, IGameGui gameGui, IDtrBar dtrBar, IPluginLog pluginLog, ITargetManager targetManager, INotificationManager notificationManager, - ITextureProvider textureProvider, IContextMenu contextMenu, IGameInteropProvider gameInteropProvider) + ITextureProvider textureProvider, IContextMenu contextMenu, IGameInteropProvider gameInteropProvider, IGameConfig gameConfig) { if (!Directory.Exists(pluginInterface.ConfigDirectory.FullName)) Directory.CreateDirectory(pluginInterface.ConfigDirectory.FullName); @@ -131,7 +130,7 @@ public sealed class Plugin : IDalamudPlugin collection.AddSingleton((s) => new EventAggregator(pluginInterface.ConfigDirectory.FullName, s.GetRequiredService>(), s.GetRequiredService())); collection.AddSingleton((s) => new DalamudUtilService(s.GetRequiredService>(), - clientState, objectTable, framework, gameGui, condition, gameData, targetManager, + clientState, objectTable, framework, gameGui, condition, gameData, targetManager, gameConfig, s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService())); collection.AddSingleton((s) => new DtrEntry(s.GetRequiredService>(), dtrBar, s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService())); diff --git a/MareSynchronos/Services/DalamudUtilService.cs b/MareSynchronos/Services/DalamudUtilService.cs index 043b6f1..4e292c6 100644 --- a/MareSynchronos/Services/DalamudUtilService.cs +++ b/MareSynchronos/Services/DalamudUtilService.cs @@ -30,6 +30,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber private readonly IClientState _clientState; private readonly ICondition _condition; private readonly IDataManager _gameData; + private readonly IGameConfig _gameConfig; private readonly BlockedCharacterHandler _blockedCharacterHandler; private readonly IFramework _framework; private readonly IGameGui _gameGui; @@ -46,7 +47,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber private bool _sentBetweenAreas = false; public DalamudUtilService(ILogger logger, IClientState clientState, IObjectTable objectTable, IFramework framework, - IGameGui gameGui, ICondition condition, IDataManager gameData, ITargetManager targetManager, + IGameGui gameGui, ICondition condition, IDataManager gameData, ITargetManager targetManager, IGameConfig gameConfig, BlockedCharacterHandler blockedCharacterHandler, MareMediator mediator, PerformanceCollectorService performanceCollector) { _logger = logger; @@ -56,6 +57,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber _gameGui = gameGui; _condition = condition; _gameData = gameData; + _gameConfig = gameConfig; _blockedCharacterHandler = blockedCharacterHandler; Mediator = mediator; _performanceCollector = performanceCollector; @@ -142,6 +144,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber public Lazy> WorldData { get; private set; } public Lazy> TerritoryData { get; private set; } public Lazy> MapData { get; private set; } + public bool IsLodEnabled { get; private set; } public MareMediator Mediator { get; } @@ -716,6 +719,12 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber Mediator.Publish(new DalamudLogoutMessage()); } + if (_gameConfig != null + && _gameConfig.TryGet(Dalamud.Game.Config.SystemConfigOption.LodType_DX11, out bool lodEnabled)) + { + IsLodEnabled = lodEnabled; + } + if (IsInCombatOrPerforming) Mediator.Publish(new FrameworkUpdateMessage()); diff --git a/MareSynchronos/UI/SettingsUi.cs b/MareSynchronos/UI/SettingsUi.cs index 73a0131..bace2f3 100644 --- a/MareSynchronos/UI/SettingsUi.cs +++ b/MareSynchronos/UI/SettingsUi.cs @@ -608,11 +608,12 @@ public class SettingsUi : WindowMediatorSubscriberBase } bool stopWhining = _configService.Current.DebugStopWhining; - if (ImGui.Checkbox("Do not notify for modified game files", ref stopWhining)) + if (ImGui.Checkbox("Do not notify for modified game files or enabled LOD", ref stopWhining)) { _configService.Current.DebugStopWhining = stopWhining; } - _uiShared.DrawHelpText("Having modified game files will still mark your logs with UNSUPPORTED and you will not receive support, message shown or not."); + _uiShared.DrawHelpText("Having modified game files will still mark your logs with UNSUPPORTED and you will not receive support, message shown or not." + UiSharedService.TooltipSeparator + + "Keeping LOD enabled can lead to more crashes. Use at your own risk."); } private void DrawFileStorageSettings() diff --git a/MareSynchronos/WebAPI/SignalR/ApiController.cs b/MareSynchronos/WebAPI/SignalR/ApiController.cs index 467c2e4..62b7237 100644 --- a/MareSynchronos/WebAPI/SignalR/ApiController.cs +++ b/MareSynchronos/WebAPI/SignalR/ApiController.cs @@ -267,6 +267,18 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM NotificationType.Error, TimeSpan.FromSeconds(15))); } + if (_dalamudUtil.IsLodEnabled) + { + Logger.LogWarning("Model LOD is enabled during connection"); + if (!_mareConfigService.Current.DebugStopWhining) + { + Mediator.Publish(new NotificationMessage("Model LOD is enabled", + "You have \"Use low-detail models on distant objects (LOD)\" enabled. Having model LOD enabled is known to be a reason to cause " + + "random crashes when loading in or rendering modded pairs. Disable LOD while using Mare: " + + "Go to XIV Menu -> System Configuration -> Graphics Settings and disable the model LOD option.", NotificationType.Warning, TimeSpan.FromSeconds(15))); + } + } + await LoadIninitialPairsAsync().ConfigureAwait(false); await LoadOnlinePairsAsync().ConfigureAwait(false); }