mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add logging of destructed resource handles.
This commit is contained in:
parent
71a7520e58
commit
f00fe54bb3
4 changed files with 21 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
||||
|
|
@ -13,6 +14,23 @@ namespace Penumbra.Interop.Loader;
|
|||
|
||||
public unsafe partial class ResourceLoader
|
||||
{
|
||||
public delegate IntPtr ResourceHandleDestructor( ResourceHandle* handle );
|
||||
|
||||
[Signature( "48 89 5C 24 ?? 57 48 83 EC ?? 48 8D 05 ?? ?? ?? ?? 48 8B D9 48 89 01 B8",
|
||||
DetourName = nameof( ResourceHandleDestructorDetour ) )]
|
||||
public static Hook< ResourceHandleDestructor >? ResourceHandleDestructorHook;
|
||||
|
||||
private IntPtr ResourceHandleDestructorDetour( ResourceHandle* handle )
|
||||
{
|
||||
if( handle != null )
|
||||
{
|
||||
PluginLog.Information( "[ResourceLoader] Destructing Resource Handle {Path:l} at 0x{Address:X} (Refcount {Refcount}) .", handle->FileName,
|
||||
( ulong )handle, handle->RefCount );
|
||||
}
|
||||
|
||||
return ResourceHandleDestructorHook!.Original( handle );
|
||||
}
|
||||
|
||||
// A static pointer to the SE Resource Manager
|
||||
[Signature( "48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 32 C0", ScanType = ScanType.StaticAddress, UseFlags = SignatureUseFlags.Pointer )]
|
||||
public static ResourceManager** ResourceManager;
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ public unsafe partial class ResourceLoader
|
|||
ReadSqPackHook.Dispose();
|
||||
GetResourceSyncHook.Dispose();
|
||||
GetResourceAsyncHook.Dispose();
|
||||
ResourceHandleDestructorHook?.Dispose();
|
||||
}
|
||||
|
||||
private int ComputeHash( Utf8String path, GetResourceParameters* pGetResParams )
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public unsafe partial class ResourceLoader : IDisposable
|
|||
ResourceRequested += LogPath;
|
||||
ResourceLoaded += LogResource;
|
||||
FileLoaded += LogLoadedFile;
|
||||
ResourceHandleDestructorHook?.Enable();
|
||||
EnableHooks();
|
||||
}
|
||||
|
||||
|
|
@ -44,6 +45,7 @@ public unsafe partial class ResourceLoader : IDisposable
|
|||
ResourceRequested -= LogPath;
|
||||
ResourceLoaded -= LogResource;
|
||||
FileLoaded -= LogLoadedFile;
|
||||
ResourceHandleDestructorHook?.Disable();
|
||||
}
|
||||
|
||||
public void EnableReplacements()
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ public partial class ConfigWindow
|
|||
: newName.Any( c => ( symbol = c ) > ( char )0x7F )
|
||||
? ( $"Path contains invalid symbol {symbol}. Only ASCII is allowed.", false )
|
||||
: ( $"Press Enter or Click Here to Save (Current Directory: {old})", true );
|
||||
|
||||
return ( ImGui.Button( text, w ) || saved ) && valid;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue