|
2 | 2 | using Dalamud.Hooking; |
3 | 3 | using Dalamud.Plugin.Services; |
4 | 4 | using Dalamud.Utility.Signatures; |
| 5 | +using FFXIVClientStructs.FFXIV.Client.Game; |
5 | 6 | using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; |
6 | 7 | using Penumbra.Collections; |
7 | 8 | using Penumbra.Api.Enums; |
@@ -37,6 +38,10 @@ public AnimationHookService(PerformanceTracker performance, IObjectTable objects |
37 | 38 | _conditions = conditions; |
38 | 39 |
|
39 | 40 | interop.InitializeFromAttributes(this); |
| 41 | + _loadCharacterSoundHook = |
| 42 | + interop.HookFromAddress<LoadCharacterSound>( |
| 43 | + (nint)FFXIVClientStructs.FFXIV.Client.Game.Character.Character.VfxContainer.MemberFunctionPointers.LoadCharacterSound, |
| 44 | + LoadCharacterSoundDetour); |
40 | 45 |
|
41 | 46 | _loadCharacterSoundHook.Enable(); |
42 | 47 | _loadTimelineResourcesHook.Enable(); |
@@ -113,9 +118,7 @@ public void Dispose() |
113 | 118 | /// <summary> Characters load some of their voice lines or whatever with this function. </summary> |
114 | 119 | private delegate nint LoadCharacterSound(nint character, int unk1, int unk2, nint unk3, ulong unk4, int unk5, int unk6, ulong unk7); |
115 | 120 |
|
116 | | - // TODO: Use ClientStructs |
117 | | - [Signature(Sigs.LoadCharacterSound, DetourName = nameof(LoadCharacterSoundDetour))] |
118 | | - private readonly Hook<LoadCharacterSound> _loadCharacterSoundHook = null!; |
| 121 | + private readonly Hook<LoadCharacterSound> _loadCharacterSoundHook; |
119 | 122 |
|
120 | 123 | private nint LoadCharacterSoundDetour(nint container, int unk1, int unk2, nint unk3, ulong unk4, int unk5, int unk6, ulong unk7) |
121 | 124 | { |
@@ -194,16 +197,18 @@ private void LoadSomePapDetour(nint a1, int a2, nint a3, int a4) |
194 | 197 | _animationLoadData.Value = last; |
195 | 198 | } |
196 | 199 |
|
| 200 | + private delegate void SomeActionLoadDelegate(ActionTimelineManager* timelineManager); |
| 201 | + |
197 | 202 | /// <summary> Seems to load character actions when zoning or changing class, maybe. </summary> |
198 | 203 | [Signature(Sigs.LoadSomeAction, DetourName = nameof(SomeActionLoadDetour))] |
199 | | - private readonly Hook<CharacterBaseNoArgumentDelegate> _someActionLoadHook = null!; |
| 204 | + private readonly Hook<SomeActionLoadDelegate> _someActionLoadHook = null!; |
200 | 205 |
|
201 | | - private void SomeActionLoadDetour(nint gameObject) |
| 206 | + private void SomeActionLoadDetour(ActionTimelineManager* timelineManager) |
202 | 207 | { |
203 | 208 | using var performance = _performance.Measure(PerformanceType.LoadAction); |
204 | 209 | var last = _animationLoadData.Value; |
205 | | - _animationLoadData.Value = _collectionResolver.IdentifyCollection((GameObject*)gameObject, true); |
206 | | - _someActionLoadHook.Original(gameObject); |
| 210 | + _animationLoadData.Value = _collectionResolver.IdentifyCollection((GameObject*)timelineManager->Parent, true); |
| 211 | + _someActionLoadHook.Original(timelineManager); |
207 | 212 | _animationLoadData.Value = last; |
208 | 213 | } |
209 | 214 |
|
|
0 commit comments