diff --git a/Penumbra/Interop/Resolver/PathResolver.Animation.cs b/Penumbra/Interop/Resolver/PathResolver.Animation.cs index 363ce1e2..53cb7be5 100644 --- a/Penumbra/Interop/Resolver/PathResolver.Animation.cs +++ b/Penumbra/Interop/Resolver/PathResolver.Animation.cs @@ -72,4 +72,25 @@ public unsafe partial class PathResolver _animationLoadCollection = last; return ret; } + + public delegate void LoadSomePap( IntPtr a1, int a2, IntPtr a3, int a4 ); + + [Signature( "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC ?? 41 8B D9 89 51" )] + public Hook< LoadSomePap >? LoadSomePapHook; + + private void LoadSomePapDetour( IntPtr a1, int a2, IntPtr a3, int a4 ) + { + var timelinePtr = a1 + 0x50; + var last = _animationLoadCollection; + if( timelinePtr != IntPtr.Zero ) + { + var actorIdx = ( int )( *( *( ulong** )timelinePtr + 1 ) >> 3 ); + if( actorIdx >= 0 && actorIdx < Dalamud.Objects.Length ) + { + _animationLoadCollection = IdentifyCollection( ( GameObject* )( Dalamud.Objects[ actorIdx ]?.Address ?? IntPtr.Zero ) ); + } + } + LoadSomePapHook!.Original( a1, a2, a3, a4 ); + _animationLoadCollection = last; + } } \ No newline at end of file diff --git a/Penumbra/Interop/Resolver/PathResolver.Data.cs b/Penumbra/Interop/Resolver/PathResolver.Data.cs index 71cda6c5..28241e9c 100644 --- a/Penumbra/Interop/Resolver/PathResolver.Data.cs +++ b/Penumbra/Interop/Resolver/PathResolver.Data.cs @@ -93,6 +93,7 @@ public unsafe partial class PathResolver LoadTimelineResourcesHook?.Enable(); CharacterBaseLoadAnimationHook?.Enable(); LoadSomeAvfxHook?.Enable(); + LoadSomePapHook?.Enable(); } private void DisableDataHooks() @@ -105,6 +106,7 @@ public unsafe partial class PathResolver LoadTimelineResourcesHook?.Disable(); CharacterBaseLoadAnimationHook?.Disable(); LoadSomeAvfxHook?.Disable(); + LoadSomePapHook?.Disable(); } private void DisposeDataHooks() @@ -116,6 +118,7 @@ public unsafe partial class PathResolver LoadTimelineResourcesHook?.Dispose(); CharacterBaseLoadAnimationHook?.Dispose(); LoadSomeAvfxHook?.Dispose(); + LoadSomePapHook?.Dispose(); } // This map links DrawObjects directly to Actors (by ObjectTable index) and their collections. @@ -272,8 +275,12 @@ public unsafe partial class PathResolver } // Housing Retainers - if( Penumbra.Config.UseDefaultCollectionForRetainers && gameObject->ObjectKind == (byte) ObjectKind.EventNpc && gameObject->DataID == 1011832 ) + if( Penumbra.Config.UseDefaultCollectionForRetainers + && gameObject->ObjectKind == ( byte )ObjectKind.EventNpc + && gameObject->DataID == 1011832 ) + { return Penumbra.CollectionManager.Default; + } string? actorName = null; if( Penumbra.Config.PreferNamedCollectionsOverOwners ) diff --git a/Penumbra/Interop/Resolver/PathResolver.cs b/Penumbra/Interop/Resolver/PathResolver.cs index d12e6d00..ab4d208b 100644 --- a/Penumbra/Interop/Resolver/PathResolver.cs +++ b/Penumbra/Interop/Resolver/PathResolver.cs @@ -76,6 +76,9 @@ public partial class PathResolver : IDisposable private bool HandleAnimationFile( ResourceType type, Utf8GamePath _, [NotNullWhen(true)] out ModCollection? collection ) { + if( type == ResourceType.Pap && _.Path.EndsWith( '0', '1', '0', '.', 'p', 'a', 'p' ) ) + PluginLog.Information( $"PAPPITY PAP {_}" ); + if( _animationLoadCollection != null ) { switch( type ) @@ -84,6 +87,7 @@ public partial class PathResolver : IDisposable case ResourceType.Pap: case ResourceType.Avfx: case ResourceType.Atex: + case ResourceType.Scd: collection = _animationLoadCollection; return true; }