Merge branch 'refs/heads/master' into apiX

# Conflicts:
#	Dalamud/Game/Libc/LibcFunction.cs
#	Dalamud/Game/Libc/LibcFunctionAddressResolver.cs
#	Dalamud/Game/Libc/OwnedStdString.cs
#	Dalamud/Game/Libc/StdString.cs
#	Dalamud/Interface/UiBuilder.cs
This commit is contained in:
Kaz Wolfe 2024-04-28 11:54:54 -07:00
commit b32ed39826
No known key found for this signature in database
GPG key ID: 258813F53A16EBB4
297 changed files with 768 additions and 543 deletions

View file

@ -12,6 +12,7 @@ jobs:
matrix: matrix:
branches: branches:
- new_im_hooks - new_im_hooks
- apiX
defaults: defaults:
run: run:

View file

@ -27,7 +27,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Lumina" Version="3.16.0" /> <PackageReference Include="Lumina" Version="3.17.0" />
<PackageReference Include="Lumina.Excel" Version="6.5.2" /> <PackageReference Include="Lumina.Excel" Version="6.5.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.333"> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.333">

View file

@ -2,7 +2,6 @@ using System;
using System.IO; using System.IO;
using Dalamud.Configuration.Internal; using Dalamud.Configuration.Internal;
using Dalamud.Game;
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Plugin; using Dalamud.Plugin;

View file

@ -1,10 +1,11 @@
namespace Dalamud; using Dalamud.Utility;
// TODO(v10): Delete this, and use Dalamud.Common.ClientLanguage instead for everything. namespace Dalamud;
/// <summary> /// <summary>
/// Enum describing the language the game loads in. /// Enum describing the language the game loads in.
/// </summary> /// </summary>
[Api10ToDo("Delete this, and use Dalamud.Common.ClientLanguage instead for everything.")]
public enum ClientLanguage public enum ClientLanguage
{ {
/// <summary> /// <summary>

View file

@ -1,10 +1,11 @@
using System; using Dalamud.Utility;
namespace Dalamud; namespace Dalamud;
/// <summary> /// <summary>
/// Extension methods for the <see cref="ClientLanguage"/> class. /// Extension methods for the <see cref="ClientLanguage"/> class.
/// </summary> /// </summary>
[Api10ToDo("Delete this, and use Dalamud.Common.ClientLanguage instead for everything.")]
public static class ClientLanguageExtensions public static class ClientLanguageExtensions
{ {
/// <summary> /// <summary>

View file

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Dalamud.Configuration.Internal; namespace Dalamud.Configuration.Internal;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Configuration.Internal; namespace Dalamud.Configuration.Internal;
/// <summary> /// <summary>

View file

@ -33,8 +33,9 @@ internal sealed class Dalamud : IServiceType
{ {
#region Internals #region Internals
private static int shownServiceError = 0;
private readonly ManualResetEvent unloadSignal; private readonly ManualResetEvent unloadSignal;
#endregion #endregion
/// <summary> /// <summary>
@ -68,54 +69,47 @@ internal sealed class Dalamud : IServiceType
// Set up FFXIVClientStructs // Set up FFXIVClientStructs
this.SetupClientStructsResolver(cacheDir); this.SetupClientStructsResolver(cacheDir);
if (!configuration.IsResumeGameAfterPluginLoad) void KickoffGameThread()
{ {
Log.Verbose("=============== GAME THREAD KICKOFF ===============");
Timings.Event("Game thread kickoff");
NativeFunctions.SetEvent(mainThreadContinueEvent); NativeFunctions.SetEvent(mainThreadContinueEvent);
ServiceManager.InitializeEarlyLoadableServices() }
.ContinueWith(t =>
void HandleServiceInitFailure(Task t)
{
Log.Error(t.Exception!, "Service initialization failure");
if (Interlocked.CompareExchange(ref shownServiceError, 1, 0) != 0)
return;
Util.Fatal(
"Dalamud failed to load all necessary services.\n\nThe game will continue, but you may not be able to use plugins.",
"Dalamud", false);
}
ServiceManager.InitializeEarlyLoadableServices()
.ContinueWith(
t =>
{ {
if (t.IsCompletedSuccessfully) if (t.IsCompletedSuccessfully)
return; return;
Log.Error(t.Exception!, "Service initialization failure"); HandleServiceInitFailure(t);
Util.Fatal(
"Dalamud failed to load all necessary services.\n\nThe game will continue, but you may not be able to use plugins.",
"Dalamud", false);
}); });
}
else ServiceManager.BlockingResolved.ContinueWith(
{ t =>
Task.Run(async () =>
{ {
try if (t.IsCompletedSuccessfully)
{ {
var tasks = new[] KickoffGameThread();
{ return;
ServiceManager.InitializeEarlyLoadableServices(),
ServiceManager.BlockingResolved,
};
await Task.WhenAny(tasks);
var faultedTasks = tasks.Where(x => x.IsFaulted).Select(x => (Exception)x.Exception!).ToArray();
if (faultedTasks.Any())
throw new AggregateException(faultedTasks);
NativeFunctions.SetEvent(mainThreadContinueEvent);
await Task.WhenAll(tasks);
}
catch (Exception e)
{
Log.Error(e, "Service initialization failure");
Util.Fatal("Dalamud could not initialize correctly. Please report this error. \n\nThe game will continue, but you may not be able to use plugins.", "Dalamud", false);
}
finally
{
NativeFunctions.SetEvent(mainThreadContinueEvent);
} }
HandleServiceInitFailure(t);
}); });
}
this.DefaultExceptionFilter = NativeFunctions.SetUnhandledExceptionFilter(nint.Zero); this.DefaultExceptionFilter = NativeFunctions.SetUnhandledExceptionFilter(nint.Zero);
NativeFunctions.SetUnhandledExceptionFilter(this.DefaultExceptionFilter); NativeFunctions.SetUnhandledExceptionFilter(this.DefaultExceptionFilter);

View file

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Feature"> <PropertyGroup Label="Feature">
<DalamudVersion>9.1.0.5</DalamudVersion> <DalamudVersion>9.1.0.7</DalamudVersion>
<Description>XIV Launcher addon framework</Description> <Description>XIV Launcher addon framework</Description>
<AssemblyVersion>$(DalamudVersion)</AssemblyVersion> <AssemblyVersion>$(DalamudVersion)</AssemblyVersion>
<Version>$(DalamudVersion)</Version> <Version>$(DalamudVersion)</Version>
@ -68,9 +68,9 @@
<PackageReference Include="goaaats.Reloaded.Hooks" Version="4.2.0-goat.4" /> <PackageReference Include="goaaats.Reloaded.Hooks" Version="4.2.0-goat.4" />
<PackageReference Include="goaaats.Reloaded.Assembler" Version="1.0.14-goat.2" /> <PackageReference Include="goaaats.Reloaded.Assembler" Version="1.0.14-goat.2" />
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" /> <PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
<PackageReference Include="Lumina" Version="3.16.0" /> <PackageReference Include="Lumina" Version="3.17.0" />
<PackageReference Include="Lumina.Excel" Version="6.5.2" /> <PackageReference Include="Lumina.Excel" Version="6.5.2" />
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.0-preview.1.24081.5" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.46-beta"> <PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.46-beta">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>

View file

@ -1,4 +1,3 @@
using System.Diagnostics;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
@ -52,15 +51,12 @@ internal sealed class DataManager : IInternalDisposableService, IDataManager
DefaultExcelLanguage = this.Language.ToLumina(), DefaultExcelLanguage = this.Language.ToLumina(),
}; };
var processModule = Process.GetCurrentProcess().MainModule; this.GameData = new(
if (processModule != null) Path.Combine(Path.GetDirectoryName(Environment.ProcessPath)!, "sqpack"),
luminaOptions)
{ {
this.GameData = new GameData(Path.Combine(Path.GetDirectoryName(processModule.FileName)!, "sqpack"), luminaOptions); StreamPool = new(),
} };
else
{
throw new Exception("Could not main module.");
}
Log.Information("Lumina is ready: {0}", this.GameData.DataPath); Log.Information("Lumina is ready: {0}", this.GameData.DataPath);
@ -107,7 +103,8 @@ internal sealed class DataManager : IInternalDisposableService, IDataManager
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex, "Could not download data."); Log.Error(ex, "Could not initialize Lumina");
throw;
} }
} }
@ -161,6 +158,7 @@ internal sealed class DataManager : IInternalDisposableService, IDataManager
void IInternalDisposableService.DisposeService() void IInternalDisposableService.DisposeService()
{ {
this.luminaCancellationTokenSource.Cancel(); this.luminaCancellationTokenSource.Cancel();
this.GameData.Dispose();
} }
private class LauncherTroubleshootingInfo private class LauncherTroubleshootingInfo

View file

@ -5,6 +5,7 @@ using Dalamud.Game.Gui;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using Dalamud.Memory; using Dalamud.Memory;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
namespace Dalamud.Game.Addon.Events; namespace Dalamud.Game.Addon.Events;

View file

@ -10,6 +10,7 @@ using Dalamud.IoC.Internal;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using Dalamud.Memory; using Dalamud.Memory;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
namespace Dalamud.Game.Addon.Lifecycle; namespace Dalamud.Game.Addon.Lifecycle;
@ -133,6 +134,9 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
/// <param name="listener">The listener to unregister.</param> /// <param name="listener">The listener to unregister.</param>
internal void UnregisterListener(AddonLifecycleEventListener listener) internal void UnregisterListener(AddonLifecycleEventListener listener)
{ {
// Set removed state to true immediately, then lazily remove it from the EventListeners list on next Framework Update.
listener.Removed = true;
this.framework.RunOnTick(() => this.framework.RunOnTick(() =>
{ {
this.EventListeners.Remove(listener); this.EventListeners.Remove(listener);
@ -167,6 +171,10 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
if (listener.EventType != eventType) if (listener.EventType != eventType)
continue; continue;
// If the listener is pending removal, and is waiting until the next Framework Update, don't invoke listener.
if (listener.Removed)
continue;
// Match on string.empty for listeners that want events for all addons. // Match on string.empty for listeners that want events for all addons.
if (!string.IsNullOrWhiteSpace(listener.AddonName) && !args.IsAddon(listener.AddonName)) if (!string.IsNullOrWhiteSpace(listener.AddonName) && !args.IsAddon(listener.AddonName))
continue; continue;

View file

@ -26,6 +26,11 @@ internal class AddonLifecycleEventListener
/// </summary> /// </summary>
public string AddonName { get; init; } public string AddonName { get; init; }
/// <summary>
/// Gets or sets a value indicating whether this event has been unregistered.
/// </summary>
public bool Removed { get; set; }
/// <summary> /// <summary>
/// Gets the event type this listener is looking for. /// Gets the event type this listener is looking for.
/// </summary> /// </summary>

View file

@ -4,6 +4,7 @@ using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using Dalamud.Memory; using Dalamud.Memory;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
namespace Dalamud.Game.Addon.Lifecycle; namespace Dalamud.Game.Addon.Lifecycle;

View file

@ -1,10 +1,7 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using JetBrains.Annotations;
namespace Dalamud.Game; namespace Dalamud.Game;
/// <summary> /// <summary>

View file

@ -4,6 +4,7 @@ using System.Collections.Generic;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game.UI; using FFXIVClientStructs.FFXIV.Client.Game.UI;
using Serilog; using Serilog;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -6,6 +5,7 @@ using System.Runtime.InteropServices;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.Buddy; namespace Dalamud.Game.ClientState.Buddy;

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Resolvers; using Dalamud.Game.ClientState.Resolvers;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState; namespace Dalamud.Game.ClientState;
/// <summary> /// <summary>

View file

@ -1,6 +1,7 @@
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.Conditions; namespace Dalamud.Game.ClientState.Conditions;

View file

@ -1,4 +1,3 @@
using System;
using System.Numerics; using System.Numerics;
using Dalamud.Data; using Dalamud.Data;

View file

@ -1,10 +1,10 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.Fates; namespace Dalamud.Game.ClientState.Fates;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.GamePad; namespace Dalamud.Game.ClientState.GamePad;
/// <summary> /// <summary>

View file

@ -1,10 +1,10 @@
using System;
using System.Numerics; using System.Numerics;
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using ImGuiNET; using ImGuiNET;
using Serilog; using Serilog;

View file

@ -1,6 +1,4 @@
using System; namespace Dalamud.Game.ClientState.JobGauge.Enums;
namespace Dalamud.Game.ClientState.JobGauge.Enums;
/// <summary> /// <summary>
/// MNK Nadi types. /// MNK Nadi types.

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Enums; namespace Dalamud.Game.ClientState.JobGauge.Enums;
/// <summary> /// <summary>

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
@ -6,6 +5,7 @@ using Dalamud.Game.ClientState.JobGauge.Types;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.JobGauge; namespace Dalamud.Game.ClientState.JobGauge;

View file

@ -1,4 +1,3 @@
using System;
using System.Linq; using System.Linq;
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
using FFXIVClientStructs.FFXIV.Client.Game.Gauge; using FFXIVClientStructs.FFXIV.Client.Game.Gauge;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,4 +1,3 @@
using System;
using System.Linq; using System.Linq;
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Enums;
using FFXIVClientStructs.FFXIV.Client.Game.Gauge; using FFXIVClientStructs.FFXIV.Client.Game.Gauge;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.JobGauge.Types; namespace Dalamud.Game.ClientState.JobGauge.Types;
/// <summary> /// <summary>

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -6,6 +5,7 @@ using System.Runtime.InteropServices;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.Keys; namespace Dalamud.Game.ClientState.Keys;

View file

@ -1,6 +1,4 @@
using System; namespace Dalamud.Game.ClientState.Keys;
namespace Dalamud.Game.ClientState.Keys;
/// <summary> /// <summary>
/// Attribute describing a VirtualKey. /// Attribute describing a VirtualKey.

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.ClientState.Objects.Enums; namespace Dalamud.Game.ClientState.Objects.Enums;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
namespace Dalamud.Game.ClientState.Objects.SubKinds; namespace Dalamud.Game.ClientState.Objects.SubKinds;

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
namespace Dalamud.Game.ClientState.Objects.SubKinds; namespace Dalamud.Game.ClientState.Objects.SubKinds;

View file

@ -1,8 +1,7 @@
using System;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
#pragma warning disable CS0618 #pragma warning disable CS0618
namespace Dalamud.Game.ClientState.Objects; namespace Dalamud.Game.ClientState.Objects;

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.Statuses; using Dalamud.Game.ClientState.Statuses;
using Dalamud.Utility; using Dalamud.Utility;

View file

@ -1,4 +1,3 @@
using System;
using System.Numerics; using System.Numerics;
using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.Enums;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -6,6 +5,7 @@ using System.Runtime.InteropServices;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Serilog; using Serilog;
namespace Dalamud.Game.ClientState.Party; namespace Dalamud.Game.ClientState.Party;

View file

@ -1,4 +1,3 @@
using System;
using System.Numerics; using System.Numerics;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;

View file

@ -1,4 +1,5 @@
using Dalamud.Data; using Dalamud.Data;
using Lumina.Excel; using Lumina.Excel;
namespace Dalamud.Game.ClientState.Resolvers; namespace Dalamud.Game.ClientState.Resolvers;

View file

@ -1,5 +1,3 @@
using System;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Resolvers; using Dalamud.Game.ClientState.Resolvers;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;

View file

@ -1,5 +1,3 @@
using System.Reflection;
namespace Dalamud.Game.Command; namespace Dalamud.Game.Command;
/// <summary> /// <summary>

View file

@ -1,6 +1,4 @@
using System; namespace Dalamud.Game.Config;
namespace Dalamud.Game.Config;
public abstract record ConfigChangeEvent(Enum Option); public abstract record ConfigChangeEvent(Enum Option);

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Config; namespace Dalamud.Game.Config;
/// <summary> /// <summary>

View file

@ -1,7 +1,3 @@
using System;
using FFXIVClientStructs.FFXIV.Common.Configuration;
namespace Dalamud.Game.Config; namespace Dalamud.Game.Config;
/// <summary> /// <summary>

View file

@ -1,7 +1,3 @@
using System;
using FFXIVClientStructs.FFXIV.Common.Configuration;
namespace Dalamud.Game.Config; namespace Dalamud.Game.Config;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game; namespace Dalamud.Game;
/// <summary> /// <summary>

View file

@ -268,11 +268,15 @@ internal sealed unsafe class ContextMenu : IInternalDisposableService, IContextM
foreach (var item in items) foreach (var item in items)
{ {
if (!item.Prefix.HasValue && !item.UseDefaultPrefix) if (!item.Prefix.HasValue)
{ {
item.Prefix = MenuItem.DalamudDefaultPrefix; item.Prefix = MenuItem.DalamudDefaultPrefix;
item.PrefixColor = MenuItem.DalamudDefaultPrefixColor; item.PrefixColor = MenuItem.DalamudDefaultPrefixColor;
Log.Warning($"Menu item \"{item.Name}\" has no prefix, defaulting to Dalamud's. Menu items outside of a submenu must have a prefix.");
if (!item.UseDefaultPrefix)
{
Log.Warning($"Menu item \"{item.Name}\" has no prefix, defaulting to Dalamud's. Menu items outside of a submenu must have a prefix.");
}
} }
} }

View file

@ -11,6 +11,7 @@ using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Logging.Internal; using Dalamud.Logging.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Graphics; using FFXIVClientStructs.FFXIV.Client.Graphics;
using FFXIVClientStructs.FFXIV.Client.System.Memory; using FFXIVClientStructs.FFXIV.Client.System.Memory;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
@ -73,13 +74,16 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
this.configuration.QueueSave(); this.configuration.QueueSave();
} }
/// <inheritdoc/>
public IReadOnlyList<IReadOnlyDtrBarEntry> Entries => this.entries;
/// <inheritdoc/> /// <inheritdoc/>
public DtrBarEntry Get(string title, SeString? text = null) public DtrBarEntry Get(string title, SeString? text = null)
{ {
if (this.entries.Any(x => x.Title == title) || this.newEntries.Any(x => x.Title == title)) if (this.entries.Any(x => x.Title == title) || this.newEntries.Any(x => x.Title == title))
throw new ArgumentException("An entry with the same title already exists."); throw new ArgumentException("An entry with the same title already exists.");
var entry = new DtrBarEntry(title, null); var entry = new DtrBarEntry(this.configuration, title, null);
entry.Text = text; entry.Text = text;
// Add the entry to the end of the order list, if it's not there already. // Add the entry to the end of the order list, if it's not there already.
@ -196,7 +200,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
foreach (var data in this.entries) foreach (var data in this.entries)
{ {
var isHide = this.configuration.DtrIgnore!.Any(x => x == data.Title) || !data.Shown; var isHide = data.UserHidden || !data.Shown;
if (data is { Dirty: true, Added: true, Text: not null, TextNode: not null }) if (data is { Dirty: true, Added: true, Text: not null, TextNode: not null })
{ {
@ -499,6 +503,9 @@ internal class DtrBarPluginScoped : IInternalDisposableService, IDtrBar
private readonly DtrBar dtrBarService = Service<DtrBar>.Get(); private readonly DtrBar dtrBarService = Service<DtrBar>.Get();
private readonly Dictionary<string, DtrBarEntry> pluginEntries = new(); private readonly Dictionary<string, DtrBarEntry> pluginEntries = new();
/// <inheritdoc/>
public IReadOnlyList<IReadOnlyDtrBarEntry> Entries => this.dtrBarService.Entries;
/// <inheritdoc/> /// <inheritdoc/>
void IInternalDisposableService.DisposeService() void IInternalDisposableService.DisposeService()
@ -510,7 +517,7 @@ internal class DtrBarPluginScoped : IInternalDisposableService, IDtrBar
this.pluginEntries.Clear(); this.pluginEntries.Clear();
} }
/// <inheritdoc/> /// <inheritdoc/>
public DtrBarEntry Get(string title, SeString? text = null) public DtrBarEntry Get(string title, SeString? text = null)
{ {

View file

@ -1,37 +1,114 @@
using System; using System.Linq;
using Dalamud.Configuration.Internal;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
namespace Dalamud.Game.Gui.Dtr; namespace Dalamud.Game.Gui.Dtr;
/// <summary>
/// Interface representing a read-only entry in the server info bar.
/// </summary>
public interface IReadOnlyDtrBarEntry
{
/// <summary>
/// Gets the title of this entry.
/// </summary>
public string Title { get; }
/// <summary>
/// Gets a value indicating whether this entry has a click action.
/// </summary>
public bool HasClickAction { get; }
/// <summary>
/// Gets the text of this entry.
/// </summary>
public SeString Text { get; }
/// <summary>
/// Gets a tooltip to be shown when the user mouses over the dtr entry.
/// </summary>
public SeString Tooltip { get; }
/// <summary>
/// Gets a value indicating whether this entry should be shown.
/// </summary>
public bool Shown { get; }
/// <summary>
/// Gets a value indicating whether or not the user has hidden this entry from view through the Dalamud settings.
/// </summary>
public bool UserHidden { get; }
/// <summary>
/// Triggers the click action of this entry.
/// </summary>
/// <returns>True, if a click action was registered and executed.</returns>
public bool TriggerClickAction();
}
/// <summary>
/// Interface representing an entry in the server info bar.
/// </summary>
public interface IDtrBarEntry : IReadOnlyDtrBarEntry
{
/// <summary>
/// Gets or sets the text of this entry.
/// </summary>
public new SeString? Text { get; set; }
/// <summary>
/// Gets or sets a tooltip to be shown when the user mouses over the dtr entry.
/// </summary>
public new SeString? Tooltip { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this entry is visible.
/// </summary>
public new bool Shown { get; set; }
/// <summary>
/// Gets or sets a action to be invoked when the user clicks on the dtr entry.
/// </summary>
public Action? OnClick { get; set; }
/// <summary>
/// Remove this entry from the bar.
/// You will need to re-acquire it from DtrBar to reuse it.
/// </summary>
public void Remove();
}
/// <summary> /// <summary>
/// Class representing an entry in the server info bar. /// Class representing an entry in the server info bar.
/// </summary> /// </summary>
public sealed unsafe class DtrBarEntry : IDisposable public sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry
{ {
private readonly DalamudConfiguration configuration;
private bool shownBacking = true; private bool shownBacking = true;
private SeString? textBacking = null; private SeString? textBacking;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="DtrBarEntry"/> class. /// Initializes a new instance of the <see cref="DtrBarEntry"/> class.
/// </summary> /// </summary>
/// <param name="configuration">Dalamud configuration, used to check if the entry is hidden by the user.</param>
/// <param name="title">The title of the bar entry.</param> /// <param name="title">The title of the bar entry.</param>
/// <param name="textNode">The corresponding text node.</param> /// <param name="textNode">The corresponding text node.</param>
internal DtrBarEntry(string title, AtkTextNode* textNode) internal DtrBarEntry(DalamudConfiguration configuration, string title, AtkTextNode* textNode)
{ {
this.configuration = configuration;
this.Title = title; this.Title = title;
this.TextNode = textNode; this.TextNode = textNode;
} }
/// <summary> /// <inheritdoc/>
/// Gets the title of this entry.
/// </summary>
public string Title { get; init; } public string Title { get; init; }
/// <summary> /// <inheritdoc cref="IDtrBarEntry.Text" />
/// Gets or sets the text of this entry.
/// </summary>
public SeString? Text public SeString? Text
{ {
get => this.textBacking; get => this.textBacking;
@ -41,10 +118,8 @@ public sealed unsafe class DtrBarEntry : IDisposable
this.Dirty = true; this.Dirty = true;
} }
} }
/// <summary> /// <inheritdoc cref="IDtrBarEntry.Tooltip" />
/// Gets or sets a tooltip to be shown when the user mouses over the dtr entry.
/// </summary>
public SeString? Tooltip { get; set; } public SeString? Tooltip { get; set; }
/// <summary> /// <summary>
@ -52,9 +127,10 @@ public sealed unsafe class DtrBarEntry : IDisposable
/// </summary> /// </summary>
public Action? OnClick { get; set; } public Action? OnClick { get; set; }
/// <summary> /// <inheritdoc/>
/// Gets or sets a value indicating whether this entry is visible. public bool HasClickAction => this.OnClick != null;
/// </summary>
/// <inheritdoc cref="IDtrBarEntry.Shown" />
public bool Shown public bool Shown
{ {
get => this.shownBacking; get => this.shownBacking;
@ -65,6 +141,10 @@ public sealed unsafe class DtrBarEntry : IDisposable
} }
} }
/// <inheritdoc/>
[Api10ToDo("Maybe make this config scoped to internalname?")]
public bool UserHidden => this.configuration.DtrIgnore?.Any(x => x == this.Title) ?? false;
/// <summary> /// <summary>
/// Gets or sets the internal text node of this entry. /// Gets or sets the internal text node of this entry.
/// </summary> /// </summary>
@ -73,17 +153,27 @@ public sealed unsafe class DtrBarEntry : IDisposable
/// <summary> /// <summary>
/// Gets a value indicating whether this entry should be removed. /// Gets a value indicating whether this entry should be removed.
/// </summary> /// </summary>
internal bool ShouldBeRemoved { get; private set; } = false; internal bool ShouldBeRemoved { get; private set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this entry is dirty. /// Gets or sets a value indicating whether this entry is dirty.
/// </summary> /// </summary>
internal bool Dirty { get; set; } = false; internal bool Dirty { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this entry has just been added. /// Gets or sets a value indicating whether this entry has just been added.
/// </summary> /// </summary>
internal bool Added { get; set; } = false; internal bool Added { get; set; }
/// <inheritdoc/>
public bool TriggerClickAction()
{
if (this.OnClick == null)
return false;
this.OnClick.Invoke();
return true;
}
/// <summary> /// <summary>
/// Remove this entry from the bar. /// Remove this entry from the bar.

View file

@ -7,6 +7,7 @@ using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Memory; using Dalamud.Memory;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Serilog; using Serilog;
namespace Dalamud.Game.Gui.FlyText; namespace Dalamud.Game.Gui.FlyText;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Gui; namespace Dalamud.Game.Gui;
/// <summary> /// <summary>

View file

@ -6,6 +6,7 @@ using Dalamud.Hooking;
using Dalamud.IoC; using Dalamud.IoC;
using Dalamud.IoC.Internal; using Dalamud.IoC.Internal;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Serilog; using Serilog;
namespace Dalamud.Game.Gui.PartyFinder; namespace Dalamud.Game.Gui.PartyFinder;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Gui.PartyFinder.Types; namespace Dalamud.Game.Gui.PartyFinder.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Gui.PartyFinder.Types; namespace Dalamud.Game.Gui.PartyFinder.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Gui.PartyFinder.Types; namespace Dalamud.Game.Gui.PartyFinder.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Gui.PartyFinder.Types; namespace Dalamud.Game.Gui.PartyFinder.Types;
/// <summary> /// <summary>

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Gui.PartyFinder.Types; namespace Dalamud.Game.Gui.PartyFinder.Types;
/// <summary> /// <summary>

View file

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Dalamud.Data; using Dalamud.Data;
using Dalamud.Game.Gui.PartyFinder.Internal; using Dalamud.Game.Gui.PartyFinder.Internal;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
namespace Dalamud.Game.Gui.PartyFinder.Types; namespace Dalamud.Game.Gui.PartyFinder.Types;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Gui.PartyFinder.Types; namespace Dalamud.Game.Gui.PartyFinder.Types;
/// <summary> /// <summary>

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
#if !DEBUG #if !DEBUG

View file

@ -1,5 +1,3 @@
using System;
namespace Dalamud.Game.Internal.DXGI; namespace Dalamud.Game.Internal.DXGI;
/// <summary> /// <summary>

View file

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using CheapLoc; using CheapLoc;
@ -9,6 +8,7 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Interface.Internal; using Dalamud.Interface.Internal;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Serilog; using Serilog;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;

View file

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types; using Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types;
using Dalamud.Game.Network.Structures; using Dalamud.Game.Network.Structures;
using Dalamud.Networking.Http; using Dalamud.Networking.Http;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;

View file

@ -1,4 +1,3 @@
using System;
using System.Net.Sockets; using System.Net.Sockets;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;

View file

@ -1,4 +1,3 @@
using System;
using System.IO; using System.IO;
namespace Dalamud.Game.Network.Structures; namespace Dalamud.Game.Network.Structures;

View file

@ -1,4 +1,3 @@
using System;
using System.IO; using System.IO;
namespace Dalamud.Game.Network.Structures; namespace Dalamud.Game.Network.Structures;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -7,8 +6,6 @@ using System.IO;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Dalamud.IoC;
using Dalamud.IoC.Internal;
using Iced.Intel; using Iced.Intel;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
@ -6,6 +5,7 @@ using System.IO;
using Dalamud.Data; using Dalamud.Data;
using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog; using Serilog;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;

View file

@ -1,4 +1,3 @@
using System;
using System.IO; using System.IO;
namespace Dalamud.Game.Text.SeStringHandling.Payloads; namespace Dalamud.Game.Text.SeStringHandling.Payloads;

Some files were not shown because too many files have changed in this diff Show more