mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-21 23:37:47 +01:00
Load Atex based on the last loaded Avfx, testing?
This commit is contained in:
parent
549f8ce4b4
commit
32cf729aa8
4 changed files with 42 additions and 38 deletions
|
|
@ -1,10 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Logging;
|
|
||||||
using Dalamud.Utility.Signatures;
|
using Dalamud.Utility.Signatures;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
|
||||||
using Penumbra.Collections;
|
using Penumbra.Collections;
|
||||||
using GameObject = FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject;
|
using GameObject = FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject;
|
||||||
|
|
||||||
|
|
@ -13,6 +9,7 @@ namespace Penumbra.Interop.Resolver;
|
||||||
public unsafe partial class PathResolver
|
public unsafe partial class PathResolver
|
||||||
{
|
{
|
||||||
private ModCollection? _animationLoadCollection;
|
private ModCollection? _animationLoadCollection;
|
||||||
|
private ModCollection? _lastAvfxCollection = null;
|
||||||
|
|
||||||
public delegate ulong LoadTimelineResourcesDelegate( IntPtr timeline );
|
public delegate ulong LoadTimelineResourcesDelegate( IntPtr timeline );
|
||||||
|
|
||||||
|
|
@ -123,16 +120,4 @@ public unsafe partial class PathResolver
|
||||||
SomeOtherAvfxHook!.Original( unk );
|
SomeOtherAvfxHook!.Original( unk );
|
||||||
_animationLoadCollection = last;
|
_animationLoadCollection = last;
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate IntPtr SomeAtexDelegate( IntPtr a1, IntPtr a2, IntPtr a3, IntPtr a4, uint a5, IntPtr a6 );
|
|
||||||
|
|
||||||
[Signature( "E8 ?? ?? ?? ?? 84 C0 75 ?? 48 8B CE 41 B6" )]
|
|
||||||
public Hook< SomeAtexDelegate >? SomeAtexHook;
|
|
||||||
|
|
||||||
public IntPtr SomeAtexDetour( IntPtr a1, IntPtr a2, IntPtr a3, IntPtr a4, uint a5, IntPtr a6 )
|
|
||||||
{
|
|
||||||
var ret = SomeAtexHook!.Original( a1, a2, a3, a4, a5, a6 );
|
|
||||||
PluginLog.Information( $"{a1:X} {a2:X} {a3:X} {a4:X} {a5:X} {a6:X} {ret}" );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +99,6 @@ public unsafe partial class PathResolver
|
||||||
LoadSomePapHook?.Enable();
|
LoadSomePapHook?.Enable();
|
||||||
SomeActionLoadHook?.Enable();
|
SomeActionLoadHook?.Enable();
|
||||||
SomeOtherAvfxHook?.Enable();
|
SomeOtherAvfxHook?.Enable();
|
||||||
SomeAtexHook?.Enable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisableDataHooks()
|
private void DisableDataHooks()
|
||||||
|
|
@ -115,7 +114,6 @@ public unsafe partial class PathResolver
|
||||||
LoadSomePapHook?.Disable();
|
LoadSomePapHook?.Disable();
|
||||||
SomeActionLoadHook?.Disable();
|
SomeActionLoadHook?.Disable();
|
||||||
SomeOtherAvfxHook?.Disable();
|
SomeOtherAvfxHook?.Disable();
|
||||||
SomeAtexHook?.Disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisposeDataHooks()
|
private void DisposeDataHooks()
|
||||||
|
|
@ -130,7 +128,6 @@ public unsafe partial class PathResolver
|
||||||
LoadSomePapHook?.Dispose();
|
LoadSomePapHook?.Dispose();
|
||||||
SomeActionLoadHook?.Dispose();
|
SomeActionLoadHook?.Dispose();
|
||||||
SomeOtherAvfxHook?.Dispose();
|
SomeOtherAvfxHook?.Dispose();
|
||||||
SomeAtexHook?.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.
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public partial class PathResolver : IDisposable
|
||||||
|| PathCollections.TryRemove( gamePath.Path, out collection )
|
|| PathCollections.TryRemove( gamePath.Path, out collection )
|
||||||
|| HandleAnimationFile( type, gamePath, out collection )
|
|| HandleAnimationFile( type, gamePath, out collection )
|
||||||
|| HandleDecalFile( type, gamePath, out collection );
|
|| HandleDecalFile( type, gamePath, out collection );
|
||||||
if( !nonDefault || collection == null)
|
if( !nonDefault || collection == null )
|
||||||
{
|
{
|
||||||
collection = Penumbra.CollectionManager.Default;
|
collection = Penumbra.CollectionManager.Default;
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +60,7 @@ public partial class PathResolver : IDisposable
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HandleDecalFile( ResourceType type, Utf8GamePath gamePath, [NotNullWhen(true)] out ModCollection? collection )
|
private bool HandleDecalFile( ResourceType type, Utf8GamePath gamePath, [NotNullWhen( true )] out ModCollection? collection )
|
||||||
{
|
{
|
||||||
if( type == ResourceType.Tex
|
if( type == ResourceType.Tex
|
||||||
&& _lastCreatedCollection != null
|
&& _lastCreatedCollection != null
|
||||||
|
|
@ -74,27 +74,43 @@ public partial class PathResolver : IDisposable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.Atex )
|
switch( type )
|
||||||
if (_animationLoadCollection == null)
|
|
||||||
PluginLog.Information( $"ATEX {_} Default" );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PluginLog.Information( $"ATEX {_} {_animationLoadCollection?.Name}" );
|
|
||||||
}
|
|
||||||
if( _animationLoadCollection != null )
|
|
||||||
{
|
{
|
||||||
switch( type )
|
case ResourceType.Tmb:
|
||||||
{
|
case ResourceType.Pap:
|
||||||
case ResourceType.Tmb:
|
case ResourceType.Scd:
|
||||||
case ResourceType.Pap:
|
if( _animationLoadCollection != null )
|
||||||
case ResourceType.Avfx:
|
{
|
||||||
case ResourceType.Atex:
|
|
||||||
case ResourceType.Scd:
|
|
||||||
collection = _animationLoadCollection;
|
collection = _animationLoadCollection;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ResourceType.Avfx:
|
||||||
|
_lastAvfxCollection = _animationLoadCollection ?? Penumbra.CollectionManager.Default;
|
||||||
|
if( _animationLoadCollection != null )
|
||||||
|
{
|
||||||
|
collection = _animationLoadCollection;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ResourceType.Atex:
|
||||||
|
if( _lastAvfxCollection != null )
|
||||||
|
{
|
||||||
|
collection = _lastAvfxCollection;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( _animationLoadCollection != null )
|
||||||
|
{
|
||||||
|
collection = _animationLoadCollection;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
collection = null;
|
collection = null;
|
||||||
|
|
|
||||||
|
|
@ -504,6 +504,12 @@ public class Penumbra : IDisposable
|
||||||
CollectionManager.Default.Index );
|
CollectionManager.Default.Index );
|
||||||
sb.AppendFormat( "> **`Current Collection: `** {0}... ({1})\n", CollectionName( CollectionManager.Current ),
|
sb.AppendFormat( "> **`Current Collection: `** {0}... ({1})\n", CollectionName( CollectionManager.Current ),
|
||||||
CollectionManager.Current.Index );
|
CollectionManager.Current.Index );
|
||||||
|
foreach( var type in CollectionTypeExtensions.Special )
|
||||||
|
{
|
||||||
|
var collection = CollectionManager.ByType( type );
|
||||||
|
if( collection != null )
|
||||||
|
sb.AppendFormat( "> **`{0,-29}`** {1}... ({2})\n", type.ToName(), CollectionName( collection ), collection.Index );
|
||||||
|
}
|
||||||
foreach( var (name, collection) in CollectionManager.Characters )
|
foreach( var (name, collection) in CollectionManager.Characters )
|
||||||
{
|
{
|
||||||
sb.AppendFormat( "> **`{2,-29}`** {0}... ({1})\n", CollectionName( collection ),
|
sb.AppendFormat( "> **`{2,-29}`** {0}... ({1})\n", CollectionName( collection ),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue