Some further stuff.

This commit is contained in:
Ottermandias 2023-03-17 13:19:23 +01:00
parent 0df12a34cb
commit 3fc724b7ee
15 changed files with 106 additions and 73 deletions

View file

@ -1,39 +0,0 @@
using Dalamud.Utility.Signatures;
using Penumbra.GameData;
namespace Penumbra.Interop;
public unsafe class ResidentResourceManager
{
// A static pointer to the resident resource manager address.
[Signature( Sigs.ResidentResourceManager, ScanType = ScanType.StaticAddress )]
private readonly Structs.ResidentResourceManager** _residentResourceManagerAddress = null;
// Some attach and physics files are stored in the resident resource manager, and we need to manually trigger a reload of them to get them to apply.
public delegate void* ResidentResourceDelegate( void* residentResourceManager );
[Signature( Sigs.LoadPlayerResources )]
public readonly ResidentResourceDelegate LoadPlayerResources = null!;
[Signature( Sigs.UnloadPlayerResources )]
public readonly ResidentResourceDelegate UnloadPlayerResources = null!;
public Structs.ResidentResourceManager* Address
=> *_residentResourceManagerAddress;
public ResidentResourceManager()
{
SignatureHelper.Initialise( this );
}
// Reload certain player resources by force.
public void Reload()
{
if( Address != null && Address->NumResources > 0 )
{
Penumbra.Log.Debug( "Reload of resident resources triggered." );
UnloadPlayerResources.Invoke( Address );
LoadPlayerResources.Invoke( Address );
}
}
}