From 533c53fd8d51801f6c40f407802bb111bfcf25eb Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Wed, 27 Nov 2024 23:28:56 +0100 Subject: [PATCH] Fix some issues with Crests --- Glamourer/Glamourer.cs | 2 +- Glamourer/Interop/CrestService.cs | 25 +++++++++++++++++++ .../Interop/Penumbra/ModSettingApplier.cs | 2 +- Penumbra.GameData | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Glamourer/Glamourer.cs b/Glamourer/Glamourer.cs index b4489e8..93173ba 100644 --- a/Glamourer/Glamourer.cs +++ b/Glamourer/Glamourer.cs @@ -139,7 +139,7 @@ public class Glamourer : IDalamudPlugin ReadOnlySpan relevantPlugins = [ "Penumbra", "MareSynchronos", "CustomizePlus", "SimpleHeels", "VfxEditor", "heliosphere-plugin", "Ktisis", "Brio", "DynamicBridge", - "LoporritSync", + "LoporritSync", "GagSpeak", "RoleplayingVoiceDalamud", ]; var plugins = _services.GetService().InstalledPlugins .GroupBy(p => p.InternalName) diff --git a/Glamourer/Interop/CrestService.cs b/Glamourer/Interop/CrestService.cs index 8e217b6..95b3587 100644 --- a/Glamourer/Interop/CrestService.cs +++ b/Glamourer/Interop/CrestService.cs @@ -2,6 +2,7 @@ using Dalamud.Plugin.Services; using Dalamud.Utility.Signatures; using FFXIVClientStructs.FFXIV.Client.Game.Character; +using FFXIVClientStructs.FFXIV.Client.Game.Event; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using OtterGui.Classes; using Penumbra.GameData; @@ -37,6 +38,7 @@ public sealed unsafe class CrestService : EventWrapperRef3 _crestChangeCallerHook = null!; + + private delegate void CrestChangeCallerDelegate(DrawDataContainer* container, byte* data); + + private void CrestChangeCallerDetour(DrawDataContainer* container, byte* data) + { + var actor = (Actor)container->OwnerObject; + ref var flags = ref data[16]; + foreach (var slot in CrestExtensions.AllRelevantSet) + { + var newValue = ((CrestFlag)flags).HasFlag(slot); + Invoke(actor, slot, ref newValue); + flags = (byte)(newValue ? flags | (byte)slot : flags & (byte)~slot); + } + Glamourer.Log.Verbose( + $"Called inlined CrestChange via CrestChangeCaller on {(ulong)container:X} with {(flags & 0x1F):X} and prior flags {actor.CrestBitfield}."); + + using var _ = _inUpdate.EnterMethod(); + _crestChangeCallerHook.Original(container, data); + } + public static bool GetModelCrest(Actor gameObject, CrestFlag slot) { if (!gameObject.IsCharacter) diff --git a/Glamourer/Interop/Penumbra/ModSettingApplier.cs b/Glamourer/Interop/Penumbra/ModSettingApplier.cs index fcdc7b7..a6fe3e5 100644 --- a/Glamourer/Interop/Penumbra/ModSettingApplier.cs +++ b/Glamourer/Interop/Penumbra/ModSettingApplier.cs @@ -18,7 +18,7 @@ public class ModSettingApplier(PenumbraService penumbra, Configuration config, O if (!objects.TryGetValue(state.Identifier, out var data)) { Glamourer.Log.Verbose( - $"[Mod Applier] No mod settings applied because no actor for {state.Identifier} could be found to associate collection."); + $"[Mod Applier] No mod settings applied because no actor for {state.Identifier.Incognito(null)} could be found to associate collection."); return; } diff --git a/Penumbra.GameData b/Penumbra.GameData index 79d8d78..cceebd8 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit 79d8d782b3b454a41f7f87f398806ec4d08d485f +Subproject commit cceebd89a19e27ac843b0a7d17d3c2bb41c77367