diff --git a/Glamourer.GameData/Offsets.cs b/Glamourer.GameData/Offsets.cs index a6b5d1f..71151d9 100644 --- a/Glamourer.GameData/Offsets.cs +++ b/Glamourer.GameData/Offsets.cs @@ -1,19 +1,7 @@ namespace Glamourer; -public static class Offsets -{ - public static class Character - { - public const int ClassJobContainer = 0x1A8; - } - - public const byte DrawObjectVisorStateFlag = 0x40; - public const byte DrawObjectVisorToggleFlag = 0x80; -} - public static class Sigs { public const string ChangeJob = "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC ?? 80 61"; public const string FlagSlotForUpdate = "48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 8B DA 49 8B F0 48 8B F9 83 FA 0A"; - public const string ChangeCustomize = "E8 ?? ?? ?? ?? 41 0F B6 C5 66 41 89 86"; } diff --git a/Glamourer/Interop/ChangeCustomizeService.cs b/Glamourer/Interop/ChangeCustomizeService.cs index 0b6f2fb..a5a46e6 100644 --- a/Glamourer/Interop/ChangeCustomizeService.cs +++ b/Glamourer/Interop/ChangeCustomizeService.cs @@ -2,7 +2,6 @@ using System.Threading; using Dalamud.Hooking; using Dalamud.Plugin.Services; -using Dalamud.Utility.Signatures; using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; using Glamourer.Customization; using Glamourer.Events; @@ -19,8 +18,9 @@ namespace Glamourer.Interop; /// public unsafe class ChangeCustomizeService : EventWrapper>, ChangeCustomizeService.Priority> { - private readonly PenumbraReloaded _penumbraReloaded; - private readonly IGameInteropProvider _interop; + private readonly PenumbraReloaded _penumbraReloaded; + private readonly IGameInteropProvider _interop; + private readonly delegate* unmanaged[Stdcall] _original; /// Check whether we in a manual customize update, in which case we need to not toggle certain flags. public static readonly ThreadLocal InUpdate = new(() => false); @@ -37,6 +37,7 @@ public unsafe class ChangeCustomizeService : EventWrapper _changeCustomizeHook; public bool UpdateCustomize(Model model, CustomizeData customize) @@ -71,7 +71,7 @@ public unsafe class ChangeCustomizeService : EventWrapper(new Customize(*(CustomizeData*)data)); - Invoke(this, (Model)human, customize); - ((Customize*)data)->Load(customize.Value); + if (!InUpdate.Value) + { + var customize = new Ref(new Customize(*(CustomizeData*)data)); + Invoke(this, (Model)human, customize); + ((Customize*)data)->Load(customize.Value); + } return _changeCustomizeHook.Original(human, data, skipEquipment); } }