diff --git a/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs b/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs index 78cea1a0f..716ce1bfb 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Linq; using System.Runtime.CompilerServices; using Dalamud.Game.Addon.Lifecycle.AddonArgTypes; @@ -133,19 +132,6 @@ internal unsafe class AddonLifecycle : IInternalDisposableService } } - /// - /// Resolves a virtual table address to the original virtual table address. - /// - /// The modified address to resolve. - /// The original address. - internal AtkUnitBase.AtkUnitBaseVirtualTable* GetOriginalVirtualTable(AtkUnitBase.AtkUnitBaseVirtualTable* tableAddress) - { - var matchedTable = AllocatedTables.FirstOrDefault(table => table.ModifiedVirtualTable == tableAddress); - if (matchedTable == null) return null; - - return matchedTable.OriginalVirtualTable; - } - private void OnAddonInitialize(AtkUnitBase* addon) { try @@ -260,8 +246,4 @@ internal class AddonLifecyclePluginScoped : IInternalDisposableService, IAddonLi }); } } - - /// - public unsafe nint GetOriginalVirtualTable(nint virtualTableAddress) - => (nint)this.addonLifecycleService.GetOriginalVirtualTable((AtkUnitBase.AtkUnitBaseVirtualTable*)virtualTableAddress); } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonVirtualTable.cs b/Dalamud/Game/Addon/Lifecycle/AddonVirtualTable.cs index 736415738..47ff92c3d 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonVirtualTable.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonVirtualTable.cs @@ -45,6 +45,9 @@ internal unsafe class AddonVirtualTable : IDisposable private readonly AtkUnitBase* atkUnitBase; + private readonly AtkUnitBase.AtkUnitBaseVirtualTable* originalVirtualTable; + private readonly AtkUnitBase.AtkUnitBaseVirtualTable* modifiedVirtualTable; + // Pinned Function Delegates, as these functions get assigned to an unmanaged virtual table, // the CLR needs to know they are in use, or it will invalidate them causing random crashing. private readonly AtkUnitBase.Delegates.Dtor destructorFunction; @@ -75,16 +78,16 @@ internal unsafe class AddonVirtualTable : IDisposable this.lifecycleService = lifecycleService; // Save original virtual table - this.OriginalVirtualTable = addon->VirtualTable; + this.originalVirtualTable = addon->VirtualTable; // Create copy of original table // Note this will copy any derived/overriden functions that this specific addon has. // Note: currently there are 73 virtual functions, but there's no harm in copying more for when they add new virtual functions to the game - this.ModifiedVirtualTable = (AtkUnitBase.AtkUnitBaseVirtualTable*)IMemorySpace.GetUISpace()->Malloc(0x8 * VirtualTableEntryCount, 8); - NativeMemory.Copy(addon->VirtualTable, this.ModifiedVirtualTable, 0x8 * VirtualTableEntryCount); + this.modifiedVirtualTable = (AtkUnitBase.AtkUnitBaseVirtualTable*)IMemorySpace.GetUISpace()->Malloc(0x8 * VirtualTableEntryCount, 8); + NativeMemory.Copy(addon->VirtualTable, this.modifiedVirtualTable, 0x8 * VirtualTableEntryCount); // Overwrite the addons existing virtual table with our own - addon->VirtualTable = this.ModifiedVirtualTable; + addon->VirtualTable = this.modifiedVirtualTable; // Pin each of our listener functions this.destructorFunction = this.OnAddonDestructor; @@ -105,40 +108,30 @@ internal unsafe class AddonVirtualTable : IDisposable this.focusFunction = this.OnAddonFocus; // Overwrite specific virtual table entries - this.ModifiedVirtualTable->Dtor = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.destructorFunction); - this.ModifiedVirtualTable->OnSetup = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onSetupFunction); - this.ModifiedVirtualTable->Finalizer = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.finalizerFunction); - this.ModifiedVirtualTable->Draw = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.drawFunction); - this.ModifiedVirtualTable->Update = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.updateFunction); - this.ModifiedVirtualTable->OnRefresh = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onRefreshFunction); - this.ModifiedVirtualTable->OnRequestedUpdate = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onRequestedUpdateFunction); - this.ModifiedVirtualTable->ReceiveEvent = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onReceiveEventFunction); - this.ModifiedVirtualTable->Open = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.openFunction); - this.ModifiedVirtualTable->Close = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.closeFunction); - this.ModifiedVirtualTable->Show = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.showFunction); - this.ModifiedVirtualTable->Hide = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.hideFunction); - this.ModifiedVirtualTable->OnMove = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onMoveFunction); - this.ModifiedVirtualTable->OnMouseOver = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onMouseOverFunction); - this.ModifiedVirtualTable->OnMouseOut = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onMouseOutFunction); - this.ModifiedVirtualTable->Focus = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.focusFunction); + this.modifiedVirtualTable->Dtor = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.destructorFunction); + this.modifiedVirtualTable->OnSetup = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onSetupFunction); + this.modifiedVirtualTable->Finalizer = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.finalizerFunction); + this.modifiedVirtualTable->Draw = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.drawFunction); + this.modifiedVirtualTable->Update = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.updateFunction); + this.modifiedVirtualTable->OnRefresh = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onRefreshFunction); + this.modifiedVirtualTable->OnRequestedUpdate = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onRequestedUpdateFunction); + this.modifiedVirtualTable->ReceiveEvent = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onReceiveEventFunction); + this.modifiedVirtualTable->Open = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.openFunction); + this.modifiedVirtualTable->Close = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.closeFunction); + this.modifiedVirtualTable->Show = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.showFunction); + this.modifiedVirtualTable->Hide = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.hideFunction); + this.modifiedVirtualTable->OnMove = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onMoveFunction); + this.modifiedVirtualTable->OnMouseOver = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onMouseOverFunction); + this.modifiedVirtualTable->OnMouseOut = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.onMouseOutFunction); + this.modifiedVirtualTable->Focus = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.focusFunction); } - /// - /// Gets the original virtual table address for this addon. - /// - internal AtkUnitBase.AtkUnitBaseVirtualTable* OriginalVirtualTable { get; private set; } - - /// - /// Gets the modified virtual address for this addon. - /// - internal AtkUnitBase.AtkUnitBaseVirtualTable* ModifiedVirtualTable { get; private set; } - /// public void Dispose() { // Ensure restoration is done atomically. - Interlocked.Exchange(ref *(nint*)&this.atkUnitBase->VirtualTable, (nint)this.OriginalVirtualTable); - IMemorySpace.Free(this.ModifiedVirtualTable, 0x8 * VirtualTableEntryCount); + Interlocked.Exchange(ref *(nint*)&this.atkUnitBase->VirtualTable, (nint)this.originalVirtualTable); + IMemorySpace.Free(this.modifiedVirtualTable, 0x8 * VirtualTableEntryCount); } private AtkEventListener* OnAddonDestructor(AtkUnitBase* thisPtr, byte freeFlags) @@ -151,7 +144,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - result = this.OriginalVirtualTable->Dtor(thisPtr, freeFlags); + result = this.originalVirtualTable->Dtor(thisPtr, freeFlags); } catch (Exception e) { @@ -160,7 +153,7 @@ internal unsafe class AddonVirtualTable : IDisposable if ((freeFlags & 1) == 1) { - IMemorySpace.Free(this.ModifiedVirtualTable, 0x8 * VirtualTableEntryCount); + IMemorySpace.Free(this.modifiedVirtualTable, 0x8 * VirtualTableEntryCount); AddonLifecycle.AllocatedTables.Remove(this); } } @@ -189,7 +182,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->OnSetup(addon, valueCount, values); + this.originalVirtualTable->OnSetup(addon, valueCount, values); } catch (Exception e) { @@ -216,7 +209,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->Finalizer(thisPtr); + this.originalVirtualTable->Finalizer(thisPtr); } catch (Exception e) { @@ -241,7 +234,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->Draw(addon); + this.originalVirtualTable->Draw(addon); } catch (Exception e) { @@ -272,7 +265,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->Update(addon, delta); + this.originalVirtualTable->Update(addon, delta); } catch (Exception e) { @@ -306,7 +299,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - result = this.OriginalVirtualTable->OnRefresh(addon, valueCount, values); + result = this.originalVirtualTable->OnRefresh(addon, valueCount, values); } catch (Exception e) { @@ -340,7 +333,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->OnRequestedUpdate(addon, numberArrayData, stringArrayData); + this.originalVirtualTable->OnRequestedUpdate(addon, numberArrayData, stringArrayData); } catch (Exception e) { @@ -376,7 +369,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->ReceiveEvent(addon, eventType, eventParam, atkEvent, atkEventData); + this.originalVirtualTable->ReceiveEvent(addon, eventType, eventParam, atkEvent, atkEventData); } catch (Exception e) { @@ -405,7 +398,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - result = this.OriginalVirtualTable->Open(thisPtr, depthLayer); + result = this.originalVirtualTable->Open(thisPtr, depthLayer); } catch (Exception e) { @@ -439,7 +432,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - result = this.OriginalVirtualTable->Close(thisPtr, fireCallback); + result = this.originalVirtualTable->Close(thisPtr, fireCallback); } catch (Exception e) { @@ -473,7 +466,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->Show(thisPtr, silenceOpenSoundEffect, unsetShowHideFlags); + this.originalVirtualTable->Show(thisPtr, silenceOpenSoundEffect, unsetShowHideFlags); } catch (Exception e) { @@ -507,7 +500,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->Hide(thisPtr, unkBool, callHideCallback, setShowHideFlags); + this.originalVirtualTable->Hide(thisPtr, unkBool, callHideCallback, setShowHideFlags); } catch (Exception e) { @@ -534,7 +527,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->OnMove(thisPtr); + this.originalVirtualTable->OnMove(thisPtr); } catch (Exception e) { @@ -561,7 +554,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->OnMouseOver(thisPtr); + this.originalVirtualTable->OnMouseOver(thisPtr); } catch (Exception e) { @@ -588,7 +581,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->OnMouseOut(thisPtr); + this.originalVirtualTable->OnMouseOut(thisPtr); } catch (Exception e) { @@ -615,7 +608,7 @@ internal unsafe class AddonVirtualTable : IDisposable try { - this.OriginalVirtualTable->Focus(thisPtr); + this.originalVirtualTable->Focus(thisPtr); } catch (Exception e) { diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index e42bbe608..90850a08b 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -220,7 +220,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa /// public IDalamudVersionInfo GetDalamudVersion() { - return new DalamudVersionInfo(Versioning.GetAssemblyVersionParsed(), Versioning.GetActiveTrack(), Versioning.GetGitHash(), Versioning.GetGitHashClientStructs(), Versioning.GetScmVersion()); + return new DalamudVersionInfo(Versioning.GetAssemblyVersionParsed(), Versioning.GetActiveTrack()); } #region IPC diff --git a/Dalamud/Plugin/Services/IAddonLifecycle.cs b/Dalamud/Plugin/Services/IAddonLifecycle.cs index aeff29811..1269b13dc 100644 --- a/Dalamud/Plugin/Services/IAddonLifecycle.cs +++ b/Dalamud/Plugin/Services/IAddonLifecycle.cs @@ -17,7 +17,7 @@ public interface IAddonLifecycle : IDalamudService /// The event type that triggered the message. /// Information about what addon triggered the message. public delegate void AddonEventDelegate(AddonEvent type, AddonArgs args); - + /// /// Register a listener that will trigger on the specified event and any of the specified addons. /// @@ -25,7 +25,7 @@ public interface IAddonLifecycle : IDalamudService /// Addon names that will trigger the handler to be invoked. /// The handler to invoke. void RegisterListener(AddonEvent eventType, IEnumerable addonNames, AddonEventDelegate handler); - + /// /// Register a listener that will trigger on the specified event only for the specified addon. /// @@ -33,14 +33,14 @@ public interface IAddonLifecycle : IDalamudService /// The addon name that will trigger the handler to be invoked. /// The handler to invoke. void RegisterListener(AddonEvent eventType, string addonName, AddonEventDelegate handler); - + /// /// Register a listener that will trigger on the specified event for any addon. /// /// Event type to trigger on. /// The handler to invoke. void RegisterListener(AddonEvent eventType, AddonEventDelegate handler); - + /// /// Unregister listener from specified event type and specified addon names. /// @@ -51,7 +51,7 @@ public interface IAddonLifecycle : IDalamudService /// Addon names to deregister. /// Optional specific handler to remove. void UnregisterListener(AddonEvent eventType, IEnumerable addonNames, [Optional] AddonEventDelegate handler); - + /// /// Unregister all listeners for the specified event type and addon name. /// @@ -62,7 +62,7 @@ public interface IAddonLifecycle : IDalamudService /// Addon name to deregister. /// Optional specific handler to remove. void UnregisterListener(AddonEvent eventType, string addonName, [Optional] AddonEventDelegate handler); - + /// /// Unregister an event type handler.
This will only remove a handler that is added via . ///
@@ -72,17 +72,10 @@ public interface IAddonLifecycle : IDalamudService /// Event type to deregister. /// Optional specific handler to remove. void UnregisterListener(AddonEvent eventType, [Optional] AddonEventDelegate handler); - + /// /// Unregister all events that use the specified handlers. /// /// Handlers to remove. void UnregisterListener(params AddonEventDelegate[] handlers); - - /// - /// Resolves an addons virtual table address back to the original unmodified table address. - /// - /// The address of a modified addons virtual table. - /// The address of the addons original virtual table. - nint GetOriginalVirtualTable(nint virtualTableAddress); } diff --git a/Dalamud/Plugin/VersionInfo/DalamudVersionInfo.cs b/Dalamud/Plugin/VersionInfo/DalamudVersionInfo.cs index 0a6fad9c2..c87c012af 100644 --- a/Dalamud/Plugin/VersionInfo/DalamudVersionInfo.cs +++ b/Dalamud/Plugin/VersionInfo/DalamudVersionInfo.cs @@ -1,20 +1,11 @@ namespace Dalamud.Plugin.VersionInfo; /// -internal class DalamudVersionInfo(Version version, string? track, string? gitHash, string? gitHashClientStructs, string? scmVersion) : IDalamudVersionInfo +internal class DalamudVersionInfo(Version version, string? track) : IDalamudVersionInfo { /// public Version Version { get; } = version; /// public string? BetaTrack { get; } = track; - - /// - public string? GitHash { get; } = gitHash; - - /// - public string? GitHashClientStructs { get; } = gitHashClientStructs; - - /// - public string? ScmVersion { get; } = scmVersion; } diff --git a/Dalamud/Plugin/VersionInfo/IDalamudVersionInfo.cs b/Dalamud/Plugin/VersionInfo/IDalamudVersionInfo.cs index 6297ce196..e6b6a9601 100644 --- a/Dalamud/Plugin/VersionInfo/IDalamudVersionInfo.cs +++ b/Dalamud/Plugin/VersionInfo/IDalamudVersionInfo.cs @@ -16,22 +16,4 @@ public interface IDalamudVersionInfo /// Null if this build wasn't launched from XIVLauncher. /// string? BetaTrack { get; } - - /// - /// Gets the git commit hash value from the assembly or null if it cannot be found. Will be null for Debug builds, - /// and will be suffixed with `-dirty` if in release with pending changes. - /// - string? GitHash { get; } - - /// - /// Gets the git hash value from the assembly or null if it cannot be found. - /// - string? GitHashClientStructs { get; } - - /// - /// Gets the SCM Version from the assembly, or null if it cannot be found. The value returned will generally be - /// the git describe output for this build, which will be a raw version if this is a stable build or an - /// appropriately-annotated version if this is *not* stable. Local builds will return a `Local Build` text string. - /// - string? ScmVersion { get; } } diff --git a/docfx.json b/docfx.json index cf7a80194..30c85957c 100644 --- a/docfx.json +++ b/docfx.json @@ -4,17 +4,18 @@ "src": [ { "files": [ - "bin/Release/Dalamud.dll" + "Dalamud.Interface/Dalamud.Interface.csproj", + "Dalamud/Dalamud.csproj", + "lib/ImGuiScene/ImGuiScene/ImGuiScene.csproj", + "lib/ImGuiScene/deps/ImGui.NET/src/ImGui.NET-472/ImGui.NET-472.csproj", + "lib/ImGuiScene/deps/SDL2-CS/SDL2-CS.csproj" ] } ], "dest": "api", "disableGitFeatures": false, "disableDefaultFilter": false, - "filter": "filterConfig.yml", - "properties": { - "TargetFramework": "net10.0-windows" - } + "filter": "filterConfig.yml" } ], "build": { diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index df206b5f6..85e962dd9 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit df206b5f61855e3ba73f93fd57bc07056698ac4a +Subproject commit 85e962dd959254c771bf9fa82832f4fbc7679a65 diff --git a/lib/Lumina.Excel b/lib/Lumina.Excel index d8d0b53e2..c74841abc 160000 --- a/lib/Lumina.Excel +++ b/lib/Lumina.Excel @@ -1 +1 @@ -Subproject commit d8d0b53e27393f509ac5397511cb8d251d562277 +Subproject commit c74841abce0830ead4437ed2f560bceb6235a538