Probably fix some atex/avfx problems.

This commit is contained in:
Ottermandias 2022-12-25 14:04:29 +01:00
parent d5e2fc3b05
commit 8bca3d82f5
3 changed files with 37 additions and 13 deletions

View file

@ -19,18 +19,18 @@ public class Dalamud
public static void Initialize( DalamudPluginInterface pluginInterface ) public static void Initialize( DalamudPluginInterface pluginInterface )
=> pluginInterface.Create< Dalamud >(); => pluginInterface.Create< Dalamud >();
// @formatter:off // @formatter:off
[PluginService][RequiredVersion("1.0")] public static DalamudPluginInterface PluginInterface { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static DalamudPluginInterface PluginInterface { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static CommandManager Commands { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static CommandManager Commands { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static DataManager GameData { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static DataManager GameData { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static ClientState ClientState { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static ClientState ClientState { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static ChatGui Chat { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static ChatGui Chat { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static Framework Framework { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static Framework Framework { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static Condition Conditions { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static Condition Conditions { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static TargetManager Targets { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static TargetManager Targets { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static ObjectTable Objects { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static ObjectTable Objects { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static TitleScreenMenu TitleScreenMenu { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static TitleScreenMenu TitleScreenMenu { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static GameGui GameGui { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static GameGui GameGui { get; private set; } = null!;
[PluginService][RequiredVersion("1.0")] public static KeyState KeyState { get; private set; } = null!; [PluginService][RequiredVersion("1.0")] public static KeyState KeyState { get; private set; } = null!;
// @formatter:on // @formatter:on
} }

View file

@ -24,6 +24,14 @@ public unsafe partial class PathResolver
SignatureHelper.Initialise( this ); SignatureHelper.Initialise( this );
} }
public void UpdateAvfx( ResourceType type, ResolveData data )
{
if( type == ResourceType.Avfx )
{
_lastAvfxData = data;
}
}
public bool HandleFiles( ResourceType type, Utf8GamePath _, out ResolveData resolveData ) public bool HandleFiles( ResourceType type, Utf8GamePath _, out ResolveData resolveData )
{ {
switch( type ) switch( type )
@ -91,6 +99,7 @@ public unsafe partial class PathResolver
_someActionLoadHook.Enable(); _someActionLoadHook.Enable();
_someOtherAvfxHook.Enable(); _someOtherAvfxHook.Enable();
_loadCharacterSoundHook.Enable(); _loadCharacterSoundHook.Enable();
//_apricotResourceLoadHook.Enable();
} }
public void Disable() public void Disable()
@ -102,6 +111,7 @@ public unsafe partial class PathResolver
_someActionLoadHook.Disable(); _someActionLoadHook.Disable();
_someOtherAvfxHook.Disable(); _someOtherAvfxHook.Disable();
_loadCharacterSoundHook.Disable(); _loadCharacterSoundHook.Disable();
//_apricotResourceLoadHook.Disable();
} }
public void Dispose() public void Dispose()
@ -113,6 +123,7 @@ public unsafe partial class PathResolver
_someActionLoadHook.Dispose(); _someActionLoadHook.Dispose();
_someOtherAvfxHook.Dispose(); _someOtherAvfxHook.Dispose();
_loadCharacterSoundHook.Dispose(); _loadCharacterSoundHook.Dispose();
//_apricotResourceLoadHook.Dispose();
} }
// Characters load some of their voice lines or whatever with this function. // Characters load some of their voice lines or whatever with this function.
@ -250,5 +261,17 @@ public unsafe partial class PathResolver
_someOtherAvfxHook.Original( unk ); _someOtherAvfxHook.Original( unk );
_animationLoadData = last; _animationLoadData = last;
} }
//private delegate byte ApricotResourceLoadDelegate( IntPtr handle, IntPtr unk1, byte unk2 );
//
//[Signature( "48 89 74 24 ?? 57 48 83 EC ?? 41 0F B6 F0 48 8B F9", DetourName = nameof( ApricotResourceLoadDetour ) )]
//private readonly Hook< ApricotResourceLoadDelegate > _apricotResourceLoadHook = null!;
//
//
//private byte ApricotResourceLoadDetour( IntPtr handle, IntPtr unk1, byte unk2 )
//{
// Penumbra.Log.Information( $"{handle:X} {new ByteString( ( ( ResourceHandle* )handle )->FileName() )} {unk1:X} {unk2} {_lastAvfxData.ModCollection.Name}" );
// return _apricotResourceLoadHook.Original( handle, unk1, unk2 );
//}
} }
} }

View file

@ -71,6 +71,7 @@ public partial class PathResolver : IDisposable
// We also need to handle defaulted materials against a non-default collection. // We also need to handle defaulted materials against a non-default collection.
var path = resolved == null ? gamePath.Path.ToString() : resolved.Value.FullName; var path = resolved == null ? gamePath.Path.ToString() : resolved.Value.FullName;
MaterialState.HandleCollection( resolveData, path, nonDefault, type, resolved, out data ); MaterialState.HandleCollection( resolveData, path, nonDefault, type, resolved, out data );
_animations.UpdateAvfx( type, data.Item2 );
return true; return true;
} }