Make GMP independent of file, cleanup unused functions.

This commit is contained in:
Ottermandias 2024-06-15 15:55:51 +02:00
parent c53f29c257
commit 943207cae8
14 changed files with 108 additions and 158 deletions

View file

@ -1,10 +1,11 @@
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using OtterGui.Services;
using Penumbra.GameData;
using Penumbra.Interop.PathResolving;
namespace Penumbra.Interop.Hooks.Meta;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using OtterGui.Services;
using Penumbra.Collections;
using Penumbra.GameData;
using Penumbra.Interop.PathResolving;
namespace Penumbra.Interop.Hooks.Meta;
/// <summary>
/// GMP. This gets called every time when changing visor state, and it accesses the gmp file itself,
/// but it only applies a changed gmp file after a redraw for some reason.
@ -26,10 +27,11 @@ public sealed unsafe class SetupVisor : FastHook<SetupVisor.Delegate>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private byte Detour(DrawObject* drawObject, ushort modelId, byte visorState)
{
var collection = _collectionResolver.IdentifyCollection(drawObject, true);
using var gmp = _metaState.ResolveGmpData(collection.ModCollection);
var ret = Task.Result.Original.Invoke(drawObject, modelId, visorState);
Penumbra.Log.Excessive($"[Setup Visor] Invoked on {(nint)drawObject:X} with {modelId}, {visorState} -> {ret}.");
_metaState.GmpCollection = _collectionResolver.IdentifyCollection(drawObject, true);
_metaState.UndividedGmpId = modelId;
var ret = Task.Result.Original.Invoke(drawObject, modelId, visorState);
Penumbra.Log.Information($"[Setup Visor] Invoked on {(nint)drawObject:X} with {modelId}, {visorState} -> {ret}.");
_metaState.GmpCollection = ResolveData.Invalid;
return ret;
}
}