mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Skin Fixer: Make resolving skin.shpk for new draw objects async
This commit is contained in:
parent
ead88f9fa6
commit
ec14efb789
1 changed files with 16 additions and 12 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Utility.Signatures;
|
using Dalamud.Utility.Signatures;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
||||||
|
|
@ -102,20 +103,23 @@ public unsafe class SkinFixer : IDisposable
|
||||||
if (((CharacterBase*)drawObject)->GetModelType() != CharacterBase.ModelType.Human)
|
if (((CharacterBase*)drawObject)->GetModelType() != CharacterBase.ModelType.Human)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nint skinShpk;
|
Task.Run(delegate
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var data = _collectionResolver.IdentifyCollection((DrawObject*)drawObject, true);
|
nint skinShpk;
|
||||||
skinShpk = data.Valid ? (nint)_resources.LoadResolvedResource(ResourceCategory.Shader, ResourceType.Shpk, SkinShpkPath.Path, data) : nint.Zero;
|
try
|
||||||
}
|
{
|
||||||
catch (Exception e)
|
var data = _collectionResolver.IdentifyCollection((DrawObject*)drawObject, true);
|
||||||
{
|
skinShpk = data.Valid ? (nint)_resources.LoadResolvedResource(ResourceCategory.Shader, ResourceType.Shpk, SkinShpkPath.Path, data) : nint.Zero;
|
||||||
Penumbra.Log.Error($"Error while resolving skin.shpk for human {drawObject:X}: {e}");
|
}
|
||||||
skinShpk = nint.Zero;
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
|
Penumbra.Log.Error($"Error while resolving skin.shpk for human {drawObject:X}: {e}");
|
||||||
|
skinShpk = nint.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
if (skinShpk != nint.Zero && _skinShpks.TryAdd(drawObject, skinShpk) && skinShpk != _utility.DefaultSkinShpkResource)
|
if (skinShpk != nint.Zero && _skinShpks.TryAdd(drawObject, skinShpk) && skinShpk != _utility.DefaultSkinShpkResource)
|
||||||
Interlocked.Increment(ref _moddedSkinShpkCount);
|
Interlocked.Increment(ref _moddedSkinShpkCount);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCharacterBaseDestructor(nint characterBase)
|
private void OnCharacterBaseDestructor(nint characterBase)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue