Rework ResolveData.

This commit is contained in:
Ottermandias 2022-09-05 13:30:07 +02:00
parent 75182d094b
commit d12a3dd152
14 changed files with 199 additions and 170 deletions

View file

@ -48,7 +48,7 @@ public unsafe partial class ResourceLoader
public Utf8GamePath OriginalPath;
public FullPath ManipulatedPath;
public ResourceCategory Category;
public object? ResolverInfo;
public ResolveData ResolverInfo;
public ResourceType Extension;
}
@ -59,18 +59,18 @@ public unsafe partial class ResourceLoader
public void EnableDebug()
{
_decRefHook?.Enable();
_decRefHook.Enable();
ResourceLoaded += AddModifiedDebugInfo;
}
public void DisableDebug()
{
_decRefHook?.Disable();
_decRefHook.Disable();
ResourceLoaded -= AddModifiedDebugInfo;
}
private void AddModifiedDebugInfo( Structs.ResourceHandle* handle, Utf8GamePath originalPath, FullPath? manipulatedPath,
LinkedModCollection? resolverInfo )
ResolveData resolverInfo )
{
if( manipulatedPath == null || manipulatedPath.Value.Crc64 == 0 )
{
@ -244,7 +244,7 @@ public unsafe partial class ResourceLoader
private static void LogPath( Utf8GamePath path, bool synchronous )
=> PluginLog.Information( $"[ResourceLoader] Requested {path} {( synchronous ? "synchronously." : "asynchronously." )}" );
private static void LogResource( Structs.ResourceHandle* handle, Utf8GamePath path, FullPath? manipulatedPath, LinkedModCollection? _ )
private static void LogResource( Structs.ResourceHandle* handle, Utf8GamePath path, FullPath? manipulatedPath, ResolveData _ )
{
var pathString = manipulatedPath != null ? $"custom file {manipulatedPath} instead of {path}" : path.ToString();
PluginLog.Information( $"[ResourceLoader] Loaded {pathString} to 0x{( ulong )handle:X}. (Refcount {handle->RefCount})" );