Use file type enum for Crc64 handling.

This commit is contained in:
Ottermandias 2022-06-20 18:27:41 +02:00
parent c4f82435bf
commit 00c11b49f0
2 changed files with 6 additions and 5 deletions

View file

@ -68,7 +68,7 @@ public unsafe partial class ResourceLoader
}
}
private event Action< Utf8GamePath, FullPath?, object? >? PathResolved;
private event Action< Utf8GamePath, ResourceType, FullPath?, object? >? PathResolved;
private ResourceHandle* GetResourceHandler( bool isSync, ResourceManager* resourceManager, ResourceCategory* categoryId,
ResourceType* resourceType, int* resourceHash, byte* path, GetResourceParameters* pGetResParams, bool isUnk )
@ -85,7 +85,7 @@ public unsafe partial class ResourceLoader
// If no replacements are being made, we still want to be able to trigger the event.
var (resolvedPath, data) = ResolvePath( gamePath, *categoryId, *resourceType, *resourceHash );
PathResolved?.Invoke( gamePath, resolvedPath, data );
PathResolved?.Invoke( gamePath, *resourceType, resolvedPath, data );
if( resolvedPath == null )
{
var retUnmodified = CallOriginalHandler( isSync, resourceManager, categoryId, resourceType, resourceHash, path, pGetResParams, isUnk );

View file

@ -4,6 +4,7 @@ using Dalamud.Hooking;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle;
using Penumbra.GameData.ByteString;
using Penumbra.GameData.Enums;
namespace Penumbra.Interop.Loader;
@ -67,11 +68,11 @@ public unsafe partial class ResourceLoader
: LoadMdlFileExternHook.Original( resourceHandle, unk1, unk2, ptr );
private void AddCrc( Utf8GamePath _, FullPath? path, object? _2 )
private void AddCrc( Utf8GamePath _, ResourceType type, FullPath? path, object? _2 )
{
if( path is { Extension: ".mdl" or ".tex" } p )
if( path.HasValue && type is ResourceType.Mdl or ResourceType.Tex )
{
_customFileCrc.Add( p.Crc64 );
_customFileCrc.Add( path.Value.Crc64 );
}
}