mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-01-02 05:43:42 +01:00
Add handling for Monk fist weapon hack, remove LoadEquipment hooks, and add item movement and plate apply hooks instead.
This commit is contained in:
parent
323924fba2
commit
5874688838
19 changed files with 403 additions and 128 deletions
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
using Glamourer.Events;
|
||||
using Glamourer.Interop.Structs;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
|
@ -11,24 +10,18 @@ namespace Glamourer.Interop;
|
|||
|
||||
public unsafe class UpdateSlotService : IDisposable
|
||||
{
|
||||
public readonly SlotUpdating SlotUpdatingEvent;
|
||||
public readonly EquipmentLoading EquipmentLoadingEvent;
|
||||
public readonly SlotUpdating SlotUpdatingEvent;
|
||||
|
||||
public UpdateSlotService(SlotUpdating slotUpdating, EquipmentLoading equipmentLoadingEvent)
|
||||
public UpdateSlotService(SlotUpdating slotUpdating)
|
||||
{
|
||||
SlotUpdatingEvent = slotUpdating;
|
||||
EquipmentLoadingEvent = equipmentLoadingEvent;
|
||||
SlotUpdatingEvent = slotUpdating;
|
||||
SignatureHelper.Initialise(this);
|
||||
_flagSlotForUpdateHook.Enable();
|
||||
_loadEquipmentHook =
|
||||
Hook<LoadEquipmentDelegateIntern>.FromAddress((nint) DrawDataContainer.MemberFunctionPointers.LoadEquipment, LoadEquipmentDetour);
|
||||
_loadEquipmentHook.Enable();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_flagSlotForUpdateHook.Dispose();
|
||||
_loadEquipmentHook.Dispose();
|
||||
}
|
||||
|
||||
public void UpdateSlot(Model drawObject, EquipSlot slot, CharacterArmor data)
|
||||
|
|
@ -53,10 +46,6 @@ public unsafe class UpdateSlotService : IDisposable
|
|||
[Signature(Sigs.FlagSlotForUpdate, DetourName = nameof(FlagSlotForUpdateDetour))]
|
||||
private readonly Hook<FlagSlotForUpdateDelegateIntern> _flagSlotForUpdateHook = null!;
|
||||
|
||||
private delegate void LoadEquipmentDelegateIntern(DrawDataContainer* drawDataContainer, uint slotIdx, CharacterArmor data, bool force);
|
||||
|
||||
private readonly Hook<LoadEquipmentDelegateIntern> _loadEquipmentHook = null!;
|
||||
|
||||
private ulong FlagSlotForUpdateDetour(nint drawObject, uint slotIdx, CharacterArmor* data)
|
||||
{
|
||||
var slot = slotIdx.ToEquipSlot();
|
||||
|
|
@ -66,14 +55,6 @@ public unsafe class UpdateSlotService : IDisposable
|
|||
return returnValue == ulong.MaxValue ? _flagSlotForUpdateHook.Original(drawObject, slotIdx, data) : returnValue;
|
||||
}
|
||||
|
||||
private void LoadEquipmentDetour(DrawDataContainer* drawDataContainer, uint slotIdx, CharacterArmor data, bool force)
|
||||
{
|
||||
var slot = slotIdx.ToEquipSlot();
|
||||
EquipmentLoadingEvent.Invoke(drawDataContainer->Parent, slot, data);
|
||||
Glamourer.Log.Excessive($"[LoadEquipment] Called with 0x{(ulong)drawDataContainer:X} for slot {slot} with {data} ({force}).");
|
||||
_loadEquipmentHook.Original(drawDataContainer, slotIdx, data, force);
|
||||
}
|
||||
|
||||
private ulong FlagSlotForUpdateInterop(Model drawObject, EquipSlot slot, CharacterArmor armor)
|
||||
=> _flagSlotForUpdateHook.Original(drawObject.Address, slot.ToIndex(), &armor);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue