mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-28 11:29:24 +01:00
Some further stuff.
This commit is contained in:
parent
0df12a34cb
commit
3fc724b7ee
15 changed files with 106 additions and 73 deletions
39
Penumbra/Interop/Services/ResidentResourceManager.cs
Normal file
39
Penumbra/Interop/Services/ResidentResourceManager.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using Dalamud.Utility.Signatures;
|
||||
using Penumbra.GameData;
|
||||
|
||||
namespace Penumbra.Interop.Services;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue