mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Update ChangeCustomize to call the original by address for Palette+ compatibility.
This commit is contained in:
parent
6dbac4e084
commit
ba81d585d4
2 changed files with 11 additions and 20 deletions
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
|||
/// </summary>
|
||||
public unsafe class ChangeCustomizeService : EventWrapper<Action<Model, Ref<Customize>>, ChangeCustomizeService.Priority>
|
||||
{
|
||||
private readonly PenumbraReloaded _penumbraReloaded;
|
||||
private readonly IGameInteropProvider _interop;
|
||||
private readonly PenumbraReloaded _penumbraReloaded;
|
||||
private readonly IGameInteropProvider _interop;
|
||||
private readonly delegate* unmanaged[Stdcall]<Human*, byte*, bool, bool> _original;
|
||||
|
||||
/// <summary> Check whether we in a manual customize update, in which case we need to not toggle certain flags. </summary>
|
||||
public static readonly ThreadLocal<bool> InUpdate = new(() => false);
|
||||
|
|
@ -37,6 +37,7 @@ public unsafe class ChangeCustomizeService : EventWrapper<Action<Model, Ref<Cust
|
|||
_penumbraReloaded = penumbraReloaded;
|
||||
_interop = interop;
|
||||
_changeCustomizeHook = Create();
|
||||
_original = Human.MemberFunctionPointers.UpdateDrawData;
|
||||
_penumbraReloaded.Subscribe(Restore, PenumbraReloaded.Priority.ChangeCustomizeService);
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +62,6 @@ public unsafe class ChangeCustomizeService : EventWrapper<Action<Model, Ref<Cust
|
|||
|
||||
private delegate bool ChangeCustomizeDelegate(Human* human, byte* data, byte skipEquipment);
|
||||
|
||||
[Signature(Sigs.ChangeCustomize, DetourName = nameof(ChangeCustomizeDetour))]
|
||||
private Hook<ChangeCustomizeDelegate> _changeCustomizeHook;
|
||||
|
||||
public bool UpdateCustomize(Model model, CustomizeData customize)
|
||||
|
|
@ -71,7 +71,7 @@ public unsafe class ChangeCustomizeService : EventWrapper<Action<Model, Ref<Cust
|
|||
|
||||
Glamourer.Log.Verbose($"[ChangeCustomize] Invoked on 0x{model.Address:X} with {customize}.");
|
||||
InUpdate.Value = true;
|
||||
var ret = _changeCustomizeHook.Original(model.AsHuman, customize.Data, 1);
|
||||
var ret = _original(model.AsHuman, customize.Data, true);
|
||||
InUpdate.Value = false;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -81,9 +81,12 @@ public unsafe class ChangeCustomizeService : EventWrapper<Action<Model, Ref<Cust
|
|||
|
||||
private bool ChangeCustomizeDetour(Human* human, byte* data, byte skipEquipment)
|
||||
{
|
||||
var customize = new Ref<Customize>(new Customize(*(CustomizeData*)data));
|
||||
Invoke(this, (Model)human, customize);
|
||||
((Customize*)data)->Load(customize.Value);
|
||||
if (!InUpdate.Value)
|
||||
{
|
||||
var customize = new Ref<Customize>(new Customize(*(CustomizeData*)data));
|
||||
Invoke(this, (Model)human, customize);
|
||||
((Customize*)data)->Load(customize.Value);
|
||||
}
|
||||
return _changeCustomizeHook.Original(human, data, skipEquipment);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue