Temporarily use custom address for ReadStainingTemplate.

This commit is contained in:
Ottermandias 2025-05-01 23:02:08 +02:00
parent 9a684c9ff5
commit b53124e708
2 changed files with 10 additions and 6 deletions

View file

@ -1,4 +1,5 @@
using Dalamud.Hooking;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
@ -27,7 +28,8 @@ public sealed unsafe class PrepareColorSet
: base("Prepare Color Set ")
{
_updateColorSets = updateColorSets;
_task = hooks.CreateHook<Delegate>(Name, Sigs.PrepareColorSet, Detour, true);
hooks.Provider.InitializeFromAttributes(this);
_task = hooks.CreateHook<Delegate>(Name, Sigs.PrepareColorSet, Detour, true);
}
private readonly Task<Hook<Delegate>> _task;
@ -49,6 +51,10 @@ public sealed unsafe class PrepareColorSet
private delegate Texture* Delegate(MaterialResourceHandle* material, StainId stainId1, StainId stainId2);
// TODO use CS when stabilized in Dalamud.
[Signature("E8 ?? ?? ?? ?? 48 8B FB EB 07")]
private static delegate* unmanaged<MaterialResourceHandle*, ushort*, byte, Half*, uint, void> _readStainingTemplate = null;
private Texture* Detour(MaterialResourceHandle* material, StainId stainId1, StainId stainId2)
{
Glamourer.Log.Excessive($"[{Name}] Triggered with 0x{(nint)material:X} {stainId1.Id} {stainId2.Id}.");
@ -78,12 +84,10 @@ public sealed unsafe class PrepareColorSet
if (GetDyeTable(material, out var dyeTable))
{
if (stainIds.Stain1.Id != 0)
((delegate* unmanaged<MaterialResourceHandle*, ushort*, byte, Half*, uint, void>)MaterialResourceHandle.MemberFunctionPointers
.ReadStainingTemplate)(material, dyeTable, stainIds.Stain1.Id, (Half*)(&newTable), 0);
_readStainingTemplate(material, dyeTable, stainIds.Stain1.Id, (Half*)(&newTable), 0);
if (stainIds.Stain2.Id != 0)
((delegate* unmanaged<MaterialResourceHandle*, ushort*, byte, Half*, uint, void>)MaterialResourceHandle.MemberFunctionPointers
.ReadStainingTemplate)(material, dyeTable, stainIds.Stain2.Id, (Half*)(&newTable), 1);
_readStainingTemplate(material, dyeTable, stainIds.Stain2.Id, (Half*)(&newTable), 1);
}
table = newTable;

@ -1 +1 @@
Subproject commit d13d700796648f2a9279250052c4aa8ebeca221f
Subproject commit abfce28e0bacdea841f029f59bc19971c43814d8