add lod warning on connection when lod is enabled

This commit is contained in:
Stanley Dimant
2025-01-26 15:08:01 +01:00
parent aa8d34ff46
commit 831a3dd1ee
4 changed files with 27 additions and 6 deletions

View File

@@ -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<ILogger<EventAggregator>>(), s.GetRequiredService<MareMediator>()));
collection.AddSingleton((s) => new DalamudUtilService(s.GetRequiredService<ILogger<DalamudUtilService>>(),
clientState, objectTable, framework, gameGui, condition, gameData, targetManager,
clientState, objectTable, framework, gameGui, condition, gameData, targetManager, gameConfig,
s.GetRequiredService<BlockedCharacterHandler>(), s.GetRequiredService<MareMediator>(), s.GetRequiredService<PerformanceCollectorService>()));
collection.AddSingleton((s) => new DtrEntry(s.GetRequiredService<ILogger<DtrEntry>>(), dtrBar, s.GetRequiredService<MareConfigService>(),
s.GetRequiredService<MareMediator>(), s.GetRequiredService<PairManager>(), s.GetRequiredService<ApiController>()));

View File

@@ -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<DalamudUtilService> 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<Dictionary<ushort, string>> WorldData { get; private set; }
public Lazy<Dictionary<uint, string>> TerritoryData { get; private set; }
public Lazy<Dictionary<uint, (Lumina.Excel.Sheets.Map Map, string MapName)>> 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());

View File

@@ -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()

View File

@@ -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);
}