Move signatures and add Footsteps.

This commit is contained in:
Ottermandias 2023-12-20 16:43:30 +01:00
parent 5d28904bdf
commit d8f5851e0c
3 changed files with 23 additions and 8 deletions

@ -1 +1 @@
Subproject commit bee73fbe1e263d81067029ad97c8e4a263c88147
Subproject commit 4d3570fd47d78dbc49cf5e41fd3545a533ef9e81

View file

@ -55,6 +55,7 @@ public unsafe class AnimationHookService : IDisposable
_unkParasolAnimationHook.Enable();
_dismountHook.Enable();
_apricotListenerSoundPlayHook.Enable();
_footStepHook.Enable();
}
public bool HandleFiles(ResourceType type, Utf8GamePath _, out ResolveData resolveData)
@ -113,6 +114,7 @@ public unsafe class AnimationHookService : IDisposable
_unkParasolAnimationHook.Dispose();
_dismountHook.Dispose();
_apricotListenerSoundPlayHook.Dispose();
_footStepHook.Dispose();
}
/// <summary> Characters load some of their voice lines or whatever with this function. </summary>
@ -324,7 +326,7 @@ public unsafe class AnimationHookService : IDisposable
private delegate void UnkMountAnimationDelegate(DrawObject* drawObject, uint unk1, byte unk2, uint unk3);
[Signature("48 89 5C 24 ?? 48 89 6C 24 ?? 89 54 24", DetourName = nameof(UnkMountAnimationDetour))]
[Signature(Sigs.UnkMountAnimation, DetourName = nameof(UnkMountAnimationDetour))]
private readonly Hook<UnkMountAnimationDelegate> _unkMountAnimationHook = null!;
private void UnkMountAnimationDetour(DrawObject* drawObject, uint unk1, byte unk2, uint unk3)
@ -335,10 +337,9 @@ public unsafe class AnimationHookService : IDisposable
_animationLoadData.Value = last;
}
private delegate void UnkParasolAnimationDelegate(DrawObject* drawObject, int unk1);
[Signature("48 89 5C 24 ?? 48 89 74 24 ?? 89 54 24 ?? 57 48 83 EC ?? 48 8B F9", DetourName = nameof(UnkParasolAnimationDetour))]
[Signature(Sigs.UnkParasolAnimation, DetourName = nameof(UnkParasolAnimationDetour))]
private readonly Hook<UnkParasolAnimationDelegate> _unkParasolAnimationHook = null!;
private void UnkParasolAnimationDetour(DrawObject* drawObject, int unk1)
@ -347,9 +348,9 @@ public unsafe class AnimationHookService : IDisposable
_animationLoadData.Value = _collectionResolver.IdentifyCollection(drawObject, true);
_unkParasolAnimationHook.Original(drawObject, unk1);
_animationLoadData.Value = last;
}
}
[Signature("E8 ?? ?? ?? ?? F6 43 ?? ?? 74 ?? 48 8B CB", DetourName = nameof(DismountDetour))]
[Signature(Sigs.Dismount, DetourName = nameof(DismountDetour))]
private readonly Hook<DismountDelegate> _dismountHook = null!;
private delegate void DismountDelegate(nint a1, nint a2);
@ -375,7 +376,7 @@ public unsafe class AnimationHookService : IDisposable
_animationLoadData.Value = last;
}
[Signature("48 89 6C 24 ?? 41 54 41 56 41 57 48 81 EC", DetourName = nameof(ApricotListenerSoundPlayDetour))]
[Signature(Sigs.ApricotListenerSoundPlay, DetourName = nameof(ApricotListenerSoundPlayDetour))]
private readonly Hook<ApricotListenerSoundPlayDelegate> _apricotListenerSoundPlayHook = null!;
private delegate nint ApricotListenerSoundPlayDelegate(nint a1, nint a2, nint a3, nint a4, nint a5, nint a6);
@ -406,4 +407,17 @@ public unsafe class AnimationHookService : IDisposable
_animationLoadData.Value = last;
return ret;
}
private delegate void FootStepDelegate(GameObject* gameObject, int id, int unk);
[Signature(Sigs.FootStepSound, DetourName = nameof(FootStepDetour))]
private readonly Hook<FootStepDelegate> _footStepHook = null!;
private void FootStepDetour(GameObject* gameObject, int id, int unk)
{
var last = _animationLoadData.Value;
_animationLoadData.Value = _collectionResolver.IdentifyCollection(gameObject, true);
_footStepHook.Original(gameObject, id, unk);
_animationLoadData.Value = last;
}
}

View file

@ -1,6 +1,7 @@
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
using Penumbra.GameData;
namespace Penumbra.Interop.Structs;
@ -10,7 +11,7 @@ public class ModelResourceHandleUtility
public ModelResourceHandleUtility(IGameInteropProvider interop)
=> interop.InitializeFromAttributes(this);
[Signature("E8 ?? ?? ?? ?? 44 8B CD 48 89 44 24")]
[Signature(Sigs.GetMaterialFileNameBySlot)]
private static nint _getMaterialFileNameBySlot = nint.Zero;
public static unsafe byte* GetMaterialFileNameBySlot(ModelResourceHandle* handle, uint slot)