Skin Fixer: Make resolving skin.shpk for new draw objects async

This commit is contained in:
Exter-N 2023-08-27 04:04:14 +02:00
parent ead88f9fa6
commit ec14efb789

View file

@ -3,6 +3,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Dalamud.Hooking;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
@ -102,6 +103,8 @@ public unsafe class SkinFixer : IDisposable
if (((CharacterBase*)drawObject)->GetModelType() != CharacterBase.ModelType.Human)
return;
Task.Run(delegate
{
nint skinShpk;
try
{
@ -116,6 +119,7 @@ public unsafe class SkinFixer : IDisposable
if (skinShpk != nint.Zero && _skinShpks.TryAdd(drawObject, skinShpk) && skinShpk != _utility.DefaultSkinShpkResource)
Interlocked.Increment(ref _moddedSkinShpkCount);
});
}
private void OnCharacterBaseDestructor(nint characterBase)