diff --git a/Penumbra.GameData b/Penumbra.GameData index bee73fbe..4d3570fd 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit bee73fbe1e263d81067029ad97c8e4a263c88147 +Subproject commit 4d3570fd47d78dbc49cf5e41fd3545a533ef9e81 diff --git a/Penumbra/Interop/PathResolving/AnimationHookService.cs b/Penumbra/Interop/PathResolving/AnimationHookService.cs index 7fa0ed35..d13ef7f2 100644 --- a/Penumbra/Interop/PathResolving/AnimationHookService.cs +++ b/Penumbra/Interop/PathResolving/AnimationHookService.cs @@ -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(); } /// Characters load some of their voice lines or whatever with this function. @@ -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 _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 _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 _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 _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 _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; + } } diff --git a/Penumbra/Interop/Structs/ModelResourceHandleUtility.cs b/Penumbra/Interop/Structs/ModelResourceHandleUtility.cs index 008cd59a..bcfa2fa2 100644 --- a/Penumbra/Interop/Structs/ModelResourceHandleUtility.cs +++ b/Penumbra/Interop/Structs/ModelResourceHandleUtility.cs @@ -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)