From bc068f991389d2adcaa05b26d2877ddf6acd63bc Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Mon, 1 Jan 2024 00:48:20 +0100 Subject: [PATCH] Fix offsets. --- Penumbra/Interop/Hooks/Meta/GetEqpIndirect.cs | 7 +++---- Penumbra/Interop/Hooks/Meta/UpdateModel.cs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Penumbra/Interop/Hooks/Meta/GetEqpIndirect.cs b/Penumbra/Interop/Hooks/Meta/GetEqpIndirect.cs index c1b6eacc..8ffc050f 100644 --- a/Penumbra/Interop/Hooks/Meta/GetEqpIndirect.cs +++ b/Penumbra/Interop/Hooks/Meta/GetEqpIndirect.cs @@ -22,13 +22,12 @@ public sealed unsafe class GetEqpIndirect : FastHook [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] private void Detour(DrawObject* drawObject) { - if ((*(byte*)(drawObject + Offsets.GetEqpIndirectSkip1) & 1) == 0 || *(ulong*)(drawObject + Offsets.GetEqpIndirectSkip2) == 0) + // Shortcut because this is also called all the time. + // Same thing is checked at the beginning of the original function. + if ((*(byte*)((nint)drawObject + Offsets.GetEqpIndirectSkip1) & 1) == 0 || *(ulong*)((nint)drawObject + Offsets.GetEqpIndirectSkip2) == 0) return; Penumbra.Log.Excessive($"[Get EQP Indirect] Invoked on {(nint)drawObject:X}."); - // Shortcut because this is also called all the time. - // Same thing is checked at the beginning of the original function. - var collection = _collectionResolver.IdentifyCollection(drawObject, true); using var eqp = _metaState.ResolveEqpData(collection.ModCollection); Task.Result.Original(drawObject); diff --git a/Penumbra/Interop/Hooks/Meta/UpdateModel.cs b/Penumbra/Interop/Hooks/Meta/UpdateModel.cs index c169ead2..786ad5f2 100644 --- a/Penumbra/Interop/Hooks/Meta/UpdateModel.cs +++ b/Penumbra/Interop/Hooks/Meta/UpdateModel.cs @@ -24,7 +24,7 @@ public sealed unsafe class UpdateModel : FastHook { // Shortcut because this is called all the time. // Same thing is checked at the beginning of the original function. - if (*(int*)(drawObject + Offsets.UpdateModelSkip) == 0) + if (*(int*)((nint)drawObject + Offsets.UpdateModelSkip) == 0) return; Penumbra.Log.Excessive($"[Update Model] Invoked on {(nint)drawObject:X}.");