mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 13:14:17 +01:00
Add another hook for animations in character collections.
This commit is contained in:
parent
58e46accae
commit
df1a75b58a
3 changed files with 33 additions and 1 deletions
|
|
@ -72,4 +72,25 @@ public unsafe partial class PathResolver
|
||||||
_animationLoadCollection = last;
|
_animationLoadCollection = last;
|
||||||
return ret;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -93,6 +93,7 @@ public unsafe partial class PathResolver
|
||||||
LoadTimelineResourcesHook?.Enable();
|
LoadTimelineResourcesHook?.Enable();
|
||||||
CharacterBaseLoadAnimationHook?.Enable();
|
CharacterBaseLoadAnimationHook?.Enable();
|
||||||
LoadSomeAvfxHook?.Enable();
|
LoadSomeAvfxHook?.Enable();
|
||||||
|
LoadSomePapHook?.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisableDataHooks()
|
private void DisableDataHooks()
|
||||||
|
|
@ -105,6 +106,7 @@ public unsafe partial class PathResolver
|
||||||
LoadTimelineResourcesHook?.Disable();
|
LoadTimelineResourcesHook?.Disable();
|
||||||
CharacterBaseLoadAnimationHook?.Disable();
|
CharacterBaseLoadAnimationHook?.Disable();
|
||||||
LoadSomeAvfxHook?.Disable();
|
LoadSomeAvfxHook?.Disable();
|
||||||
|
LoadSomePapHook?.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisposeDataHooks()
|
private void DisposeDataHooks()
|
||||||
|
|
@ -116,6 +118,7 @@ public unsafe partial class PathResolver
|
||||||
LoadTimelineResourcesHook?.Dispose();
|
LoadTimelineResourcesHook?.Dispose();
|
||||||
CharacterBaseLoadAnimationHook?.Dispose();
|
CharacterBaseLoadAnimationHook?.Dispose();
|
||||||
LoadSomeAvfxHook?.Dispose();
|
LoadSomeAvfxHook?.Dispose();
|
||||||
|
LoadSomePapHook?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This map links DrawObjects directly to Actors (by ObjectTable index) and their collections.
|
// This map links DrawObjects directly to Actors (by ObjectTable index) and their collections.
|
||||||
|
|
@ -272,8 +275,12 @@ public unsafe partial class PathResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
// Housing Retainers
|
// 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;
|
return Penumbra.CollectionManager.Default;
|
||||||
|
}
|
||||||
|
|
||||||
string? actorName = null;
|
string? actorName = null;
|
||||||
if( Penumbra.Config.PreferNamedCollectionsOverOwners )
|
if( Penumbra.Config.PreferNamedCollectionsOverOwners )
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,9 @@ public partial class PathResolver : IDisposable
|
||||||
|
|
||||||
private bool HandleAnimationFile( ResourceType type, Utf8GamePath _, [NotNullWhen(true)] out ModCollection? collection )
|
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 )
|
if( _animationLoadCollection != null )
|
||||||
{
|
{
|
||||||
switch( type )
|
switch( type )
|
||||||
|
|
@ -84,6 +87,7 @@ public partial class PathResolver : IDisposable
|
||||||
case ResourceType.Pap:
|
case ResourceType.Pap:
|
||||||
case ResourceType.Avfx:
|
case ResourceType.Avfx:
|
||||||
case ResourceType.Atex:
|
case ResourceType.Atex:
|
||||||
|
case ResourceType.Scd:
|
||||||
collection = _animationLoadCollection;
|
collection = _animationLoadCollection;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue