mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add collection logging to resolve logging.
This commit is contained in:
parent
58f86743eb
commit
889fc101a8
2 changed files with 31 additions and 2 deletions
|
|
@ -1,4 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||||
|
using Penumbra.String;
|
||||||
|
|
||||||
namespace Penumbra.Collections;
|
namespace Penumbra.Collections;
|
||||||
|
|
||||||
|
|
@ -34,6 +37,31 @@ public readonly struct ResolveData
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
=> ModCollection.Name;
|
=> ModCollection.Name;
|
||||||
|
|
||||||
|
public unsafe string AssociatedName()
|
||||||
|
{
|
||||||
|
if( AssociatedGameObject == IntPtr.Zero )
|
||||||
|
{
|
||||||
|
return "no associated object.";
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var id = Penumbra.Actors.FromObject( ( GameObject* )AssociatedGameObject, out _, false, true );
|
||||||
|
if( id.IsValid )
|
||||||
|
{
|
||||||
|
var name = id.ToString();
|
||||||
|
var parts = name.Split( ' ', 3 );
|
||||||
|
return string.Join( " ", parts.Length != 3 ? parts.Select( n => $"{n[ 0 ]}." ) : parts[ ..2 ].Select( n => $"{n[ 0 ]}." ).Append( parts[ 2 ] ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"0x{AssociatedGameObject:X}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ResolveDataExtensions
|
public static class ResolveDataExtensions
|
||||||
|
|
|
||||||
|
|
@ -253,10 +253,11 @@ public unsafe partial class ResourceLoader
|
||||||
private static void LogPath( Utf8GamePath path, bool synchronous )
|
private static void LogPath( Utf8GamePath path, bool synchronous )
|
||||||
=> Penumbra.Log.Information( $"[ResourceLoader] Requested {path} {( synchronous ? "synchronously." : "asynchronously." )}" );
|
=> Penumbra.Log.Information( $"[ResourceLoader] Requested {path} {( synchronous ? "synchronously." : "asynchronously." )}" );
|
||||||
|
|
||||||
private static void LogResource( Structs.ResourceHandle* handle, Utf8GamePath path, FullPath? manipulatedPath, ResolveData _ )
|
private static void LogResource( Structs.ResourceHandle* handle, Utf8GamePath path, FullPath? manipulatedPath, ResolveData data )
|
||||||
{
|
{
|
||||||
var pathString = manipulatedPath != null ? $"custom file {manipulatedPath} instead of {path}" : path.ToString();
|
var pathString = manipulatedPath != null ? $"custom file {manipulatedPath} instead of {path}" : path.ToString();
|
||||||
Penumbra.Log.Information( $"[ResourceLoader] [{handle->FileType}] Loaded {pathString} to 0x{( ulong )handle:X}. (Refcount {handle->RefCount})" );
|
Penumbra.Log.Information(
|
||||||
|
$"[ResourceLoader] [{handle->FileType}] Loaded {pathString} to 0x{( ulong )handle:X} using collection {data.ModCollection.AnonymizedName} for {data.AssociatedName()}. (Refcount {handle->RefCount}) " );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LogLoadedFile( Structs.ResourceHandle* resource, ByteString path, bool success, bool custom )
|
private static void LogLoadedFile( Structs.ResourceHandle* resource, ByteString path, bool success, bool custom )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue